00001 #ifndef UIINTERFACE_H 00002 #define UIINTERFACE_H 00003 00004 #include <control/controldata.h> 00005 00006 #include <tools/global.h> 00007 00008 #include <QList> 00009 #include <QStringList> 00010 00011 class QAbstractItemModel; 00012 00013 namespace domain 00014 { 00015 class Task; 00016 class Resource; 00017 class User; 00018 } 00019 00020 namespace control 00021 { 00022 00023 class ControllerInterface; 00024 class TaskModel; 00025 class ResourceModel; 00026 class ResourceReservationModel; 00027 class UserRequirementsModel; 00028 class ResourceRequirementsModel; 00029 class InvitationModel; 00030 } 00031 00032 namespace ui 00033 { 00034 00035 class UI_EXPORT UiInterface : public QObject 00036 { 00037 Q_OBJECT 00038 00039 public: 00040 00041 enum SelectionMode 00042 { 00043 SingleSelection, 00044 MultiSelection 00045 }; 00046 00047 UiInterface(); 00048 virtual ~UiInterface(); 00049 00063 virtual bool askQuestion(const QString& before, 00064 QAbstractItemModel* model = 0, 00065 const QString& after = QString()) = 0; 00066 00080 virtual control::data::SelectionData getSelection( 00081 const QString& before, 00082 QAbstractItemModel* model, 00083 SelectionMode mode = SingleSelection, 00084 const QString& after = "") = 0; 00085 00098 virtual control::data::TaskDetails getTaskDetails( 00099 const control::data::TaskRepresentation& rep) = 0; 00100 00101 virtual control::data::ReservationDetails getReservationDetails 00102 (control::ResourceReservationModel* reservations) = 0; 00110 virtual control::data::ResourceDetails getResourceDetails(const QStringList& types) = 0; 00111 00117 virtual control::data::ProjectDetails getProjectDetails() = 0; 00118 00127 virtual control::data::StringInputData getChoice(const QStringList& options, 00128 const QString& message) = 0; 00129 00143 virtual control::data::StringInputData showTaskDetails( 00144 const control::data::TaskRepresentation& rep, 00145 const QStringList& options = QStringList(), 00146 bool editMode = false) = 0; 00147 00148 virtual control::data::SelectionData getInvitationSelection( 00149 control::InvitationModel* pending, 00150 control::InvitationModel* accepted) = 0; 00151 00155 virtual void showModel(QAbstractItemModel* model, const QString& message = QString()) = 0; 00156 00160 virtual void setOverview(const control::data::OverviewDetails& details) = 0; 00161 00167 virtual void showError(const QString& message) = 0; 00168 00174 virtual void showWarning(const QString& message) = 0; 00175 00181 virtual void showMessage(const QString& message) = 0; 00182 00183 virtual control::data::MinMaxDurationData 00184 getMinMaxDuration(const QString& message) = 0; 00185 00194 virtual control::data::StringInputData getText(const QString& message) = 0; 00195 00204 virtual control::data::IntInputData getInt(const QString& message, 00205 int value = 0, 00206 int minValue = -2147483647, 00207 int maxValue = 2147483647) = 0; 00208 00218 virtual QString getOpenFileName(const QString& dir = QString(), 00219 const QString& filter = QString()) = 0; 00220 00230 virtual QString getSaveFileName(const QString& dir = QString(), 00231 const QString& filter = QString()) = 0; 00232 00233 virtual control::data::DateTimeInputData getDateTime( 00234 const QString& message = QString()) = 0; 00235 00239 virtual void start() = 0; 00240 00246 virtual void loadControllers(const QList<control::ControllerInterface*>& c); 00247 00253 void setUser(const domain::User* user); 00254 00258 const domain::User* user(); 00259 00260 public Q_SLOTS: 00261 00262 virtual void setTime(const QDateTime& time) = 0; 00263 00264 protected: 00265 00269 QList<control::ControllerInterface*> controllers; 00270 00271 private: 00272 00273 virtual void setUsername(const QString& name) = 0; 00274 00275 const domain::User* currentUser; 00276 }; 00277 00278 } 00279 00280 #endif