summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-07-22 02:36:26 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2013-07-22 03:19:22 -0400
commitbc17798ef26a56e2df3b2145f3cbccccd53d90a2 (patch)
tree7e1cb7b38214183cc0ed8e56fb349dd2cb4fd763 /Source/Core
parent3c7f223aa10412dcd76d6d79f93250c69f96813a (diff)
InputConfigDiag: Add a simple error status label
This tells you what you did wrong at a high level if you messed up.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/Src/InputConfigDiag.cpp18
-rw-r--r--Source/Core/DolphinWX/Src/InputConfigDiag.h1
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp4
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h1
4 files changed, 21 insertions, 3 deletions
diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp
index 6a740aae45..33471f9d9b 100644
--- a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp
+++ b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp
@@ -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)
{
@@ -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()
@@ -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);
@@ -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();
diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.h b/Source/Core/DolphinWX/Src/InputConfigDiag.h
index 475fa9ed5e..0a355c1d2f 100644
--- a/Source/Core/DolphinWX/Src/InputConfigDiag.h
+++ b/Source/Core/DolphinWX/Src/InputConfigDiag.h
@@ -112,6 +112,7 @@ public:
private:
GamepadPage* const m_parent;
wxStaticText* m_bound_label;
+ wxStaticText* m_error_label;
DeviceQualifier m_devq;
bool GetExpressionForSelectedControl(wxString &expr);
};
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp
index f0870a18a4..d2982bba24 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp
@@ -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);
}
//
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h
index 711f393894..00b4b2c07d 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h
+++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h
@@ -64,6 +64,7 @@ public:
ControlState range;
std::string expression;
const bool is_input;
+ ciface::ExpressionParser::ExpressionParseStatus parse_error;
virtual ~ControlReference() {
delete parsed_expression;