Browse Source

Fix Roku input so that keypresses works as expected

Tobias Hieta 8 years ago
parent
commit
77de638336
1 changed files with 6 additions and 7 deletions
  1. 6 7
      src/input/InputRoku.cpp

+ 6 - 7
src/input/InputRoku.cpp

@@ -108,15 +108,10 @@ void InputRoku::handleRequest(QHttpRequest* request, QHttpResponse* response)
   {
     handleQueryDeviceInfo(request, response);
   }
-  else if (path.startsWith("/keypress/") || path.startsWith("/keydown/"))
+  else if (path.startsWith("/keypress/") || path.startsWith("/keydown/") || path.startsWith("/keyup/"))
   {
     handleKeyPress(request, response);
   }
-  else if (path.startsWith("/keyup/"))
-  {
-    response->setStatusCode(qhttp::ESTATUS_OK);
-    response->end();
-  }
   else
   {
     QLOG_WARN() << "Could not handle roku input:" << path;
@@ -206,7 +201,11 @@ void InputRoku::handleKeyPress(QHttpRequest* request, QHttpResponse* response)
     return;
   }
 
-  emit receivedInput("roku", pathsplit.value(2));
+  auto url = request->url().toString();
+  if (url.startsWith("/keydown/") || url.startsWith("/keypress/"))
+    emit receivedInput("roku", pathsplit.value(2), true);
+  if (url.startsWith("/keyup/") || url.startsWith("/keypress/"))
+    emit receivedInput("roku", pathsplit.value(2), false);
 
   response->setStatusCode(qhttp::ESTATUS_OK);
   response->end();