forked from SmartisanTech/Wrench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adbphonescreenthread.cpp
57 lines (50 loc) · 1.25 KB
/
adbphonescreenthread.cpp
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
#include "wrench.h"
#include "adbphonescreenthread.hpp"
#include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment>
#include <QtCore/QFile>
#include <QtCore/QDir>
#include <cassert>
#include <QtDebug>
#include <QtCore/QThread>
#include "bhj_help.hpp"
#include <QTimer>
AdbPhoneScreenThread::AdbPhoneScreenThread(QObject* parent)
: QThread(parent)
{
mPhoneScreenDialog = (PhoneScreenDialog *)parent;
shouldStop = 0;
paused = 0;
mScreenSyncer = 0;
}
AdbPhoneScreenThread::~AdbPhoneScreenThread()
{
if (mScreenSyncer) {
mScreenSyncer->deleteLater();
}
}
void AdbPhoneScreenThread::stopIt()
{
shouldStop = 1;
}
void AdbPhoneScreenThread::run()
{
mScreenSyncer = new PhoneScreenSyncer();
connect(mScreenSyncer, SIGNAL(phoneScreenUpdate()), mPhoneScreenDialog, SLOT(phoneScreenUpdated()));
connect(this, SIGNAL(dialogShow(bool)), mScreenSyncer, SLOT(startSyncing(bool)));
connect(this, SIGNAL(requestSyncScreen()), mScreenSyncer, SLOT(syncScreen()));
mScreenSyncer->syncScreen();
exec();
}
void AdbPhoneScreenThread::continueLoop()
{
emit dialogShow(true);
}
void AdbPhoneScreenThread::pauseLoop()
{
emit dialogShow(false);
}
void AdbPhoneScreenThread::syncScreen()
{
emit requestSyncScreen();
}