Sayonara Player
Loading...
Searching...
No Matches
LocalLibrary.h
1/* LocalLibrary.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 SAYONARA_PLAYER_LOCAL_LIBRARY_H
22#define SAYONARA_PLAYER_LOCAL_LIBRARY_H
23
24#include "AbstractLibrary.h"
25#include "Importer/LibraryImporter.h"
26#include "Utils/Pimpl.h"
27
28class ReloadThread;
29
30namespace Library
31{
32 class Info;
33 class Manager;
34}
35
36class LocalLibrary :
37 public AbstractLibrary
38{
39 friend class Library::Manager;
40
41 Q_OBJECT
42 PIMPL(LocalLibrary)
43
44 signals:
45 void sigImportDialogRequested(const QString& targetDirectory);
46 void sigRenamed(const QString& newName);
47 void sigPathChanged(const QString& newPath);
48
49 public:
50 LocalLibrary(Library::Manager* libraryManager, LibraryId id, LibraryPlaylistInteractor* playlistInteractor,
51 QObject* parent = nullptr);
52 ~LocalLibrary() override;
53
54 bool setLibraryPath(const QString& libraryPath);
55 bool setLibraryName(const QString& libraryName);
56
57 [[nodiscard]] Library::Info info() const;
58 [[nodiscard]] Library::Importer* importer();
59 [[nodiscard]] bool isReloading() const override;
60
61 public slots: // NOLINT(readability-redundant-access-specifiers)
62 void deleteTracks(const MetaDataList& tracks, Library::TrackDeletionMode answer) override;
63 void reloadLibrary(bool clear_first, Library::ReloadQuality quality) override;
64 void importFiles(const QStringList& files) override;
65 void importFilesTo(const QStringList& files, const QString& targetDirectory);
66
67 void refreshArtists() override;
68 void refreshAlbums() override;
69 void refreshTracks() override;
70
71 protected:
72 void initLibraryImpl() override;
73
74 private:
75 void applyDatabaseFixes();
76 void initReloadThread();
77
78 void getAllArtists(ArtistList& artists) const override;
79 void getAllArtistsBySearchstring(const Library::Filter& filter, ArtistList& artists) const override;
80
81 void getAllAlbums(AlbumList& albums) const override;
82 void
83 getAllAlbumsByArtist(const IdList& artistIds, AlbumList& albums, const Library::Filter& filter) const override;
84 void getAllAlbumsBySearchstring(const Library::Filter& filter, AlbumList& albums) const override;
85
86 [[nodiscard]] int getTrackCount() const override;
87 void getAllTracks(MetaDataList& v_md) const override;
88 void getAllTracks(const QStringList& paths, MetaDataList& tracks) const override;
89 void getAllTracksByArtist(const IdList& artistIds, MetaDataList& tracks,
90 const Library::Filter& filter) const override;
91 void
92 getAllTracksByAlbum(const IdList& albumIds, MetaDataList& tracks, const Library::Filter& filter) const override;
93 void getAllTracksBySearchstring(const Library::Filter& filter, MetaDataList& v_md) const override;
94 void getAllTracksByPath(const QStringList& paths, MetaDataList& v_md) const override;
95
96 void getTrackById(TrackID trackId, MetaData& track) const override;
97 void getAlbumById(AlbumId albumId, Album& album) const override;
98 void getArtistById(ArtistId artistId, Artist& artist) const override;
99
100 private slots: // NOLINT(readability-redundant-access-specifiers)
101 void reloadThreadFinished();
102 void searchModeChanged();
103 void showAlbumArtistsChanged();
104 void importStatusChanged(Library::Importer::ImportStatus status);
105 void metadataChanged();
106 void albumsChanged();
107};
108
109#endif // SAYONARA_PLAYER_LOCAL_LIBRARY_H
Definition Album.h:91
Definition Album.h:37
Definition Artist.h:61
Definition Artist.h:34
Definition LibraryPlaylistInteractor.h:34
Definition Filter.h:34
Definition LibraryImporter.h:48
The Info class.
Definition LibraryInfo.h:38
Definition LibraryManager.h:50
Definition MetaDataList.h:34
Definition MetaData.h:43