fixed edge display for volume cells
[engrid-github.git] / src / libengrid / guisettingsviewer.h
blob48f2731972392406cb44bad5d5d72f8023bada3f
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 #ifndef SETTINGSVIEWER_H
22 #define SETTINGSVIEWER_H
24 #include <QDialog>
25 #include <QtGui>
27 #include "guisettingstab.h"
29 // class QPushButton;
30 // class QSettings;
31 // class QTreeWidget;
32 // class QTreeWidgetItem;
34 // IMPORTANT:
35 // Setting keys can contain any Unicode characters. The Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses case-sensitive keys. To avoid portability problems, follow these two simple rules:
36 // Always refer to the same key using the same case. For example, if you refer to a key as "text fonts" in one place in your code, don't refer to it as "Text Fonts" somewhere else.
37 // Avoid key names that are identical except for the case. For example, if you have a key called "MainWindow", don't try to save another key as "mainwindow".
38 // Do not use slashes ('/' and '\') in key names; the backslash character is used to separate sub keys (see below). On windows '\' are converted by QSettings to '/', which makes them identical.
40 /**
41 * Creates a QWidget with one tab per main group found in the specified QSettings file. Each of those tabs is a SettingsTab.
43 class GuiSettingsViewer : public QDialog
45 Q_OBJECT
47 public:
49 // constructors
50 /**
51 * Constructor using the (org,app) pair to determine QSettings
52 * @param org organization
53 * @param app application
54 * @param parent Parent QWidget
56 GuiSettingsViewer(QString org, QString app, QWidget *parent = 0);
58 /**
59 * Constructor taking a QSettings argument to build the widget.
60 * @param Set QSettings to use
61 * @param parent Parent QWidget
63 GuiSettingsViewer(QSettings* Set, QWidget *parent = 0);
65 public:
66 void CreateViewer();
68 private slots:
69 void open();
70 void save();///< save the settings
71 void readSettings();
73 /** add child settings
74 * @todo Delete the tabs for real. Or make sure they have the correct parent.
76 void addChildSettings();
78 private:
80 QPushButton *openButton;///< Button for the open() action
81 QPushButton *saveButton;///< Button for the save() action
82 QPushButton *closeButton;///< Button for the close() action
84 QTabWidget tabWidget;///< a QTabWidget
85 QVector<GuiSettingsTab> tabs;///< a vector containing the tabs
87 QString organization;///< organization: cf QSettings documentation for more info
88 QString application;///< application: cf QSettings documentation for more info
89 QSettings* m_settings;///< The settings used
91 public:
92 /**
93 * if key=value pair not found in m_settings file, write it + read key value from m_settings file and return it.
94 * Version for int variables
95 * @param group group
96 * @param key key
97 * @param value value
99 int getSet(QString group, QString key, int value);
102 * if key=value pair not found in m_settings file, write it + read key value from m_settings file and return it.
103 * Version for double variables
104 * @param group group
105 * @param key key
106 * @param value value
108 double getSet(QString group, QString key, double value);
111 * if key=value pair not found in m_settings file, write it + read key value from m_settings file and return it.
112 * Version for bool variables
113 * @param group group
114 * @param key key
115 * @param value value
117 bool getSet(QString group, QString key, bool value);
120 * if key=value pair not found in m_settings file, write it + read key value from m_settings file and return it.
121 * Version for path variables
122 * @param group group
123 * @param key key
124 * @param value value
125 * @param type type \n
126 * type = 0 : standard string \n
127 * type = 1 : filename \n
128 * type = 2 : directory
130 QString getSet(QString group, QString key, QString value, int type);
133 #endif