QSS Solver GUI
4.5.3
settings.cpp
Go to the documentation of this file.
1
/*****************************************************************************
2
3
This file is part of QSS Solver.
4
5
QSS Solver is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9
10
QSS Solver is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with QSS Solver. If not, see <http://www.gnu.org/licenses/>.
17
18
******************************************************************************/
19
20
#include <QtGui>
21
#include <Qt>
22
23
#include <
settings.hpp
>
24
#include <
utils.hpp
>
25
26
SettingsDlg::SettingsDlg
(QWidget *parent) : QDialog(parent)
27
{
28
setupUi(
this
);
29
_utils
=
new
Utils
();
30
_models->setText(
_utils
->
relativePath
(
MMOC_MODELS
));
31
_packages->setText(
_utils
->
relativePath
(
MMOC_PACKAGES
));
32
_include->setText(
_utils
->
relativePath
(
MMOC_INCLUDE
));
33
_output->setText(
_utils
->
relativePath
(
MMOC_OUTPUT
));
34
_build->setText(
_utils
->
relativePath
(
MMOC_BUILD
));
35
_engine->setText(
_utils
->
relativePath
(
MMOC_ENGINE
));
36
_source->setText(
_utils
->
relativePath
(
MMOC_SOURCE
));
37
_libs->setText(
_utils
->
relativePath
(
MMOC_LIBS
));
38
_bin->setText(
_utils
->
relativePath
(
MMOC_BIN
));
39
_externalLibs->setText(
_utils
->
relativePath
(
MMOC_LIBRARIES
));
40
_comp->setText(
_utils
->
appCommand
(
CMD_COMPILE
));
41
_buildCmd->setText(
_utils
->
appCommand
(
CMD_BUILD
));
42
_simulate->setText(
_utils
->
appCommand
(
CMD_SIMULATE
));
43
_plot->setText(
_utils
->
appCommand
(
CMD_PLOT
));
44
_sbml->setText(
_utils
->
appCommand
(
CMD_SBML
));
45
_flags->setText(
_utils
->
appFlag
(
FLG_FLAGS
));
46
_plotFlags->setText(
_utils
->
appFlag
(
FLG_PLOT
));
47
_setCheckBoxValue
(_allCbx,
_utils
->
appFlag
(
FLG_DBG_ALL
));
48
_setCheckBoxValue
(_initialValuesCbx,
_utils
->
appFlag
(
FLG_DBG_INIT_VALUES
));
49
_setCheckBoxValue
(_externalEventsCbx,
_utils
->
appFlag
(
FLG_DBG_EXTERNAL_EVENT
));
50
_setCheckBoxValue
(_memoryCbx,
_utils
->
appFlag
(
FLG_DBG_MEMORY
));
51
_setCheckBoxValue
(_synchronizeCbx,
_utils
->
appFlag
(
FLG_DBG_SYNCHRONIZE
));
52
_setCheckBoxValue
(_stepInfoCbx,
_utils
->
appFlag
(
FLG_DBG_STEP_INFO
));
53
_setCheckBoxValue
(_varChangesCbx,
_utils
->
appFlag
(
FLG_DBG_VAR_CHANGES
));
54
_setCheckBoxValue
(_waitForCbx,
_utils
->
appFlag
(
FLG_DBG_WAIT_FOR
));
55
_setCheckBoxValue
(_weightsCbx,
_utils
->
appFlag
(
FLG_DBG_WEIGHTS
));
56
_setCheckBoxValue
(_dtCbx,
_utils
->
appFlag
(
FLG_DBG_DT
));
57
connect(
this
, &SettingsDlg::accepted,
this
, &
SettingsDlg::_save
);
58
}
59
60
SettingsDlg::~SettingsDlg
() {
delete
_utils
; }
61
62
void
SettingsDlg::_save
()
63
{
64
_utils
->
setDir
(
MMOC_MODELS
, _models->text());
65
_utils
->
setDir
(
MMOC_PACKAGES
, _packages->text());
66
_utils
->
setDir
(
MMOC_INCLUDE
, _include->text());
67
_utils
->
setDir
(
MMOC_OUTPUT
, _output->text());
68
_utils
->
setDir
(
MMOC_BUILD
, _build->text());
69
_utils
->
setDir
(
MMOC_ENGINE
, _engine->text());
70
_utils
->
setDir
(
MMOC_SOURCE
, _source->text());
71
_utils
->
setDir
(
MMOC_LIBS
, _libs->text());
72
_utils
->
setDir
(
MMOC_BIN
, _bin->text());
73
_utils
->
setDir
(
MMOC_LIBRARIES
, _externalLibs->text());
74
_utils
->
setCommand
(
CMD_COMPILE
, _comp->text());
75
_utils
->
setCommand
(
CMD_BUILD
, _buildCmd->text());
76
_utils
->
setCommand
(
CMD_SIMULATE
, _simulate->text());
77
_utils
->
setCommand
(
CMD_PLOT
, _plot->text());
78
_utils
->
setCommand
(
CMD_SBML
, _sbml->text());
79
_utils
->
setFlag
(
FLG_FLAGS
, _flags->text());
80
_utils
->
setFlag
(
FLG_DBG_ALL
,
_getCheckBoxValue
(_allCbx));
81
_utils
->
setFlag
(
FLG_DBG_INIT_VALUES
,
_getCheckBoxValue
(_initialValuesCbx));
82
_utils
->
setFlag
(
FLG_DBG_EXTERNAL_EVENT
,
_getCheckBoxValue
(_externalEventsCbx));
83
_utils
->
setFlag
(
FLG_DBG_MEMORY
,
_getCheckBoxValue
(_memoryCbx));
84
_utils
->
setFlag
(
FLG_DBG_SYNCHRONIZE
,
_getCheckBoxValue
(_synchronizeCbx));
85
_utils
->
setFlag
(
FLG_DBG_STEP_INFO
,
_getCheckBoxValue
(_stepInfoCbx));
86
_utils
->
setFlag
(
FLG_DBG_VAR_CHANGES
,
_getCheckBoxValue
(_varChangesCbx));
87
_utils
->
setFlag
(
FLG_DBG_WAIT_FOR
,
_getCheckBoxValue
(_waitForCbx));
88
_utils
->
setFlag
(
FLG_DBG_WEIGHTS
,
_getCheckBoxValue
(_weightsCbx));
89
_utils
->
setFlag
(
FLG_DBG_DT
,
_getCheckBoxValue
(_dtCbx));
90
_utils
->
setFlag
(
FLG_PLOT
, _plotFlags->text());
91
}
92
93
QString
SettingsDlg::_getCheckBoxValue
(QCheckBox *chkBox)
94
{
95
if
(chkBox->checkState() == Qt::Checked) {
96
return
"true"
;
97
}
else
{
98
return
"false"
;
99
}
100
}
101
102
void
SettingsDlg::_setCheckBoxValue
(QCheckBox *chkBox, QString value)
103
{
104
if
(value.compare(
"true"
) == 0) {
105
chkBox->setCheckState(Qt::Checked);
106
}
else
{
107
chkBox->setCheckState(Qt::Unchecked);
108
}
109
}
CMD_SBML
@ CMD_SBML
Definition:
utils.hpp:58
SettingsDlg::SettingsDlg
SettingsDlg(QWidget *parent=NULL)
Definition:
settings.cpp:26
MMOC_SOURCE
@ MMOC_SOURCE
Definition:
utils.hpp:51
Utils::setDir
void setDir(AppDirs d, QString value)
Definition:
utils.cpp:219
Utils::appFlag
QString appFlag(AppFlags f)
Definition:
utils.cpp:78
utils.hpp
MMOC_BIN
@ MMOC_BIN
Definition:
utils.hpp:50
SettingsDlg::_setCheckBoxValue
void _setCheckBoxValue(QCheckBox *chkBox, QString value)
Definition:
settings.cpp:102
FLG_DBG_SYNCHRONIZE
@ FLG_DBG_SYNCHRONIZE
Definition:
utils.hpp:46
MMOC_LIBRARIES
@ MMOC_LIBRARIES
Definition:
utils.hpp:53
FLG_DBG_INIT_VALUES
@ FLG_DBG_INIT_VALUES
Definition:
utils.hpp:43
MMOC_MODELS
@ MMOC_MODELS
Definition:
utils.hpp:45
FLG_PLOT
@ FLG_PLOT
Definition:
utils.hpp:53
settings.hpp
CMD_COMPILE
@ CMD_COMPILE
Definition:
utils.hpp:58
CMD_SIMULATE
@ CMD_SIMULATE
Definition:
utils.hpp:58
SettingsDlg::~SettingsDlg
~SettingsDlg()
Definition:
settings.cpp:60
FLG_DBG_DT
@ FLG_DBG_DT
Definition:
utils.hpp:51
Utils
Definition:
utils.hpp:60
SettingsDlg::_save
void _save()
Definition:
settings.cpp:62
FLG_DBG_WEIGHTS
@ FLG_DBG_WEIGHTS
Definition:
utils.hpp:50
MMOC_INCLUDE
@ MMOC_INCLUDE
Definition:
utils.hpp:54
Utils::setFlag
void setFlag(AppFlags f, QString value)
Definition:
utils.cpp:225
FLG_DBG_MEMORY
@ FLG_DBG_MEMORY
Definition:
utils.hpp:45
SettingsDlg::_utils
Utils * _utils
Definition:
settings.hpp:56
FLG_DBG_EXTERNAL_EVENT
@ FLG_DBG_EXTERNAL_EVENT
Definition:
utils.hpp:44
MMOC_OUTPUT
@ MMOC_OUTPUT
Definition:
utils.hpp:46
Utils::setCommand
void setCommand(AppCmds c, QString value)
Definition:
utils.cpp:99
Utils::relativePath
QString relativePath(AppDirs d)
Definition:
utils.cpp:90
MMOC_PACKAGES
@ MMOC_PACKAGES
Definition:
utils.hpp:52
FLG_DBG_VAR_CHANGES
@ FLG_DBG_VAR_CHANGES
Definition:
utils.hpp:48
SettingsDlg::_getCheckBoxValue
QString _getCheckBoxValue(QCheckBox *chkBox)
Definition:
settings.cpp:93
FLG_DBG_WAIT_FOR
@ FLG_DBG_WAIT_FOR
Definition:
utils.hpp:49
Utils::appCommand
QString appCommand(AppCmds c)
Definition:
utils.cpp:22
FLG_FLAGS
@ FLG_FLAGS
Definition:
utils.hpp:52
FLG_DBG_ALL
@ FLG_DBG_ALL
Definition:
utils.hpp:42
MMOC_ENGINE
@ MMOC_ENGINE
Definition:
utils.hpp:48
CMD_BUILD
@ CMD_BUILD
Definition:
utils.hpp:58
MMOC_LIBS
@ MMOC_LIBS
Definition:
utils.hpp:49
CMD_PLOT
@ CMD_PLOT
Definition:
utils.hpp:58
FLG_DBG_STEP_INFO
@ FLG_DBG_STEP_INFO
Definition:
utils.hpp:47
MMOC_BUILD
@ MMOC_BUILD
Definition:
utils.hpp:47
settings.cpp
Generated on Fri Feb 21 2025 11:44:00 for QSS Solver GUI by
1.8.17