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;
31 
32 namespace Library
33 {
38  class Importer :
39  public QObject
40  {
41  Q_OBJECT
42  PIMPL(Importer)
43 
44  public:
45  explicit Importer(LocalLibrary* library);
46  ~Importer();
47 
48  enum class ImportStatus : uint8_t
49  {
50  Cancelled,
51  Rollback,
52  Caching,
53  NoTracks,
54  WaitForUser,
55  Importing,
56  Imported
57  };
58 
59  signals:
60  void sig_got_metadata(const MetaDataList&);
61  void sig_status_changed(Importer::ImportStatus);
62  void sig_got_library_dirs(const QStringList& library_dirs);
63  void sig_progress(int percent);
64  void sig_triggered();
65  void sig_target_dir_changed(const QString& target_dir);
66 
67 
68  public:
69  void import_files(const QStringList& files, const QString& target_dir);
70  void accept_import(const QString& target_dir);
71  void cancel_import();
72 
73  Importer::ImportStatus status() const;
74 
75 
76  private slots:
77  void caching_thread_finished();
78  void copy_thread_finished();
79  void emit_status(Importer::ImportStatus status);
80  void metadata_changed(const MetaDataList& old_md, const MetaDataList& new_md);
81 
82  };
83 }
84 
85 #endif // LIBRARYIMPORTER_H
Definition: LocalLibrary.h:35
The MetaDataList class.
Definition: MetaDataList.h:38
The LibraryImporter class.
Definition: LibraryImporter.h:38
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:31