-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcontrolthread.cpp
More file actions
49 lines (39 loc) · 1.17 KB
/
controlthread.cpp
File metadata and controls
49 lines (39 loc) · 1.17 KB
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
#include "controlthread.h"
ControlThread::ControlThread() {
this->state = true;
recordThread = new RecordThread();
connect(this, SIGNAL(stopRecord()), recordThread, SLOT(stopRecord()));
typedef QList<const Click*> Clicks;
qRegisterMetaType<Clicks>("Clicks");
connect(recordThread, SIGNAL(updateSettings(Clicks)), this, SLOT(updateSettings(Clicks)));
}
void ControlThread::run() {
while(state){
if(GetAsyncKeyState(VK_LCONTROL) & GetAsyncKeyState(VK_SPACE) & 0x8000) {
clickThread = new ClickThread(clicks);
clickThread->start();
clickThread->wait();
delete clickThread;
}
if(GetAsyncKeyState(VK_F5) & 0x8000) {
recordThread->start();
}
if(GetAsyncKeyState(VK_F6) & 0x8000) {
if(recordThread->isRunning()) {
emit stopRecord();
}
}
Sleep(80);
}
this->state = true;
}
void ControlThread::stop() {
emit stopRecord();
this->state = false;
}
void ControlThread::updateSettings(QList<const Click*> clicks) {
this->clicks = clicks;
}
ControlThread::~ControlThread() {
delete recordThread;
}