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 
33 #include "Utils/Settings/SayonaraClass.h"
34 #include "Utils/Library/LibraryNamespaces.h"
35 #include "Utils/Pimpl.h"
36 
37 #include <QThread>
38 #include <QDir>
39 
40 namespace Library
41 {
42  class ReloadThread :
43  public QThread,
44  public SayonaraClass
45  {
46  Q_OBJECT
47  PIMPL(ReloadThread)
48 
49  signals:
50  void sig_reloading_library(const QString& message, int progress);
51  void sig_new_block_saved();
52 
53  public:
54  explicit ReloadThread(QObject* parent);
55  ~ReloadThread();
56 
57  void pause();
58  void goon();
59  void stop();
60  bool is_running() const;
61  void set_quality(ReloadQuality quality);
62  void set_library(LibraryId lib_id, const QString& library_path);
63 
64  protected:
65  virtual void run() override;
66 
67  private:
68  bool get_and_save_all_files(const QHash<QString, MetaData>& v_md_map);
69  QStringList get_files_recursive(QDir base_dir);
70  QStringList process_sub_files(const QDir& dir, const QStringList& sub_files);
71  void store_metadata_block(const MetaDataList& v_md);
72  };
73 }
74 
75 #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 MetaDataList class.
Definition: MetaDataList.h:37
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:29
Definition: ReloadThread.h:42