Merge pull request #5577 from ligfx/separateexpressionparsingandbinding

ControlReference/ExpressionParser: separate parsing from binding
This commit is contained in:
Leo Lam
2017-09-15 19:11:57 +02:00
committed by GitHub
9 changed files with 200 additions and 202 deletions

View File

@ -110,7 +110,7 @@ void IOWindow::CreateMainLayout()
void IOWindow::Update()
{
m_expression_text->setPlainText(QString::fromStdString(m_reference->expression));
m_expression_text->setPlainText(QString::fromStdString(m_reference->GetExpression()));
m_range_spinbox->setValue(m_reference->range * SLIDER_TICK_COUNT);
m_range_slider->setValue(m_reference->range * SLIDER_TICK_COUNT);
@ -164,7 +164,7 @@ void IOWindow::OnDialogButtonPressed(QAbstractButton* button)
return;
}
m_reference->expression = m_expression_text->toPlainText().toStdString();
m_reference->SetExpression(m_expression_text->toPlainText().toStdString());
if (button != m_apply_button)
accept();

View File

@ -27,7 +27,7 @@ static QString EscapeAmpersand(QString&& string)
}
MappingButton::MappingButton(MappingWidget* widget, ControlReference* ref)
: ElidedButton(EscapeAmpersand(QString::fromStdString(ref->expression))), m_parent(widget),
: ElidedButton(EscapeAmpersand(QString::fromStdString(ref->GetExpression()))), m_parent(widget),
m_reference(ref)
{
Connect();
@ -66,7 +66,7 @@ void MappingButton::OnButtonPressed()
if (!expr.isEmpty())
{
m_reference->expression = expr.toStdString();
m_reference->SetExpression(expr.toStdString());
Update();
}
else
@ -78,13 +78,13 @@ void MappingButton::OnButtonPressed()
void MappingButton::OnButtonTimeout()
{
setText(EscapeAmpersand(QString::fromStdString(m_reference->expression)));
setText(EscapeAmpersand(QString::fromStdString(m_reference->GetExpression())));
}
void MappingButton::Clear()
{
m_parent->Update();
m_reference->expression.clear();
m_reference->SetExpression("");
Update();
}
@ -92,7 +92,7 @@ void MappingButton::Update()
{
const auto lock = ControllerEmu::EmulatedController::GetStateLock();
m_reference->UpdateReference(g_controller_interface, m_parent->GetParent()->GetDeviceQualifier());
setText(EscapeAmpersand(QString::fromStdString(m_reference->expression)));
setText(EscapeAmpersand(QString::fromStdString(m_reference->GetExpression())));
m_parent->SaveSettings();
}