00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MAINWINDOW_H
00021 #define MAINWINDOW_H
00022
00023 #include <iostream>
00024 #include <string>
00025 #include <sstream>
00026
00027 #include <QMainWindow>
00028 #include <QTextEdit>
00029 #include <QLabel>
00030
00031 #include "ui_MainWindow.h"
00032
00033
00034 #include "ThreadManager.h"
00035 #include "ScenarioSelectionWidget.h"
00036
00037 using namespace std;
00038
00039
00040
00042
00048 class MainWindow : public QMainWindow, public Ui::MainWindow {
00049 Q_OBJECT
00050
00051 public:
00052 MainWindow();
00053
00054 void setCurrentLogFileName(const QString &fileName);
00055 void setCurrentModelFileName(const QString &fileName);
00056 bool saveLogFile(const QString &logFileName);
00057 QString strippedName(const QString &fullFileName);
00058
00059 QString getModelFileName(){return curModelFileName;};
00060 void setModelFileName(const QString curModelFileName_h){curModelFileName=curModelFileName_h;};
00061
00062 public slots:
00063 void setUnsavedStatus(bool unsavedStatus_h){unsavedStatus = unsavedStatus_h;};
00064 void setOutputDirName(string outputDirName_h){outputDirName = outputDirName_h.c_str();};
00065 void addLayer(QString layerName_h, QString layerLabel_h);
00066 void switchToLayer(QString layerName_h);
00067 void updatePixel(QString layerName_h, int x_h, int y_h, QColor color_h);
00068 void updateImage(QString layerName_h, const QImage &image_h);
00069 void switchToLayerFromLayerSelector(int layerIndex_h);
00071 void treeViewerItemChangeValue(string itemID, string newValue);
00072 void treeViewerItemRemove(string itemID);
00073 void treeViewerAddItem(string text, string itemID, string parentID);
00074 void processLogArea(const QString& message_h);
00075 void resetGUIForNewSimulation();
00076
00077
00078 void receiveScenarioOptions(const QVector<QString> &scenarios_h);
00079
00080
00081 signals:
00082 void currentModelFilenameChanged (QString);
00083 void selectedScenarioName(const QString &scenarioName_h);
00084
00085 protected:
00086 void closeEvent(QCloseEvent *event);
00087
00088 private slots:
00089 void open();
00090 bool save();
00091 bool saveAs();
00092 void startModelMainThread();
00093 void stopModelMainThread();
00094 void pauseOrResumeModelMainThread();
00095 void openRecentFile();
00096 void hideDebugMsgs(bool hide);
00097 void about();
00098 void showDocumentation();
00099
00100 private:
00101
00102 ThreadManager modelMainThread;
00103 QLabel* yearSBLabel;
00104 QLabel* mainSBLabel;
00105 bool unsavedStatus;
00106 QString outputDirName;
00107 QString curLogFileName;
00108 QString curModelFileName;
00109 QString curBaseDirectory;
00110 QStringList recentFiles;
00111 enum { MaxRecentFiles = 5 };
00112 QAction * recentFileActions[MaxRecentFiles];
00113 QAction * separatorAction;
00114 bool debugMsgsEnable;
00115 ScenarioSelectionWidget *scenarioWidget;
00127 map <string, QTreeWidgetItem*> svIndex;
00128
00129 void createStatusBar();
00130 bool okToContinue();
00131 void readSettings();
00132 void writeSettings();
00133 void updateRecentFileActions();
00134 };
00135
00136 #endif