forked from AntiMicro/antimicro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoprofileinfo.cpp
158 lines (134 loc) · 3.27 KB
/
autoprofileinfo.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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* antimicro Gamepad to KB+M event mapper
* Copyright (C) 2015 Travis Nickles <[email protected]>
*
* This program 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.
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QFileInfo>
#include "autoprofileinfo.h"
AutoProfileInfo::AutoProfileInfo(QString guid, QString profileLocation,
QString exe, bool active, QObject *parent) :
QObject(parent)
{
setGUID(guid);
setProfileLocation(profileLocation);
setExe(exe);
setActive(active);
setDefaultState(false);
}
AutoProfileInfo::AutoProfileInfo(QString guid, QString profileLocation,
bool active, QObject *parent) :
QObject(parent)
{
setGUID(guid);
setProfileLocation(profileLocation);
setActive(active);
setDefaultState(false);
}
AutoProfileInfo::AutoProfileInfo(QObject *parent) :
QObject(parent)
{
setActive(true);
setDefaultState(false);
}
AutoProfileInfo::~AutoProfileInfo()
{
}
void AutoProfileInfo::setGUID(QString guid)
{
this->guid = guid;
}
QString AutoProfileInfo::getGUID()
{
return guid;
}
void AutoProfileInfo::setProfileLocation(QString profileLocation)
{
QFileInfo info(profileLocation);
if (profileLocation != this->profileLocation &&
info.exists() && info.isReadable())
{
this->profileLocation = profileLocation;
}
else if (profileLocation.isEmpty())
{
this->profileLocation = "";
}
}
QString AutoProfileInfo::getProfileLocation()
{
return profileLocation;
}
void AutoProfileInfo::setExe(QString exe)
{
if (!exe.isEmpty())
{
QFileInfo info(exe);
if (exe != this->exe && info.exists() && info.isExecutable())
{
this->exe = exe;
}
#ifdef Q_OS_WIN
else if (exe != this->exe && info.suffix() == "exe")
{
this->exe = exe;
}
#endif
}
else
{
this->exe = exe;
}
}
QString AutoProfileInfo::getExe()
{
return exe;
}
void AutoProfileInfo::setWindowClass(QString windowClass)
{
this->windowClass = windowClass;
}
QString AutoProfileInfo::getWindowClass()
{
return windowClass;
}
void AutoProfileInfo::setWindowName(QString winName)
{
this->windowName = winName;
}
QString AutoProfileInfo::getWindowName()
{
return windowName;
}
void AutoProfileInfo::setActive(bool active)
{
this->active = active;
}
bool AutoProfileInfo::isActive()
{
return active;
}
void AutoProfileInfo::setDefaultState(bool value)
{
this->defaultState = value;
}
bool AutoProfileInfo::isCurrentDefault()
{
return defaultState;
}
void AutoProfileInfo::setDeviceName(QString name)
{
this->deviceName = name;
}
QString AutoProfileInfo::getDeviceName()
{
return deviceName;
}