.Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Scheduler.h
1 // Scheduler.h - SchedulerGUI main window declaration.
2 // Written by Jesse Z. Zhong & Nicholas Kriner
3 #ifndef __Scheduler_GUI_H__
4 #define __Scheduler_GUI_H__
5 #pragma region Includes
6 #include "stdafx.h"
7 #include "ui_SchedulerGUI.h"
8 
9 #include "rapidjson/document.h"
10 #include "rapidjson/filestream.h"
11 #include "rapidjson/prettywriter.h"
12 
13 #include <qmessagebox.h>
14 #include <qsettings.h>
15 #include <qdialogbuttonbox.h>
16 #include <qpushbutton.h>
17 #include <qdatetime.h>
18 
19 #include <GasCombo.h>
20 #include <Utilities.h>
21 #include <ProjectNames.h>
22 #include <SimulationWorker.h>
23 #include <SimulationController.h>
24 #include <ChangeConfirmation.h>
25 
26 #include <limits>
27 
28 #include <InfoStruct\InfoStruct.h>
29 #include <Constants\AtomicProperties.h>
30 using namespace std;
31 using namespace MDSimulation;
32 #pragma endregion
33 
34 // TODO: - Possibly add the ability to revert specific changes
35 
36 
41 namespace SchedulerGUI {
42 
44  enum Options {Accept, Reject, DoNothing};
45 
49  class Scheduler : public QMainWindow {
50  Q_OBJECT
51  public:
52  #pragma region Constants
53  static const QString Scheduler::ModuleName;
55 
57  static const QString Scheduler::MostRecentlyUsedFile;
58 
60  static const QString Scheduler::MostRecentDirectory;
61 
63  static const string EmptySpaces;
64  #pragma endregion
65 
71  Scheduler();
72 
76  ~Scheduler();
77 
78  protected slots:
79  #pragma region Protected Slots
80 
83  void SetOutputDir();
84 
88  void LoadParameters();
89 
93  void LoadRecentFile();
94 
98  void SaveParameters();
99 
109  void UpdateUI();
110 
114  void UpdateDriverMode(const QString& newMode);
115 
120  void UpdateGasComp();
121 
122 
132  void UpdateParameters();
133 
137  void ChangeOutDirBox(const QString& dirPath);
138 
142  void ToggleRunSim();
143 
147  void TogglePlaySim();
148 
153  void ToggleStartButtonName(const bool state);
154 
159  void TogglePlayButtonName(const bool state);
160 
164  void WriteToLog(const QString& message);
165  #pragma endregion
166  protected:
167  #pragma region Initialization and Helper Methods
168 
171  void InitMapList();
172 
177  void InitGasComboBoxes();
178 
182  void InitLiquidComboBox();
183 
187  void ConnectWidgets();
188 
193  QString FullName(const string& symbol);
194 
198  bool ValidParam(QLineEdit &paramBox);
199 
203  void ResetGasComboBoxes();
204 
208  bool InfoStructDifference(InfoStruct structA, InfoStruct structB);
209 
213  int ShowInfoStructDifference(InfoStruct structA, InfoStruct structB);
214 
224  InfoStruct GUIToInfoStruct();
225 
230  bool DoubleChanged(double a, double b);
231  #pragma endregion
232  #pragma region UI Internals
233 
239  QSettings* SchedulerSettings_;
240 
241  // Members
243  map<string, QString> FullGasNames_;
244  vector<GasCombo> GasList_;
247  QString LogString_;
248  Ui::SchedulerGUI UI_;
250  #pragma endregion
251  friend class ChangeConfirmation;
252  };
253 }
254 #endif // !__Scheduler_GUI_H__
map< string, QString > FullGasNames_
Map of elements&#39; symbols-&gt;fullnames.
Definition: Scheduler.h:243
Ui::SchedulerGUI UI_
Instance of the UI/form.
Definition: Scheduler.h:248
The main window of Scheduler.
Definition: Scheduler.h:49
QSettings * SchedulerSettings_
Settings for use in the scheduler&#39;s saving and loading of parameters.
Definition: Scheduler.h:239
bool GasCompCorrect_
True if the gases add up to 1.0, false otherwise.
Definition: Scheduler.h:245
Takes in, as input, two InfoStructs and prompts the user to Accept and change, Reject and revert...
Definition: ChangeConfirmation.h:18
vector< GasCombo > GasList_
Vector list of the gas Combo/Spin boxes.
Definition: Scheduler.h:244
Options
Used by ChangeConfirmation to signify which action the user wishes to take.
Definition: Scheduler.h:44
InfoStruct InfoStruct_
Parameters object used to read and write variables to/from .json files.
Definition: Scheduler.h:249
QString LogString_
String used for writing messages to and forwarding to the UI&#39;s action log box.
Definition: Scheduler.h:247
Handles the running of the simulation with all the necessary requirements and conditions.
Definition: SimulationController.h:17
static const string EmptySpaces
Blank spaces. Used for formatting.
Definition: Scheduler.h:63
SimulationController * SimControl_
Used to create, run, and control a simulation instance.
Definition: Scheduler.h:242
Defines the structure used to hold the configurable constants of the simulation.
Definition: InfoStruct.h:36
bool AllBoxesFilled_
True if all boxes have valid data, false otherwise.
Definition: Scheduler.h:246