-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhotkey.h
65 lines (59 loc) · 1.74 KB
/
hotkey.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
/* 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 HOTKEY_H
#define HOTKEY_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++" // TODO: Refactor
#include <QSet>
#pragma GCC diagnostic pop
#include <windows.h>
class hotKey : public QSet<UINT>
{
public:
hotKey() : QSet<UINT>() {}
template<typename INITIALIZER_TYPE>
inline hotKey(const std::initializer_list<INITIALIZER_TYPE> &l) {
for(const INITIALIZER_TYPE &value : l)
{
this->insert(UINT(value));
}
}
inline hotKey(UINT singleKey) : QSet<UINT>() {
this->insert(singleKey);
}
inline const QSet<UINT> toSet() {
return static_cast<QSet<UINT>>(*this);
}
inline const QString toQString() {
QString szReturn;
for(UINT value : this->toSet())
{
szReturn+=QString::number(value)+" ";
}
return szReturn.left(szReturn.size()-1);
}
inline void fromQString(const QString &str)
{
this->clear();
auto list = str.split(" ");
for(auto value : list)
{
this->insert(value.toInt());
}
}
};
#endif // HOTKEY_H