compiles on openSUSE 15.4 part 2
[engrid-github.git] / src / libengrid / guisettingstab.cpp
blob2b5d35546906be702031263084d0340b26feeadb
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
11 // + +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
16 // + +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #include "guisettingstab.h"
22 #include <typeinfo>
24 #include <QFormLayout>
25 #include <QtDebug>
27 #include <iostream>
28 using namespace std;
30 GuiSettingsTab::GuiSettingsTab(QString org, QString app, QString group, QWidget *parent): QWidget(parent)
33 // qDebug() << "group=" << group;
35 QFormLayout *permissionsLayout = new QFormLayout;
37 QSettings settings(org, app);
39 if (group != QObject::tr("General")) settings.beginGroup(group);
41 settings.beginGroup(QObject::tr("int"));
42 foreach(QString key, settings.childKeys()) {
43 int I = settings.value(key).toInt();
44 spinbox.append(new QSpinBox);
45 spinbox_name.append(key);
46 spinbox.back()->setValue(I);
47 permissionsLayout->addRow(key, spinbox.back());
49 settings.endGroup();
51 settings.beginGroup(QObject::tr("bool"));
52 foreach(QString key, settings.childKeys()) {
53 checkbox.append(new QCheckBox);
54 checkbox_name.append(key);
55 checkbox.back()->setCheckState((Qt::CheckState)settings.value(key).toInt());
56 permissionsLayout->addRow(key, checkbox.back());
58 settings.endGroup();
60 settings.beginGroup(QObject::tr("double"));
61 foreach(QString key, settings.childKeys()) {
62 double D = settings.value(key).toDouble();
63 QString s;
64 s.setNum(D);
65 //s.sprintf("%.2f", D);
66 double_lineedit.append(new QLineEdit);
67 double_lineedit_name.append(key);
68 double_lineedit.back()->setText(s);
69 permissionsLayout->addRow(key, double_lineedit.back());
71 settings.endGroup();
73 settings.beginGroup(QObject::tr("QString"));
74 foreach(QString key, settings.childKeys()) {
75 QString S = settings.value(key).toString();
76 string_lineedit.append(new QLineEdit);
77 string_lineedit_name.append(key);
78 string_lineedit.back()->setText(S);
79 permissionsLayout->addRow(key, string_lineedit.back());
81 settings.endGroup();
83 settings.beginGroup(QObject::tr("Filename"));
84 foreach(QString key, settings.childKeys()) {
85 QString S = settings.value(key).toString();
86 filename_dialoglineedit.append(new DialogLineEdit(true));
87 filename_dialoglineedit_name.append(key);
88 filename_dialoglineedit.back()->setText(S);
89 permissionsLayout->addRow(key, filename_dialoglineedit.back());
91 settings.endGroup();
93 settings.beginGroup(QObject::tr("Directory"));
94 foreach(QString key, settings.childKeys()) {
95 QString S = settings.value(key).toString();
96 directory_dialoglineedit.append(new DialogLineEdit(false));
97 directory_dialoglineedit_name.append(key);
98 directory_dialoglineedit.back()->setText(S);
99 permissionsLayout->addRow(key, directory_dialoglineedit.back());
101 settings.endGroup();
103 if (group != QObject::tr("General")) settings.endGroup();
105 setLayout(permissionsLayout);