-
Notifications
You must be signed in to change notification settings - Fork 14
/
settingclasses.cpp
39 lines (37 loc) · 1.3 KB
/
settingclasses.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
#include "settingclasses.h"
#include "interface/common.h"
#include "interface/core_commands.h"
#include <SDL.h>
#include <QLabel>
#include <QVBoxLayout>
CustomLineEdit::CustomLineEdit(QWidget *parent)
: QLineEdit(parent)
{
connect(this, &QLineEdit::editingFinished, [=]()
{
int i_value = this->text().toInt();
float f_value = this->text().toFloat();
switch (m_ParamType) {
case M64TYPE_INT:
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toUtf8().constData(), m_ParamType, &i_value);
break;
case M64TYPE_FLOAT:
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toUtf8().constData(), m_ParamType, &f_value);
break;
case M64TYPE_STRING:
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toUtf8().constData(), m_ParamType, this->text().toUtf8().constData());
break;
default:
break;
}
(*ConfigSaveFile)(); });
}
CustomCheckBox::CustomCheckBox(QWidget *parent)
: QCheckBox(parent)
{
connect(this, &QCheckBox::stateChanged, [=](int state)
{
int value = state == Qt::Checked ? 1 : 0;
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toUtf8().constData(), m_ParamType, &value);
(*ConfigSaveFile)(); });
}