1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
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. +
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. +
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/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #include "guisettingstab.h"
24 #include <QFormLayout>
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());
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());
60 settings
.beginGroup(QObject::tr("double"));
61 foreach(QString key
, settings
.childKeys()) {
62 double D
= settings
.value(key
).toDouble();
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());
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());
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());
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());
103 if (group
!= QObject::tr("General")) settings
.endGroup();
105 setLayout(permissionsLayout
);