/********* * * In the name of the Father, and of the Son, and of the Holy Spirit. * * This file is part of BibleTime's source code, http://www.bibletime.info/. * * Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ #ifndef BTSEARCHOPTIONSAREA_H #define BTSEARCHOPTIONSAREA_H #include #include "backend/keys/cswordversekey.h" #include "frontend/searchdialog/chistorycombobox.h" class CSwordModuleInfo; class QComboBox; class QEvent; class QGridLayout; class QGroupBox; class QHBoxLayout; class QLabel; class QObject; class QPushButton; class QRadioButton; namespace Search { class BtSearchOptionsArea : public QWidget { Q_OBJECT public: enum SearchType { /* Values provided for serialization */ AndType = 0, OrType = 1, FullType = 2 }; BtSearchOptionsArea(QWidget *parent = 0); ~BtSearchOptionsArea(); /* * Add text to search combox box history */ void addToHistory(const QString& text); /** * Sets the search text used in the page. */ void setSearchText(const QString& text); /** * Returns the search text set in this page. */ QString searchText() const; SearchType searchType(); inline QPushButton * searchButton() const { return m_searchButton; } /** Returns the list of used modules. */ inline QList modules() const { return m_modules; } /** * Sets all options back to the default. */ void reset(); /** * Returns the selected search scope if a search scope was selected. */ sword::ListKey searchScope(); bool hasSearchScope(); protected: /** * Initializes this page. */ void initView(); void initConnections(); /** * Reads the settings of the last searchdialog session. */ void readSettings(); /** * Reads the settings for the searchdialog from disk. */ void saveSettings(); bool eventFilter(QObject* obj, QEvent* event); public slots: /** Sets the modules used by the search. */ void setModules(const QList &modules); /** Sets the modules when user selects them from the combobox.*/ void moduleListTextSelected(int index); /** * Reimplementation. */ void aboutToShow(); /** * Refreshes the list of ranges and the range combobox. */ void refreshRanges(); /** * Opens the modules chooser dialog. */ void chooseModules(); protected slots: void setupRanges(); void syntaxHelp(); void slotSearchTextEditReturnPressed(); void slotValidateText(const QString& newText); signals: void sigSetSearchButtonStatus(bool); void sigStartSearch(); private: QList m_modules; QHBoxLayout *hboxLayout; QGroupBox *searchGroupBox; QGridLayout *gridLayout; QLabel *m_searchTextLabel; QPushButton* m_searchButton; QLabel* m_helpLabel; QRadioButton* m_typeAndButton; QRadioButton* m_typeOrButton; QRadioButton* m_typeFreeButton; QPushButton *m_chooseModulesButton; QPushButton *m_chooseRangeButton; QLabel *m_searchScopeLabel; QComboBox *m_rangeChooserCombo; CHistoryComboBox *m_searchTextCombo; QLabel *m_modulesLabel; QComboBox* m_modulesCombo; }; } QDataStream &operator<<(QDataStream &out, const Search::BtSearchOptionsArea::SearchType &searchType); QDataStream &operator>>(QDataStream &in, Search::BtSearchOptionsArea::SearchType &searchType); Q_DECLARE_METATYPE(Search::BtSearchOptionsArea::SearchType) #endif