Sayonara Player
LibraryPluginHandler.h
1 /* LibraryPluginLoader.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 LIBRARYPLUGINLOADER_H
24 #define LIBRARYPLUGINLOADER_H
25 
26 #include <QDir>
27 #include <QList>
28 #include <QPluginLoader>
29 #include <QWidget>
30 
31 #include "GUI/Helper/SayonaraWidget/SayonaraWidget.h"
32 
39  public QObject,
40  protected SayonaraClass
41 {
42 
43  Q_OBJECT
44 
45 signals:
46  void sig_idx_changed(int);
47 
48 private:
50  QList<QPair<QString, QIcon>> _library_entries;
51 
52  int _cur_idx;
53  QWidget* _library_parent=nullptr;
54 
60  void init_library(int idx);
61 
62 
63 public:
64  LibraryPluginHandler(QObject* parent=nullptr);
66 
67 
72  void init(const QList<LibraryContainerInterface*>& containers);
73 
78  void set_library_parent(QWidget* parent);
79 
80 
86 
92 
98  int get_cur_library_idx() const;
99 
100 
101 private slots:
106  void index_changed(int idx);
107 
111  void language_changed();
112 };
113 
114 #endif // LIBRARYPLUGINLOADER_H
LibraryContainerInterface * get_cur_library() const
Get the current selected (and shown) library.
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:31
Library Plugin Manager.
Definition: LibraryPluginHandler.h:38
An interface class needed when implementing a library plugin.
Definition: LibraryContainer.h:42
void init(const QList< LibraryContainerInterface *> &containers)
Search for plugins and add some predefined plugins.
int get_cur_library_idx() const
Get the current index of the library (indicated by current index in dropdown.
QList< LibraryContainerInterface * > get_libraries() const
Get a list for all found plugins. The ui is not necessarily initialized.
void set_library_parent(QWidget *parent)
Set the parent widget for library plugins.
Definition: org_mpris_media_player2_adaptor.h:20