MainWindow Class Reference

Main GUI interface. More...

#include <MainWindow.h>

Collaboration diagram for MainWindow:

Collaboration graph
[legend]
List of all members.

Public Slots

void setUnsavedStatus (bool unsavedStatus_h)
void setOutputDirName (string outputDirName_h)
void addLayer (QString layerName_h, QString layerLabel_h)
void switchToLayer (QString layerName_h)
void updatePixel (QString layerName_h, int x_h, int y_h, QColor color_h)
void updateImage (QString layerName_h, const QImage &image_h)
void switchToLayerFromLayerSelector (int layerIndex_h)
void treeViewerItemChangeValue (string itemID, string newValue)
 Change value to an existing item in the Status Viewer.
void treeViewerItemRemove (string itemID)
void treeViewerAddItem (string text, string itemID, string parentID)
 e.g. manager_farmer_manager agents or agent_12345_ownedHa
void processLogArea (const QString &message_h)
void resetGUIForNewSimulation ()
 Reset the graphical elements for a new simulation.
void receiveScenarioOptions (const QVector< QString > &scenarios_h)

Signals

void currentModelFilenameChanged (QString)
void selectedScenarioName (const QString &scenarioName_h)

Public Member Functions

 MainWindow ()
 Constructor.
void setCurrentLogFileName (const QString &fileName)
void setCurrentModelFileName (const QString &fileName)
bool saveLogFile (const QString &logFileName)
QString strippedName (const QString &fullFileName)
QString getModelFileName ()
void setModelFileName (const QString curModelFileName_h)

Protected Member Functions

void closeEvent (QCloseEvent *event)
 Manage the event of closing the application.

Private Types

enum  { MaxRecentFiles = 5 }

Private Slots

void open ()
bool save ()
bool saveAs ()
void startModelMainThread ()
void stopModelMainThread ()
void pauseOrResumeModelMainThread ()
void openRecentFile ()
void hideDebugMsgs (bool hide)
void about ()
void showDocumentation ()

Private Member Functions

void createStatusBar ()
bool okToContinue ()
void readSettings ()
void writeSettings ()
void updateRecentFileActions ()

Private Attributes

ThreadManager modelMainThread
QLabel * yearSBLabel
 Status bar current year label.
QLabel * mainSBLabel
 Status bar main label.
bool unsavedStatus
QString outputDirName
QString curLogFileName
QString curModelFileName
QString curBaseDirectory
QStringList recentFiles
QAction * recentFileActions [MaxRecentFiles]
QAction * separatorAction
bool debugMsgsEnable
 Allow debug messages to be show in the logArea.
ScenarioSelectionWidgetscenarioWidget
map< string, QTreeWidgetItem * > svIndex
 Map containing the ID and the pointers to the status viewer.

Detailed Description

Main GUI interface.

MainWindow derive from both the generic Qt QMainWindow and from Ui::MainWindow (the latter being the autmatically generated C++ code from QtDesigner).
It implements code and functionality that can not be done in the QtDesigner.

Definition at line 48 of file MainWindow.h.


Member Enumeration Documentation

anonymous enum [private]

Enumerator:
MaxRecentFiles 

Definition at line 111 of file MainWindow.h.


Constructor & Destructor Documentation

MainWindow (  ) 

Constructor.

It setup the Gui from the QTDesiger autogenerated code and connect various GUI signal/slots

Definition at line 35 of file MainWindow.cpp.


Member Function Documentation

void setCurrentLogFileName ( const QString &  fileName  ) 

Definition at line 188 of file MainWindow.cpp.

Referenced by MainWindow(), and saveLogFile().

Here is the caller graph for this function:

void setCurrentModelFileName ( const QString &  fileName  ) 

Definition at line 193 of file MainWindow.cpp.

Referenced by open(), and openRecentFile().

bool saveLogFile ( const QString &  logFileName  ) 

Definition at line 352 of file MainWindow.cpp.

Referenced by save(), and saveAs().

