Hello community,

here is the log from the commit of package liblastfm for openSUSE:Factory 
checked in at 2013-11-07 12:53:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/liblastfm (Old)
 and      /work/SRC/openSUSE:Factory/.liblastfm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "liblastfm"

Changes:
--------
--- /work/SRC/openSUSE:Factory/liblastfm/liblastfm.changes      2013-03-07 
07:28:55.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.liblastfm.new/liblastfm.changes 2013-11-07 
12:53:22.000000000 +0100
@@ -1,0 +2,7 @@
+Thu Nov  7 00:38:12 UTC 2013 - [email protected]
+
+- Update to 1.0.8:
+  * Bugfix release, no changelog provided
+  * Ability to build the library against Qt5 (disabled for now)
+
+-------------------------------------------------------------------

Old:
----
  liblastfm-1.0.7.tar.gz

New:
----
  liblastfm-1.0.8.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ liblastfm.spec ++++++
--- /var/tmp/diff_new_pack.zjVU7r/_old  2013-11-07 12:53:22.000000000 +0100
+++ /var/tmp/diff_new_pack.zjVU7r/_new  2013-11-07 12:53:22.000000000 +0100
@@ -20,7 +20,7 @@
 %define _soversion 1
 
 Name:           liblastfm
-Version:        1.0.7
+Version:        1.0.8
 Release:        0
 Summary:        A Qt C++ Library for the Last.fm Webservices
 License:        GPL-3.0+
@@ -66,7 +66,7 @@
 %setup -q
 
 %build
-%cmake_kde4 -d build
+%cmake_kde4 -d build -- -DBUILD_WITH_QT4=ON
 %make_jobs
 
 %install

++++++ liblastfm-1.0.7.tar.gz -> liblastfm-1.0.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/CMakeLists.txt 
new/liblastfm-1.0.8/CMakeLists.txt
--- old/liblastfm-1.0.7/CMakeLists.txt  2013-02-27 10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/CMakeLists.txt  2013-09-03 17:43:03.000000000 +0200
@@ -9,7 +9,7 @@
 
 set(LASTFM_MAJOR_VERSION "1")
 set(LASTFM_MINOR_VERSION "0")
-set(LASTFM_PATCH_VERSION "7")
+set(LASTFM_PATCH_VERSION "8")
 set(LASTFM_VERSION_STRING 
"${LASTFM_MAJOR_VERSION}.${LASTFM_MINOR_VERSION}.${LASTFM_PATCH_VERSION}")
 
 # options
@@ -26,9 +26,17 @@
 
 # setup qt stuff
 set(CMAKE_AUTOMOC ON)
