blob: 60c8abeaeb90e1a8d1764fe15651b2a5fcd958f3 (
plain)
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
|
#pragma once
#include <QList>
#include <QObject>
#include <QString>
class QByteArray;
class QStringList;
struct AndroidDeviceInfo
{
QString serialNumber;
enum State { OkState, UnAuthorizedState, OfflineState };
State state;
bool unauthorized;
enum AndroidDeviceType { Hardware, Emulator };
AndroidDeviceType type;
static QStringList adbSelector(const QString &serialNumber);
static QString adbPath();
};
class AndroidUtils : public QObject
{
Q_OBJECT
public:
struct FileInfo
{
FileInfo();
enum Type {
File,
Directory
};
Type type;
QString name;
qint64 size;
};
typedef QList<FileInfo> FileInfoList;
enum UpdateType {
PushLocalToDevice,
PullFromDeviceToLocal
};
public:
AndroidUtils();
void reloadAdb();
QString serialNumber() const;
bool runAdb(const QStringList ¶ms, QByteArray *output = 0) const;
FileInfoList ls(const QString &path) const;
bool sameFile(const QString &localPath, const QString &devicePath);
bool updateFile(const QString &localPath, const QString &devicePath, UpdateType updateType);
signals:
void statusMessage(const QString &message);
private slots:
void processReadyRead();
private:
QString m_adbPath;
mutable qint64 m_wait;
mutable QString m_serialNumber;
};
|