Sayonara Player
GUI_AbstractLibrary.h
1 /* GUI_AbstractLibrary.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 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 
46  public Gui::Widget
47  {
48  Q_OBJECT
49  PIMPL(GUI_AbstractLibrary)
50 
51  public:
52  explicit GUI_AbstractLibrary(AbstractLibrary* library,
53  QWidget* parent=nullptr);
54 
55  virtual ~GUI_AbstractLibrary() override;
56 
57  private:
58  virtual void init();
59  virtual void initSearchBar();
60 
61  protected:
62  virtual void languageChanged() override;
63  virtual void initShortcuts();
64  virtual bool hasSelections() const;
65 
66  virtual TrackDeletionMode showDeleteDialog(int n_tracks)=0;
67 
68  protected slots:
69  virtual void liveSearchChanged();
70 
71  virtual void clearSelections();
72  virtual void searchTriggered();
73  virtual void searchEdited(const QString& searchstring);
74  virtual void keyPressed(int key);
75  virtual void queryLibrary();
76 
77  virtual void itemDeleteClicked();
78  virtual void showDeleteAnswer(const QString& text);
79 
80  void tracksDeleteClicked();
81 
82  protected:
83  virtual TableView* lvArtist() const=0;
84  virtual TableView* lvAlbum() const=0;
85  virtual TableView* lvTracks() const=0;
86  virtual SearchBar* leSearch() const=0;
87 
88  virtual QList<Filter::Mode> searchOptions() const=0;
89 
90  template<typename T, typename UI>
91  void setupParent(T* subclass, UI** ui)
92  {
93  *ui = new UI();
94 
95  UI* uiPtr = *ui;
96  uiPtr->setupUi(subclass);
97 
98  init();
99  }
100  };
101 }
102 
103 #endif // GUI_ABSTRACTLIBRARY_H
Library::GUI_AbstractLibrary
The GUI_AbstractLibrary class.
Definition: GUI_AbstractLibrary.h:47
Library::TableView
The TableView class.
Definition: TableView.h:38
Gui::Widget
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() \nT...
Definition: Widget.h:39
QList
Definition: EngineUtils.h:33
AbstractLibrary
Definition: AbstractLibrary.h:43
Library
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31
Library::TrackDeletionMode
TrackDeletionMode
The TrackDeletionMode enum.
Definition: LibraryNamespaces.h:37
Library::SearchBar
The searchbar has a special context menu which allows to select the search mode. A special search mod...
Definition: Searchbar.h:39