QString strippedName ( const QString &  fullFileName  ) 

Definition at line 209 of file MainWindow.cpp.

Referenced by setCurrentModelFileName(), and updateRecentFileActions().

Here is the caller graph for this function:

QString getModelFileName (  )  [inline]

Definition at line 59 of file MainWindow.h.

void setModelFileName ( const QString  curModelFileName_h  )  [inline]

Definition at line 60 of file MainWindow.h.

void setUnsavedStatus ( bool  unsavedStatus_h  )  [inline, slot]

Definition at line 63 of file MainWindow.h.

Referenced by MainWindow().

void setOutputDirName ( string  outputDirName_h  )  [inline, slot]

Definition at line 64 of file MainWindow.h.

Referenced by MainWindow().

void addLayer ( QString  layerName_h,
QString  layerLabel_h 
) [slot]

Perform all the operation needed when adding a new layer:

Definition at line 427 of file MainWindow.cpp.

Referenced by MainWindow().

void switchToLayer ( QString  layerName_h  )  [slot]

Perform all the operation needed when switching layer:

Definition at line 444 of file MainWindow.cpp.

void updatePixel ( QString  layerName_h,
int  x_h,
int  y_h,
QColor  color_h 
) [slot]

Definition at line 459 of file MainWindow.cpp.

Referenced by MainWindow().

void updateImage ( QString  layerName_h,
const QImage &  image_h 
) [slot]

Definition at line 465 of file MainWindow.cpp.

Referenced by MainWindow().

void switchToLayerFromLayerSelector ( int  layerIndex_h  )  [slot]

Definition at line 452 of file MainWindow.cpp.

Referenced by MainWindow().

void treeViewerItemChangeValue ( string  itemID,
string  newValue 
) [slot]

Change value to an existing item in the Status Viewer.

Definition at line 472 of file MainWindow.cpp.

Referenced by MainWindow().

void treeViewerItemRemove ( string  itemID  )  [slot]

Definition at line 489 of file MainWindow.cpp.

Referenced by MainWindow().

void treeViewerAddItem ( string  text,
string  itemID,
string  parentID 
) [slot]

e.g. manager_farmer_manager agents or agent_12345_ownedHa

Definition at line 515 of file MainWindow.cpp.

Referenced by MainWindow().

void processLogArea ( const QString &  message_h  )  [slot]

Definition at line 539 of file MainWindow.cpp.

Referenced by MainWindow().

void resetGUIForNewSimulation (  )  [slot]

Reset the graphical elements for a new simulation.

Definition at line 594 of file MainWindow.cpp.

Referenced by MainWindow().

void receiveScenarioOptions ( const QVector< QString > &  scenarios_h  )  [slot]

Definition at line 651 of file MainWindow.cpp.

Referenced by MainWindow().

void currentModelFilenameChanged ( QString   )  [signal]

void selectedScenarioName ( const QString &  scenarioName_h  )  [signal]

void closeEvent ( QCloseEvent *  event  )  [protected]

Manage the event of closing the application.

Definition at line 173 of file MainWindow.cpp.

void open (  )  [private, slot]

Definition at line 276 of file MainWindow.cpp.

Referenced by MainWindow().

bool save (  )  [private, slot]

Definition at line 324 of file MainWindow.cpp.

Referenced by MainWindow(), and okToContinue().

bool saveAs (  )  [private, slot]

Definition at line 337 of file MainWindow.cpp.

Referenced by MainWindow(), and save().

void startModelMainThread (  )  [private, slot]

Definition at line 381 of file MainWindow.cpp.

Referenced by MainWindow().

void stopModelMainThread (  )  [private, slot]

Definition at line 393 of file MainWindow.cpp.

Referenced by MainWindow().

void pauseOrResumeModelMainThread (  )  [private, slot]

Definition at line 403 of file MainWindow.cpp.

Referenced by MainWindow().

void openRecentFile (  )  [private, slot]

Definition at line 306 of file MainWindow.cpp.

Referenced by MainWindow().

