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/Pimpl.h"
31 
32 class QPushButton;
33 class QComboBox;
34 class AbstractLibrary;
35 
36 namespace Library
37 {
38  class TableView;
39  class SearchBar;
40 
42  public Gui::Widget
43  {
44  Q_OBJECT
45  PIMPL(GUI_AbstractLibrary)
46 
47  public:
48  explicit GUI_AbstractLibrary(AbstractLibrary* library,
49  QWidget *parent=nullptr);
50 
51  virtual ~GUI_AbstractLibrary();
52 
53  private:
54  virtual void init();
55  virtual void init_search_bar();
56 
57  protected:
58  virtual void language_changed() override;
59  virtual void init_shortcuts();
60 
61  virtual TrackDeletionMode show_delete_dialog(int n_tracks)=0;
62 
63  protected slots:
64  virtual void live_search_changed();
65 
66  virtual void clear_selections();
67  virtual void search_return_pressed();
68  virtual void search_edited(const QString& searchstring);
69  virtual void key_pressed(int key);
70  virtual void query_library();
71 
72  virtual void item_delete_clicked();
73  virtual void show_delete_answer(QString);
74  virtual void id3_tags_changed();
75 
76  void tracks_delete_clicked();
77 
78  protected:
79  virtual TableView* lv_artist() const=0;
80  virtual TableView* lv_album() const=0;
81  virtual TableView* lv_tracks() const=0;
82  virtual SearchBar* le_search() const=0;
83 
84  virtual QList<Filter::Mode> search_options() const=0;
85 
86  template<typename T, typename UI>
87  void setup_parent(T* subclass, UI** ui)
88  {
89  *ui = new UI();
90 
91  UI* ui_ptr = *ui;
92  ui_ptr->setupUi(subclass);
93 
94  init();
95  }
96  };
97 }
98 
99 #endif // GUI_ABSTRACTLIBRARY_H
TrackDeletionMode
The TrackDeletionMode enum.
Definition: LibraryNamespaces.h:35
Definition: AbstractLibrary.h:39
Definition: GUI_AbstractLibrary.h:41
Definition: TableView.h:32
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() wi...
Definition: Widget.h:38
Definition: LibrarySearchBar.h:11
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:29
Definition: org_mpris_media_player2_adaptor.h:20