BibleTime
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-2025 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
24class QListWidget;
25class QListWidgetItem;
26class 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*/
36class BtConfigDialog : public QDialog {
37
38 Q_OBJECT
39
40public: // 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
60
61 };
62
63public: // 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
76Q_SIGNALS:
77
79
80private: // fields:
81
82 QListWidget * const m_contentsList;
83 QStackedWidget * const m_pageWidget;
85
86};
void setHeaderText(QString const &headerText)
virtual void save() const =0
QListWidgetItem *const m_listWidgetItem
~Page() noexcept override
void addPage(Page *const pageWidget)
Adds the page to this dialog, taking ownership.
QListWidget *const m_contentsList
QStackedWidget *const m_pageWidget
void signalSettingsChanged()