2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008,2009 Oliver Gloth +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #include "guisettingstab.h"
25 #include <QFormLayout>
30 GuiSettingsTab::GuiSettingsTab(QString org
, QString app
, QString group
, QWidget
*parent
): QWidget(parent
)
33 QFormLayout
*permissionsLayout
= new QFormLayout
;
35 QSettings
settings(org
, app
);
37 if(group
!="General") settings
.beginGroup(group
);
39 settings
.beginGroup("int");
40 foreach (QString key
, settings
.childKeys()) {
41 int I
=settings
.value(key
).toInt();
42 spinbox
.append(new QSpinBox
);
43 spinbox_name
.append(key
);
44 spinbox
.back()->setValue(I
);
45 permissionsLayout
->addRow(key
, spinbox
.back());
49 settings
.beginGroup("bool");
50 foreach (QString key
, settings
.childKeys()) {
51 checkbox
.append(new QCheckBox
);
52 checkbox_name
.append(key
);
53 checkbox
.back()->setCheckState((Qt::CheckState
)settings
.value(key
).toInt());
54 permissionsLayout
->addRow(key
, checkbox
.back());
58 settings
.beginGroup("double");
59 foreach (QString key
, settings
.childKeys()) {
60 double D
=settings
.value(key
).toDouble();
63 double_lineedit
.append(new QLineEdit
);
64 double_lineedit_name
.append(key
);
65 double_lineedit
.back()->setText(s
);
66 permissionsLayout
->addRow(key
, double_lineedit
.back());
70 settings
.beginGroup("string");
71 foreach (QString key
, settings
.childKeys()) {
72 QString s
= settings
.value(key
).toString();
73 string_lineedit
.append(new QLineEdit
);
74 string_lineedit_name
.append(key
);
75 string_lineedit
.back()->setText(s
);
76 permissionsLayout
->addRow(key
, string_lineedit
.back());
80 if(group
!="General") settings
.endGroup();
82 setLayout(permissionsLayout
);