-
Notifications
You must be signed in to change notification settings - Fork 0
/
progresscontrol.h
46 lines (38 loc) · 1.13 KB
/
progresscontrol.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
#ifndef PROGRESSCONTROL_H
#define PROGRESSCONTROL_H
#include <QFileInfo>
#include <QMutex>
#include "settings.h"
class ProgressControl {
public:
ProgressControl(Settings *pSettings);
~ProgressControl();
void checkLimits(QFileInfo srcFileInfo);
bool fileCountLimitIsReached();
QString getTextQuestion(int limit, QFileInfo srcFileInfo);
int getLimitsCount();
int getMax();
float getRealMax();
bool limitIsReached(int numb);
void prepare(int sourceFileCount, quint64 outDirSize);
QString say(int numb);
void step(QFileInfo srcFileInfo);
private:
struct Limit {
bool enable;
bool reached;
QString echo;
float min;
float max;
float val;
};
enum {DISK_SIZE_LIMIT, RESERVED_SPACE_LIMIT, COPIED_SIZE_LIMIT,
DEST_SIZE_LIMIT, FILE_COUNT_LIMIT, QUEUE_LIMIT};
static const int LIMITS_COUNT = 4; // without QUEUE_LIMIT
static const int FULL_LIMITS_COUNT = LIMITS_COUNT + 2;
// with QUEUE_LIMIT and FILE_COUNT_LIMIT
Limit limits[FULL_LIMITS_COUNT];
QMutex mutex;
Settings *settings;
};
#endif // PROGRESSCONTROL_H