Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
InputConfigDiag: Add a simple error status label
This tells you what you did wrong at a high level if you messed up.
  • Loading branch information
magcius committed Jul 22, 2013
1 parent 3c7f223 commit bc17798
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
18 changes: 18 additions & 0 deletions Source/Core/DolphinWX/Src/InputConfigDiag.cpp
Expand Up @@ -6,6 +6,9 @@
#include "UDPConfigDiag.h"
#include "WxUtils.h"
#include "HW/Wiimote.h"
#include "ControllerInterface/ExpressionParser.h"

using namespace ciface::ExpressionParser;

void GamepadPage::ConfigUDPWii(wxCommandEvent &event)
{
Expand Down Expand Up @@ -225,6 +228,18 @@ void ControlDialog::UpdateGUI()
// updates the "bound controls:" label
m_bound_label->SetLabel(wxString::Format(_("Bound Controls: %lu"),
(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()
Expand Down Expand Up @@ -560,7 +575,9 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent)

range_slider->Bind(wxEVT_SCROLL_CHANGED, &GamepadPage::AdjustControlOption, parent);
wxStaticText* const range_label = new wxStaticText(this, -1, _("Range"));

m_bound_label = new wxStaticText(this, -1, wxT(""));
m_error_label = new wxStaticText(this, -1, wxT(""));

wxBoxSizer* const range_sizer = new wxBoxSizer(wxHORIZONTAL);
range_sizer->Add(range_label, 0, wxCENTER|wxLEFT, 5);
Expand All @@ -579,6 +596,7 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent)
main_szr->Add(textctrl, 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 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_error_label, 0, wxCENTER, 0);

UpdateListContents();

Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinWX/Src/InputConfigDiag.h
Expand Up @@ -112,6 +112,7 @@ class ControlDialog : public wxDialog
private:
GamepadPage* const m_parent;
wxStaticText* m_bound_label;
wxStaticText* m_error_label;
DeviceQualifier m_devq;
bool GetExpressionForSelectedControl(wxString &expr);
};
Expand Down
Expand Up @@ -228,9 +228,7 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference*
ref->parsed_expression = NULL;

ControlFinder finder(*this, default_device, ref->is_input);
ExpressionParseStatus status;
status = ParseExpression(ref->expression, finder, &ref->parsed_expression);
// XXX: do something with status?
ref->parse_error = ParseExpression(ref->expression, finder, &ref->parsed_expression);
}

//
Expand Down
Expand Up @@ -64,6 +64,7 @@ class ControllerInterface : public DeviceContainer
ControlState range;
std::string expression;
const bool is_input;
ciface::ExpressionParser::ExpressionParseStatus parse_error;

virtual ~ControlReference() {
delete parsed_expression;
Expand Down

0 comments on commit bc17798

Please sign in to comment.