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 
60 
61  protected:
62  virtual void init_shortcuts();
63  virtual ::Library::TrackDeletionMode show_delete_dialog(int n_tracks)=0;
64 
65  protected slots:
66  virtual void _sl_live_search_changed();
67 
68  virtual void search_esc_pressed();
69  virtual void search_return_pressed();
70  virtual void search_edited(const QString& searchstring);
71  virtual void search_mode_changed(::Library::Filter::Mode mode);
72  virtual void esc_pressed();
73  virtual void query_library();
74 
75 
76  virtual void item_delete_clicked();
77  void tracks_delete_clicked();
78  virtual void show_delete_answer(QString);
79 
80 
81  public slots:
82  virtual void id3_tags_changed();
83 
84  protected:
85 
86  virtual ::Library::TableView* lv_artist() const=0;
87  virtual ::Library::TableView* lv_album() const=0;
88  virtual ::Library::TableView* lv_tracks() const=0;
89  virtual QLineEdit* le_search() const=0;
90 
91  virtual QList<::Library::Filter::Mode> search_options() const=0;
92 
93  template<typename T, typename UI>
94  void setup_parent(T* subclass, UI** ui)
95  {
96  *ui = new UI();
97 
98  UI* ui_ptr = *ui;
99  ui_ptr->setupUi(subclass);
100 
101  init();
102  }
103  };
104 }
105 
106 #endif // GUI_ABSTRACTLIBRARY_H
TrackDeletionMode
The TrackDeletionMode enum.
Definition: LibraryNamespaces.h:35
Definition: AbstractLibrary.h:47
Definition: GUI_AbstractLibrary.h:44
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() wi...
Definition: Widget.h:38
An interface class needed when implementing a library plugin.
Definition: LibraryManager.h:36
Definition: org_mpris_media_player2_adaptor.h:20