Sayonara Player
LibrarySearchBar.h
1 /* LibrarySearchBar.h */
2 
3 /* Copyright (C) 2011-2019 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 
22 
23 #ifndef LIBRARYSEARCHBAR_H
24 #define LIBRARYSEARCHBAR_H
25 
26 #include <QLineEdit>
27 #include "Utils/Pimpl.h"
28 #include "Utils/Library/Filter.h"
29 #include "Gui/Utils/Widgets/WidgetTemplate.h"
30 
31 namespace Library
32 {
33  class SearchBar : public Gui::WidgetTemplate<QLineEdit>
34  {
35  Q_OBJECT
36  PIMPL(SearchBar)
37 
39 
40  signals:
41  void sig_current_mode_changed();
42  void sig_text_changed(const QString& text);
43 
44  public:
45  SearchBar(QWidget* parent=nullptr);
46  ~SearchBar() override;
47 
48  void set_invalid_genre_mode(bool b);
49  bool has_invalid_genre_mode() const;
50 
51  void set_modes(const QList<Filter::Mode>& modes);
52  QList<Filter::Mode> modes() const;
53 
54  void set_current_mode(Filter::Mode mode);
55  void set_next_mode();
56  Filter::Mode current_mode() const;
57 
58  protected:
59  void init_context_menu();
60  void keyPressEvent(QKeyEvent* e) override;
61  void language_changed() override;
62  void skin_changed() override;
63 
64  private slots:
65  void text_changed(const QString& text);
66  void search_shortcut_pressed();
67 
68  void livesearch_changed();
69  void livesearch_triggered(bool b);
70  };
71 }
72 
73 #endif // LIBRARYSEARCHBAR_H
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings...
Definition: WidgetTemplate.h:76
Definition: LibrarySearchBar.h:33
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:29
Definition: org_mpris_media_player2_adaptor.h:20