Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Components
Library
Importer
LibraryImporter.h
1
/* LibraryImporter.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 LIBRARYIMPORTER_H
22
#define LIBRARYIMPORTER_H
23
24
#include "Utils/Pimpl.h"
25
#include <QObject>
26
27
namespace
Util
28
{
29
class
FileSystem
;
30
}
31
32
namespace
Tagging
33
{
34
class
TagReader
;
35
}
36
37
namespace
DB
38
{
39
class
LibraryDatabase
;
40
}
41
42
class
MetaDataList
;
43
namespace
Library
44
{
45
class
Info
;
46
class
Importer :
47
public
QObject
48
{
49
Q_OBJECT
50
PIMPL(Importer)
51
52
public
:
53
Importer(
DB::LibraryDatabase
* libraryDatabase, std::shared_ptr<Util::FileSystem> fileSystem,
54
std::shared_ptr<Tagging::TagReader> tagReader, QObject* parent);
55
~Importer()
override
;
56
57
enum class
ImportStatus :
58
uint8_t
59
{
60
Cancelled,
61
Rollback,
62
Caching,
63
NoTracks,
64
NoValidTracks,
65
CachingFinished,
66
Importing,
67
Imported
68
};
69
70
signals:
71
void
sigStatusChanged(Library::Importer::ImportStatus status);
72
void
sigProgress(
int
percent);
73
void
sigCachedFilesChanged();
74
void
sigTargetDirectoryChanged(
const
QString& targetDir);
75
76
public
:
77
void
import
(
const
QString& libraryPath,
const
QStringList& files,
const
QString& targetDir);
78
void
cancelImport();
79
void
copy(
const
QString& targetDir);
80
[[nodiscard]] Importer::ImportStatus status()
const
;
81
[[nodiscard]]
MetaDataList
cachedTracks()
const
;
82
83
void
reset();
84
85
private
slots:
86
void
cachingProcessorFinished();
87
void
copyProcessorFinished();
88
89
private
:
// NOLINT(readability-redundant-access-specifiers)
90
void
startCaching(
const
QStringList& files,
const
QString& libraryPath);
91
void
rollback();
92
void
emitStatus(Importer::ImportStatus status);
93
void
storeTracksInLibrary(
const
MetaDataList
& tracks,
int
copiedFiles);
94
};
95
}
96
97
#endif
// LIBRARYIMPORTER_H
DB::LibraryDatabase
Definition
LibraryDatabase.h:42
Library::Info
The Info class.
Definition
LibraryInfo.h:38
MetaDataList
Definition
MetaDataList.h:34
Tagging::TagReader
Definition
TagReader.h:34
Util::FileSystem
Definition
FileSystem.h:34
Tagging
The GUI_TagEdit class.
Definition
Engine.h:33
Util
Helper functions.
Definition
MetaTypeRegistry.h:25
Generated on
for Sayonara Player by
1.17.0