.Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Attributes | Protected Slots | Protected Member Functions | Protected Attributes | Friends | List of all members
SchedulerGUI::Scheduler Class Reference

The main window of Scheduler. More...

#include <Scheduler.h>

Inheritance diagram for SchedulerGUI::Scheduler:

Public Member Functions

 Scheduler ()
 Constructor. More...
 
 ~Scheduler ()
 Destructor.
 

Static Public Attributes

static const string EmptySpaces = " "
 Blank spaces. Used for formatting.
 

Protected Slots

void SetOutputDir ()
 Sets the directory to which simulation output will be written to.
 
void LoadParameters ()
 Prompts the user for a parameter file and loads the data from it to the UI.
 
void LoadRecentFile ()
 Checks to see if there was a file used before, loads it if there was.
 
void SaveParameters ()
 Writes the parameters set in the UI to a file at a location specified by the user.
 
void UpdateUI ()
 Called when a file is loaded and the UI needs to be changed. More...
 
void UpdateDriverMode (const QString &newMode)
 Disables frequency editing if the new mode is Constant.
 
void UpdateGasComp ()
 Called whenever a GasSpinBox is edited. More...
 
void UpdateParameters ()
 Called whenever a parameter is edited. More...
 
void ChangeOutDirBox (const QString &dirPath)
 Changes the text in the output directory line edit.
 
void ToggleRunSim ()
 Starts or stops the simulation.
 
void TogglePlaySim ()
 Plays or pauses an initialized simulation.
 
void ToggleStartButtonName (const bool state)
 Toggles the simulation start button between two different strings of text: "Start" and "Stop" depending on the running state of the simulation.
 
void TogglePlayButtonName (const bool state)
 Toggles the simulation play button so that switches icons/images depending on the state the simulation is running in.
 
void WriteToLog (const QString &message)
 Writes to the log box in the UI.
 

Protected Member Functions

void InitMapList ()
 Initializes the mapping of symbols->full element names.
 
void InitGasComboBoxes ()
 Initializes the Atomic Parts list; adds all elements to ComboBoxes and links ComboBoxes and SpinBoxes to relevant signals in the Scheduler UI.
 
void InitLiquidComboBox ()
 Initializes the Liquid ComboBox so that it has the list of liquids.
 
void ConnectWidgets ()
 Connects widgets in the UI to relevant signals.
 
QString FullName (const string &symbol)
 Checks the symbol->fullname mapping; if symbol has a full name pairing, return the fullname; else, return the symbol.
 
bool ValidParam (QLineEdit &paramBox)
 Checks to make sure that a parameter box has a valid (for the localization) double value.
 
void ResetGasComboBoxes ()
 Resets the Gas ComboBox + SpinBox combo to default, 0-values.
 
bool InfoStructDifference (InfoStruct structA, InfoStruct structB)
 Checks two InfoStructs to see if any values are different. More...
 
int ShowInfoStructDifference (InfoStruct structA, InfoStruct structB)
 Produces a UI window that displays the differences between the previous values and current values.
 
InfoStruct GUIToInfoStruct ()
 Returns the values in the GUI in the form of an InfoStruct. More...
 
bool DoubleChanged (double a, double b)
 Returns true if the difference between two double values is larger than a given epsilon value, using a constant epsilon value.
 

Protected Attributes

QSettings * SchedulerSettings_
 Settings for use in the scheduler's saving and loading of parameters. More...
 
SimulationControllerSimControl_
 Used to create, run, and control a simulation instance. More...
 
map< string, QString > FullGasNames_
 Map of elements' symbols->fullnames. More...
 
vector< GasComboGasList_
 Vector list of the gas Combo/Spin boxes. More...
 
bool GasCompCorrect_
 True if the gases add up to 1.0, false otherwise. More...
 
bool AllBoxesFilled_
 True if all boxes have valid data, false otherwise. More...
 
QString LogString_
 String used for writing messages to and forwarding to the UI's action log box. More...
 
Ui::SchedulerGUI UI_
 Instance of the UI/form. More...
 
InfoStruct InfoStruct_
 Parameters object used to read and write variables to/from .json files. More...
 

Friends

class ChangeConfirmation
 

Detailed Description

The main window of Scheduler.

Constructor & Destructor Documentation

Scheduler::Scheduler ( )

Constructor.

Sets up the UI elements. Also makes sure that there is a module name, organization name, and that everything is initialized.

Member Function Documentation

InfoStruct Scheduler::GUIToInfoStruct ( )
protected

Returns the values in the GUI in the form of an InfoStruct.

This is mainly intended to test if InfoStruct_ is equal to the current parameters (before running the simulation or before saving). If you need an InfoStruct, force the user to save first and perform data validation (e.g. making sure the gases add up to 1.0) in the SaveParameters() function, then use InfoStruct_ (as it is updated after saves or loads and should have valid data. The struct returned by this function is not guaranteed to be valid and can crash the simulation).

bool Scheduler::InfoStructDifference ( InfoStruct  structA,
InfoStruct  structB 
)
protected

Checks two InfoStructs to see if any values are different.

Returns true if there is a difference.

void Scheduler::UpdateGasComp ( )
protectedslot

Called whenever a GasSpinBox is edited.

Sets bool GasCompCorrect_ to true if the sum of GasSpinBox values == 1.0; else it is set to false.

void Scheduler::UpdateParameters ( )
protectedslot

Called whenever a parameter is edited.

If all parameters have valid data, bool AllBoxesFilled_ is set to true; otherwise, it stays (or becomes) false

Checks to see if the parameter entered into the lineEdit is valid. If it is, keep it; otherwise, warn the user and empty it. Also checks to see if all boxes have valid data, if they do, AllBoxesFilled_ is set to true.

void Scheduler::UpdateUI ( )
protectedslot

Called when a file is loaded and the UI needs to be changed.

When loading a file, Scheduler::InfoStruct_ should be set beforehand. i.e. this->InfoStruct_ = this->InfoStruct_.ParseInfoStruct( fileName ); this->UpdateUI(); Parameter, Liquid, Driver and Gas boxes are updated based on the values in the InfoStruct_

Member Data Documentation

bool SchedulerGUI::Scheduler::AllBoxesFilled_
protected

True if all boxes have valid data, false otherwise.

map<string, QString> SchedulerGUI::Scheduler::FullGasNames_
protected

Map of elements' symbols->fullnames.

bool SchedulerGUI::Scheduler::GasCompCorrect_
protected

True if the gases add up to 1.0, false otherwise.

vector<GasCombo> SchedulerGUI::Scheduler::GasList_
protected

Vector list of the gas Combo/Spin boxes.

InfoStruct SchedulerGUI::Scheduler::InfoStruct_
protected

Parameters object used to read and write variables to/from .json files.

QString SchedulerGUI::Scheduler::LogString_
protected

String used for writing messages to and forwarding to the UI's action log box.

QSettings* SchedulerGUI::Scheduler::SchedulerSettings_
protected

Settings for use in the scheduler's saving and loading of parameters.

Utilizes Scheduler::ApplicationName as the application name and Scheduler::OrganizationName as the company name

SimulationController* SchedulerGUI::Scheduler::SimControl_
protected

Used to create, run, and control a simulation instance.

Ui::SchedulerGUI SchedulerGUI::Scheduler::UI_
protected

Instance of the UI/form.


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