replaced abort() with EG_BUG
[engrid.git] / src / guisettingstab.cpp
blob74600b3884181ea3f5f56816c3580b188b2612e5
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008,2009 Oliver Gloth +
7 // + +
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. +
12 // + +
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. +
17 // + +
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/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #include "guisettingstab.h"
24 #include <typeinfo>
25 #include <QFormLayout>
27 #include <iostream>
28 using namespace std;
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());
47 settings.endGroup();
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());
56 settings.endGroup();
58 settings.beginGroup("double");
59 foreach (QString key, settings.childKeys()) {
60 double D=settings.value(key).toDouble();
61 QString s;
62 s.sprintf("%.2f", D);
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());
68 settings.endGroup();
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());
78 settings.endGroup();
80 if(group!="General") settings.endGroup();
82 setLayout(permissionsLayout);