-
Notifications
You must be signed in to change notification settings - Fork 4
/
mainwindow.h
97 lines (75 loc) · 2.38 KB
/
mainwindow.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
/* This file is part of cuteAndroidBackup.
cuteAndroidBackup 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 3 of the License, or
any later version.
cuteAndroidBackup is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with cuteAndroidBackup. If not, see <http://www.gnu.org/licenses/>. */
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMessageBox>
#include <QProcess>
#include <QFileInfo>
#include <QFileDialog>
#include <QSettings>
#include <QStandardItemModel>
#include <QListWidgetItem>
// Application states
#define IDLE 0
#define DEVICES 1
#define APPS 2
#define BACKUP 3
#define RESTORE 4
#define MINIMUM_FILE_SIZE 1024 // Minimum size for a working backup file (Apps that do not allow backup generates files < 1K)
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
Q_INVOKABLE void adjustSize() { QWidget::adjustSize(); }
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_actionExit_triggered();
void procStarted();
void procError(QProcess::ProcessError procError);
void procExited(int exitCode, QProcess::ExitStatus exitStatus);
void progStandardOutput();
void progStandardError();
void on_btnADBpath_clicked();
void on_btnBackupPath_clicked();
void on_btnAppsRefresh_clicked();
void on_btnRestoreRefresh_clicked();
void on_checkBox_details_stateChanged(int status);
void on_btnBackup_clicked();
void on_btnRestore_clicked();
void on_actionAbout_triggered();
private:
Ui::MainWindow *ui;
QProcess * proc;
static const QString BACKUP_FILE_EXTENSION;
void setDefaultConsoleColor();
void doBackup();
void doRestore();
void getAppsList();
void getRestoreList();
void checkBackup();
int state;
QString buffer;
QList<QListWidgetItem *> selectionList;
struct AppInfo {
int id;
QString fancyname;
QString realname;
QString path;
} ;
QList<AppInfo> appList;
};
#endif // MAINWINDOW_H