fixed edge display for volume cells
[engrid-github.git] / src / libengrid / guisettingstab.cpp
blobfc975e86acd0fa7f196b75c7cb7e2251a6d0ec0c
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>
23 #include <QFormLayout>
24 #include <QtDebug>
26 #include <iostream>
27 using namespace std;
29 GuiSettingsTab::GuiSettingsTab(QString org, QString app, QString group, QWidget *parent): QWidget(parent)
32 // qDebug() << "group=" << group;
34 QFormLayout *permissionsLayout = new QFormLayout;
36 QSettings settings(org, app);
38 if (group != QObject::tr("General")) settings.beginGroup(group);
40 settings.beginGroup(QObject::tr("int"));
41 foreach(QString key, settings.childKeys()) {
42 int I = settings.value(key).toInt();
43 spinbox.append(new QSpinBox);
44 spinbox_name.append(key);
45 spinbox.back()->setValue(I);
46 permissionsLayout->addRow(key, spinbox.back());
48 settings.endGroup();
50 settings.beginGroup(QObject::tr("bool"));
51 foreach(QString key, settings.childKeys()) {
52 checkbox.append(new QCheckBox);
53 checkbox_name.append(key);
54 checkbox.back()->setCheckState((Qt::CheckState)settings.value(key).toInt());
55 permissionsLayout->addRow(key, checkbox.back());
57 settings.endGroup();
59 settings.beginGroup(QObject::tr("double"));
60 foreach(QString key, settings.childKeys()) {
61 double D = settings.value(key).toDouble();
62 QString s;
63 s.setNum(D);
64 //s.sprintf("%.2f", D);
65 double_lineedit.append(new QLineEdit);
66 double_lineedit_name.append(key);
67 double_lineedit.back()->setText(s);
68 permissionsLayout->addRow(key, double_lineedit.back());
70 settings.endGroup();
72 settings.beginGroup(QObject::tr("QString"));
73 foreach(QString key, settings.childKeys()) {
74 QString S = settings.value(key).toString();
75 string_lineedit.append(new QLineEdit);
76 string_lineedit_name.append(key);
77 string_lineedit.back()->setText(S);
78 permissionsLayout->addRow(key, string_lineedit.back());
80 settings.endGroup();
82 settings.beginGroup(QObject::tr("Filename"));
83 foreach(QString key, settings.childKeys()) {
84 QString S = settings.value(key).toString();
85 filename_dialoglineedit.append(new DialogLineEdit(true));
86 filename_dialoglineedit_name.append(key);
87 filename_dialoglineedit.back()->setText(S);
88 permissionsLayout->addRow(key, filename_dialoglineedit.back());
90 settings.endGroup();
92 settings.beginGroup(QObject::tr("Directory"));
93 foreach(QString key, settings.childKeys()) {
94 QString S = settings.value(key).toString();
95 directory_dialoglineedit.append(new DialogLineEdit(false));
96 directory_dialoglineedit_name.append(key);
97 directory_dialoglineedit.back()->setText(S);
98 permissionsLayout->addRow(key, directory_dialoglineedit.back());
100 settings.endGroup();
102 if (group != QObject::tr("General")) settings.endGroup();
104 setLayout(permissionsLayout);