OSDN Git Service

- Added better status reporting functions.
[tjqt4port/tj2qt4.git] / taskjuggler / Project.h
index a6e7539..8fe7ee6 100644 (file)
 #endif
 class Kotrus;
 
+/**
+ * The Project class is the root of the data tree of the application. In
+ * principle an application could handle multiple projects, but this has never
+ * been tested.
+ *
+ * @short The root class of all project related infromation.
+ * @author Chris Schlaeger <cs@suse.de>
+ */
 class Project
 {
 public:
        Project();
-       ~Project() { }
+       ~Project();
 
-       bool addTask(Task* t);
+       /**
+        * Generate cross references between all data structures and run a
+        * consistency check. This function must be called after the project data
+        * tree has been contructed. 
+        * @return Only if all tests were successful TRUE is returned.
+        */
        bool pass2();
 
-       void preparePlan();
-       void finishPlan();
-       void prepareActual();
-       void finishActual();
-       bool schedule();
+       /**
+        * Schedule all tasks for all scenarios. @return In case any errors were
+        * detected FALSE is returned.
+        */
+       bool scheduleAllScenarios();
+       
+       /**
+        * Returns the number of supported scenarios.
+        */
+       int getMaxScenarios() { return scenarioNames.count(); }
+       /**
+        * Returns the name of a scenario.
+        * @param sc Specifies the scenario.
+        */
+       const QString& getScenarioName(int sc);
 
+       /**
+        * Set the name of the project. The project name is maily used for the
+        * reports.
+        */
        void setName(const QString& n) { name = n; }
+       /**
+        * Returns the name of the project.
+        */
        const QString& getName() const { return name; }
 
+       /**
+        * Set the version number of the project. This version is maily used for
+        * reports.
+        */
        void setVersion(const QString& v) { version = v; }
+       /**
+        * Returns the version number of the project.
+        */
        const QString& getVersion() const { return version; }
 
+       /**
+        * Set the copyright information. This is a default text used for all
+        * reports.
+        */
        void setCopyright(const QString& c) { copyright = c; }
+       /**
+        * Returns the copyright information of the project.
+        */
        const QString& getCopyright() const { return copyright; }
-
+       
+       /**
+        * Set the default priority for all top-level tasks. Normally this value
+        * is 500.
+        */
        void setPriority(int p) { priority = p; }
+       /**
+        * Returns the default priority for all top-level tasks.
+        */
        int getPriority() const { return priority; }
 
+       /**
+        * Set the start time of the project.
+        */
        void setStart(time_t s) { start = s; }
+       /**
+        * Get the start time of the project.
+        */
        time_t getStart() const { return start; }
 
+       /**
+        * Set the end time of the project. The specified second is still
+        * considered as within the project time frame.
+        */
        void setEnd(time_t e) { end = e; }
+       /**
+        * Get the end time of the project.
+        */
        time_t getEnd() const { return end; }
 
        void setNow(time_t n) { now = n; }
@@ -112,6 +176,7 @@ public:
                 * day is not registered as a vacation day then it is a workday. */
                return !(workingHours[dayOfWeek(d, FALSE)]->isEmpty() || isVacation(d));
        }
+       int calcWorkingDays(const Interval& iv);
        
        Interval* getVacationListFirst()
        {
@@ -122,6 +187,10 @@ public:
                return vacationList.next();
        }
 
+       void addTask(Task* t)
+       {
+               taskList.append(t);
+       }
        Task* getTask(const QString& id)
        {
                return taskList.getTask(id);
@@ -140,7 +209,7 @@ public:
 
        void addAccount(Account* a)
        {
-               accountList.inSort(a);
+               accountList.append(a);
        }
        Account* getAccount(const QString& id)
        {
@@ -150,7 +219,7 @@ public:
 
        void addShift(Shift* s)
        {
-               shiftList.inSort(s);
+               shiftList.append(s);
        }
        Shift* getShift(const QString& id)
        {
@@ -246,31 +315,27 @@ public:
        bool readKotrus();
        bool updateKotrus();
 
+       void setShortTimeFormat(const QString& tf) { shortTimeFormat = tf; }
+       const QString& getShortTimeFormat() const { return shortTimeFormat; }
+
+       void setTimeFormat(const QString& tf) { timeFormat = tf; }
+       const QString& getTimeFormat() const { return timeFormat; }
+
        TaskList getTaskList() { return taskList; }
        ResourceList getResourceList() { return resourceList; }
        AccountList getAccountList() { return accountList; }
 
        void generateReports();
        bool needsActualDataForReports();
-       void removeActiveTask(Task* t);
-       void addActiveTask(Task* t);
-
-       static void setDebugLevel(int l)
-       {
-               debugLevel = l;
-               Task::setDebugLevel(l);
-               Resource::setDebugLevel(l);
-       }
-       static void setDebugMode(int m)
-       {
-               debugMode = m;
-               Task::setDebugMode(m);
-               Resource::setDebugMode(m);
-       }
 
 private:
-       bool checkSchedule();
-       void updateActiveTaskList(TaskList& sortedTasks);
+       void overlayScenario(int sc);
+       void prepareScenario(int sc);
+       void finishScenario(int sc);
+       
+       bool schedule(const QString& scenario);
+
+       bool checkSchedule(const QString& scenario);
 
        /// The start date of the project
        time_t start;
@@ -279,6 +344,7 @@ private:
        /// The current date used in reports.
        time_t now;
 
+       /// True if week based calculations use Monday as first day of week.
        bool weekStartsMonday;
 
        /// The name of the Project
@@ -288,6 +354,9 @@ private:
        /// Some legal words to please the boss.
        QString copyright;
 
+       QString timeFormat;
+       QString shortTimeFormat;
+
        /**
         * The default priority that will be inherited by all tasks. Sub tasks
         * will inherit the priority of its parent task. */
@@ -338,6 +407,9 @@ private:
      * used. */
        QStringList projectIDs;
 
+       QStringList scenarioNames;
+       bool hasExtraValues;    // TODO: Fix this for multiple scenarios
+
        ShiftList shiftList;
        TaskList taskList;
        ResourceList resourceList;
@@ -358,15 +430,6 @@ private:
        QList<HTMLAccountReport> htmlAccountReports;
        QList<HTMLWeeklyCalendar> htmlWeeklyCalendars;
        QList<ExportReport> exportReports;
-
-       static int debugLevel;
-       static int debugMode;
-       /**
-        * The task lists for active ASAP and ALAP tasks are only used
-        * during the scheduling process.
-        */
-       TaskList activeAsap;
-       TaskList activeAlap;
 } ;
 
 #endif