Sayonara Player
LibraryManager.h
1 /* LibraryManager.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 LIBRARYMANAGER_H
22 #define LIBRARYMANAGER_H
23 
24 #include "Utils/Singleton.h"
25 #include "Utils/Pimpl.h"
26 
27 #include <QObject>
28 
29 class LocalLibrary;
30 
31 namespace Library
32 {
33  class Info;
34  class Manager :
35  public QObject
36  {
37  Q_OBJECT
38  PIMPL(Manager)
39  SINGLETON(Manager)
40 
41  friend class LocalLibrary;
42 
43  signals:
44  void sigPathChanged(LibraryId id);
45  void sigAdded(LibraryId id);
46  void sigRenamed(LibraryId id);
47  void sigMoved(LibraryId id, int from, int to);
48  void sigRemoved(LibraryId id);
49 
50  private:
51  void reset();
52 
53  public:
54  LibraryId addLibrary(const QString& name, const QString& path);
55  bool renameLibrary(LibraryId id, const QString& name);
56  bool removeLibrary(LibraryId id);
57  bool moveLibrary(int old_row, int new_row);
58  bool changeLibraryPath(LibraryId id, const QString& path);
59 
60  QList<Info> allLibraries() const;
61 
62  Info libraryInfo(LibraryId id) const;
63  Info libraryInfoByPath(const QString& path) const;
64 
65  int count() const;
66 
67  LocalLibrary* libraryInstance(LibraryId id);
68 
69  static QString requestLibraryName(const QString& path);
70  };
71 }
72 
73 
74 #endif // LIBRARYMANAGER_H
QList
Definition: EngineUtils.h:33
Library
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31
LocalLibrary
Definition: LocalLibrary.h:37
Library::Manager
Definition: LibraryManager.h:36
Library::Info
The Info class.
Definition: LibraryInfo.h:37