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 #include "Utils/Pimpl.h"
26 #include "Utils/Settings/SayonaraClass.h"
27 
28 class QFrame;
29 class QAction;
30 class QPixmap;
31 class QMenu;
32 class QWidget;
33 class QComboBox;
34 class Settings;
35 
36 
43 namespace Library
44 {
45  class PluginHandler;
46 
47  class Container :
48  public QObject,
49  public SayonaraClass
50  {
51  Q_OBJECT
52  PIMPL(Container)
53 
54  friend class PluginHandler;
55 
56  private:
57  void set_initialized();
58 
59  private slots:
60  void language_changed();
61 
62  public:
63  explicit Container(QObject* parent=nullptr);
64  virtual ~Container();
65 
70  virtual QString name() const=0;
71 
76  virtual QString display_name() const;
77 
82  virtual QWidget* widget() const=0;
83 
84  virtual QFrame* header() const=0;
85 
86  virtual QPixmap icon() const=0;
87 
88 
93  virtual QMenu* menu();
94 
95 
101  void set_menu_action(QAction* action);
102 
107  QAction* menu_action() const;
108 
109 
113  virtual void init_ui()=0;
114 
119  bool is_initialized() const;
120 
121  virtual void show();
122 
123  virtual void hide();
124  };
125 }
126 
128 Q_DECLARE_INTERFACE(LibraryContainerInterface, "com.sayonara-player.library")
129 
130 #endif // LIBRARYCONTAINER_H
Definition: LibraryContainer.h:47
virtual QMenu * menu()
return actions menu (may be nullptr). The title does not have to be set
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
QAction * menu_action() const
get the action in the player menubar.
virtual QString display_name() const
Should return the translated name displayed in the library view combobox.
virtual void init_ui()=0
Should initialize the ui. The ui constructor should be called within this function.
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...
bool is_initialized() const
tests, if the ui already has been initialized
virtual QWidget * widget() const =0
Should return the UI for the library view.
The Settings class.
Definition: Settings.h:37
virtual QString name() const =0
Should return an untranslated name used for identifying this widget.
An interface class needed when implementing a library plugin.
Definition: LibraryManager.h:36
Library Plugin Manager.
Definition: LibraryPluginHandler.h:41