Ticket #2844: lirc.diff
File lirc.diff, 2.6 KB (added by , 17 years ago) |
---|
-
libs/libmythui/mythmainwindow.cpp
53 53 54 54 #define GESTURE_TIMEOUT 1000 55 55 56 #ifdef USE_LIRC57 static void *SpawnLirc(void *param)58 {59 QString config_file = MythContext::GetConfDir() + "/lircrc";60 if (!QFile::exists(config_file))61 config_file = QDir::homeDirPath() + "/.lircrc";62 63 LircClient *cl = new LircClient((MythMainWindow *)param);64 if (!cl->Init(config_file, "mythtv"))65 cl->Process();66 67 return NULL;68 }69 #endif70 71 56 #ifdef USE_JOYSTICK_MENU 72 57 static void *SpawnJoystickMenu(void *param) 73 58 { … … 294 279 installEventFilter(this); 295 280 296 281 #ifdef USE_LIRC 297 pthread_t lirc_tid; 298 pthread_attr_t attr; 299 pthread_attr_init(&attr); 300 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); 282 QString lircrc = MythContext::GetConfDir() + "/lircrc"; 283 if (!QFile::exists(lircrc)) 284 lircrc = QDir::homeDirPath() + "/.lircrc"; 301 285 302 pthread_create(&lirc_tid, &attr, SpawnLirc, this); 286 LircClient *lircClient = new LircClient(this); 287 288 if (!lircClient->Init(lircrc, "mythtv")) 289 { 290 lircClient->start(); 291 } else { 292 delete lircClient; 293 } 303 294 #endif 304 295 305 296 #ifdef USE_JOYSTICK_MENU -
libs/libmyth/lirc.cpp
61 61 lirc_freeconfig(lircConfig); 62 62 } 63 63 64 void LircClient:: Process(void)64 void LircClient::run() 65 65 { 66 66 char *code = 0; 67 67 char *ir = 0; … … 105 105 } 106 106 } 107 107 108 108 109 void LircClient::SpawnApp(void) 109 110 { 110 111 // Spawn app to thwap led (or what ever the user has picked if … … 122 123 } 123 124 } 124 125 126 -
libs/libmyth/lirc.h
5 5 #include <qobject.h> 6 6 #include <qsocket.h> 7 7 #include <qstring.h> 8 #include <qthread.h> 8 9 9 10 #include "mythdialogs.h" 10 11 11 class MPUBLIC LircClient : public QObject 12 class MPUBLIC LircClient : public QObject, public QThread 12 13 { 13 14 Q_OBJECT 14 15 public: 15 16 LircClient(QObject *main_window); 16 17 ~LircClient(); 17 18 int Init(const QString &config_file, const QString &program); 18 void Process(void);19 19 20 protected: 21 void run(); 22 20 23 private: 21 24 void SpawnApp(void); 22 25 23 26 struct lirc_config *lircConfig; 24 27 QObject *mainWindow; 25 pthread_t pth;26 28 QString external_app; 27 29 }; 28 30