This repository has been archived by the owner on Nov 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
btrfs-assistant.h
137 lines (120 loc) · 3.61 KB
/
btrfs-assistant.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#ifndef BTRFSASSISTANT_H
#define BTRFSASSISTANT_H
#include <QDir>
#include <QFile>
#include <QMainWindow>
#include <QMap>
#include <QMessageBox>
#include <QProcess>
#include <QSet>
#include <QSettings>
#include <QSignalMapper>
#include <QThread>
#include <QTime>
#include <QTranslator>
#include <QUuid>
#include <QXmlStreamReader>
QT_BEGIN_NAMESPACE
namespace Ui {
class BtrfsAssistant;
}
QT_END_NAMESPACE
struct Result {
int exitCode;
QString output;
};
struct Btrfs {
QString mountPoint;
long totalSize;
long allocatedSize;
long usedSize;
long freeSize;
long dataSize;
long dataUsed;
long metaSize;
long metaUsed;
long sysSize;
long sysUsed;
QMap<QString, QString> subVolumes;
};
struct SnapperSnapshots {
int number;
QString time;
QString desc;
};
struct SnapperSubvolume {
QString subvol;
QString subvolid;
QString time;
QString desc;
QString uuid;
};
class BtrfsAssistant : public QMainWindow {
Q_OBJECT
protected:
QSet<QString> unitsEnabledSet;
QHash<QString, QCheckBox *> configCheckBoxes;
QMap<QString, Btrfs> fsMap;
QStringList bmFreqValues = {"none", "daily", "weekly", "monthly"};
QSet<QCheckBox *> changedCheckBoxes;
QMap<QString, QString> snapperConfigs;
QMap<QString, QVector<SnapperSnapshots>> snapperSnapshots;
QMap<QString, QVector<SnapperSubvolume>> snapperSubvolumes;
bool hasSnapper = false;
bool hasBtrfsmaintenance = false;
bool isSnapBoot = false;
QSettings *settings;
QSettings *bmSettings;
QString btrfsmaintenanceConfig;
QSettings::Format bmFormat;
void refreshInterface();
void loadEnabledUnits();
void setupConfigBoxes();
void apply();
void loadBTRFS();
void populateBtrfsUi(const QString &uuid);
void populateSubvolList(const QString &uuid);
void reloadSubvolList(const QString &uuid);
void loadSnapper();
void populateSnapperGrid();
void populateSnapperConfigSettings();
void restoreSnapshot(const QString &uuid, QString subvolume);
void switchToSnapperRestore();
QMap<QString, QString> getSnapshotBoot();
void enableRestoreMode(bool enable);
void loadSnapperRestoreMode();
void snapperTimelineEnable(bool enable);
void populateBmTab();
void updateServices(QList<QCheckBox *>);
public:
explicit BtrfsAssistant(QWidget *parent = 0);
~BtrfsAssistant();
QString getVersion(QString name);
QString version;
QString output;
bool setup(bool skipSnapshotPrompt, bool snapshotBoot);
private slots:
void on_checkBox_bmBalance_clicked(bool checked);
void on_checkBox_bmDefrag_clicked(bool checked);
void on_checkBox_bmScrub_clicked(bool checked);
void on_checkBox_includesnapshots_clicked();
void on_checkBox_snapper_enabletimeline_clicked(bool checked);
void on_checkBox_snapper_restore_clicked(bool checked);
void on_comboBox_btrfsdevice_activated(int);
void on_comboBox_snapper_configs_activated(int);
void on_comboBox_snapper_config_settings_activated(int);
void on_pushButton_bmApply_clicked();
void on_pushButton_deletesubvol_clicked();
void on_pushButton_load_clicked();
void on_pushButton_loadsubvol_clicked();
void on_pushButton_restore_snapshot_clicked();
void on_pushButton_snapper_create_clicked();
void on_pushButton_snapper_delete_clicked();
void on_pushButton_snapper_delete_config_clicked();
void on_pushButton_snapper_new_config_clicked();
void on_pushButton_snapper_save_config_clicked();
void on_pushButton_SnapperUnitsApply_clicked();
private:
Ui::BtrfsAssistant *ui;
};
#endif // BTRFSASSISTANT_H