InputConfigDiag: Add a simple error status label
This tells you what you did wrong at a high level if you messed up.
This commit is contained in:
parent
3c7f223aa1
commit
bc17798ef2
|
@ -6,6 +6,9 @@
|
||||||
#include "UDPConfigDiag.h"
|
#include "UDPConfigDiag.h"
|
||||||
#include "WxUtils.h"
|
#include "WxUtils.h"
|
||||||
#include "HW/Wiimote.h"
|
#include "HW/Wiimote.h"
|
||||||
|
#include "ControllerInterface/ExpressionParser.h"
|
||||||
|
|
||||||
|
using namespace ciface::ExpressionParser;
|
||||||
|
|
||||||
void GamepadPage::ConfigUDPWii(wxCommandEvent &event)
|
void GamepadPage::ConfigUDPWii(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
|
@ -225,6 +228,18 @@ void ControlDialog::UpdateGUI()
|
||||||
// updates the "bound controls:" label
|
// updates the "bound controls:" label
|
||||||
m_bound_label->SetLabel(wxString::Format(_("Bound Controls: %lu"),
|
m_bound_label->SetLabel(wxString::Format(_("Bound Controls: %lu"),
|
||||||
(unsigned long)control_reference->BoundCount()));
|
(unsigned long)control_reference->BoundCount()));
|
||||||
|
|
||||||
|
switch (control_reference->parse_error)
|
||||||
|
{
|
||||||
|
case EXPRESSION_PARSE_SYNTAX_ERROR:
|
||||||
|
m_error_label->SetLabel("Syntax error");
|
||||||
|
break;
|
||||||
|
case EXPRESSION_PARSE_NO_DEVICE:
|
||||||
|
m_error_label->SetLabel("Device not found");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_error_label->SetLabel("");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void GamepadPage::UpdateGUI()
|
void GamepadPage::UpdateGUI()
|
||||||
|
@ -560,7 +575,9 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent)
|
||||||
|
|
||||||
range_slider->Bind(wxEVT_SCROLL_CHANGED, &GamepadPage::AdjustControlOption, parent);
|
range_slider->Bind(wxEVT_SCROLL_CHANGED, &GamepadPage::AdjustControlOption, parent);
|
||||||
wxStaticText* const range_label = new wxStaticText(this, -1, _("Range"));
|
wxStaticText* const range_label = new wxStaticText(this, -1, _("Range"));
|
||||||
|
|
||||||
m_bound_label = new wxStaticText(this, -1, wxT(""));
|
m_bound_label = new wxStaticText(this, -1, wxT(""));
|
||||||
|
m_error_label = new wxStaticText(this, -1, wxT(""));
|
||||||
|
|
||||||
wxBoxSizer* const range_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* const range_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
range_sizer->Add(range_label, 0, wxCENTER|wxLEFT, 5);
|
range_sizer->Add(range_label, 0, wxCENTER|wxLEFT, 5);
|
||||||
|
@ -579,6 +596,7 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent)
|
||||||
main_szr->Add(textctrl, 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
main_szr->Add(textctrl, 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||||
main_szr->Add(bottom_btns_sizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5);
|
main_szr->Add(bottom_btns_sizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5);
|
||||||
main_szr->Add(m_bound_label, 0, wxCENTER, 0);
|
main_szr->Add(m_bound_label, 0, wxCENTER, 0);
|
||||||
|
main_szr->Add(m_error_label, 0, wxCENTER, 0);
|
||||||
|
|
||||||
UpdateListContents();
|
UpdateListContents();
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ public:
|
||||||
private:
|
private:
|
||||||
GamepadPage* const m_parent;
|
GamepadPage* const m_parent;
|
||||||
wxStaticText* m_bound_label;
|
wxStaticText* m_bound_label;
|
||||||
|
wxStaticText* m_error_label;
|
||||||
DeviceQualifier m_devq;
|
DeviceQualifier m_devq;
|
||||||
bool GetExpressionForSelectedControl(wxString &expr);
|
bool GetExpressionForSelectedControl(wxString &expr);
|
||||||
};
|
};
|
||||||
|
|
|
@ -228,9 +228,7 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference*
|
||||||
ref->parsed_expression = NULL;
|
ref->parsed_expression = NULL;
|
||||||
|
|
||||||
ControlFinder finder(*this, default_device, ref->is_input);
|
ControlFinder finder(*this, default_device, ref->is_input);
|
||||||
ExpressionParseStatus status;
|
ref->parse_error = ParseExpression(ref->expression, finder, &ref->parsed_expression);
|
||||||
status = ParseExpression(ref->expression, finder, &ref->parsed_expression);
|
|
||||||
// XXX: do something with status?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
ControlState range;
|
ControlState range;
|
||||||
std::string expression;
|
std::string expression;
|
||||||
const bool is_input;
|
const bool is_input;
|
||||||
|
ciface::ExpressionParser::ExpressionParseStatus parse_error;
|
||||||
|
|
||||||
virtual ~ControlReference() {
|
virtual ~ControlReference() {
|
||||||
delete parsed_expression;
|
delete parsed_expression;
|
||||||
|
|
Loading…
Reference in New Issue