00001 #ifndef CONTROLDATA_H 00002 #define CONTROLDATA_H 00003 00004 #include <domain/duration.h> 00005 #include <domain/resource.h> 00006 #include <domain/tasktype.h> 00007 00008 #include <tools/global.h> 00009 00010 #include <QString> 00011 #include <QList> 00012 #include <QDateTime> 00013 #include <QModelIndex> 00014 00015 namespace domain 00016 { 00017 class Task; 00018 class User; 00019 class Resource; 00020 class ResourceType; 00021 } 00022 00023 namespace control 00024 { 00025 00026 class InvitationModel; 00027 class ResourceModel; 00028 class ProjectModel; 00029 class ReservationModel; 00030 class UserModel; 00031 class ResourceRequirementsModel; 00032 class UserRequirementsModel; 00033 class TaskModel; 00034 00035 namespace data 00036 { 00037 00041 struct CONTROL_EXPORT UserInputData 00042 { 00043 UserInputData(); 00044 00050 bool processData; 00051 }; 00052 00062 struct CONTROL_EXPORT SelectionData : public UserInputData 00063 { 00064 QModelIndexList selection; 00065 }; 00066 00070 struct CONTROL_EXPORT TaskDetails : public UserInputData 00071 { 00072 TaskDetails(const domain::Task* task = 0); 00073 00074 QDateTime startTime; 00075 QDateTime endTime; 00076 domain::Duration duration; 00077 QMap<QString, QVariant> fields; 00078 00079 SelectionData selectedTasks; 00080 }; 00081 00086 struct CONTROL_EXPORT TaskTypeDetails 00087 { 00088 TaskTypeDetails(domain::TaskType* type = 0); 00089 00090 QList<domain::Field> fields; 00091 }; 00092 00093 struct CONTROL_EXPORT TaskRepresentation 00094 { 00095 TaskRepresentation(); 00096 00097 TaskDetails details; 00098 TaskTypeDetails type; 00099 TaskModel* subTasks; 00100 UserRequirementsModel* userReqs; 00101 ResourceRequirementsModel* resourceReqs; 00102 }; 00103 00107 struct CONTROL_EXPORT ResourceDetails : public UserInputData 00108 { 00109 QString description; 00110 QString type; 00111 }; 00112 00116 struct CONTROL_EXPORT ReservationDetails : public UserInputData 00117 { 00118 QDateTime time; 00119 domain::Duration duration; 00120 }; 00121 00125 struct CONTROL_EXPORT ProjectDetails : public UserInputData 00126 { 00127 QString description; 00128 }; 00129 00130 struct CONTROL_EXPORT MinMaxDurationData : public UserInputData 00131 { 00132 domain::Duration minDuration; 00133 domain::Duration maxDuration; 00134 00135 bool minDurationSet; 00136 bool maxDurationSet; 00137 }; 00138 00142 template<typename T> 00143 struct CONTROL_EXPORT SimpleInputData : public UserInputData 00144 { 00145 T data; 00146 00147 operator T() const 00148 { 00149 return data; 00150 } 00151 00152 operator T&() 00153 { 00154 return data; 00155 } 00156 }; 00157 00158 typedef SimpleInputData<int> IntInputData; 00159 typedef SimpleInputData<QString> StringInputData; 00160 typedef SimpleInputData<QDateTime> DateTimeInputData; 00161 00162 struct OverviewDetails 00163 { 00164 TaskModel* tasks; 00165 UserModel* users; 00166 ReservationModel* reservations; 00167 ResourceModel* resources; 00168 InvitationModel* invitations; 00169 ProjectModel* projects; 00170 }; 00171 00172 } 00173 } 00174 00175 #endif