Sayonara Player
ReloadThread.h
1 /* ReloadThread.h */
2 
3 /* Copyright (C) 2011-2016 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 
33 #include <QThread>
34 #include <QHash>
35 #include <QDir>
36 
37 #include "Helper/Tagging/Tagging.h"
38 #include "Helper/Settings/SayonaraClass.h"
39 #include "Helper/MetaData/MetaDataList.h"
40 #include "LibraryNamespaces.h"
41 
42 
43 class DatabaseConnector;
44 class ReloadThread :
45  public QThread,
46  protected SayonaraClass
47 {
48 
49 Q_OBJECT
50 
51 signals:
52  void sig_reloading_library(const QString& message, int progress);
53  void sig_new_block_saved();
54 
55 
56 public:
57 
58 
59  SINGLETON_QOBJECT(ReloadThread)
60 
61  void set_lib_path(const QString& library_path);
62 
63  void pause();
64  void goon();
65  bool is_running() const;
66 
67  void set_quality(Library::ReloadQuality quality);
68 
69 
70 protected:
71  virtual void run() override;
72 
73 
74 private:
75  DatabaseConnector* _db=nullptr;
76  QString _library_path;
77  MetaDataList _v_md;
78  Library::ReloadQuality _quality;
79  bool _paused, _running;
80 
81 
82 private:
83 
84  int get_and_save_all_files(const QHash<QString, MetaData>& v_md_map);
85  QStringList get_files_recursive (QDir base_dir);
86  QStringList process_sub_files(const QDir& dir, const QStringList& sub_files);
87 
88  bool compare_md(const MetaData& md1, const MetaData& md2);
89 
90 };
91 
92 #endif /* RELOADTHREAD_H_ */
Definition: ReloadThread.h:44
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:31
Definition: MetaData.h:49
Definition: DatabaseConnector.h:40
Definition: MetaDataList.h:44