Sayonara Player
ReloadThread.h
1 /* ReloadThread.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 
22 /*
23  * ReloadThread.h
24  *
25  * Created on: Jun 19, 2011
26  * Author: Lucio Carreras
27  */
28 
29 #ifndef RELOADTHREAD_H_
30 #define RELOADTHREAD_H_
31 
32 #include <QThread>
33 #include <QHash>
34 #include <QDir>
35 
36 #include "Utils/Settings/SayonaraClass.h"
37 #include "Utils/Library/LibraryNamespaces.h"
38 #include "Utils/Pimpl.h"
39 
40 class MetaData;
41 class MetaDataList;
42 
43 namespace Library
44 {
45  class ReloadThread :
46  public QThread,
47  public SayonaraClass
48  {
49  Q_OBJECT
50  PIMPL(ReloadThread)
51 
52  signals:
53  void sig_reloading_library(const QString& message, int progress);
54  void sig_new_block_saved();
55 
56  public:
57  explicit ReloadThread(QObject* parent);
58  ~ReloadThread();
59 
60  void pause();
61  void goon();
62  void stop();
63  bool is_running() const;
64  void set_quality(ReloadQuality quality);
65  void set_library(LibraryId lib_id, const QString& library_path);
66 
67  protected:
68  virtual void run() override;
69 
70  private:
71  bool get_and_save_all_files(const QHash<QString, MetaData>& v_md_map);
72  QStringList get_files_recursive(QDir base_dir);
73  QStringList process_sub_files(const QDir& dir, const QStringList& sub_files);
74  void store_metadata_block(const MetaDataList& v_md);
75  };
76 }
77 
78 #endif /* RELOADTHREAD_H_ */
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
ReloadQuality
The ReloadQuality enum.
Definition: LibraryNamespaces.h:46
The MetaData class.
Definition: MetaData.h:48
The MetaDataList class.
Definition: MetaDataList.h:38
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:31
Definition: ReloadThread.h:45