Subversion Repositories public iLand

Rev

Rev 161 | Rev 223 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
105 Werner 2
#ifndef MODELCONTROLLER_H
3
#define MODELCONTROLLER_H
128 Werner 4
#include <QObject>
105 Werner 5
 
128 Werner 6
class Model;
7
class ModelController: public QObject
105 Werner 8
{
128 Werner 9
    Q_OBJECT
105 Werner 10
public:
11
    ModelController();
128 Werner 12
    ~ModelController();
13
    Model *model() const { return mModel; }
14
    // bool checkers...
145 Werner 15
    bool canCreate(); ///< return true if the model can be created (settings loaded and model does not exist)
16
    bool canDestroy(); ///< model may be destroyed
17
    bool canRun(); ///< model may be run
161 werner 18
    bool isRunning(); ///< model is running
19
    // dynamic outputs (variable fields)
20
    void setupDynamicOutput(QString fieldList);
21
    QString dynamicOutput();
222 werner 22
signals:
23
    void finished(QString errorMessage);
24
    void year(int year);
128 Werner 25
public slots:
26
    void setFileName(QString initFileName); ///< set project file name
27
    void create(); ///< create the model
28
    void destroy(); ///< delete the model
222 werner 29
    void run(int years); ///< run the model
128 Werner 30
    void runYear(); ///< runs a single time step
222 werner 31
    bool pause(); ///< pause execution, and if paused, continue to run. returns state *after* change, i.e. true=now in paused mode
32
    void cancel(); ///< cancel execution of the model
128 Werner 33
private:
161 werner 34
    void fetchDynamicOutput();
128 Werner 35
    Model *mModel;
36
    QString mInitFile;
161 werner 37
    QStringList mDynFieldList;
38
    QStringList mDynData;
39
 
105 Werner 40
};
41
 
42
#endif // MODELCONTROLLER_H