|
void | openProject () |
| Open a project. More...
|
|
bool | saveAll () |
| Save the parameter file. More...
|
|
bool | save_as () |
| Open a file dialog to save the parameter file. More...
|
|
void | about () |
| Show some information on the parameterGUI. More...
|
|
void | aboutOpenFCST () |
| Show some information on the OpenFCST. More...
|
|
void | tree_was_modified () |
| A slot that should be always called, if parameter values were changed. More...
|
|
void | next_click () |
| A slot for the next button, progresses the GUI's state. More...
|
|
void | printOutput () |
| A slot that should be called to take output from the current process's std and err streams. More...
|
|
void | finishedFCST (int status, QProcess::ExitStatus qStatus) |
| A slot that is called when FCST ends, updates GUI state. More...
|
|
void | newProject () |
| A slot attached to a menu action, to start a new project. More...
|
|
void | updateFolderView (const QString &path) |
| A slot that is called when fileWatcher reports new files in the workingDir. More...
|
|
void | fileBrowserClicked (QListWidgetItem *item) |
| A slot to manage user interaction when a file name is double clicked in the file browser. More...
|
|
void | save_log () |
| A slot to manage user interaction when the menu "Save Log File" action is triggered. More...
|
|
|
void | create_actions () |
| This function creates all actions. More...
|
|
void | create_menus () |
| This function creates all menus. More...
|
|
bool | maybe_save () |
| This function checks, if parameters were changed and show a dialog, if changes should be saved. More...
|
|
bool | save_file (const QString &filename, const QString &newfilename="") |
| Save parameters to filename in XML format. More...
|
|
void | load_file (const QString &filename, bool showMsg=true) |
| Load parameters from filename in XML format. More...
|
|
void | create_widgets () |
| Function for setting up GUI, used by constructor. More...
|
|
void | create_tab (QString name_) |
| Function for creating tab given a file in the local working directory Throws an std::runtime_error if file is not found. More...
|
|
bool | callFCST (QStringList arguments, bool pipeMsg) |
| Functions for calling and killing FCST, if pipeMsg is true then FCST output will be displayed on screen. More...
|
|
void | killFCST () |
|
bool | setWorkingDir () |
| Function for getting working directory from user. More...
|
|
void | log (const std::string &input) |
| Logging function, appends to gui_log.txt. More...
|
|
The MainWindow class of the the FCST parameterGUI.
Modified from the deal.II parameterGUI, which was developed by Martin Steigemann, Wolfgang Bangerth, 2010.
The FCST parameter GUI allows users to start a new "FCST Project" whereby fcst is called to generate default parameter files in a logical sequence (main >> data & opt), allowing the user to manually edit these files, and then eventually run a simulation using FCST and the edited parameter files. Output streams and files are displayed within the user interface, providing the user with a integrated environment in which they can setup and run a simulation from start to finish.
Developer Guide
This application inherits the Qt QMainWindow to provide the functionality of a "main" application, using many of its interfaces.
Visual Elements
The body of the application is composed of several widgets. Each widget is associated with a Box layout element so that it can dynamically expand as the QMainWindow size changes.
Top left: A QTabWidget is used to house several QTreeWidgets which display the loaded parameter files. Bottom Left: A QWidget supports a QLabel (used to display the logo image) and QPushButton Top Right: A read only QTextEdit is used to display fcst output Bottom Right: A QListWidget widget is used to represent a list of files created by fcst
Menus: The menuBar, a member of QMainWindow is populated by two other QMenu's Status Bar: The statusBar is a member of QMainWindow
Maintaining and modifying
Private functions are used to load and set up aspects of the GUI, whilst private slots are used to handle events invoked by the GUI (i.e. a button click). To modify the behaviour of the how the GUI reacts to user interactions please review the slot functions.
The main driving function of the program is the next_click() slot. When the user presses the next button/starts a new project/opens an existing project next_click() will try progress the program state "currentState" along the GUI's enumeration of states "States". The operations associated with each state are as follows:
Start:
- The program has just started
- Working file directory must be set
- A main file must be prepared by calling FCST
- Load the main file to the GUI
- Progress to next state
Main:
- Assumption: FCST has been used to generate a main file and the user has had time to edit it
- Save the main file and use it to generate data and optimization files
- Load these files to GUI
- Progress to next state
Ready:
- Assumption: main and data files have been loaded and the user has had time to edit them
- The GUI can get to this state if the user loads an existing project, by progressing from the Main state, or by retreating from the Running state
- Save these files and start a simulation using FCST
- Begin watching for new files in working directory (detect as FCST output)
- Progress to next state
Running:
- FCST has been called, output is being piped to text element
- The user has the option to end current simulation
- Retreat to previous state
Assumptions of FCST
This program is written with the following assumption of FCST binary's (BIN) interfaces
BIN -p:
- Result: FCST will output a default main file called "main.xml"
BIN -p file_name:
- FCST will assume that file_name is the name of a main file
- FCST will read the main file and generate data parameter file "data.xml"
- FCST may create and optimization parameter files "opt.xml", but not required to
Notes for Qt beginners
Qt online class documentation is very good! If you are wondering about an API just Google any class name.
Most objects in Qt are handled as naked pointers. Object constructors take a pointer to a parent object. The parent will manage their destruction. When the MainWindow is destroyed by the
- Note
- It is important that all developers learn and understand the Signal/Slots mechanism.
- Author
- Philip Wardlaw 2014