[amarok] backport upstream commit to disable polling (kde#289462)
Rex Dieter
rdieter at fedoraproject.org
Tue Jul 17 00:26:15 UTC 2012
commit ef32d4d89a5e41352476753a52bbfa3747d9f5eb
Author: Rex Dieter <rdieter at fedoraproject.org>
Date: Mon Jul 16 19:28:04 2012 -0500
backport upstream commit to disable polling (kde#289462)
amarok.spec | 10 ++-
..._r92fe9ac171b9920ba65adf244c7dbe23d694d209.diff | 100 ++++++++++++++++++++
2 files changed, 109 insertions(+), 1 deletions(-)
---
diff --git a/amarok.spec b/amarok.spec
index 67c1e2a..10ba019 100644
--- a/amarok.spec
+++ b/amarok.spec
@@ -2,7 +2,7 @@
Name: amarok
Summary: Media player
Version: 2.5.90
-Release: 4%{?dist}
+Release: 5%{?dist}
# KDE e.V. may determine that future GPL versions are accepted
License: GPLv2 or GPLv3
@@ -17,11 +17,15 @@ Patch0: amarok-2.5.0-onlinedoc.patch
#Patch50: amarok-2.2.1.90-qtscript_not_required.patch
## upstream patches
+# liblastfm1 support
# https://git.reviewboard.kde.org/r/105276/
Patch100: amarok-liblastfm1.patch
%if 0%{?fedora} > 17
%define liblastfm1 1
%endif
+# disable polling
+# https://projects.kde.org/projects/extragear/multimedia/amarok/repository/revisions/92fe9ac171b9920ba65adf244c7dbe23d694d209
+Patch101: changeset_r92fe9ac171b9920ba65adf244c7dbe23d694d209.diff
BuildRequires: curl-devel
BuildRequires: desktop-file-utils
@@ -96,6 +100,7 @@ BuildArch: noarch
%if 0%{?liblastfm1}
%patch100 -p1 -b .liblastfm1
%endif
+%patch101 -p1 -b .disable_polling
%build
@@ -184,6 +189,9 @@ fi
%changelog
+* Mon Jul 16 2012 Rex Dieter <rdieter at fedoraproject.org> 2.5.90-5
+- backport upstream commit to disable polling (kde#289462)
+
* Sat Jul 14 2012 Rex Dieter <rdieter at fedoraproject.org> 2.5.90-4
- update kdelibs/phonon dep versions
diff --git a/changeset_r92fe9ac171b9920ba65adf244c7dbe23d694d209.diff b/changeset_r92fe9ac171b9920ba65adf244c7dbe23d694d209.diff
new file mode 100644
index 0000000..db15949
--- /dev/null
+++ b/changeset_r92fe9ac171b9920ba65adf244c7dbe23d694d209.diff
@@ -0,0 +1,100 @@
+commit 92fe9ac171b9920ba65adf244c7dbe23d694d209
+Author: Matěj Laitl <matej at laitl.cz>
+Date: Mon Jun 11 17:00:52 2012 +0200
+
+ MediaDeviceCache: remove polling, solid events should suffice
+
+ This fixes a bug where Amarok (very probably needlessly) polls solid
+ for all devices every single second (!!!) just to detect whether some
+ unmounted paths become mounted or vice versa. This should not be needed
+ at all, solid should notify us about everything.
+
+ Let's hope this doesn't cause subtle bugs, but several people already
+ tested it with success [thanks, Sam]. (probably none of them with older
+ kdelibs though)
+
+ BUG: 289462
+ FIXED-IN: 2.7
+ REVIEW: 105221
+
+diff --git a/src/MediaDeviceCache.cpp b/src/MediaDeviceCache.cpp
+index 15583b8..c9758cd 100644
+--- a/src/MediaDeviceCache.cpp
++++ b/src/MediaDeviceCache.cpp
+@@ -54,10 +54,6 @@ MediaDeviceCache::MediaDeviceCache() : QObject()
+ this, SLOT( slotAddSolidDevice( const QString & ) ) );
+ connect( Solid::DeviceNotifier::instance(), SIGNAL( deviceRemoved( const QString & ) ),
+ this, SLOT( slotRemoveSolidDevice( const QString & ) ) );
+- connect(&m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
+-
+- m_timer.setSingleShot(true);
+- m_timer.start(1000);
+ }
+
+ MediaDeviceCache::~MediaDeviceCache()
+@@ -287,45 +283,6 @@ MediaDeviceCache::slotRemoveSolidDevice( const QString &udi )
+ emit deviceRemoved( udi );
+ }
+
+-void MediaDeviceCache::slotTimeout()
+-{
+- KMountPoint::List possibleMountList = KMountPoint::possibleMountPoints();
+- KMountPoint::List currentMountList = KMountPoint::currentMountPoints();
+- QList<Solid::Device> deviceList = Solid::Device::listFromType( Solid::DeviceInterface::StorageAccess );
+-
+- for (KMountPoint::List::iterator it = possibleMountList.begin(); it != possibleMountList.end(); ++it) {
+- if ((*it)->mountType() == "nfs" || (*it)->mountType() == "nfs4" ||
+- (*it)->mountType() == "smb" || (*it)->mountType() == "cifs") {
+- QString path = (*it)->mountPoint();
+- bool mounted = false;
+- QString udi = QString();
+-
+- foreach( const Solid::Device &device, deviceList )
+- {
+- const Solid::StorageAccess* ssa = device.as<Solid::StorageAccess>();
+- if( ssa && path == ssa->filePath())
+- udi = device.udi();
+- }
+-
+- for (KMountPoint::List::iterator it2 = currentMountList.begin(); it2 != currentMountList.end(); ++it2) {
+- if ( (*it)->mountType() == (*it2)->mountType() &&
+- (*it)->mountPoint() == (*it2)->mountPoint() ) {
+- mounted = true;
+- break;
+- }
+- }
+-
+- if ( m_accessibility[udi] != mounted ) {
+- m_accessibility[udi] = mounted;
+- slotAccessibilityChanged( mounted, udi);
+- }
+- }
+- }
+-
+- m_timer.setSingleShot(true);
+- m_timer.start(1000);
+-}
+-
+ void
+ MediaDeviceCache::slotAccessibilityChanged( bool accessible, const QString &udi )
+ {
+diff --git a/src/MediaDeviceCache.h b/src/MediaDeviceCache.h
+index a48d453..2d5288a 100644
+--- a/src/MediaDeviceCache.h
++++ b/src/MediaDeviceCache.h
+@@ -63,7 +63,6 @@ class AMAROK_EXPORT MediaDeviceCache : public QObject
+ void slotAddSolidDevice( const QString &udi );
+ void slotRemoveSolidDevice( const QString &udi );
+ void slotAccessibilityChanged( bool accessible, const QString &udi );
+- void slotTimeout();
+
+ private:
+ QMap<QString, MediaDeviceCache::DeviceType> m_type;
+@@ -71,7 +70,6 @@ class AMAROK_EXPORT MediaDeviceCache : public QObject
+ QMap<QString, bool> m_accessibility;
+ QStringList m_volumes;
+ static MediaDeviceCache* s_instance;
+- QTimer m_timer;
+ };
+
+ #endif /* AMAROK_MEDIADEVICECACHE_H */
More information about the scm-commits
mailing list