00001 00023 #ifndef MAINWINDOW_H 00024 #define MAINWINDOW_H 00025 00026 00027 #include <QtGui> 00028 #include <QDir> 00029 #include <QPluginLoader> 00030 #include <QFileInfoList> 00031 #include <QDebug> 00032 #include <QSettings> 00033 #include <QStringList> 00034 #include <QMap> 00035 #include <QWhatsThis> 00036 #include <QPlastiqueStyle> 00037 #include <QWindowsVistaStyle> 00038 #include <QStandardItem> 00039 #include <QStandardItemModel> 00040 #include <QModelIndexList> 00041 #include <QItemSelectionModel> 00042 #include <QDesktopServices> 00043 #include <QErrorMessage> 00044 #include <QVBoxLayout> 00045 #include <iostream> 00046 #include <stdio.h> 00047 #include <vector> 00048 #include <stack> 00049 00050 #include "defines.h" 00051 #include "calculatemanager.h" 00052 00053 #include "simulationstorage.h" 00054 #include "xyplot.h" 00055 #include "xyplotarea.h" 00056 #include "ui_listframe.h" 00057 #include "ui_moreinfo.h" 00058 #include "../../Support/calculatefunctions.h" 00059 #include "../../Support/data.h" 00060 #include "../../Support/frictioninterface.h" 00061 #include "../../Support/calculateregimeinterface.h" 00062 #include "../../Support/interfacefrictioninterface.h" 00063 #include "../../Support/frictionfunctions.h" 00064 #include "../../Support/regimetransitioninterface.h" 00065 00066 namespace Ui { 00067 class MainWindow; 00068 } 00069 00070 class MainWindow : public QMainWindow { 00071 Q_OBJECT 00072 public: 00073 MainWindow(QWidget *parent = 0); 00074 ~MainWindow(); 00075 00076 protected: 00077 void changeEvent(QEvent *e); 00078 00079 private: 00080 Ui::MainWindow *ui; 00081 Ui::ListFrame *uiRegimeListFrame; 00082 Ui::ListFrame *uiFlowListFrame; 00083 CalculateManager *cm; 00084 QErrorMessage *errorMessage; 00085 00086 QSplitter *regimeSplitter; 00087 QSplitter *flowSplitter; 00088 QTabWidget *tabWidgetFlow; 00089 00090 XYPlotArea* regimePlot; 00091 XYPlotArea *holdupPlot; 00092 XYPlotArea *pressurePlot; 00093 XYPlotArea *alphaPlot; 00094 XYPlotArea *diameterPlot; 00095 00096 QStandardItemModel *simulationsFlowModel; 00097 QStandardItemModel *simulationsRegimeModel; 00098 QItemSelectionModel *simulationFlowItemSelectionModel; 00099 QItemSelectionModel *simulationRegimeItemSelectionModel; 00100 00101 void addPluginComboBoxItems(); 00102 void addPredefinesComboBoxItems(flowtype_t flowType, bool newItem = false, QString focusComboBoxName = ""); 00103 void addRegimeCheckBoxes(); 00104 void loadWidgetValues(); 00105 void saveWidgetValues(); 00106 void saveGasDefinition(QString definitionName); 00107 void saveLiquidDefinition(QString definitionName); 00108 00109 void enableDisableSimulationListButtons(simulationtype_t simulationType); 00110 void plotSelectedSimulations(simulationtype_t simulationType); 00111 void showSimulationListInformation(simulationtype_t simulationType); 00112 void removeSelectedItemsFromList(simulationtype_t simulationType); 00113 void loadSimulationListParameters(simulationtype_t simulationType); 00114 void addRemoveOldItemsSimulationList(simulationtype_t simulationType); 00115 00116 void getWidgetValues(Data *data); 00117 void setWidgetValues(const Data *data); 00118 void saveGasDefinition(QString name, QString density, QString viscosity, QString temperature, QString pressure, 00119 QString densityMin = "", QString viscosityMin = "", QString temperatureMin = "", QString pressureMin = "", 00120 QString densityMax = "", QString viscosityMax = "", QString temperatureMax = "", QString pressureMax = ""); 00121 void saveLiquidDefinition(QString name, QString density, QString viscosity, QString densityMin = "", QString viscosityMin = "", 00122 QString densityMax = "", QString viscosityMax = ""); 00123 bool isInputValid(simulationtype_t simulationType); 00124 void firstRunSetup(); 00125 regimetype_t getRegimeType(); 00126 scale_t getScaleType(); 00127 00128 FrictionFunctions *getSelectedFrictionPlugins(std::vector<FrictionInterface *> frictionPlugins, 00129 std::vector<InterfaceFrictionInterface *> interfaceFrictionPlugins, 00130 std::vector<SlipRelationInterface *> slipRelationFrictionPlugins); 00131 CalculateFunctions *getSelectedCalculatePlugins(std::vector<CalculateRegimeInterface *> calculatePlugins); 00132 std::vector<FrictionInterface *> frictionInterfacePlugins; 00133 std::vector<InterfaceFrictionInterface*> interfaceFrictionInterfacePlugins; 00134 std::vector<SlipRelationInterface*> slipRelationInterfacePlugins; 00135 std::vector<RegimeTransitionInterface *> regimeInterfacePlugins; 00136 std::vector<CalculateRegimeInterface *> calculateInterfacePlugins; 00137 00138 std::vector<QRadioButton *> _radioButtonsVariable; 00139 std::vector<double> _variableScaler; 00140 00141 std::vector<QLineEdit *> _lineEdits; 00142 std::vector<QLineEdit *> _lineEditsMin; 00143 std::vector<QLineEdit *> _lineEditsMax; 00144 std::vector<QLineEdit *> _lineEditsAll; 00145 std::vector<QCheckBox *> _regimeCheckBoxes; 00146 std::vector<CalculateManager *> _regimeCalculationManagers; 00147 QStringList _settingNamesLineEdits; 00148 QStringList _settingNamesLineEditsMin; 00149 QStringList _settingNamesLineEditsMax; 00150 QStringList _settingNamesLineEditsAll; 00151 QStringList _settingDefaultsLineEdits; 00152 QStringList _settingDefaultsLineEditsMin; 00153 QStringList _settingDefaultsLineEditsMax; 00154 QStringList _settingDefaultsLineEditsAll; 00155 QStringList _settingNamesRadioBoxes; 00156 00157 00158 std::vector<QRadioButton *> _radioButtonsRegime; 00159 std::vector<XYPlotArea *> _XYPlotAreas; 00160 00161 unsigned int _simID; 00162 unsigned int _firstNewSimID; 00163 unsigned int _simRegimeID; 00164 unsigned int _firstNewSimRegimeID; 00165 00166 private slots: 00167 00168 void on_checkBoxRegimeUseMinimumHoldup_clicked(); 00169 void on_actionSource_code_documentation_triggered(); 00170 void on_actionAbout_MultiPhasePlot_triggered(); 00171 void on_actionExit_triggered(); 00172 void on_actionWhats_this_triggered(); 00173 void on_pushButtonRemoveSelectedFlow_clicked(); 00174 void on_pushButtonRemoveSelectedRegime_clicked(); 00175 void on_pushButtonFlowMoreInfo_clicked(); 00176 void on_pushButtonRegimeMoreInfo_clicked(); 00177 void on_pushButtonLoadSimulationParametersFlow_clicked(); 00178 void on_pushButtonLoadSimulationParametersRegime_clicked(); 00179 void on_simulationFlowItemSelectionModel_selectionChanged(QItemSelection, QItemSelection ); 00180 void on_simulationRegimeItemSelectionModel_selectionChanged(QItemSelection , QItemSelection ); 00181 void on_checkBoxIncludeOldSimulationsFlow_clicked(); 00182 void on_checkBoxIncludeOldSimulationsRegime_clicked(); 00183 void on_pushButtonPlotSimulations_clicked(); 00184 void on_pushButtonPlotSimulationsRegime_clicked(); 00185 void on_pushButtonSimulateFlow_clicked(); 00186 void on_radioButtonVariable_clicked(); 00187 void on_flowSimulation_progressed(int percent); 00188 void on_flowSimulation_finished(); 00189 void on_pushButtonStopSimulationFlow_clicked(); 00190 void on_flowSimulation_terminated(); 00191 void on_pushButtonSimulateRegime_clicked(); 00192 void on_pushButtonClearSelectionFlow_clicked(); 00193 void on_pushButtonClearSelectionRegime_clicked(); 00194 void on_pushButtonDeleteLiquidPredefines_clicked(); 00195 void on_pushButtonDeleteGasPredefines_clicked(); 00196 void on_pushButtonLoadLiquidPredefines_clicked(); 00197 void on_pushButtonSaveLiquidPredefine_clicked(); 00198 void on_pushButtonLoadGasPredefines_clicked(); 00199 void on_pushButtonSaveGasPredefine_clicked(); 00200 void on_regimeSimulation_finished(); 00201 void on_regimeSimulation_progressed(int asdf); 00202 void on_pushButtonStopSimulationRegime_clicked(); 00203 void on_regimeSimulation_terminated(); 00204 void on_simulationError(QString); 00205 00206 00207 }; 00208 00209 #endif // MAINWINDOW_H