Doomseeker
Wadseeker
Download
Tracker
Git
Docs
Main Page
Plugin API
Related Pages
Modules
Classes
Files
File List
File Members
src
core
gui
configuration
configurationdialog.h
1
//------------------------------------------------------------------------------
2
// configurationdialog.h
3
//------------------------------------------------------------------------------
4
//
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2.1 of the License, or (at your option) any later version.
9
//
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
// 02110-1301 USA
19
//
20
//------------------------------------------------------------------------------
21
// Copyright (C) 2009 "Zalewa" <zalewapl@gmail.com>
22
//------------------------------------------------------------------------------
23
#ifndef __CONFIGUREDIALOG_H_
24
#define __CONFIGUREDIALOG_H_
25
26
#include "dptr.h"
27
#include "gui/configuration/configpage.h"
28
29
#include <QDialog>
30
31
class
QAbstractButton;
32
class
QModelIndex;
33
class
QStandardItem;
34
class
QTreeView;
35
36
class
ConfigurationDialog
:
public
QDialog
37
{
38
Q_OBJECT
39
40
public
:
41
ConfigurationDialog
(QWidget *parent =
nullptr
);
42
~
ConfigurationDialog
()
override
;
43
59
virtual
QStandardItem *
addConfigPage
(QStandardItem *rootItem,
ConfigPage
*configPage,
int
position = -1);
60
79
QStandardItem *
addLabel
(QStandardItem *rootItem,
const
QString &label,
int
position = -1);
80
81
public
slots:
82
void
reject()
override
;
83
84
protected
:
85
virtual
void
doSaveSettings() {}
86
void
keyPressEvent(QKeyEvent *e)
override
;
87
92
QTreeView *
optionsTree
();
93
97
void
showConfigPage
(
ConfigPage
*widget);
98
99
virtual
bool
validate()
100
{
101
return
true
;
102
}
103
104
private
:
105
DPtr<ConfigurationDialog>
d;
106
107
bool
canConfigPageBeAdded(
ConfigPage
*configPage);
108
bool
isConfigPageValid(
ConfigPage
*configPage);
109
bool
hasConfigPage(
ConfigPage
*configPage);
110
bool
hasItemOnList(QStandardItem *pItem)
const
;
111
QModelIndex findPageModelIndex(
ConfigPage
*page);
112
void
saveSettings();
113
void
validatePage(
ConfigPage
*page);
114
115
private
slots:
116
void
btnClicked(QAbstractButton *button);
117
void
onPageValidationRequested();
118
void
switchToItem(
const
QModelIndex ¤t,
const
QModelIndex &previous);
119
};
120
121
#endif
ConfigurationDialog::optionsTree
QTreeView * optionsTree()
Returns pointer to the tree widget that contains configuration sections list.
Definition:
configurationdialog.cpp:301
ConfigurationDialog
Definition:
configurationdialog.h:36
ConfigurationDialog::addConfigPage
virtual QStandardItem * addConfigPage(QStandardItem *rootItem, ConfigPage *configPage, int position=-1)
Adds a new configuration page to the options tree view.
Definition:
configurationdialog.cpp:120
ConfigurationDialog::addLabel
QStandardItem * addLabel(QStandardItem *rootItem, const QString &label, int position=-1)
Adds a label node to the options tree view.
Definition:
configurationdialog.cpp:161
DPtr< ConfigurationDialog >
ConfigPage
Base class for configuration pages.
Definition:
configpage.h:44
ConfigurationDialog::showConfigPage
void showConfigPage(ConfigPage *widget)
Definition:
configurationdialog.cpp:325
Doomseeker © 2009-2024 The Doomseeker Team