Permalink
Browse files

jsonrpc: send Input.OnInputRequested/OnInputFinished from CGUIDialogN…

…umeric as well
  • Loading branch information...
1 parent 9740905 commit 4c5310b2053919b69946fbeb3d8691a1828d1973 @Montellese committed Jul 10, 2012
Showing with 49 additions and 0 deletions.
  1. +46 −0 xbmc/dialogs/GUIDialogNumeric.cpp
  2. +3 −0 xbmc/dialogs/GUIDialogNumeric.h
@@ -27,6 +27,7 @@
#include "input/XBMC_vkeys.h"
#include "utils/StringUtils.h"
#include "guilib/LocalizeStrings.h"
+#include "interfaces/AnnouncementManager.h"
#define CONTROL_HEADING_LABEL 1
#define CONTROL_INPUT_LABEL 4
@@ -54,6 +55,51 @@ CGUIDialogNumeric::~CGUIDialogNumeric(void)
{
}
+void CGUIDialogNumeric::OnInitWindow()
+{
+ CGUIDialog::OnInitWindow();
+
+ CVariant data;
+ switch (m_mode)
+ {
+ case INPUT_TIME:
+ data["type"] = "time";
+ break;
+ case INPUT_DATE:
+ data["type"] = "date";
+ break;
+ case INPUT_IP_ADDRESS:
+ data["type"] = "ip";
+ break;
+ case INPUT_PASSWORD:
+ data["type"] = "password";
+ break;
+ case INPUT_NUMBER:
+ data["type"] = "number";
+ break;
+ case INPUT_TIME_SECONDS:
+ data["type"] = "seconds";
+ break;
+ default:
+ data["type"] = "keyboard";
+ break;
+ }
+
+ const CGUILabelControl *control = (const CGUILabelControl *)GetControl(CONTROL_HEADING_LABEL);
+ if (control != NULL)
+ data["title"] = control->GetDescription();
+
+ ANNOUNCEMENT::CAnnouncementManager::Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
+}
+
+void CGUIDialogNumeric::OnDeinitWindow(int nextWindowID)
+{
+ // call base class
+ CGUIDialog::OnDeinitWindow(nextWindowID);
+
+ ANNOUNCEMENT::CAnnouncementManager::Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputFinished");
+}
+
bool CGUIDialogNumeric::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_NEXT_ITEM)
@@ -54,6 +54,9 @@ class CGUIDialogNumeric :
static bool ShowAndGetSeconds(CStdString& timeString, const CStdString &heading);
protected:
+ virtual void OnInitWindow();
+ virtual void OnDeinitWindow(int nextWindowID);
+
void OnNumber(unsigned int num);
void VerifyDate(bool checkYear);
void OnNext();

0 comments on commit 4c5310b

Please sign in to comment.