BibleTime
crangechooserdialog.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 <QListWidgetItem>
18#include <QObject>
19#include <QString>
20#include <QStringList>
21
22
23class QDialogButtonBox;
24class QLabel;
25class QLineEdit;
26class QPushButton;
27class QTextEdit;
28class QWidget;
29
30namespace Search {
31
32/** \todo Redesign this dialog and rename to have a Bt prefix. */
34
35 Q_OBJECT
36
37private: // types:
38
39 class RangeItem: public QListWidgetItem {
40
41 public:
42
43 RangeItem(QString const & caption,
44 QString const & range = QString(),
45 QListWidget * parent = nullptr)
46 : QListWidgetItem(caption, parent)
47 , m_range(range) {}
48
49 QString caption() const { return text(); }
50 void setCaption(QString const & caption) { setText(caption); }
51 QString const & range() const { return m_range; }
52 void setRange(QString const & range) { m_range = range; }
53
54 private: // fields:
55
56 QString m_range;
57
58 }; /* class RangeItem */
59
60public: // methods:
61
62 CRangeChooserDialog(const QStringList& rangeScopeModule, QWidget *parentDialog = nullptr);
63
64 void accept() override;
65
66private: // methods:
67
68 /**
69 Initializes widgets.
70 */
71 void initView();
72
73 /**
74 Initializes connections.
75 */
76 void initConnections();
77
78 void retranslateUi();
79
80 /**
81 Stores the values from the current edit view to the given RangeItem.
82 \param[out] i The RangeItem object to store the values to.
83 */
85
86 /**
87 Resets the editing controls based on whether a range is selected in the
88 range list.
89 */
90 void resetEditControls();
91
92private Q_SLOTS:
93
94 /**
95 Called when m_nameEdit changes.
96 */
97 void nameEditTextChanged(const QString &newText);
98
99private:
100
102 QListWidget *m_rangeList;
103
106
109
111 QListWidget *m_resultList;
112
113 QPushButton *m_newRangeButton;
115
116 QDialogButtonBox *m_buttonBox;
117
118 QStringList m_scopeModules;
119
120}; /* class CRangeChooserDialog */
121
122} /* namespace Search */
void setCaption(QString const &caption)
RangeItem(QString const &caption, QString const &range=QString(), QListWidget *parent=nullptr)
void nameEditTextChanged(const QString &newText)