[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdebase/kioslave/media/mediamanager
From: Andreas Kling <kling () impul ! se>
Date: 2006-09-07 18:41:04
Message-ID: 1157654464.847722.15226.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 581852 by kling:
Don't keep a timer firing every 500ms if there's nothing to poll for.
M +9 -4 linuxcdpolling.cpp
M +2 -0 linuxcdpolling.h
--- branches/KDE/3.5/kdebase/kioslave/media/mediamanager/linuxcdpolling.cpp #581851:581852
@@ -23,7 +23,6 @@
#include <qthread.h>
#include <qmutex.h>
-#include <qtimer.h>
#include <qfile.h>
#include <kdebug.h>
@@ -189,9 +188,7 @@
const QString &, bool, bool)),
this, SLOT(slotMediumStateChanged(const QString &)) );
- QTimer *timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
- timer->start(500);
+ connect(&m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
}
LinuxCDPolling::~LinuxCDPolling()
@@ -229,6 +226,7 @@
PollingThread *thread = new PollingThread(dev);
m_threads[id] = thread;
thread->start();
+ m_timer.start(500);
}
}
@@ -268,6 +266,7 @@
PollingThread *thread = new PollingThread(dev);
m_threads[id] = thread;
thread->start();
+ m_timer.start(500);
}
else if (m_threads.contains(id) && medium->isMounted())
{
@@ -283,6 +282,12 @@
{
//kdDebug(1219) << "LinuxCDPolling::slotTimeout()" << endl;
+ if (m_threads.isEmpty())
+ {
+ m_timer.stop();
+ return;
+ }
+
QMap<QString, PollingThread*>::iterator it = m_threads.begin();
QMap<QString, PollingThread*>::iterator end = m_threads.end();
--- branches/KDE/3.5/kdebase/kioslave/media/mediamanager/linuxcdpolling.h #581851:581852
@@ -24,6 +24,7 @@
#include <qobject.h>
#include <qcstring.h>
#include <qmap.h>
+#include <qtimer.h>
class DiscType
{
@@ -79,6 +80,7 @@
QMap<QString, PollingThread*> m_threads;
QStringList m_excludeNotification;
+ QTimer m_timer;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic