Merge branch 'master' into gui
[mdictionary] / trunk / src / base / mDictionary / 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 Q_SIGNALS:
44     void searchForTranslations(QString);
45     void stopSearching();
46
47 public Q_SLOTS:
48     //! Enable or disable search word line edit and history buttons
49     /*!
50       While searching it disables only history button and line edit.
51       Search/Stop button is always enabled
52     */
53     void setEnabled(bool);
54
55 private Q_SLOTS:
56     void clearSearchWordToolButtonClicked();
57     void searchPushButtonClicked();
58     void historyPrevToolButtonClicked();
59     void historyNextToolButtonClicked();
60     void historyShowToolButtonClicked();
61
62 private:
63     QLineEdit* searchWordLineEdit;
64     QToolButton* clearSearchWordToolButton;
65     QPushButton* searchPushButton;
66     QToolButton* historyPrevToolButton;
67     QToolButton* historyNextToolButton;
68     QToolButton* historyShowToolButton;
69     QHBoxLayout* horizontalLayout;
70     QProgressBar* searchingProgressBar;
71
72     QVBoxLayout* verticalLayout;
73
74     bool isSearching;
75
76     void initializeUI();
77     void showHistoryListDialog();
78 };
79
80 #endif // SEARCHBARWIDGET_H