-
Notifications
You must be signed in to change notification settings - Fork 0
/
threadcopy.h
81 lines (71 loc) · 1.92 KB
/
threadcopy.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef THREADCOPY_H
#define THREADCOPY_H
#include <QThread>
#include <QtGui>
#include <QFileInfo>
#include <QHash>
#include <QtWidgets>
#include "progresscontrol.h"
#include "settings.h"
#include "sourcefiles.h"
#include "srcdiritemmodel.h"
class ThreadCopy : public QThread
{
Q_OBJECT
public:
QWaitCondition questionWait;
ThreadCopy(Settings *pSettings, SrcDirItemModel *pSrcDirModel,
QListWidget *pFilterListWidget, QListWidget *pIgnoreListWidget,
int nSleep, QObject *parent);
~ThreadCopy();
void run();
void setAnswer(int ans);
float getProgressMax();
private:
enum {LIMIT_REACHED, TRY_OTHER_FILE, LIMIT_OK};
bool allwaysTryOtherFile;
int answer;
bool enableFilter;
bool enableIgnore;
QListWidget *filterListWidget;
QListWidget *ignoreListWidget;
QMutex mutex;
QString outputDir;
quint64 outDirSize;
QHash<QString, bool> outputFiles;
ProgressControl *progressCtrl;
Settings *settings;
SourceFiles *sourceFiles;
int sleepTime;
SrcDirItemModel *srcDirModel;
bool stopFlag;
QRegExp wildcard;
QMutex questionMutex;
bool checkFile(QFileInfo file, int index);
bool checkFileFilter(QString file);
bool checkFileIgnore(QString file);
int checkLimits(QFileInfo srcFileInfo);
void copy();
void deleteOldFiles();
quint64 getDirSize(QString path);
int getSleep();
bool getStopFlag();
QString getTextQuestion(int sizeLimit, QFileInfo srcFileInfo);
void scan();
int scanDir(QString pathDir, int index);
void scanOutput(QString pathDir);
void showQuestion(QString q);
public slots:
void setSleep(int nSleep);
void stop();
signals:
void changeDiskFreeSpace();
void done();
void fileQueueChanged(int);
void print(QString);
void scanFinished();
void runTimer();
void progressChanged(int);
void question(QString);
};
#endif // THREADCOPY_H