-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsystemfocuswidget.cpp
More file actions
56 lines (47 loc) · 1.49 KB
/
systemfocuswidget.cpp
File metadata and controls
56 lines (47 loc) · 1.49 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
50
51
52
53
54
55
56
#include "systemfocuswidget.h"
#include "ui_systemfocuswidget.h"
SystemFocusWidget::SystemFocusWidget(QWidget *parent) : QWidget(parent), ui(new Ui::SystemFocusWidget){
isOn = false;
recordView = new CurrentRecord;
hotkeys = new QSystemHotkey;
ui->setupUi(this);
hotkeys->addKey(300,MOD_ALT,'X');
hotkeys->addKey(200,MOD_CONTROL,'X');
hotkeys->addKey(500,MOD_ALT,'A');
hotkeys->addKey(400,MOD_CONTROL,'A');
connect(ui->btn,SIGNAL(clicked()),this,SLOT(clickToggle()));
connect(hotkeys,SIGNAL(runHotkey(int)),this,SLOT(emitKey(int)));
}
SystemFocusWidget::~SystemFocusWidget(){
delete ui;
}
void SystemFocusWidget::setRecord(QStringList header, QStringList record){
recordView->setRecord(header, record);
}
void SystemFocusWidget::setSelection(int column){
recordView->setSelection(column);
}
void SystemFocusWidget::clickToggle(){
if(isOn){
emit changeSystemFocus();
isOn = false;
setTitle("Start");
recordView->hide();
QApplication::processEvents();
hotkeys->haltHotkeys();
} else {
emit changeSystemFocus();
isOn = true;
setTitle("Stop");
recordView->show();
recordView->setSelection(0);
QApplication::processEvents();
hotkeys->beginHotkeys();
}
}
void SystemFocusWidget::emitKey(int key){
emit hotkey(key);
}
void SystemFocusWidget::setTitle(QString title){
ui->btn->setText(title);
}