Sayonara Player
LibraryContainer.h
1 /* LibraryContainer.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef LIBRARYCONTAINER_H
24 #define LIBRARYCONTAINER_H
25 
26 #include <QIcon>
27 #include <QWidget>
28 #include <QComboBox>
29 
30 #include <QList>
31 #include <QAction>
32 
33 class Settings;
35 
43  public QObject
44 {
45  Q_OBJECT
46 
47  friend class LibraryPluginHandler;
48 
49 private:
50  bool _initialized;
51  QAction* _action=nullptr;
52  Settings* _settings=nullptr;
53 
57  void set_initialized();
58 
59 private slots:
60  void language_changed();
61 
62 public:
63 
64  explicit LibraryContainerInterface(QObject* parent=nullptr);
65  virtual ~LibraryContainerInterface();
66 
71  virtual QIcon get_icon() const=0;
72 
73 
78  virtual QString get_name() const=0;
79 
84  virtual QString get_display_name() const=0;
85 
90  virtual QWidget* get_ui() const=0;
91 
96  virtual QComboBox* get_libchooser()=0;
97 
98 
103  virtual QMenu* get_menu();
104 
105 
106 
107  void set_menu_action(QAction* action);
108 
109  QAction* get_menu_action() const;
110 
111 
112 
113 
114 
118  virtual void init_ui()=0;
119 
120 
125  bool is_initialized() const;
126 
127 };
128 
129 
130 Q_DECLARE_INTERFACE(LibraryContainerInterface, "com.sayonara-player.library")
131 
132 #endif // LIBRARYCONTAINER_H
virtual QString get_name() const =0
Should return an untranslated name used for identifying this widget.
bool is_initialized() const
tests, if the ui already has been initialized
Library Plugin Manager.
Definition: LibraryPluginHandler.h:38
virtual void init_ui()=0
Should initialize the ui. The ui constructor should be called within this function.
virtual QComboBox * get_libchooser()=0
Should return the library chooser combo box.
An interface class needed when implementing a library plugin.
Definition: LibraryContainer.h:42
The Settings class.
Definition: Settings.h:31
virtual QString get_display_name() const =0
Should return the translated name displayed in the library view combobox.
virtual QMenu * get_menu()
return actions menu (may be nullptr). The title does not have to be set
virtual QWidget * get_ui() const =0
Should return the UI for the library view.
virtual QIcon get_icon() const =0
Should return the icon displayed in the library view combobox.