9#include "UserInterface.h"
11#include "GuiBooleanParameter.h"
16 GuiBooleanParameter::GuiBooleanParameter(QGridLayout *grid, UserInterface &ui,
17 int group,
int param) :
18 GuiParameter(grid, ui, group, param) {
20 p_checkBox =
new QCheckBox((QString)ui.ParamBrief(group, param));
22 grid->addWidget(p_checkBox, param, 2);
24 RememberWidget(p_checkBox);
25 connect(p_checkBox, SIGNAL(toggled(
bool)),
this, SIGNAL(ValueChanged()));
27 if(p_ui->HelpersSize(group, param) != 0) {
28 grid->addWidget(AddHelpers(p_checkBox), param, 3);
31 p_type = BooleanWidget;
35 GuiBooleanParameter::~GuiBooleanParameter() {}
38 void GuiBooleanParameter::Set(QString newValue) {
39 p_checkBox->setChecked(p_ui->StringToBool(newValue));
44 QString GuiBooleanParameter::Value() {
45 return p_checkBox->isChecked() ?
"YES" :
"NO";
48 std::vector<QString> GuiBooleanParameter::Exclusions() {
49 std::vector<QString> list;
52 if(Value() ==
"YES") {
53 for(
int i = 0; i < p_ui->ParamExcludeSize(p_group, p_param); i++) {
54 QString s = p_ui->ParamExclude(p_group, p_param, i);
59 for(
int i = 0; i < p_ui->ParamIncludeSize(p_group, p_param); i++) {
60 QString s = p_ui->ParamInclude(p_group, p_param, i);
69 bool GuiBooleanParameter::IsModified() {
70 if(!IsEnabled())
return false;
72 if(p_ui->ParamDefault(p_group, p_param).size() > 0) {
73 value = p_ui->ParamDefault(p_group, p_param).toUpper();
79 if(value ==
"0") value =
"NO";
80 if(value ==
"FALSE") value =
"NO";
81 if(value ==
"N") value =
"NO";
82 if(value ==
"OFF") value =
"NO";
83 if(value ==
"1") value =
"YES";
84 if(value ==
"TRUE") value =
"YES";
85 if(value ==
"Y") value =
"YES";
86 if(value ==
"ON") value =
"YES";
88 if(Value() == value)
return false;
This is free and unencumbered software released into the public domain.