void hideDebugMsgs ( bool  hide  )  [private, slot]

Definition at line 551 of file MainWindow.cpp.

Referenced by MainWindow().

void about (  )  [private, slot]

Definition at line 557 of file MainWindow.cpp.

Referenced by MainWindow().

void showDocumentation (  )  [private, slot]

Definition at line 572 of file MainWindow.cpp.

Referenced by MainWindow().

void createStatusBar (  )  [private]

Definition at line 152 of file MainWindow.cpp.

Referenced by MainWindow().

Here is the caller graph for this function:

bool okToContinue (  )  [private]

Definition at line 238 of file MainWindow.cpp.

Referenced by closeEvent(), open(), and openRecentFile().

Here is the caller graph for this function:

void readSettings (  )  [private]

Definition at line 299 of file MainWindow.cpp.

Referenced by MainWindow().

Here is the caller graph for this function:

void writeSettings (  )  [private]

Definition at line 373 of file MainWindow.cpp.

Referenced by closeEvent().

Here is the caller graph for this function:

void updateRecentFileActions (  )  [private]

Definition at line 214 of file MainWindow.cpp.

Referenced by readSettings(), and setCurrentModelFileName().

Here is the caller graph for this function:


Member Data Documentation

ThreadManager modelMainThread [private]

Definition at line 102 of file MainWindow.h.

Referenced by closeEvent(), createStatusBar(), MainWindow(), okToContinue(), pauseOrResumeModelMainThread(), setCurrentModelFileName(), startModelMainThread(), and stopModelMainThread().

QLabel* yearSBLabel [private]

Status bar current year label.

Definition at line 103 of file MainWindow.h.

Referenced by createStatusBar(), and MainWindow().

QLabel* mainSBLabel [private]

Status bar main label.

Definition at line 104 of file MainWindow.h.

Referenced by createStatusBar(), and MainWindow().

bool unsavedStatus [private]

Definition at line 105 of file MainWindow.h.

Referenced by MainWindow(), okToContinue(), save(), saveAs(), saveLogFile(), setUnsavedStatus(), and startModelMainThread().

QString outputDirName [private]

Definition at line 106 of file MainWindow.h.

Referenced by MainWindow(), save(), saveAs(), and setOutputDirName().

QString curLogFileName [private]

Definition at line 107 of file MainWindow.h.

Referenced by MainWindow(), save(), and setCurrentLogFileName().

QString curModelFileName [private]

Definition at line 108 of file MainWindow.h.

Referenced by getModelFileName(), MainWindow(), openRecentFile(), setCurrentModelFileName(), and setModelFileName().

QString curBaseDirectory [private]

Definition at line 109 of file MainWindow.h.

Referenced by MainWindow(), open(), and openRecentFile().

QStringList recentFiles [private]

Definition at line 110 of file MainWindow.h.

Referenced by readSettings(), setCurrentModelFileName(), updateRecentFileActions(), and writeSettings().

QAction* recentFileActions[MaxRecentFiles] [private]

Definition at line 112 of file MainWindow.h.

Referenced by MainWindow(), and updateRecentFileActions().

QAction* separatorAction [private]

Definition at line 113 of file MainWindow.h.

Referenced by MainWindow(), and updateRecentFileActions().

bool debugMsgsEnable [private]

Allow debug messages to be show in the logArea.

Definition at line 114 of file MainWindow.h.

Referenced by hideDebugMsgs(), MainWindow(), and processLogArea().

ScenarioSelectionWidget* scenarioWidget [private]

Definition at line 115 of file MainWindow.h.

Referenced by MainWindow(), and receiveScenarioOptions().

map<string, QTreeWidgetItem*> svIndex [private]

Map containing the ID and the pointers to the status viewer.

Ids are based on the name of the item:

Definition at line 127 of file MainWindow.h.

Referenced by resetGUIForNewSimulation(), treeViewerAddItem(), treeViewerItemChangeValue(), and treeViewerItemRemove().


The documentation for this class was generated from the following files: