File failed to load: https://isis.astrogeology.usgs.gov/9.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
GuiBooleanParameter.cpp
1
5
6/* SPDX-License-Identifier: CC0-1.0 */
7#include <QHBoxLayout>
8#include <QWidget>
9#include "UserInterface.h"
10
11#include "GuiBooleanParameter.h"
12
13
14namespace Isis {
15
16 GuiBooleanParameter::GuiBooleanParameter(QGridLayout *grid, UserInterface &ui,
17 int group, int param) :
18 GuiParameter(grid, ui, group, param) {
19
20 p_checkBox = new QCheckBox((QString)ui.ParamBrief(group, param));
21
22 grid->addWidget(p_checkBox, param, 2);
23
24 RememberWidget(p_checkBox);
25 connect(p_checkBox, SIGNAL(toggled(bool)), this, SIGNAL(ValueChanged()));
26
27 if(p_ui->HelpersSize(group, param) != 0) {
28 grid->addWidget(AddHelpers(p_checkBox), param, 3);
29 }
30
31 p_type = BooleanWidget;
32 }
33
34
35 GuiBooleanParameter::~GuiBooleanParameter() {}
36
37
38 void GuiBooleanParameter::Set(QString newValue) {
39 p_checkBox->setChecked(p_ui->StringToBool(newValue));
40 emit ValueChanged();
41 }
42
43
44 QString GuiBooleanParameter::Value() {
45 return p_checkBox->isChecked() ? "YES" : "NO";
46 }
47
48 std::vector<QString> GuiBooleanParameter::Exclusions() {
49 std::vector<QString> list;
50
51 // Exclude exclusions or inclusions
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);
55 list.push_back(s);
56 }
57 }
58 else {
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);
61 list.push_back(s);
62 }
63 }
64
65 return list;
66 }
67
70 if(!IsEnabled()) return false;
71 QString value;
72 if(p_ui->ParamDefault(p_group, p_param).size() > 0) {
73 value = p_ui->ParamDefault(p_group, p_param).toUpper();
74 }
75 else {
76 value = "NO";
77 }
78
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";
87
88 if(Value() == value) return false;
89 return true;
90 }
91}
92
bool IsModified()
Return if the parameter value is different from the default value.
virtual std::vector< QString > Exclusions()
Return list of current exclusions.
bool IsEnabled() const
Is the parameter enabled.
Command Line and Xml loader, validation, and access.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16