-find_package(Qt5Core QUIET)
+
+option(BUILD_WITH_QT4 "Build liblastfm with Qt4 no matter if Qt5 was found" 
OFF)
+
+if( NOT BUILD_WITH_QT4 )
+    # try Qt5 first, and prefer that if found
+    find_package(Qt5Core QUIET)
+endif()
+
 if(Qt5Core_DIR)
     message(STATUS "Found Qt5! Please keep in mind, this is highly 
experimental and not our main development target..")
+    include_directories(${Qt5Core_INCLUDE_DIRS})
 
 #     macro(qt_wrap_ui)
 #         qt5_wrap_ui(${ARGN})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/README.md 
new/liblastfm-1.0.8/README.md
--- old/liblastfm-1.0.7/README.md       2013-02-27 10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/README.md       2013-09-03 17:43:03.000000000 +0200
@@ -23,7 +23,6 @@
 
 Additionally, to build it you will need:
 
-* Ruby
 * cmake
 
 ## Mac OS X
@@ -36,14 +35,14 @@
 
 Do something like this:
 
-    sudo apt-get install qt4-qmake pkg-config ruby g++ libqt4-dev cmake 
libfftw-dev libsamplerate0-dev
+    sudo apt-get install qt4-qmake pkg-config g++ libqt4-dev cmake libfftw-dev 
libsamplerate0-dev
 
 Please note, we have only tested on Linux, but we think it'll work on all
 varieties of UNIX. If it doesn't, report the bug to eartle on GitHub.
 
 ## Windows
 
-Install Ruby. Install Visual Studio 2008 or higher. Install Qt. Install the
+Install Visual Studio 2008 or higher. Install Qt. Install the
 Windows Server 2003 Platform SDK r2:
 
 
http://www.microsoft.com/Downloads/details.aspx?FamilyID=484269e2-3b89-47e3-8eb7-1f2be6d7123a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/CMakeLists.txt 
new/liblastfm-1.0.8/src/CMakeLists.txt
--- old/liblastfm-1.0.7/src/CMakeLists.txt      2013-02-27 10:01:06.000000000 
+0100
+++ new/liblastfm-1.0.8/src/CMakeLists.txt      2013-09-03 17:43:03.000000000 
+0200
@@ -35,6 +35,7 @@
         RadioTuner.cpp
         RadioStation.cpp
         XmlQuery.cpp
+        Url.cpp
         UrlBuilder.cpp
         misc.cpp
         Chart.cpp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/InternetConnectionMonitor.cpp 
new/liblastfm-1.0.8/src/InternetConnectionMonitor.cpp
--- old/liblastfm-1.0.7/src/InternetConnectionMonitor.cpp       2013-02-27 
10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/InternetConnectionMonitor.cpp       2013-09-03 
17:43:03.000000000 +0200
@@ -131,11 +131,11 @@
 {
     NetworkConnectionMonitor* ncm = 0;
 
-#ifdef Q_WS_X11
+#ifdef Q_OS_X11
     ncm = new LNetworkConnectionMonitor( this );
-#elif defined(Q_WS_WIN) && ! defined __MINGW32__
+#elif defined(Q_OS_WIN) && ! defined __MINGW32__
     ncm = new WNetworkConnectionMonitor( this );
-#elif defined(Q_WS_MAC)
+#elif defined(Q_OS_MAC)
     ncm = new MNetworkConnectionMonitor( this );
 #endif
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/NetworkAccessManager.cpp 
new/liblastfm-1.0.8/src/NetworkAccessManager.cpp
--- old/liblastfm-1.0.7/src/NetworkAccessManager.cpp    2013-02-27 
10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/NetworkAccessManager.cpp    2013-09-03 
17:43:03.000000000 +0200
@@ -23,6 +23,7 @@
 #include "misc.h"
 #include <QCoreApplication>
 #include <QNetworkRequest>
+#include <QNetworkProxyQuery>
 
 class NetworkAccessManagerPrivate
 {
@@ -98,7 +99,7 @@
     if ( d( this )->userProxy.type() != QNetworkProxy::DefaultProxy )
         return d( this )->userProxy;
 
-    QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery( 
request.url() );
+    QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery( 
QNetworkProxyQuery( request.url() ) );
 
     return proxies[0];
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/NetworkAccessManager.h 
new/liblastfm-1.0.8/src/NetworkAccessManager.h
--- old/liblastfm-1.0.7/src/NetworkAccessManager.h      2013-02-27 
10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/NetworkAccessManager.h      2013-09-03 
17:43:03.000000000 +0200
@@ -34,7 +34,7 @@
 {
     Q_OBJECT
 
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
     class InternetConnectionMonitor* m_monitor;
 #endif
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/RadioTuner.cpp 
new/liblastfm-1.0.8/src/RadioTuner.cpp
--- old/liblastfm-1.0.7/src/RadioTuner.cpp      2013-02-27 10:01:06.000000000 
+0100
+++ new/liblastfm-1.0.8/src/RadioTuner.cpp      2013-09-03 17:43:03.000000000 
+0200
@@ -190,7 +190,7 @@
 
     if ( lfm.parse( qobject_cast<QNetworkReply*>(sender()) ) )
     {
-        qDebug() << lfm;
+        qDebug() << "Tune successful!";
 
         d->m_station.setTitle( lfm["station"]["name"].text() );
         d->m_station.setUrl( lfm["station"]["url"].text() );
@@ -221,7 +221,7 @@
 
     if ( lfm.parse( qobject_cast<QNetworkReply*>(sender()) ) )
     {
-        qDebug() << lfm;
+        qDebug() << "Get playlist successful!";
 
         d->m_station.setTitle( lfm["playlist"]["title"].text() );
         // we don't get the radio url in the playlist
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/ScrobbleCache.cpp 
new/liblastfm-1.0.8/src/ScrobbleCache.cpp
--- old/liblastfm-1.0.7/src/ScrobbleCache.cpp   2013-02-27 10:01:06.000000000 
+0100
+++ new/liblastfm-1.0.8/src/ScrobbleCache.cpp   2013-09-03 17:43:03.000000000 
+0200
@@ -148,10 +148,17 @@
             int plays = track.extra( "playCount" ).toInt( &ok );
             if ( !ok ) plays = 1;
 
-            for ( int i = 0 ; i < plays ; ++i )
-                d->m_tracks += track;
-
+            // Add the track that the app is sharing and set it's scrobble 
status
+            d->m_tracks += track;
             MutableTrack( track ).setScrobbleStatus( Track::Cached );
+
+            // now add any duplicate plays as clones that are all 1 second 
apart
+            for ( int i = 1 ; i < plays ; ++i )
+            {
+                MutableTrack mt = MutableTrack( track.clone() );
+                mt.setTimeStamp( mt.timestamp().addSecs( -i ) );
+                d->m_tracks += mt;
+            }
         }
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/Track.cpp 
new/liblastfm-1.0.8/src/Track.cpp
--- old/liblastfm-1.0.7/src/Track.cpp   2013-02-27 10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/Track.cpp   2013-09-03 17:43:03.000000000 +0200
@@ -100,15 +100,38 @@
     return *this;
 }
 
-
-class lastfm::TrackData : public QObject, public QSharedData
+class TrackObject : public QObject
 {
     Q_OBJECT
+public:
+    TrackObject( lastfm::TrackData& data ) : m_data( data ) {;}
+
+public:
+    void forceLoveToggled( bool love );
+    void forceScrobbleStatusChanged();
+    void forceCorrected( QString correction );
+
+private slots:
+    void onLoveFinished();
+    void onUnloveFinished();
+    void onGotInfo();
+
+signals:
+    void loveToggled( bool love );
+    void scrobbleStatusChanged( short scrobbleStatus );
+    void corrected( QString correction );
+
+private:
+    lastfm::TrackData& m_data;
+};
+
+class lastfm::TrackData : public QSharedData
+{
+    friend class TrackObject;
 
-    friend class Track;
-    friend class MutableTrack;
 public:
     TrackData();
+    ~TrackData();
 
 public:
     lastfm::Artist artist;
@@ -151,23 +174,11 @@
     bool podcast;
     bool video;
 
-private:
-    void forceLoveToggled( bool love );
-    void forceScrobbleStatusChanged();
-    void forceCorrected( QString correction );
-
-private slots:
-    void onLoveFinished();
-    void onUnloveFinished();
-    void onGotInfo();
-
-signals:
-    void loveToggled( bool love );
-    void scrobbleStatusChanged( short scrobbleStatus );
-    void corrected( QString correction );
+    TrackObject* trackObject;
 };
 
 
+
 lastfm::TrackData::TrackData()
              : trackNumber( 0 ),
                duration( 0 ),
@@ -180,7 +191,14 @@
                null( false ),
                podcast( false ),
                video( false )
-{}
+{
+    trackObject = new TrackObject( *this );
+}
+
+lastfm::TrackData::~TrackData()
+{
+    delete trackObject;
+}
 
 lastfm::Track::Track()
     :AbstractType()
@@ -266,45 +284,45 @@
 }
 
 void
-lastfm::TrackData::onLoveFinished()
+TrackObject::onLoveFinished()
 {
-    XmlQuery lfm;
+    lastfm::XmlQuery lfm;
 
     if ( lfm.parse( static_cast<QNetworkReply*>(sender()) ) )
     {
         if ( lfm.attribute( "status" ) == "ok")
-            loved = Track::Loved;
+            m_data.loved = lastfm::Track::Loved;
 
     }
 
-    emit loveToggled( loved == Track::Loved );
+    emit loveToggled( m_data.loved == lastfm::Track::Loved );
 }
 
 
 void
-lastfm::TrackData::onUnloveFinished()
+TrackObject::onUnloveFinished()
 {
-    XmlQuery lfm;
+    lastfm::XmlQuery lfm;
 
     if ( lfm.parse( static_cast<QNetworkReply*>(sender()) ) )
     {
         if ( lfm.attribute( "status" ) == "ok")
-            loved = Track::Unloved;
+            m_data.loved = lastfm::Track::Unloved;
     }
 
-    emit loveToggled( loved == Track::Loved );
+    emit loveToggled( m_data.loved == lastfm::Track::Loved );
 }
 
 void
-lastfm::TrackData::onGotInfo()
+TrackObject::onGotInfo()
 {
-    Observer observer;
+    lastfm::TrackData::Observer observer;
 
-    for ( int i = 0 ; i < observers.count() ; ++i )
+    for ( int i = 0 ; i < m_data.observers.count() ; ++i )
     {
-        if ( observers.at( i ).reply == sender() )
+        if ( m_data.observers.at( i ).reply == sender() )
         {
-            observer = observers.takeAt( i );
+            observer = m_data.observers.takeAt( i );
             break;
         }
     }
@@ -317,27 +335,25 @@
 
     if ( lfm.parse( data ) )
     {
-        qDebug() << lfm;
-
         QString imageUrl = lfm["track"]["image size=small"].text();
-        if ( !imageUrl.isEmpty() ) m_images[AbstractType::SmallImage] = 
imageUrl;
+        if ( !imageUrl.isEmpty() ) 
m_data.m_images[lastfm::AbstractType::SmallImage] = imageUrl;
         imageUrl = lfm["track"]["image size=medium"].text();
-        if ( !imageUrl.isEmpty() ) m_images[AbstractType::MediumImage] = 
imageUrl;
+        if ( !imageUrl.isEmpty() ) 
m_data.m_images[lastfm::AbstractType::MediumImage] = imageUrl;
         imageUrl = lfm["track"]["image size=large"].text();
-        if ( !imageUrl.isEmpty() ) m_images[AbstractType::LargeImage] = 
imageUrl;
+        if ( !imageUrl.isEmpty() ) 
m_data.m_images[lastfm::AbstractType::LargeImage] = imageUrl;
         imageUrl = lfm["track"]["image size=extralarge"].text();
-        if ( !imageUrl.isEmpty() ) m_images[AbstractType::ExtraLargeImage] = 
imageUrl;
+        if ( !imageUrl.isEmpty() ) 
m_data.m_images[lastfm::AbstractType::ExtraLargeImage] = imageUrl;
         imageUrl = lfm["track"]["image size=mega"].text();
-        if ( !imageUrl.isEmpty() ) m_images[AbstractType::MegaImage] = 
imageUrl;
+        if ( !imageUrl.isEmpty() ) 
m_data.m_images[lastfm::AbstractType::MegaImage] = imageUrl;
 
         if ( lfm["track"]["userloved"].text().length() > 0 )
-            loved = lfm["track"]["userloved"].text() == "0" ? Track::Unloved : 
Track::Loved;
+            m_data.loved = lfm["track"]["userloved"].text() == "0" ? 
lastfm::Track::Unloved : lastfm::Track::Loved;
 
         if ( observer.receiver )
             if ( !QMetaObject::invokeMethod( observer.receiver, 
observer.method, Q_ARG(QByteArray, data) ) )
                 QMetaObject::invokeMethod( observer.receiver, observer.method 
);
 
-        emit loveToggled( loved == Track::Loved );
+        emit loveToggled( m_data.loved == lastfm::Track::Loved );
     }
     else
     {
@@ -348,19 +364,19 @@
 }
 
 void
-lastfm::TrackData::forceLoveToggled( bool love )
+TrackObject::forceLoveToggled( bool love )
 {
     emit loveToggled( love );
 }
 
 void
-lastfm::TrackData::forceScrobbleStatusChanged()
+TrackObject::forceScrobbleStatusChanged()
 {
-    emit scrobbleStatusChanged( scrobbleStatus );
+    emit scrobbleStatusChanged( m_data.scrobbleStatus );
 }
 
 void
-lastfm::TrackData::forceCorrected( QString correction )
+TrackObject::forceCorrected( QString correction )
 {
     emit corrected( correction );
 }
@@ -377,6 +393,16 @@
 {
 }
 
+
+lastfm::Track
+lastfm::Track::clone() const
+{
+    Track clone = *this;
+    clone.d.detach();
+    return clone;
+}
+
+
 QDomElement
 lastfm::Track::toDomElement( QDomDocument& xml ) const
 {
@@ -592,7 +618,7 @@
     if ( lfm["track"]["userloved"].text().length() > 0)
         d->loved = lfm["track"]["userloved"].text() == "0" ? Unloved : Loved;
 
-    d->forceLoveToggled( d->loved == Loved );
+    d->trackObject->forceLoveToggled( d->loved == Loved );
 }
 
 void
@@ -713,8 +739,6 @@
     // this is so the web services knows whether to use corrections or not
     if (!lastfm::ws::SessionKey.isEmpty()) map["sk"] = lastfm::ws::SessionKey;
 
-    qDebug() << map;
-
     QNetworkReply* reply = ws::get( map );
 
     TrackData::Observer observer;
@@ -723,7 +747,7 @@
     observer.reply = reply;
     d->observers << observer;
 
-    QObject::connect( reply, SIGNAL(finished()), d.data(), SLOT(onGotInfo()));
+    QObject::connect( reply, SIGNAL(finished()), d->trackObject, 
SLOT(onGotInfo()));
 }
 
 
@@ -794,8 +818,6 @@
     if ( !album().isNull() ) map["album"] = album();
     map["context"] = extra("playerId");
 
-    qDebug() << map;
-
     return ws::post(map);
 }
 
@@ -805,8 +827,6 @@
     QMap<QString, QString> map;
     map["method"] = "track.removeNowPlaying";
 
-    qDebug() << map;
-
     return ws::post(map);
 }
 
@@ -822,8 +842,6 @@
     if ( !d->album.title().isEmpty() ) map["album"] = d->album.title();
     map["chosenByUser"] = source() == Track::LastFmRadio ? "0" : "1";
 
-    qDebug() << map;
-
     return ws::post(map);
 }
 
