BibleTime
btsearchoptionsarea.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 <QWidget>
16 
17 #include "../../backend/cswordmodulesearch.h"
18 #include "../../backend/drivers/btmodulelist.h"
19 #include "chistorycombobox.h"
20 
21 
22 class QComboBox;
23 class QEvent;
24 class QGridLayout;
25 class QGroupBox;
26 class QHBoxLayout;
27 class QLabel;
28 class QObject;
29 class QPushButton;
30 class QRadioButton;
31 
32 namespace Search {
33 
34 class BtSearchOptionsArea : public QWidget {
35  Q_OBJECT
36  public:
37 
38  BtSearchOptionsArea(QWidget *parent = nullptr);
39  ~BtSearchOptionsArea() override;
40  /*
41  * Add text to search combox box history
42  */
43  void addToHistory(const QString& text);
44  /**
45  * Sets the search text used in the page.
46  */
47  void setSearchText(const QString& text);
48  /**
49  * Returns the search text set in this page.
50  */
51  QString searchText() const;
52 
54 
55  /**
56  Returns the list of used modules.
57  */
58  BtConstModuleList const & modules() const { return m_modules; }
59 
60  /**
61  * Sets all options back to the default.
62  */
63  void reset();
64  /**
65  * Returns the selected search scope if a search scope was selected.
66  */
67  sword::ListKey searchScope();
68 
69  /**
70  * Opens the modules chooser dialog.
71  */
72  void chooseModules();
73 
74  /**
75  Sets the modules used by the search.
76  */
78 
79  private: // methods:
80  /**
81  * Initializes this page.
82  */
83  void initView();
84  void initConnections();
85  /**
86  * Reads the settings of the last searchdialog session.
87  */
88  void readSettings();
89  /**
90  * Reads the settings for the searchdialog from disk.
91  */
92  void saveSettings();
93  bool eventFilter(QObject* obj, QEvent* event) override;
94 
95  /**
96  * Refreshes the list of ranges and the range combobox.
97  */
98  void refreshRanges();
99 
100  /**
101  Get unique works list from the Works combobox
102  */
103  QStringList getUniqueWorksList();
104 
105  protected Q_SLOTS:
106 
107  /// \todo Implement validation
108  #if 0
109  void slotValidateText(const QString& newText);
110  #endif
111 
112  Q_SIGNALS:
114 
115  private:
117 
118  QHBoxLayout *hboxLayout;
119  QGroupBox *searchGroupBox;
120  QGridLayout *gridLayout;
122  QPushButton* m_searchButton;
123  QLabel* m_helpLabel;
124  QRadioButton* m_typeAndButton;
125  QRadioButton* m_typeOrButton;
126  QRadioButton* m_typeFreeButton;
127  QPushButton *m_chooseModulesButton;
128  QPushButton *m_chooseRangeButton;
132  QLabel *m_modulesLabel;
134 
135 };
136 
137 }
QList< CSwordModuleInfo const * > BtConstModuleList
Definition: btmodulelist.h:21
CHistoryComboBox * m_searchTextCombo
void setSearchText(const QString &text)
BtSearchOptionsArea(QWidget *parent=nullptr)
BtConstModuleList const & modules() const
bool eventFilter(QObject *obj, QEvent *event) override
void setModules(const BtConstModuleList &modules)
CSwordModuleSearch::SearchType searchType()
void addToHistory(const QString &text)