1 /*******************************************************************************
3 This file is part of mDictionary.
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.
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.
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/>.
18 Copyright 2010 Comarch S.A.
20 *******************************************************************************/
21 //! \file SearchBarWidget.h
22 //! \brief Implements search bar
23 //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
26 #ifndef SEARCHBARWIDGET_H
27 #define SEARCHBARWIDGET_H
31 #include "../backbone/backbone.h"
32 #include "../../includes/History.h"
34 //! Displays search bar
36 Contains line edit field to input word which user would like to find
37 and buttons to start/stop search and browse search history.
38 Line edit and history buttons are disabled when search is ongoing,
39 only start/stop button stays active. When searching it also displays
42 class SearchBarWidget : public QWidget {
45 explicit SearchBarWidget(QWidget *parent = 0);
49 //! Requests to search for list of words matching word passed as
51 void searchForTranslations(QString);
53 //! Requests to stop all active searchings
56 //! Requests to show previous translation in history
59 //! Requests to show next translation in history
62 //! Requests to show history list
65 //! Requests to refresh state of history buttons
66 void refreshHistoryButtons();
69 //! Enables or disables search word line edit and history buttons
71 While searching it disables only history button and line edit.
72 Search/Stop button is always enabled.
74 void setEnabled(bool);
77 //! Sets search bar in busy state
79 Displays "busy" bar and disables search word text edit and history buttons
83 //! Sets search bar in idle state
85 Hides "busy" bar and enables all widgets, refreshes state of history buttons
86 by emitting refreshHistoryButtons signal
90 //! Searches for given word
92 Sets word as text in search word line edit
94 void search(QString word);
96 //! Starts to search for given word after 500 ms
98 Sets word as text in search word line edit, and waits 500 ms to start
99 search. If in meanwhile this slot is called again it will stop previous
102 void searchDelay(QString word);
104 //! Updates state of history buttons
105 void updateHistoryButtons(bool prev, bool next, bool list);
108 void clearSearchWordToolButtonClicked();
109 void searchPushButtonClicked();
110 void delaySearchTimeout();
114 QLineEdit* searchWordLineEdit;
115 QToolButton* clearSearchWordToolButton;
116 QPushButton* searchPushButton;
117 QToolButton* historyPrevToolButton;
118 QToolButton* historyNextToolButton;
119 QToolButton* historyShowToolButton;
120 QToolButton* fullScreenToolButton;
121 QHBoxLayout* horizontalLayout;
122 QProgressBar* searchingProgressBar;
124 QIcon generateIcon(QIcon oryginal, qreal rotation=0);
126 QVBoxLayout* verticalLayout;
136 #endif // SEARCHBARWIDGET_H