[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/solid/lirc
From:       Michael Zanetti <michael_zanetti () gmx ! net>
Date:       2010-07-11 11:50:16
Message-ID: 20100711120013.2B0CBAC85F () svn ! kde ! org
[Download RAW message or body]

SVN commit 1148642 by mzanetti:

don't poll for lirc to become available, use KDirWatch to avoid unnecessary wakeups


 M  +5 -7      lircremotecontrolmanager.cpp  
 M  +2 -1      lircremotecontrolmanager.h  


--- trunk/KDE/kdebase/workspace/solid/lirc/lircremotecontrolmanager.cpp #1148641:1148642
@@ -69,16 +69,16 @@
         : RemoteControlManager(parent), d(new LircRemoteControlManagerPrivate())
 {
 
-    m_refreshTimer.setInterval(10000);
-    connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(reconnect()));
+    m_dirWatch.addFile("/var/run/lirc/lircd");
+    m_dirWatch.addFile("/dev/lircd");
+    m_dirWatch.addFile("/tmp/.lircd");
+    connect(&m_dirWatch, SIGNAL(created(QString)), this, SLOT(reconnect()));
+    
     if(d->recacheState()){
       readRemotes();
-    } else {
-        m_refreshTimer.start();
     }
 
     connect(d->m_client, SIGNAL(connectionClosed()), this, SLOT(connectionClosed()));
-//    connect(d->m_client, SIGNAL(remotesRead()), this, SLOT(reconnect())()));
 }
 
 LircRemoteControlManager::~LircRemoteControlManager()
@@ -95,7 +95,6 @@
             foreach(const QString &remote, m_remotes){
                 emit remoteControlAdded(remote);
             }
-            m_refreshTimer.stop();
             emit statusChanged(true);
         }
     }
@@ -109,7 +108,6 @@
         emit remoteControlRemoved(remote);
     }
     readRemotes();
-    m_refreshTimer.start();
     emit statusChanged(false);    
 }
 
--- trunk/KDE/kdebase/workspace/solid/lirc/lircremotecontrolmanager.h #1148641:1148642
@@ -26,6 +26,7 @@
 
 #include <QVariantList>
 #include <QTimer>
+#include <KDirWatch>
 
 class LircRemoteControlManagerPrivate;
 class KDE_EXPORT LircRemoteControlManager : public Solid::Control::Ifaces::RemoteControlManager
@@ -48,7 +49,7 @@
 private:
     LircRemoteControlManagerPrivate * d;
     QStringList m_remotes;
-    QTimer m_refreshTimer;
+    KDirWatch m_dirWatch;
     
     void readRemotes();
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic