summaryrefslogtreecommitdiffstats
path: root/copyworker.h
blob: 7413f4959274a1ee8c692b77267828b221a18ae6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version
  2 of the License, or (at your option) any later version.
*/

#ifndef COPYWORKER_H
#define COPYWORKER_H

#include <QThread>
#include <QString>
#include <QList>
#include <QPair>
#include <QMutex>
#include <QVariant>

class CopyWorker : public QThread {
    Q_OBJECT
    public:
        CopyWorker(QObject *parent = 0);
        void enqueue(const QString &source, const QString &destination);
        void appendData(const QString &source, const QVariant &data);
        const QHash<QString, QList<QVariant> > data() const { return mData; }
        void clear();
        qint64 max() const { return mMax; }
        virtual void run();

    signals:
        void success(QString);
        void bytesRead(int);
        void processint(QString);
        void error(QString);
        void file(QString);

    private:
        QList<QPair<QString, QString> > mFiles;
        QHash<QString, QList<QVariant> > mData;
        QMutex mSourceMx;
        int mMax;
};

#endif // COPYWORKER_H