Sayonara Player
GUI_AbstractLibrary.h
1 /* GUI_AbstractLibrary.h */
2 
3 /* Copyright (C) 2011-2017 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 GUI_ABSTRACTLIBRARY_H
22 #define GUI_ABSTRACTLIBRARY_H
23 
24 #include "GUI/Utils/Delegates/ComboBoxDelegate.h"
25 #include "GUI/Utils/Widgets/Widget.h"
26 
27 #include "Utils/Library/Filter.h"
28 #include "Utils/Library/Sorting.h"
29 #include "Utils/Library/LibraryNamespaces.h"
30 #include "Utils/MetaData/MetaDataFwd.h"
31 #include "Utils/Pimpl.h"
32 
33 #include <QList>
34 
35 class QPushButton;
36 class QComboBox;
37 
38 class AbstractLibrary;
39 
40 namespace Library
41 {
42  class TableView;
43 
45  public Gui::Widget
46  {
47  Q_OBJECT
48  PIMPL(GUI_AbstractLibrary)
49 
50  public:
51  explicit GUI_AbstractLibrary(AbstractLibrary* library,
52  QWidget *parent=nullptr);
53 
54  virtual ~GUI_AbstractLibrary();
55 
56  private:
57  virtual void init();
58  virtual void init_search_bar();
59  virtual void init_search_context_menu();
60 
61  protected:
62  virtual void language_changed() override;
63  virtual void init_shortcuts();
64 
65  virtual TrackDeletionMode show_delete_dialog(int n_tracks)=0;
66 
67  protected slots:
68  virtual void _sl_live_search_changed();
69 
70  virtual void clear_selections();
71  virtual void search_key_pressed(int key);
72  virtual void search_return_pressed();
73  virtual void search_edited(const QString& searchstring);
74  virtual void search_mode_changed(Filter::Mode mode);
75  virtual void key_pressed(int key);
76  virtual void query_library();
77 
78  virtual void item_delete_clicked();
79  void tracks_delete_clicked();
80  virtual void show_delete_answer(QString);
81 
82 
83  public slots:
84  virtual void id3_tags_changed();
85 
86 
87  protected:
88  virtual TableView* lv_artist() const=0;
89  virtual TableView* lv_album() const=0;
90  virtual TableView* lv_tracks() const=0;
91  virtual QLineEdit* le_search() const=0;
92 
93  virtual QList<Filter::Mode> search_options() const=0;
94 
95  template<typename T, typename UI>
96  void setup_parent(T* subclass, UI** ui)
97  {
98  *ui = new UI();
99 
100  UI* ui_ptr = *ui;
101  ui_ptr->setupUi(subclass);
102 
103  init();
104  }
105  };
106 }
107 
108 #endif // GUI_ABSTRACTLIBRARY_H
TrackDeletionMode
The TrackDeletionMode enum.
Definition: LibraryNamespaces.h:35
Definition: AbstractLibrary.h:47
Definition: GUI_AbstractLibrary.h:44
Definition: TableView.h:32
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() \nT...
Definition: Widget.h:38
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:31
Definition: org_mpris_media_player2_adaptor.h:20