| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
#pragma once |
| 19 |
|
| 20 |
#include <QString> |
| 21 |
#include <QStringList> |
| 22 |
#include <QObject> |
| 23 |
#include <QXmlStreamAttributes> |
| 24 |
|
| 25 |
#include "apps.h" |
| 26 |
|
| 27 |
class BackupCategory { |
| 28 |
|
| 29 |
public: |
| 30 |
BackupCategory(QXmlStreamAttributes cat) { |
| 31 |
foreach(QXmlStreamAttribute attr, cat) |
| 32 |
{ |
| 33 |
QString att = attr.name().toString(); |
| 34 |
QString val = attr.value().toString(); |
| 35 |
if (att == "id") |
| 36 |
id = val; |
| 37 |
else if (att == "name") |
| 38 |
name = val; |
| 39 |
else if (att == "count") |
| 40 |
count = val; |
| 41 |
else if (att == "bytesize") |
| 42 |
bytesize = val; |
| 43 |
else if (att == "perimetertype") |
| 44 |
perimetertype = (val != "personal") ? "1" : "0"; |
| 45 |
} |
| 46 |
} |
| 47 |
BackupCategory(QString idGiven, QString nameGiven) { |
| 48 |
id = idGiven; |
| 49 |
name = nameGiven; |
| 50 |
count = "0"; |
| 51 |
bytesize = "-1"; |
| 52 |
perimetertype = "0"; |
| 53 |
} |
| 54 |
|
| 55 |
~BackupCategory() {} |
| 56 |
|
| 57 |
QString id; |
| 58 |
QString name; |
| 59 |
QString count; |
| 60 |
QString bytesize; |
| 61 |
QString perimetertype; |
| 62 |
}; |
| 63 |
|
| 64 |
class BackupInfo : public QObject { |
| 65 |
Q_OBJECT |
| 66 |
|
| 67 |
public: |
| 68 |
BackupInfo(); |
| 69 |
~BackupInfo() {} |
| 70 |
QString modeString(); |
| 71 |
QString stringFromMode(int mode); |
| 72 |
int mode() const; |
| 73 |
int appMode() const; |
| 74 |
int numMethods() const; |
| 75 |
void addMode(QXmlStreamAttributes cat); |
| 76 |
void addApp(QXmlStreamAttributes cat); |
| 77 |
void sortApps(); |
| 78 |
void clearModes(); |
| 79 |
void setMode(const int &val); |
| 80 |
qint64 setAppMode(QString mode); |
| 81 |
QString curMode() const; |
| 82 |
void setCurMode(int increment); |
| 83 |
|
| 84 |
qint64 size() const; |
| 85 |
void setSize(const qint64 &val); |
| 86 |
qint64 maxSize() const; |
| 87 |
void setMaxSize(const qint64 &val); |
| 88 |
|
| 89 |
qint64 curSize() const; |
| 90 |
void setCurSize(const qint64 &val); |
| 91 |
qint64 curMaxSize() const; |
| 92 |
void setCurMaxSize(const qint64 &val); |
| 93 |
void setCurMaxSize(int index, const qint64 &val); |
| 94 |
int progress() const; |
| 95 |
void setProgress(const int &progress); |
| 96 |
|
| 97 |
QList<BackupCategory*> categories; |
| 98 |
QList<Apps*> apps; |
| 99 |
|
| 100 |
int rev() const; |
| 101 |
signals: |
| 102 |
void modeChanged(); |
| 103 |
void progressChanged(); |
| 104 |
void curModeChanged(); |
| 105 |
void sizeChanged(); |
| 106 |
void maxSizeChanged(); |
| 107 |
void curSizeChanged(); |
| 108 |
void curMaxSizeChanged(); |
| 109 |
void numMethodsChanged(); |
| 110 |
private: |
| 111 |
int _progress; |
| 112 |
qint64 _size, _maxSize; |
| 113 |
QList<qint64> _curSize, _curMaxSize; |
| 114 |
int _mode; |
| 115 |
int _curMode; |
| 116 |
int _numMethods; |
| 117 |
int _rev; |
| 118 |
int _appMode; |
| 119 |
}; |