Sayonara Player
LibraryPluginHandler.h
1 /* LibraryPluginLoader.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 LIBRARYPLUGINLOADER_H
22 #define LIBRARYPLUGINLOADER_H
23 
24 #include "Utils/Singleton.h"
25 #include "Utils/Pimpl.h"
26 
27 #include <QObject>
28 
29 class QMenu;
30 namespace Library
31 {
32  class Info;
33  class Container;
34 
39  class PluginHandler :
40  public QObject
41  {
42  Q_OBJECT
43  PIMPL(PluginHandler)
44  SINGLETON(PluginHandler)
45 
46  signals:
47  void sig_new_library_requested(const QString& name, const QString& path);
48  void sig_current_library_changed();
49  void sig_libraries_changed();
50 
51  private:
57  void init_library(Container* container);
58 
59  void init_libraries(const QList<Container*>& containers);
60  void init_dll_libraries();
61 
62 
63  public:
68  void init(const QList<Container*>& containers);
69 
74  QList<Container*> get_libraries(bool also_empty) const;
75 
76  Container* current_library() const;
77  QMenu* current_library_menu() const;
78  QWidget* current_library_widget() const;
79 
80  void add_local_library(Container* container);
81  void rename_local_library(const QString& old_name, const QString& new_name);
82  void remove_local_library(const QString& name);
83  void move_local_library(int old_local_library_index, int new_local_library_index);
84 
85  void language_changed();
86 
87  private slots:
88  void current_library_changed(int library_idx);
89 
90  public slots:
91  void set_current_library(const QString& name);
92  void set_current_library(int index);
93  void set_current_library(Container* container);
94  };
95 }
96 
97 #endif // LIBRARYPLUGINLOADER_H
Library::PluginHandler::init
void init(const QList< Container * > &containers)
Search for plugins and add some predefined plugins.
Library::PluginHandler
Library Plugin Manager.
Definition: LibraryPluginHandler.h:39
QList
Definition: EngineUtils.h:33
Library::PluginHandler::get_libraries
QList< Container * > get_libraries(bool also_empty) const
Get a list for all found plugins. The ui is not necessarily initialized.
Library
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:32
Library::Container
Definition: LibraryContainer.h:46