|
a/utils/confgui.cpp |
|
b/utils/confgui.cpp |
|
... |
|
... |
82 |
|
82 |
|
83 |
connect(buttonBox, SIGNAL(accepted()), this, SLOT(acceptChanges()));
|
83 |
connect(buttonBox, SIGNAL(accepted()), this, SLOT(acceptChanges()));
|
84 |
connect(buttonBox, SIGNAL(rejected()), this, SLOT(rejectChanges()));
|
84 |
connect(buttonBox, SIGNAL(rejected()), this, SLOT(rejectChanges()));
|
85 |
}
|
85 |
}
|
86 |
|
86 |
|
|
|
87 |
void ConfTabsW::hideButtons()
|
|
|
88 |
{
|
|
|
89 |
if (buttonBox)
|
|
|
90 |
buttonBox->hide();
|
|
|
91 |
}
|
|
|
92 |
|
87 |
void ConfTabsW::acceptChanges()
|
93 |
void ConfTabsW::acceptChanges()
|
88 |
{
|
94 |
{
|
89 |
cerr << "ConfTabsW::acceptChanges()\n";
|
95 |
cerr << "ConfTabsW::acceptChanges()\n";
|
90 |
for (vector<ConfPanelW *>::iterator it = m_panels.begin();
|
96 |
for (auto& entry : m_panels) {
|
91 |
it != m_panels.end(); it++) {
|
|
|
92 |
(*it)->storeValues();
|
97 |
entry->storeValues();
|
93 |
}
|
98 |
}
|
94 |
for (vector<ConfPanelWIF *>::iterator it = m_widgets.begin();
|
99 |
for (auto& entry : m_widgets) {
|
95 |
it != m_widgets.end(); it++) {
|
|
|
96 |
(*it)->storeValues();
|
100 |
entry->storeValues();
|
97 |
}
|
101 |
}
|
98 |
emit sig_prefsChanged();
|
102 |
emit sig_prefsChanged();
|
|
|
103 |
if (!buttonBox->isHidden())
|
99 |
close();
|
104 |
close();
|
100 |
}
|
105 |
}
|
101 |
|
106 |
|
102 |
void ConfTabsW::rejectChanges()
|
107 |
void ConfTabsW::rejectChanges()
|
103 |
{
|
108 |
{
|
104 |
cerr << "ConfTabsW::rejectChanges()\n";
|
109 |
cerr << "ConfTabsW::rejectChanges()\n";
|
105 |
reloadPanels();
|
110 |
reloadPanels();
|
|
|
111 |
if (!buttonBox->isHidden())
|
106 |
close();
|
112 |
close();
|
107 |
}
|
113 |
}
|
108 |
|
114 |
|
109 |
void ConfTabsW::reloadPanels()
|
115 |
void ConfTabsW::reloadPanels()
|
110 |
{
|
116 |
{
|
111 |
for (vector<ConfPanelW *>::iterator it = m_panels.begin();
|
117 |
for (auto& entry : m_panels) {
|
112 |
it != m_panels.end(); it++) {
|
|
|
113 |
(*it)->loadValues();
|
118 |
entry->loadValues();
|
114 |
}
|
119 |
}
|
115 |
for (vector<ConfPanelWIF *>::iterator it = m_widgets.begin();
|
120 |
for (auto& entry : m_widgets) {
|
116 |
it != m_widgets.end(); it++) {
|
|
|
117 |
(*it)->loadValues();
|
121 |
entry->loadValues();
|
118 |
}
|
122 |
}
|
119 |
}
|
123 |
}
|
120 |
|
124 |
|
121 |
int ConfTabsW::addPanel(const QString& title)
|
125 |
int ConfTabsW::addPanel(const QString& title)
|
122 |
{
|
126 |
{
|
|
... |
|
... |
861 |
paramtype = ConfTabsW::CFPT_DNL;
|
865 |
paramtype = ConfTabsW::CFPT_DNL;
|
862 |
} else {
|
866 |
} else {
|
863 |
throw std::runtime_error("Bad type " + m_curvartp +
|
867 |
throw std::runtime_error("Bad type " + m_curvartp +
|
864 |
" for " + m_curvar);
|
868 |
" for " + m_curvar);
|
865 |
}
|
869 |
}
|
866 |
|
870 |
rtrimstring(m_brief, " .");
|
867 |
switch (paramtype) {
|
871 |
switch (paramtype) {
|
868 |
case ConfTabsW::CFPT_BOOL: {
|
872 |
case ConfTabsW::CFPT_BOOL: {
|
869 |
int def = atoi(m_curvarvals.c_str());
|
873 |
int def = atoi(m_curvarvals.c_str());
|
870 |
m_w->addParam(m_idx, paramtype, u8s2qs(m_curvar),
|
874 |
m_w->addParam(m_idx, paramtype, u8s2qs(m_curvar),
|
871 |
u8s2qs(m_brief), u8s2qs(m_descr), def);
|
875 |
u8s2qs(m_brief), u8s2qs(m_descr), def);
|
|
... |
|
... |
911 |
} else if (!tagname.compare("grouptitle")) {
|
915 |
} else if (!tagname.compare("grouptitle")) {
|
912 |
if (!m_hadTitle) {
|
916 |
if (!m_hadTitle) {
|
913 |
m_w = new ConfTabsW(m_parent, "Teh title", m_lnkfact);
|
917 |
m_w = new ConfTabsW(m_parent, "Teh title", m_lnkfact);
|
914 |
m_hadTitle = true;
|
918 |
m_hadTitle = true;
|
915 |
}
|
919 |
}
|
|
|
920 |
// Get rid of "parameters" in the title, it's not interesting
|
|
|
921 |
// and this makes our tab headers smaller.
|
|
|
922 |
string ps{"parameters"};
|
|
|
923 |
string::size_type pos = m_other.find(ps);
|
|
|
924 |
if (pos != string::npos) {
|
|
|
925 |
m_other = m_other.replace(pos, ps.size(), "");
|
|
|
926 |
}
|
916 |
m_idx = m_w->addPanel(u8s2qs(m_other));
|
927 |
m_idx = m_w->addPanel(u8s2qs(m_other));
|
917 |
m_hadGroup = true;
|
928 |
m_hadGroup = true;
|
918 |
m_other.clear();
|
929 |
m_other.clear();
|
919 |
} else if (!tagname.compare("descr")) {
|
930 |
} else if (!tagname.compare("descr")) {
|
920 |
} else if (!tagname.compare("brief")) {
|
931 |
} else if (!tagname.compare("brief")) {
|