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