Sayonara Player
MiniSearcher.h
1/* MiniSearcher.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef MINISEARCHER_H
22#define MINISEARCHER_H
23
24#include "Utils/Pimpl.h"
25#include "Gui/Utils/Widgets/WidgetTemplate.h"
26
27#include <QObject>
28#include <QFrame>
29#include <QMap>
30
32class QEvent;
33class QKeyEvent;
34class QFocusEvent;
35class QHideEvent;
36
37namespace Gui
38{
44 public QObject
45 {
46 Q_OBJECT
47
48 signals:
49 void sigTabPressed();
50 void sigFocusLost();
51
52 public:
53 using QObject::QObject;
54
55 protected:
56 bool eventFilter(QObject* o, QEvent* e) override;
57 };
58
59
61 public Gui::WidgetTemplate<QFrame>
62 {
63 Q_OBJECT
64 PIMPL(MiniSearcher)
65
66 signals:
67 void sigReset();
68 void sigTextChanged(const QString&);
69 void sigFindNextRow();
70 void sigFindPrevRow();
71
72 public:
74 ~MiniSearcher() override;
75
76 bool handleKeyPress(QKeyEvent* e);
77 void setExtraTriggers(const QMap<QChar, QString>& triggers);
78 QString currentText();
79 void setNumberResults(int results);
80
81 public slots:
82 void reset();
83
84 private slots:
85 void previousResult();
86 void nextResult();
87
88 private:
89 bool isInitiator(QKeyEvent* event) const;
90 void init(const QString& text);
91 bool checkAndInit(QKeyEvent* event);
92 QRect calcGeometry() const;
93
94 protected:
95 void languageChanged() override;
96
97 void keyPressEvent(QKeyEvent* e) override;
98 void showEvent(QShowEvent* e) override;
99 void hideEvent(QHideEvent* e) override;
100 void focusOutEvent(QFocusEvent* e) override;
101 };
102}
103
104#endif // MINISEARCHER_H
Emits signals if tab was pressed or focus was lost.
Definition: MiniSearcher.h:45
Definition: MiniSearcher.h:62
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:87
Definition: LanguageUtils.h:31
The SearchViewInterface class.
Definition: SearchableView.h:70