Sayonara Player
LibraryContainer.h
1 /* LibraryContainer.h */
2 
3 /* Copyright (C) 2011-2019 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 LIBRARYCONTAINERINTERFACE_H
22 #define LIBRARYCONTAINERINTERFACE_H
23 
24 #include "Utils/Pimpl.h"
25 
26 #include <QObject>
27 
28 class QFrame;
29 class QAction;
30 class QPixmap;
31 class QMenu;
32 class QWidget;
33 class QComboBox;
34 class Settings;
35 
42 namespace Library
43 {
44  class PluginHandler;
45 
46  class Container :
47  public QObject
48  {
49  Q_OBJECT
50  PIMPL(Container)
51 
52  friend class PluginHandler;
53 
54  private:
55  void set_initialized();
56 
57  public:
58  explicit Container(QObject* parent=nullptr);
59  virtual ~Container();
60 
65  virtual QString name() const=0;
66 
67  virtual void set_name(const QString& name);
68 
73  virtual QString display_name() const;
74 
79  virtual QWidget* widget() const=0;
80 
86  virtual QFrame* header() const=0;
87 
93  virtual QPixmap icon() const=0;
94 
95 
100  virtual QMenu* menu();
101 
102 
108  void set_menu_action(QAction* action);
109 
114  QAction* menu_action() const;
115 
116 
120  virtual void init_ui()=0;
121 
126  bool is_initialized() const;
127 
134  virtual bool is_local() const;
135 
136  virtual void show();
137 
138  virtual void hide();
139 
140  void retranslate();
141  };
142 }
143 
145 Q_DECLARE_INTERFACE(LibraryContainerInterface, "com.sayonara-player.library")
146 
147 #endif // LIBRARYCONTAINER_H
Definition: LibraryContainer.h:46
virtual QMenu * menu()
return actions menu (may be nullptr). The title does not have to be set
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 QFrame * header() const =0
this is a frame at the top left of the container where the combo box will be located
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 bool is_local() const
a local library is a library which writes to the library field of the database. This should be false ...
virtual QWidget * widget() const =0
Should return the UI for the library view.
The Settings class.
Definition: Settings.h:42
virtual QPixmap icon() const =0
Every library should show a icon in the combo box.
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: LocalLibraryWatcher.h:32
Library Plugin Manager.
Definition: LibraryPluginHandler.h:39