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