]> cloud.milkyroute.net Git - dolphin.git/blob - src/filterbar/filterbar.h
Modernize: Use override where possible
[dolphin.git] / src / filterbar / filterbar.h
1 /***************************************************************************
2 * Copyright (C) 2006-2010 by Peter Penz <peter.penz19@gmail.com> *
3 * Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
4 * Copyright (C) 2012 by Stuart Citrin <ctrn3e8@gmail.com> *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21
22 #ifndef FILTERBAR_H
23 #define FILTERBAR_H
24
25 #include <QWidget>
26
27 class QLineEdit;
28 class QToolButton;
29
30 /**
31 * @brief Provides an input field for filtering the currently shown items.
32 *
33 * @author Gregor Kališnik <gregor@podnapisi.net>
34 */
35 class FilterBar : public QWidget
36 {
37 Q_OBJECT
38
39 public:
40 explicit FilterBar(QWidget* parent = 0);
41 ~FilterBar() override;
42
43 /** Called by view container to hide this **/
44 void closeFilterBar();
45
46 /**
47 * Selects the whole text of the filter bar.
48 */
49 void selectAll();
50
51 public slots:
52 /** Clears the input field. */
53 void clear();
54 /** Clears the input field if the "lock button" is disabled. */
55 void slotUrlChanged();
56 /** The input field is cleared also if the "lock button" is released. */
57 void slotToggleLockButton(bool checked);
58
59 signals:
60 /**
61 * Signal that reports the name filter has been
62 * changed to \a nameFilter.
63 */
64 void filterChanged(const QString& nameFilter);
65
66 /**
67 * Emitted as soon as the filterbar should get closed.
68 */
69 void closeRequest();
70
71 /*
72 * Emitted as soon as the focus should be returned back to the view.
73 */
74 void focusViewRequest();
75
76 protected:
77 void showEvent(QShowEvent* event) override;
78 void keyReleaseEvent(QKeyEvent* event) override;
79
80 private:
81 QLineEdit* m_filterInput;
82 QToolButton* m_lockButton;
83 };
84
85 #endif