Sayonara Player
Loading...
Searching...
No Matches
MiniSearcher.h
1/* MiniSearcher.h */
2
3/* Copyright (C) 2011-2024 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
31class SearchView;
32class QEvent;
33class QKeyEvent;
34class QFocusEvent;
35class QHideEvent;
36
37namespace Gui
38{
40 public QObject
41 {
42 Q_OBJECT
43
44 signals:
45 void sigEnterPressed();
46 void sigTabPressed();
47 void sigFocusLost();
48
49 public:
50 using QObject::QObject;
51
52 protected:
53 bool eventFilter(QObject* o, QEvent* e) override;
54 };
55
57 public Gui::WidgetTemplate<QFrame>
58 {
59 Q_OBJECT
60 PIMPL(MiniSearcher)
61
62 signals:
63 void sigTextChanged(const QString&);
64 void sigFindNextRow();
65 void sigFindPrevRow();
66
67 public:
68 explicit MiniSearcher(SearchView* searchableView);
69 ~MiniSearcher() override;
70
71 bool handleKeyPress(QKeyEvent* e);
72
73 void setNumberResults(int results);
74
75 public slots:
76 void reset();
77
78 protected:
79 void languageChanged() override;
80 void keyPressEvent(QKeyEvent* e) override;
81 void showEvent(QShowEvent* e) override;
82 void focusOutEvent(QFocusEvent* e) override;
83
84 private slots:
85 void enterPressed();
86 void tabPressed();
87 void textChanged(const QString& text);
88
89 private:
90 void resetCompleter();
91 void initConnections();
92 void previousResult();
93 void nextResult();
94 };
95}
96
97#endif // MINISEARCHER_H
Definition MiniSearcher.h:41
Definition MiniSearcher.h:58
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition WidgetTemplate.h:86
Definition SearchableView.h:35