-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclick_lock_settings.h
93 lines (79 loc) · 2.68 KB
/
click_lock_settings.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
/* Copyright (C) 2016 Alik Aslanyan <[email protected]>
* This file is part of DoubleClickFix.
*
* DoubleClickFix 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
* (at your option) any later version.
*
* DoubleClickFix 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 DoubleClickFix. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLICK_LOCK_SETTINGS_H
#define CLICK_LOCK_SETTINGS_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++" // TODO: Refactor
#include <QWidget>
#include <QCloseEvent>
#pragma GCC diagnostic pop
namespace Ui {
class click_lock_settings;
}
struct click_lock_settings_data;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++" // TODO: Refactor
#include <QLineEdit>
#pragma GCC diagnostic pop
#include "widget_input_event_catcher.h"
#include "hotkey.h"
struct click_lock_settings_data
{
double dMouseHoldingDelay;
hotKey hkKey;
bool bHotKeyEnabled;
bool bMouseHoldingEnabled;
click_lock_settings_data() : dMouseHoldingDelay(0.010), hkKey(),
bHotKeyEnabled(false), bMouseHoldingEnabled(false) {}
bool operator!=(click_lock_settings_data &o)
{
auto a = std::tie(dMouseHoldingDelay, hkKey, bHotKeyEnabled, bMouseHoldingEnabled);
auto b = std::tie(o.dMouseHoldingDelay, o.hkKey, o.bHotKeyEnabled, o.bMouseHoldingEnabled);
return a != b;
}
};
#include <tchar.h>
class click_lock_settings : public QWidget
{
Q_OBJECT
public:
explicit click_lock_settings(QWidget *parent, click_lock_settings_data &data);
click_lock_settings(const click_lock_settings&) = delete;
click_lock_settings* operator =(const click_lock_settings&) = delete;
~click_lock_settings();
void showModal();
private:
void closeEvent (QCloseEvent *event);
QString KeyCodesToQString(const QSet<UINT> &qCodes);
Ui::click_lock_settings *ui;
click_lock_settings_data m_Data;
click_lock_settings_data m_UpdatedData;
bool m_bChanged;
bool m_KeyEditingState;
void CheckState();
void UpdateHotKey();
signals:
void closed();
void settingsChanged();
void settingsRestored();
void settingsSaved(click_lock_settings_data &newData);
private slots:
void on_HotKeyEnabled_clicked();
void on_HoldingDelay_valueChanged(double arg1);
void on_MouseHoldActivate_clicked();
};
#endif // CLICK_LOCK_SETTINGS_H