added package building directories
[mdictionary] / trunk / src / base / gui / SearchBarWidget.h
1 /*******************************************************************************
2
3     This file is part of mDictionary.
4
5     mDictionary is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9
10     mDictionary is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
17
18     Copyright 2010 Comarch S.A.
19
20 *******************************************************************************/
21
22 //Created by Mateusz Półrola
23
24
25 #ifndef SEARCHBARWIDGET_H
26 #define SEARCHBARWIDGET_H
27
28 #include <QWidget>
29 #include <QtGui>
30
31
32 //! Displays search bar
33 /*!
34     Contains line edit field to input word which user would to find, and buttons
35     to browse search history.
36 */
37 class SearchBarWidget : public QWidget {
38     Q_OBJECT
39 public:
40     explicit SearchBarWidget(QWidget *parent = 0);
41     ~SearchBarWidget();
42
43     //! Returns searching status
44     /*! If backbone is still searching returns true */
45     bool isSearching() const;
46
47 Q_SIGNALS:
48     //! Requests to search for translation of word passed as parameter
49     void searchForTranslations(QString);
50
51     //! Request to stop all active searchings
52     void stopSearching();
53
54 public Q_SLOTS:
55     //! Enable or disable search word line edit and history buttons
56     /*!
57       While searching it disables only history button and line edit.
58       Search/Stop button is always enabled
59     */
60     void setEnabled(bool);
61
62 private Q_SLOTS:
63     void clearSearchWordToolButtonClicked();
64     void searchPushButtonClicked();
65     void historyPrevToolButtonClicked();
66     void historyNextToolButtonClicked();
67     void historyShowToolButtonClicked();
68
69 private:
70     QLineEdit* searchWordLineEdit;
71     QToolButton* clearSearchWordToolButton;
72     QPushButton* searchPushButton;
73     QToolButton* historyPrevToolButton;
74     QToolButton* historyNextToolButton;
75     QToolButton* historyShowToolButton;
76     QHBoxLayout* horizontalLayout;
77     QProgressBar* searchingProgressBar;
78
79     QVBoxLayout* verticalLayout;
80
81     bool _isSearching;
82
83     void initializeUI();
84     void showHistoryListDialog();
85 };
86
87 #endif // SEARCHBARWIDGET_H