Sayonara Player
Loading...
Searching...
No Matches
LibraryManager.h
1/* LibraryManager.h */
2
3/* Copyright (C) 2011-2024 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/typedefs.h"
25
26#include <QObject>
27
28class LocalLibrary;
30
31namespace Library
32{
33 class Info;
34
36 {
37 public:
38 virtual ~InfoAccessor() = default;
39
40 [[nodiscard]] virtual QList<Info> allLibraries() const = 0;
41 [[nodiscard]] virtual Info libraryInfo(LibraryId id) const = 0;
42 [[nodiscard]] virtual Info libraryInfoByPath(const QString& path) const = 0;
43 [[nodiscard]] virtual int count() const = 0;
44 [[nodiscard]] virtual LocalLibrary* libraryInstance(LibraryId id) = 0;
45 };
46
47 class Manager :
48 public QObject,
49 public InfoAccessor
50 {
51 Q_OBJECT
52
53 signals:
54 void sigPathChanged(LibraryId id);
55 void sigAdded(LibraryId id);
56 void sigRenamed(LibraryId id);
57 void sigMoved(LibraryId id, int from, int to);
58 void sigRemoved(LibraryId id);
59
60 public:
61 ~Manager() override = default;
62
63 virtual LibraryId addLibrary(const QString& name, const QString& path) = 0;
64 virtual bool renameLibrary(LibraryId id, const QString& newName) = 0;
65 virtual bool removeLibrary(LibraryId id) = 0;
66 virtual bool moveLibrary(int oldRow, int newRow) = 0;
67 virtual bool changeLibraryPath(LibraryId id, const QString& newPath) = 0;
68
69 static QString requestLibraryName(const QString& path);
70 static Manager* create(LibraryPlaylistInteractor* playlistInteractor);
71 };
72}
73
74#endif // LIBRARYMANAGER_H
Definition: LibraryPlaylistInteractor.h:34
Definition: LibraryManager.h:36
The Info class.
Definition: LibraryInfo.h:38
Definition: LibraryManager.h:50
Definition: LocalLibrary.h:38
Definition: EngineUtils.h:33