BibleTime
src
frontend
settingsdialogs
btconfigdialog.h
Go to the documentation of this file.
1
/*********
2
*
3
* In the name of the Father, and of the Son, and of the Holy Spirit.
4
*
5
* This file is part of BibleTime's source code, https://bibletime.info/
6
*
7
* Copyright 1999-2021 by the BibleTime developers.
8
* The BibleTime source code is licensed under the GNU General Public License
9
* version 2.0.
10
*
11
**********/
12
13
#pragma once
14
15
#include <QDialog>
16
17
#include <QIcon>
18
#include <QObject>
19
#include <QString>
20
#include <QWidget>
21
#include <Qt>
22
23
24
class
QListWidget;
25
class
QListWidgetItem
;
26
class
QStackedWidget;
27
28
/**
29
* Base class for configuration dialogs. A dialog which has a page chooser (icons
30
* + text) at the left, widget pages and a buttonbox.
31
*
32
* Usage: add BtConfigPage pages with addPage(), add a button box with addButtonBox().
33
* Connect the button box signals. Use setAttribute(Qt::WA_DeleteOnClose) if you want
34
* an auto-destroying window.
35
*/
36
class
BtConfigDialog
:
public
QDialog
{
37
38
Q_OBJECT
39
40
public
:
// types:
41
42
/** Base class for configuration dialog pages. */
43
class
Page
:
public
QWidget
{
44
45
friend
class
BtConfigDialog
;
46
47
public
:
// methods:
48
49
Page
(QIcon
const
& icon,
QWidget
*
const
parent =
nullptr
);
50
~Page
() noexcept override;
51
52
void
setHeaderText
(QString const & headerText);
53
54
virtual
void
save
() const = 0;
55
56
private:
// fields:
57
58
QListWidgetItem
* const
m_listWidgetItem
;
59
bool
m_ownsListWidgetItem
= true;
60
61
};
62
63
public:
// methods:
64
65
BtConfigDialog
(
QWidget
* const parent =
nullptr
,
66
Qt::WindowFlags const flags = Qt::WindowFlags());
67
68
/**
69
\brief Adds the page to this dialog, taking ownership.
70
\param[in] page pointer to the page to add.
71
*/
72
void
addPage
(
Page
* const pageWidget);
73
74
void
save
();
75
76
Q_SIGNALS:
77
78
void
signalSettingsChanged
();
79
80
private:
// fields:
81
82
QListWidget * const
m_contentsList
;
83
QStackedWidget * const
m_pageWidget
;
84
int
m_maxItemWidth
= 0;
85
86
};
BtConfigDialog::Page
Definition:
btconfigdialog.h:43
BtConfigDialog::Page::m_ownsListWidgetItem
bool m_ownsListWidgetItem
Definition:
btconfigdialog.h:59
BtConfigDialog::Page::setHeaderText
void setHeaderText(QString const &headerText)
Definition:
btconfigdialog.cpp:61
BtConfigDialog::Page::save
virtual void save() const =0
BtConfigDialog::Page::m_listWidgetItem
QListWidgetItem *const m_listWidgetItem
Definition:
btconfigdialog.h:58
BtConfigDialog::Page::Page
Page(QIcon const &icon, QWidget *const parent=nullptr)
Definition:
btconfigdialog.cpp:42
BtConfigDialog::Page::~Page
~Page() noexcept override
Definition:
btconfigdialog.cpp:56
BtConfigDialog
Definition:
btconfigdialog.h:36
BtConfigDialog::addPage
void addPage(Page *const pageWidget)
Adds the page to this dialog, taking ownership.
Definition:
btconfigdialog.cpp:116
BtConfigDialog::m_contentsList
QListWidget *const m_contentsList
Definition:
btconfigdialog.h:82
BtConfigDialog::m_maxItemWidth
int m_maxItemWidth
Definition:
btconfigdialog.h:84
BtConfigDialog::m_pageWidget
QStackedWidget *const m_pageWidget
Definition:
btconfigdialog.h:83
BtConfigDialog::signalSettingsChanged
void signalSettingsChanged()
QDialog
QListWidgetItem
QWidget
Generated by
1.9.1