@@ -846,8 +864,6 @@
         map["chosenByUser[" + QString::number(i) + "]"] = tracks[i].source() 
== Track::LastFmRadio ? "0" : "1";
     }
 
-    qDebug() << map;
-
     return ws::post(map);
 }
 
@@ -891,7 +907,7 @@
 const QObject*
 lastfm::Track::signalProxy() const
 {
-    return d.data();
+    return d->trackObject;
 }
 
 bool
@@ -1029,7 +1045,7 @@
     d->correctedAlbum = Album( artist, album );
     d->correctedAlbumArtist = albumArtist;
 
-    d->forceCorrected( toString() );
+    d->trackObject->forceCorrected( toString() );
 }
 
 lastfm::MutableTrack::MutableTrack()
@@ -1115,8 +1131,11 @@
 void
 lastfm::MutableTrack::setScrobbleStatus( ScrobbleStatus scrobbleStatus )
 {
-    d->scrobbleStatus = scrobbleStatus;
-    d->forceScrobbleStatusChanged();
+    if ( scrobbleStatus != d->scrobbleStatus )
+    {
+        d->scrobbleStatus = scrobbleStatus;
+        d->trackObject->forceScrobbleStatusChanged();
+    }
 }
 
 void
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/Track.h 
new/liblastfm-1.0.8/src/Track.h
--- old/liblastfm-1.0.7/src/Track.h     2013-02-27 10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/Track.h     2013-09-03 17:43:03.000000000 +0200
@@ -118,6 +118,8 @@
     Track( const Track& that );
     ~Track();
 
