Sayonara Player
CopyThread.h
1/* CopyThread.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (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 IMPORT_COPY_THREAD_H
22#define IMPORT_COPY_THREAD_H
23
24#include <QThread>
25
26#include "ImportCache.h"
27#include "Utils/Pimpl.h"
28
29namespace Library
30{
31 class ImportCache;
32
37 class CopyThread :
38 public QThread
39 {
40 Q_OBJECT
41 PIMPL(CopyThread)
42
43 signals:
44 void sigProgress(int);
45
46 public:
47 enum class Mode : uint8_t
48 {
49 Copy=0,
50 Rollback
51 };
52
53 CopyThread(const QString& targetDirectory, ImportCachePtr cache, QObject* parent=nullptr);
54 virtual ~CopyThread();
55
56 void cancel();
57 bool wasCancelled() const;
58
59 MetaDataList copiedMetadata() const;
60 int copiedFileCount() const;
61
62 void setMode(CopyThread::Mode mode);
63
64 private:
65 void clear();
66 void run();
67
75 void copy();
76 void rollback();
77 void emitPercent();
78 };
79}
80
81#endif
The CopyThread class.
Definition: CopyThread.h:39
The MetaDataList class.
Definition: MetaDataList.h:39
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31