Sayonara Player
LibraryContainer.h
1 /* LibraryContainer.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 LIBRARYCONTAINER_H
22 #define LIBRARYCONTAINER_H
23 
24 #include <QObject>
25 
26 class QAction;
27 class QIcon;
28 class QMenu;
29 class QWidget;
30 class QComboBox;
31 class Settings;
33 
41  public QObject
42 {
43  Q_OBJECT
44 
45  friend class LibraryPluginHandler;
46 
47 private:
48  bool _initialized;
49  QAction* _action=nullptr;
50  Settings* _settings=nullptr;
51 
55  void set_initialized();
56 
57 private slots:
58  void language_changed();
59 
60 public:
61  explicit LibraryContainerInterface(QObject* parent=nullptr);
62  virtual ~LibraryContainerInterface();
63 
68  virtual QIcon get_icon() const=0;
69 
70 
75  virtual QString get_name() const=0;
76 
81  virtual QString get_display_name() const=0;
82 
87  virtual QWidget* get_ui() const=0;
88 
93  virtual QComboBox* get_libchooser()=0;
94 
95 
100  virtual QMenu* get_menu();
101 
102 
108  void set_menu_action(QAction* action);
109 
114  QAction* get_menu_action() const;
115 
116 
120  virtual void init_ui()=0;
121 
122 
127  bool is_initialized() const;
128 };
129 
130 Q_DECLARE_INTERFACE(LibraryContainerInterface, "com.sayonara-player.library")
131 
132 #endif // LIBRARYCONTAINER_H
virtual QWidget * get_ui() const =0
Should return the UI for the library view.
Library Plugin Manager.
Definition: LibraryPluginHandler.h:35
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:40
The Settings class.
Definition: Settings.h:34
virtual QMenu * get_menu()
return actions menu (may be nullptr). The title does not have to be set
virtual QIcon get_icon() const =0
Should return the icon displayed in the library view combobox.
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
void set_menu_action(QAction *action)
sets the action member field used in the player menu bar. This is called by the player if the languag...
QAction * get_menu_action() const
get the action in the player menubar.
virtual QString get_display_name() const =0
Should return the translated name displayed in the library view combobox.