+    Track clone() const;
+
     /** this track and that track point to the same object, so they are the 
same
       * in fact. This doesn't do a deep data comparison. So even if all the 
       * fields are the same it will return false if they aren't in fact spawned
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/Url.cpp 
new/liblastfm-1.0.8/src/Url.cpp
--- old/liblastfm-1.0.7/src/Url.cpp     1970-01-01 01:00:00.000000000 +0100
+++ new/liblastfm-1.0.8/src/Url.cpp     2013-09-03 17:43:03.000000000 +0200
@@ -0,0 +1,87 @@
+/*
+   Copyright 2009 Last.fm Ltd. 
+      - Primarily authored by Max Howell, Jono Cole and Doug Mansell
+
+   This file is part of liblastfm.
+
+   liblastfm is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   liblastfm is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with liblastfm.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "Url.h"
+
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+#include <QUrlQuery>
+#endif
+
+class lastfm::UrlPrivate
+{
+    public:
+        UrlPrivate( const QUrl& url );
+        QUrl url;
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+        QUrlQuery query;
+#endif
+};
+
+lastfm::UrlPrivate::UrlPrivate( const QUrl& u )
+    : url( u )
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+    , query( u.query() )
+#endif
+{
+}
+
+lastfm::Url::Url( const QUrl& url )
+    :d( new UrlPrivate( url ) )
+{
+}
+
+lastfm::Url::~Url()
+{
+    delete d;
+}
+
+void
+lastfm::Url::addQueryItem( const QString& key, const QString& value )
+{
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+    d->query.addQueryItem( key, value );
+    d->url.setQuery( d->query );
+#else
+    d->url.addQueryItem( key, value );
+#endif
+}
+
+QUrl
+lastfm::Url::operator()()
+{
+    return url();
+}
+
+lastfm::Url&
+lastfm::Url::operator=( const lastfm::Url& that )
+{
+    d->url = that.d->url;
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+    d->query = that.d->query;
+#endif
+    return *this;
+}
+
+
+QUrl
+lastfm::Url::url() const
+{
+    return d->url;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/Url.h 
new/liblastfm-1.0.8/src/Url.h
--- old/liblastfm-1.0.7/src/Url.h       1970-01-01 01:00:00.000000000 +0100
+++ new/liblastfm-1.0.8/src/Url.h       2013-09-03 17:43:03.000000000 +0200
@@ -0,0 +1,46 @@
+/*
+   Copyright 2009-2010 Last.fm Ltd.
+      - Primarily authored by Max Howell, Jono Cole, Doug Mansell and Michael 
Coffey
+
+   This file is part of liblastfm.
+
+   liblastfm is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   liblastfm is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with liblastfm.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#pragma once
+
+#include "global.h"
+
+#include <QUrl>
+
+
+namespace lastfm
+{
+    class LASTFM_DLLEXPORT Url
+    {
+    public:
+        explicit Url( const QUrl& url );
+        ~Url();
+
+        void addQueryItem( const QString& key, const QString& value );
+
+        QUrl url() const;
+
+        QUrl operator()();
+        Url& operator=( const Url& that );
+
+    private:
+        class UrlPrivate * const d;
+    };
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/fingerprint/CMakeLists.txt 
new/liblastfm-1.0.8/src/fingerprint/CMakeLists.txt
--- old/liblastfm-1.0.7/src/fingerprint/CMakeLists.txt  2013-02-27 
10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/fingerprint/CMakeLists.txt  2013-09-03 
17:43:03.000000000 +0200
@@ -1,5 +1,5 @@
 
-find_package(Qt4 COMPONENTS QtCore QtSql REQUIRED)
+#find_package(Qt4 COMPONENTS QtCore QtSql REQUIRED)
 #FIXME: find modules are horrible, port them to 
find_package_handle_standard_args
 find_package(LibSamplerate REQUIRED)
 find_package(LibFFTW3 REQUIRED)
@@ -40,6 +40,8 @@
     SOVERSION ${LASTFM_SOVERSION}
 )
 
+qt5_use_modules(lastfm_fingerprint Network Sql Xml)
+
 install(TARGETS lastfm_fingerprint
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/fingerprint/Fingerprint.cpp 
new/liblastfm-1.0.8/src/fingerprint/Fingerprint.cpp
--- old/liblastfm-1.0.7/src/fingerprint/Fingerprint.cpp 2013-02-27 
10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/fingerprint/Fingerprint.cpp 2013-09-03 
17:43:03.000000000 +0200
@@ -24,12 +24,16 @@
 #include "Sha256.h"
 #include "fplib/FingerprintExtractor.h"
 #include "ws.h"
+#include "Url.h"
 #include <QDebug>
 #include <QFileInfo>
 #include <QNetworkAccessManager>
 #include <QNetworkRequest>
 #include <QNetworkReply>
 #include <QStringList>
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+    #include <QUrlQuery>
+#endif
 #include <fstream>
 
 #include "User.h"
@@ -248,6 +252,7 @@
     return n ? QByteArray::number( n ) : "";
 }
 
+
 QNetworkReply*
 lastfm::Fingerprint::submit() const
 {    
@@ -263,27 +268,25 @@
     QString const path = t.url().toLocalFile();
     QFileInfo const fi( path );
 
-    #define e( x ) QUrl::toPercentEncoding( x )
-    QUrl url( "http://ws.audioscrobbler.com/fingerprint/query/"; );
-    url.addEncodedQueryItem( "username", e(lastfm::User().name()) );
-    url.addEncodedQueryItem( "artist", e(t.artist()) );
-    url.addEncodedQueryItem( "album", e(t.album()) );
-    url.addEncodedQueryItem( "track", e(t.title()) );
-    url.addEncodedQueryItem( "duration", number( d->m_duration > 0 ? 
d->m_duration : t.duration() ) );
-    url.addEncodedQueryItem( "mbid", e(t.mbid()) );
-    url.addEncodedQueryItem( "filename", e(fi.completeBaseName()) );
-    url.addEncodedQueryItem( "fileextension", e(fi.completeSuffix()) );
-    url.addEncodedQueryItem( "tracknum", number( t.trackNumber() ) );
-    url.addEncodedQueryItem( "sha256", sha256( path ).toAscii() );
-    url.addEncodedQueryItem( "time", 
number(QDateTime::currentDateTime().toTime_t()) );
-    url.addEncodedQueryItem( "fpversion", 
QByteArray::number((int)fingerprint::FingerprintExtractor::getVersion()) );
-    url.addEncodedQueryItem( "fulldump", d->m_complete ? "true" : "false" );
-    url.addEncodedQueryItem( "noupdate", "false" );
-    #undef e
+    lastfm::Url url( QUrl( "http://ws.audioscrobbler.com/fingerprint/query/"; ) 
);
+    url.addQueryItem( "username", lastfm::User().name() );
+    url.addQueryItem( "artist", t.artist() );
+    url.addQueryItem( "album", t.album() );
+    url.addQueryItem( "track", t.title() );
+    url.addQueryItem( "duration", number( d->m_duration > 0 ? d->m_duration : 
t.duration() ) );
+    url.addQueryItem( "mbid", t.mbid() );
+    url.addQueryItem( "filename", fi.completeBaseName() );
+    url.addQueryItem( "fileextension", fi.completeSuffix() );
+    url.addQueryItem( "tracknum", number( t.trackNumber() ) );
+    url.addQueryItem( "sha256", sha256( path ) );
+    url.addQueryItem( "time", number(QDateTime::currentDateTime().toTime_t()) 
);
+    url.addQueryItem( "fpversion", 
QByteArray::number((int)fingerprint::FingerprintExtractor::getVersion()) );
+    url.addQueryItem( "fulldump", d->m_complete ? "true" : "false" );
+    url.addQueryItem( "noupdate", "false" );
 
     //FIXME: talk to mir about submitting fplibversion
 
-    QNetworkRequest request( url );
+    QNetworkRequest request( url.url() );
     request.setHeader( QNetworkRequest::ContentTypeHeader, 
"multipart/form-data; boundary=----------------------------8e61d618ca16" );
 
     QByteArray bytes;
@@ -295,7 +298,7 @@
     bytes += "\r\n";
     bytes += "------------------------------8e61d618ca16--\r\n";
 
-    qDebug() << url;
+    qDebug() << url.url();
     qDebug() << "Fingerprint size:" << bytes.size() << "bytes";
 
     return lastfm::nam()->post( request, bytes );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/mac/MNetworkConnectionMonitor.h 
new/liblastfm-1.0.8/src/mac/MNetworkConnectionMonitor.h
--- old/liblastfm-1.0.7/src/mac/MNetworkConnectionMonitor.h     2013-02-27 
10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/mac/MNetworkConnectionMonitor.h     2013-09-03 
17:43:03.000000000 +0200
@@ -23,7 +23,7 @@
 
 #include "../NetworkConnectionMonitor.h"
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 #include <SystemConfiguration/SCNetwork.h> //TODO remove
 #include <SystemConfiguration/SCNetworkReachability.h>
 #endif
@@ -42,7 +42,7 @@
 private slots:
 
 private:
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     static void callback( SCNetworkReachabilityRef target,
                           SCNetworkConnectionFlags flags,
                           void *info );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/mac/ProxyDict.h 
new/liblastfm-1.0.8/src/mac/ProxyDict.h
--- old/liblastfm-1.0.7/src/mac/ProxyDict.h     2013-02-27 10:01:06.000000000 
+0100
+++ new/liblastfm-1.0.8/src/mac/ProxyDict.h     2013-09-03 17:43:03.000000000 
+0200
@@ -19,7 +19,6 @@
 */
 #include <SystemConfiguration/SystemConfiguration.h>
 
