Loading [MathJax]/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
GuiBooleanParameter.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include <QHBoxLayout>
8 #include <QWidget>
9 #include "UserInterface.h"
10 
11 #include "GuiBooleanParameter.h"
12 
13 
14 namespace 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 
Isis::GuiParameter::IsEnabled
bool IsEnabled() const
Is the parameter enabled.
Definition: GuiParameter.h:59
Isis::GuiBooleanParameter::IsModified
bool IsModified()
Return if the parameter value is different from the default value.
Definition: GuiBooleanParameter.cpp:69
IsisAml::ParamDefault
QString ParamDefault(const int &group, const int &param) const
Returns the default for a parameter in a specified group.
Definition: IsisAml.cpp:1505
IsisAml::ParamIncludeSize
int ParamIncludeSize(const int &group, const int &param) const
Returns the number of parameters included in this parameter's inclusions.
Definition: IsisAml.cpp:1731
Isis::GuiBooleanParameter::Exclusions
virtual std::vector< QString > Exclusions()
Return list of current exclusions.
Definition: GuiBooleanParameter.cpp:48
IsisAml::ParamExclude
QString ParamExclude(const int &group, const int &param, const int &exclude) const
Returns the name of the specified excluded parameter.
Definition: IsisAml.cpp:1462
IsisAml::ParamExcludeSize
int ParamExcludeSize(const int &group, const int &param) const
Returns the number of parameters excluded in this parameter's exclusions.
Definition: IsisAml.cpp:1719
IsisAml::ParamInclude
QString ParamInclude(const int &group, const int &param, const int &include) const
Returns the name of the specified included parameter.
Definition: IsisAml.cpp:1477
IsisAml::StringToBool
bool StringToBool(QString value) const
Returns a boolean value based on the QString contents.
Definition: IsisAml.cpp:2867
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:16:30