Sayonara Player
LibraryPluginHandler.h
1 /* LibraryPluginLoader.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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 AbstractContainer;
34 
39  class PluginHandler :
40  public QObject
41  {
42  Q_OBJECT
43  PIMPL(PluginHandler)
44  SINGLETON(PluginHandler)
45 
46  signals:
47  void sigNewLibraryRequested(const QString& name, const QString& path);
48  void sigCurrentLibraryChanged();
49  void sigLibrariesChanged();
50 
51  private:
52  void initLibraries(const QList<AbstractContainer*>& containers);
53  void initDllLibraries();
54 
55  public:
60  void init(const QList<AbstractContainer*>& containers, AbstractContainer* fallback_library);
61 
66  QList<AbstractContainer*> libraries(bool also_empty) const;
67 
68  AbstractContainer* currentLibrary() const;
69  QWidget* currentLibraryWidget() const;
70 
71  void addLocalLibrary(AbstractContainer* container);
72  void renameLocalLibrary(const QString& old_name, const QString& new_name);
73  void removeLocalLibrary(const QString& name);
74  void moveLocalLibrary(int old_local_library_index, int new_local_library_index);
75 
76  public slots:
77  void setCurrentLibrary(const QString& name);
78  void setCurrentLibrary(int index);
79  void setCurrentLibrary(AbstractContainer* container);
80  };
81 }
82 
83 #endif // LIBRARYPLUGINLOADER_H
Library::PluginHandler::init
void init(const QList< AbstractContainer * > &containers, AbstractContainer *fallback_library)
Search for plugins and add some predefined plugins.
Library::PluginHandler
Library Plugin Manager.
Definition: LibraryPluginHandler.h:41
QList
Definition: EngineUtils.h:33
Library::AbstractContainer
This container is only used internally to avoid Ui dependencies in the Components....
Definition: AbstractLibraryContainer.h:20
Library
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31
Library::PluginHandler::libraries
QList< AbstractContainer * > libraries(bool also_empty) const
Get a list for all found plugins. The ui is not necessarily initialized.