Sayonara Player
LibraryImporter.h
1 /* LibraryImporter.h */
2 
3 /* Copyright (C) 2011-2019 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 
26 #include <QObject>
27 
28 class LocalLibrary;
29 
30 namespace Library
31 {
36  class Importer :
37  public QObject
38  {
39  Q_OBJECT
40  PIMPL(Importer)
41 
42  public:
43  explicit Importer(LocalLibrary* library);
44  ~Importer();
45 
46  enum class ImportStatus : uint8_t
47  {
48  Cancelled,
49  Rollback,
50  Caching,
51  NoTracks,
52  WaitForUser,
53  Importing,
54  Imported
55  };
56 
57  signals:
58  void sig_got_metadata(const MetaDataList&);
59  void sig_status_changed(Importer::ImportStatus);
60  void sig_got_library_dirs(const QStringList& library_dirs);
61  void sig_progress(int percent);
62  void sig_progress_no_percent(int progress);
63  void sig_triggered();
64  void sig_target_dir_changed(const QString& target_dir);
65 
66 
67  public:
68  void import_files(const QStringList& files, const QString& target_dir);
69  void accept_import(const QString& target_dir);
70  void cancel_import();
71  void reset();
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();
81 
82  };
83 }
84 
85 #endif // LIBRARYIMPORTER_H
MetaDataList
The MetaDataList class.
Definition: MetaDataList.h:37
Library::Importer
The LibraryImporter class.
Definition: LibraryImporter.h:36
Library
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:32
LocalLibrary
Definition: LocalLibrary.h:35