-
 struct ProxyDict
 {
     ProxyDict();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/misc.cpp 
new/liblastfm-1.0.8/src/misc.cpp
--- old/liblastfm-1.0.7/src/misc.cpp    2013-02-27 10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/misc.cpp    2013-09-03 17:43:03.000000000 +0200
@@ -27,7 +27,7 @@
 #endif
 
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 #include <CoreFoundation/CoreFoundation.h>
 
 QDir
@@ -60,9 +60,9 @@
             return QString::fromLocal8Bit( path );
     }
     return QDir::home();
-#elif defined(Q_WS_MAC)
+#elif defined(Q_OS_MAC)
     return QDir::home().filePath( "Library/Application Support" );
-#elif defined(Q_WS_X11)
+#elif defined(Q_OS_X11)
     return QDir::home().filePath( ".local/share" );
 #else
     return QDir::home();
@@ -80,7 +80,7 @@
 QDir
 lastfm::dir::logs()
 {
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     return QDir::home().filePath( "Library/Logs/Last.fm" );
 #else
     return runtimeData();    
@@ -91,7 +91,7 @@
 QDir
 lastfm::dir::cache()
 {
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     return QDir::home().filePath( "Library/Caches/Last.fm" );
 #else
     return runtimeData().filePath( "cache" );
@@ -124,7 +124,7 @@
 }
 #endif
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 CFStringRef
 lastfm::QStringToCFString( const QString &s )
 {
@@ -159,7 +159,7 @@
 const char*
 lastfm::platform()
 {
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
     switch (QSysInfo::WindowsVersion)
     {
         case QSysInfo::WV_32s:        return "Windows 3.1 with Win32s";
@@ -182,7 +182,7 @@
 
         default:                      return "Unknown";
     }
-#elif defined Q_WS_MAC
+#elif defined Q_OS_MAC
     switch (QSysInfo::MacintoshVersion)
     {
         case QSysInfo::MV_Unknown:    return "Unknown Mac";
@@ -199,7 +199,7 @@
 
         default:                      return "Unknown";
     }
-#elif defined Q_WS_X11
+#elif defined Q_OS_X11
     return "UNIX X11";
 #else
     return "Unknown";
@@ -213,7 +213,7 @@
     return QString::fromLatin1( digest.toHex() ).rightJustified( 32, '0' 
).toLower();
 }
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 QString
 lastfm::CFStringToQString( CFStringRef s )
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/misc.h 
new/liblastfm-1.0.8/src/misc.h
--- old/liblastfm-1.0.7/src/misc.h      2013-02-27 10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/misc.h      2013-09-03 17:43:03.000000000 +0200
@@ -23,7 +23,7 @@
 #include "global.h"
 #include <QDir>
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 typedef const struct __CFString* CFStringRef;
 #endif
 
@@ -31,10 +31,10 @@
 {
     namespace dir
     {
-    #ifdef Q_WS_WIN
+    #ifdef Q_OS_WIN
         LASTFM_DLLEXPORT QDir programFiles();
     #endif
-    #ifdef Q_WS_MAC
+    #ifdef Q_OS_MAC
         LASTFM_DLLEXPORT QDir bundle();
     #endif
         LASTFM_DLLEXPORT QDir runtimeData();
@@ -42,7 +42,7 @@
         LASTFM_DLLEXPORT QDir logs();
     }
    
-#ifdef Q_WS_MAC 
+#ifdef Q_OS_MAC 
     LASTFM_DLLEXPORT QByteArray CFStringToUtf8( CFStringRef );
     LASTFM_DLLEXPORT CFStringRef QStringToCFString( const QString& );
     LASTFM_DLLEXPORT QString CFStringToQString( CFStringRef s );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/liblastfm-1.0.7/src/ws.cpp 
new/liblastfm-1.0.8/src/ws.cpp
--- old/liblastfm-1.0.7/src/ws.cpp      2013-02-27 10:01:06.000000000 +0100
+++ new/liblastfm-1.0.8/src/ws.cpp      2013-09-03 17:43:03.000000000 +0200
@@ -20,6 +20,7 @@
 #include "ws.h"
 #include "misc.h"
 #include "NetworkAccessManager.h"
+#include "Url.h"
 
 #include <QCoreApplication>
 #include <QDomDocument>
@@ -31,10 +32,6 @@
 #include <QMutex>
 #include <QSslSocket>
 
-#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
-    #include <QUrlQuery>
-#endif
-
 static lastfm::ws::Scheme theScheme = lastfm::ws::Http;
 static QMap< QThread*, QNetworkAccessManager* > threadNamHash;
 static QSet< QThread* > ourNamSet;
@@ -155,21 +152,17 @@
 lastfm::ws::url( QMap<QString, QString> params, bool sk )
 {
     lastfm::ws::sign( params, sk );
-    QUrl url = ::baseUrl();
+    lastfm::Url url = lastfm::Url( ::baseUrl() );
     // Qt setQueryItems doesn't encode a bunch of stuff, so we do it manually
     QMapIterator<QString, QString> i( params );
     while (i.hasNext()) {
         i.next();
-        QByteArray const key = QUrl::toPercentEncoding( i.key() );
-        QByteArray const value = QUrl::toPercentEncoding( i.value() );
-#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
-        QUrlQuery(url).addQueryItem( key, value );
-#else
-        url.addEncodedQueryItem( key, value );
-#endif
+        QString const key = i.key();
+        QString const value = i.value();
+        url.addQueryItem( key, value );
     }
 
-    return url;
+    return url.url();
 }
 
 

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to