Sayonara Player
LibraryImporter.h
1 /* LibraryImporter.h */
2 
3 /* Copyright (C) 2011-2017 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/Settings/SayonaraClass.h"
25 #include "Utils/Pimpl.h"
26 
27 #include <QObject>
28 
29 class MetaDataList;
30 class LocalLibrary;
36  public QObject
37 {
38  Q_OBJECT
39  PIMPL(LibraryImporter)
40 
41 public:
42  LibraryImporter(LocalLibrary* library);
43  ~LibraryImporter();
44 
45  enum class ImportStatus : uint8_t
46  {
47  Cancelled,
48  Rollback,
49  Caching,
50  NoTracks,
51  WaitForUser,
52  Importing,
53  Imported
54  };
55 
56 signals:
57  void sig_got_metadata(const MetaDataList&);
58  void sig_status_changed(LibraryImporter::ImportStatus);
59  void sig_got_library_dirs(const QStringList& library_dirs);
60  void sig_progress(int percent);
61  void sig_triggered();
62  void sig_target_dir_changed(const QString& target_dir);
63 
64 
65 public:
66  void import_files(const QStringList& files, const QString& target_dir);
67  void accept_import(const QString& target_dir);
68  void cancel_import();
69 
70  LibraryImporter::ImportStatus get_status() const;
71 
72 
73 private slots:
74  void caching_thread_finished();
75  void copy_thread_finished();
76  void emit_status(LibraryImporter::ImportStatus status);
77  void metadata_changed(const MetaDataList& old_md, const MetaDataList& new_md);
78 
79 };
80 
81 #endif // LIBRARYIMPORTER_H
Definition: LocalLibrary.h:35
The MetaDataList class.
Definition: MetaDataList.h:38
The LibraryImporter class.
Definition: LibraryImporter.h:35