[mythtv] Non-qwerty keyboard patch for MythVideo/lirc

Chris B news at semperpax.com
Mon Sep 15 17:08:23 EDT 2003


Hi,

I had a problem inputing IMDB numbers with my remote in MythVideo.

Looks like QT is (too) smart and QKeyEvent->text() translates to the 
actual key sent Unfortunately, if I ask for a '1' in lircrc, it get 
translated to 'keycode-corresponding-to-1' by QT and  ::text() 
translates it to the primary character, which is not the number on an 
AZERTY keyboard.

I created this (very dumb) patch to solve the problem.
If someone cares to spend more than 5 minutes on this a find a nicer 
way, go ahead :-)

- Chris -
-------------- next part --------------
? .directory
? nohup.out
? mythvideo/.directory

Index: mythvideo/videomanager.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videomanager.cpp,v
retrieving revision 1.18
diff -u -r1.18 videomanager.cpp
--- mythvideo/videomanager.cpp	7 Sep 2003 21:16:14 -0000	1.18
+++ mythvideo/videomanager.cpp	15 Sep 2003 13:38:12 -0000
@@ -157,20 +157,65 @@
         case Key_Escape: exitWin(); break;
         case Key_M: case Key_I: videoMenu(); break;
 
-        case Key_0: 
-        case Key_1: 
-        case Key_2: 
-        case Key_3: 
-        case Key_4: 
-        case Key_5: 
-        case Key_6: 
-        case Key_7: 
+        case Key_0:
+            if(m_state != SHOWING_MAINWINDOW)
+            {
+                num("0");
+            }
+            break;
+        case Key_1:
+            if(m_state != SHOWING_MAINWINDOW)
+            {
+                num("1");
+            }
+            break;
+        case Key_2:
+            if(m_state != SHOWING_MAINWINDOW)
+            {
+                num("2");
+            }
+            break;
+        case Key_3:
+            if(m_state != SHOWING_MAINWINDOW)
+            {
+                num("3");
+            }
+            break;
+        case Key_4:
+            if(m_state != SHOWING_MAINWINDOW)
+            {
+                num("4");
+            }
+            break;
+        case Key_5:
+            if(m_state != SHOWING_MAINWINDOW)
+            {
+                num("5");
+            }
+            break;
+        case Key_6:
+            if(m_state != SHOWING_MAINWINDOW)
+            {
+                num("6");
+            }
+            break;
+        case Key_7:
+            if(m_state != SHOWING_MAINWINDOW)
+            {
+                num("7"); 
+            }
+            break;
         case Key_8: 
+            if(m_state != SHOWING_MAINWINDOW)
+            {
+                num("8"); 
+            }
+            break;
         case Key_9: 
         
             if(m_state != SHOWING_MAINWINDOW)
             {
-                num(e); 
+                num("9"); 
             }
             break;
 
@@ -178,11 +223,11 @@
     }
 }
 
-void VideoManager::num(QKeyEvent *e)
+void VideoManager::num(QString e)
 {
     if (m_state == SHOWING_IMDBMANUAL && curIMDBNum.length() != 7)
     {
-        curIMDBNum = curIMDBNum + e->text();
+        curIMDBNum = curIMDBNum + e;
         update(imdbEnterRect);
         if (curIMDBNum.length() == 7)
         {
Index: mythvideo/videomanager.h
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videomanager.h,v
retrieving revision 1.7
diff -u -r1.7 videomanager.h
--- mythvideo/videomanager.h	7 Sep 2003 20:58:42 -0000	1.7
+++ mythvideo/videomanager.h	15 Sep 2003 13:38:12 -0000
@@ -53,7 +53,7 @@
     void validateUp();
 
   private slots:
-    void num(QKeyEvent *e);
+    void num(QString e);
 
   private:
     bool updateML;


More information about the mythtv-dev mailing list