jsonrpc: send Input.OnInputRequested/OnInputFinished from CGUIDialogNumeric as well
authormontellese <montellese@xbmc.org>
Tue, 10 Jul 2012 13:43:40 +0000 (15:43 +0200)
committermontellese <montellese@xbmc.org>
Tue, 10 Jul 2012 15:22:57 +0000 (17:22 +0200)
xbmc/dialogs/GUIDialogNumeric.cpp
xbmc/dialogs/GUIDialogNumeric.h

index 02a3f04..0443f48 100644 (file)
@@ -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)
index b481f23..7f74cf1 100644 (file)
@@ -54,6 +54,9 @@ public:
   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();