Sayonara Player
Searchbar.h
1/* SearchBar.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 LIBRARYSEARCHBAR_H
22#define LIBRARYSEARCHBAR_H
23
24#include <QLineEdit>
25#include "Utils/Pimpl.h"
26#include "Utils/Library/Filter.h"
27#include "Gui/Utils/Widgets/WidgetTemplate.h"
28
29class QMenu;
30
31namespace Gui
32{
33 class ContextMenuFilter;
34}
35
36namespace Library
37{
38 class SearchBar :
39 public Gui::WidgetTemplate<QLineEdit>
40 {
41 Q_OBJECT
42 PIMPL(SearchBar)
43
45
46 signals:
47 void sigCurrentModeChanged();
48
49 public:
50 SearchBar(QWidget* parent = nullptr);
51 ~SearchBar() override;
52
53 void setModes(const QList<Filter::Mode>& modes);
54 void setCurrentMode(Filter::Mode mode);
55 Filter::Mode currentMode() const;
56
57 void setGenre(const QString& text, bool invalidGenreMode = false);
58
59 private slots:
60 void currentTextChanged(const QString& text);
61 void livesearchChanged();
62 void livesearchTriggered(bool b);
63
64 protected:
65 bool event(QEvent* event) override;
66 void keyPressEvent(QKeyEvent* keyEvent) override;
67 void languageChanged() override;
68 void skinChanged() override;
69
70 private:
71 QList<QAction*> initModeActions(const QList<Library::Filter::Mode>& modes);
72 void initContextMenu();
73 };
74}
75
76#endif // LIBRARYSEARCHBAR_H
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:87
Definition: Searchbar.h:40
Definition: EngineUtils.h:33
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31