From f777561f4a772c1311fad31dcc3f3114d440608e Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 15 Apr 2013 21:21:19 +1000 Subject: [PATCH] Use libmygpo-1.0.7 --- 3rdparty/libmygpo-qt/AddRemoveResult.cpp | 4 +- 3rdparty/libmygpo-qt/AddRemoveResult.h | 2 +- 3rdparty/libmygpo-qt/AddRemoveResult_p.h | 2 +- 3rdparty/libmygpo-qt/ApiRequest.cpp | 17 ++- 3rdparty/libmygpo-qt/ApiRequest.h | 16 +-- 3rdparty/libmygpo-qt/ApiRequest_p.h | 3 +- 3rdparty/libmygpo-qt/CMakeLists.txt | 9 ++ 3rdparty/libmygpo-qt/Config.cpp | 153 +++++++++++++++++++++ 3rdparty/libmygpo-qt/Config.h | 64 +++++++++ 3rdparty/libmygpo-qt/Config_p.h | 58 ++++++++ 3rdparty/libmygpo-qt/Device.cpp | 2 +- 3rdparty/libmygpo-qt/Device.h | 2 +- 3rdparty/libmygpo-qt/DeviceList.cpp | 2 +- 3rdparty/libmygpo-qt/DeviceList.h | 2 +- 3rdparty/libmygpo-qt/DeviceList_p.h | 2 +- 3rdparty/libmygpo-qt/DeviceSyncResult.cpp | 4 +- 3rdparty/libmygpo-qt/DeviceSyncResult.h | 2 +- 3rdparty/libmygpo-qt/DeviceSyncResult_p.h | 2 +- 3rdparty/libmygpo-qt/DeviceUpdates.cpp | 4 +- 3rdparty/libmygpo-qt/DeviceUpdates.h | 2 +- 3rdparty/libmygpo-qt/DeviceUpdates_p.h | 2 +- 3rdparty/libmygpo-qt/Device_p.h | 2 +- 3rdparty/libmygpo-qt/Episode.cpp | 4 +- 3rdparty/libmygpo-qt/Episode.h | 2 +- 3rdparty/libmygpo-qt/EpisodeAction.cpp | 26 +++- 3rdparty/libmygpo-qt/EpisodeAction.h | 6 +- 3rdparty/libmygpo-qt/EpisodeActionList.cpp | 14 +- 3rdparty/libmygpo-qt/EpisodeActionList.h | 2 +- 3rdparty/libmygpo-qt/EpisodeActionList_p.h | 2 +- 3rdparty/libmygpo-qt/EpisodeAction_p.h | 2 +- 3rdparty/libmygpo-qt/EpisodeList.cpp | 4 +- 3rdparty/libmygpo-qt/EpisodeList.h | 2 +- 3rdparty/libmygpo-qt/EpisodeList_p.h | 2 +- 3rdparty/libmygpo-qt/Episode_p.h | 2 +- 3rdparty/libmygpo-qt/JsonCreator.cpp | 78 +++++++++-- 3rdparty/libmygpo-qt/JsonCreator.h | 6 +- 3rdparty/libmygpo-qt/Podcast.cpp | 4 +- 3rdparty/libmygpo-qt/Podcast.h | 2 +- 3rdparty/libmygpo-qt/PodcastList.cpp | 4 +- 3rdparty/libmygpo-qt/PodcastList.h | 2 +- 3rdparty/libmygpo-qt/PodcastList_p.h | 2 +- 3rdparty/libmygpo-qt/Podcast_p.h | 2 +- 3rdparty/libmygpo-qt/RequestHandler.cpp | 12 +- 3rdparty/libmygpo-qt/RequestHandler.h | 5 +- 3rdparty/libmygpo-qt/Settings.cpp | 4 +- 3rdparty/libmygpo-qt/Settings.h | 2 +- 3rdparty/libmygpo-qt/Settings_p.h | 2 +- 3rdparty/libmygpo-qt/Tag.cpp | 2 +- 3rdparty/libmygpo-qt/Tag.h | 2 +- 3rdparty/libmygpo-qt/TagList.cpp | 4 +- 3rdparty/libmygpo-qt/TagList.h | 2 +- 3rdparty/libmygpo-qt/TagList_p.h | 2 +- 3rdparty/libmygpo-qt/Tag_p.h | 2 +- 3rdparty/libmygpo-qt/UrlBuilder.cpp | 5 +- 3rdparty/libmygpo-qt/UrlBuilder.h | 2 +- 3rdparty/libmygpo-qt/Version.h.in | 28 ++++ 3rdparty/libmygpo-qt/mygpo_export.h | 12 +- 57 files changed, 522 insertions(+), 88 deletions(-) create mode 100644 3rdparty/libmygpo-qt/Config.cpp create mode 100644 3rdparty/libmygpo-qt/Config.h create mode 100644 3rdparty/libmygpo-qt/Config_p.h create mode 100644 3rdparty/libmygpo-qt/Version.h.in diff --git a/3rdparty/libmygpo-qt/AddRemoveResult.cpp b/3rdparty/libmygpo-qt/AddRemoveResult.cpp index dcba8ef9a..1127b0391 100644 --- a/3rdparty/libmygpo-qt/AddRemoveResult.cpp +++ b/3rdparty/libmygpo-qt/AddRemoveResult.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -20,7 +20,7 @@ * USA * ***************************************************************************/ -#include +#include #include "AddRemoveResult.h" #include "AddRemoveResult_p.h" diff --git a/3rdparty/libmygpo-qt/AddRemoveResult.h b/3rdparty/libmygpo-qt/AddRemoveResult.h index e2034dcd5..cd3184666 100644 --- a/3rdparty/libmygpo-qt/AddRemoveResult.h +++ b/3rdparty/libmygpo-qt/AddRemoveResult.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/AddRemoveResult_p.h b/3rdparty/libmygpo-qt/AddRemoveResult_p.h index 9d1160aff..cd17cdcfa 100644 --- a/3rdparty/libmygpo-qt/AddRemoveResult_p.h +++ b/3rdparty/libmygpo-qt/AddRemoveResult_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/ApiRequest.cpp b/3rdparty/libmygpo-qt/ApiRequest.cpp index 482307e1e..b3c533f2a 100644 --- a/3rdparty/libmygpo-qt/ApiRequest.cpp +++ b/3rdparty/libmygpo-qt/ApiRequest.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -391,6 +391,16 @@ DeviceSyncResultPtr ApiRequestPrivate::deviceSynchronizationStatus ( const QStri return result; } +DeviceSyncResultPtr ApiRequestPrivate::setDeviceSynchronizationStatus(const QString& username, const QList< QStringList >& synchronize, const QList< QString >& stopSynchronize ) +{ + QString requestUrl = UrlBuilder::getDeviceSynchronizationStatusUrl( username ); + QNetworkReply* reply; + QByteArray data = JsonCreator::deviceSynchronizationListsToJSON( synchronize, stopSynchronize ); + reply = m_requestHandler.postRequest( data, requestUrl ); + DeviceSyncResultPtr result( new DeviceSyncResult( reply ) ); + return result; +} + ApiRequest::ApiRequest( const QString& username, const QString& password, QNetworkAccessManager* nam ) : d( new ApiRequestPrivate( username, password, nam ) ) { } @@ -598,3 +608,8 @@ DeviceSyncResultPtr ApiRequest::deviceSynchronizationStatus ( const QString& use { return d->deviceSynchronizationStatus( username ); } + +DeviceSyncResultPtr ApiRequest::setDeviceSynchronizationStatus(const QString& username, const QList& synchronize, const QList& stopSynchronize ) +{ + return d->setDeviceSynchronizationStatus( username, synchronize, stopSynchronize ); +} diff --git a/3rdparty/libmygpo-qt/ApiRequest.h b/3rdparty/libmygpo-qt/ApiRequest.h index 18be4470d..982db49ba 100644 --- a/3rdparty/libmygpo-qt/ApiRequest.h +++ b/3rdparty/libmygpo-qt/ApiRequest.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -23,10 +23,6 @@ #ifndef LIBMYGPO_QT_APIREQUEST_H #define LIBMYGPO_QT_APIREQUEST_H -#define MYGPO_MAJOR_VERSION 1 -#define MYGPO_MINOR_VERSION 0 -#define MYGPO_PATCH_VERSION 5 - #include "mygpo_export.h" #include "AddRemoveResult.h" #include "EpisodeList.h" @@ -60,9 +56,9 @@ public: ApiRequest( const QString& username, const QString& password, QNetworkAccessManager* nam ); ApiRequest( QNetworkAccessManager* nam ); ~ApiRequest( ); - + //SIMPLE API - + /** * Returns the OPML Result for the Simple API Call "Downloading Podcast Toplists" * @param count The number of Podcasts that should be returned - will be set to to 100 if > 100 or < 1 @@ -87,7 +83,7 @@ public: * */ QNetworkReply* suggestionsOpml( uint count ); - + QNetworkReply* downloadSubscriptionsOpml( const QString& username, const QString& device ); /** @@ -114,7 +110,7 @@ public: * */ QNetworkReply* suggestionsTxt( uint count ); - + QNetworkReply* downloadSubscriptionsTxt( const QString& username, const QString& device ); /** @@ -395,6 +391,8 @@ public: DeviceSyncResultPtr deviceSynchronizationStatus( const QString& username ); + DeviceSyncResultPtr setDeviceSynchronizationStatus( const QString& username, const QList& synchronize, const QList& stopSynchronize ); + private: ApiRequestPrivate* const d; }; diff --git a/3rdparty/libmygpo-qt/ApiRequest_p.h b/3rdparty/libmygpo-qt/ApiRequest_p.h index 2a135d6ee..2936e4dfa 100644 --- a/3rdparty/libmygpo-qt/ApiRequest_p.h +++ b/3rdparty/libmygpo-qt/ApiRequest_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -76,6 +76,7 @@ public: EpisodeActionListPtr episodeActionsByDeviceAndTimestamp( const QString& username, const QString& deviceId, const qulonglong since ); AddRemoveResultPtr uploadEpisodeActions( const QString& username, const QList& episodeActions ); DeviceSyncResultPtr deviceSynchronizationStatus( const QString& username ); + DeviceSyncResultPtr setDeviceSynchronizationStatus( const QString& username, const QList& synchronize, const QList& stopSynchronize ); private: RequestHandler m_requestHandler; }; diff --git a/3rdparty/libmygpo-qt/CMakeLists.txt b/3rdparty/libmygpo-qt/CMakeLists.txt index 6fed7cd74..c09d91448 100644 --- a/3rdparty/libmygpo-qt/CMakeLists.txt +++ b/3rdparty/libmygpo-qt/CMakeLists.txt @@ -1,7 +1,14 @@ +# Extra bits for Clementine. +set( MYGPO_QT_VERSION_MAJOR "1" ) +set( MYGPO_QT_VERSION_MINOR "0" ) +set( MYGPO_QT_VERSION_PATCH "7" ) +configure_file( Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/Version.h ) +include_directories("${QJSON_INCLUDEDIR}/qjson") include_directories( ${QT_INCLUDES} ${QJSON_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) set ( LIBMYGPO_QT_SRC + Config.cpp DeviceSyncResult.cpp Settings.cpp AddRemoveResult.cpp @@ -56,6 +63,7 @@ set ( LIBMYGPO_QT_MOC_H set ( LIBMYGPO_QT_INSTALL_H ApiRequest.h mygpo_export.h + Config.h Podcast.h PodcastList.h Episode.h @@ -77,3 +85,4 @@ QT4_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${LIBMYGPO_QT_MOC_H} ) add_library( mygpo-qt STATIC ${LIBMYGPO_QT_SRC} ${LIBMYGPO_QT_MOC_SRC} ) target_link_libraries( mygpo-qt ${QJSON_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ) +set_target_properties( mygpo-qt PROPERTIES VERSION ${MYGPO_QT_VERSION} SOVERSION ${MYGPO_QT_SONAME} DEFINE_SYMBOL MYGPO_MAKEDLL) diff --git a/3rdparty/libmygpo-qt/Config.cpp b/3rdparty/libmygpo-qt/Config.cpp new file mode 100644 index 000000000..a9ab85978 --- /dev/null +++ b/3rdparty/libmygpo-qt/Config.cpp @@ -0,0 +1,153 @@ +/*************************************************************************** +* This file is part of libmygpo-qt * +* Copyright (c) 2012 - 2013 Stefan Derkits * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Lesser General Public * +* License as published by the Free Software Foundation; either * +* version 2.1 of the License, or (at your option) any later version. * +* * +* This library 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 * +* Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public * +* License along with this library; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * +* USA * +***************************************************************************/ + +#include "Config_p.h" +#include "Version.h" + +#include +#include +#include + +using namespace mygpo; + +Config* Config::s_instance = 0; + +ConfigPrivate::ConfigPrivate( Config* qq ) : q( qq ), m_mygpoBaseUrl( QUrl( QLatin1String( "http://gpodder.net" ) ) ), m_userAgentPrefix( QString() ) +{ + +} + +ConfigPrivate::~ConfigPrivate() +{ + +} + +int ConfigPrivate::majorVersion() const +{ + return MYGPO_QT_VERSION_MAJOR; +} + +int ConfigPrivate::minorVersion() const +{ + return MYGPO_QT_VERSION_MINOR; +} + +int ConfigPrivate::patchVersion() const +{ + return MYGPO_QT_VERSION_PATCH; +} + +QString ConfigPrivate::version() const +{ + return QString( QLatin1String( "%1.%2.%3" ) ).arg( majorVersion() ).arg( minorVersion() ).arg( patchVersion() ); +} + +QUrl ConfigPrivate::mygpoBaseUrl() const +{ + return m_mygpoBaseUrl; +} + +void ConfigPrivate::setMygpoBaseUrl( const QUrl& mygpoBaseUrl ) +{ + this->m_mygpoBaseUrl = mygpoBaseUrl; +} + +QString ConfigPrivate::userAgent() const +{ + QString userAgent; + if ( !m_userAgentPrefix.isEmpty() ) + userAgent = m_userAgentPrefix % QLatin1String( " " ); + userAgent = userAgent % QLatin1String( "libmygpo-qt " ) % version(); + return userAgent; +} + +QString ConfigPrivate::userAgentPrefix() const +{ + return m_userAgentPrefix; +} + +void ConfigPrivate::setUserAgentPrefix( const QString& prefix ) +{ + m_userAgentPrefix = prefix; +} + +Config::Config() : d( new ConfigPrivate( this ) ) +{ + +} + +Config::~Config() +{ + delete d; +} + +int Config::majorVersion() const +{ + return d->majorVersion(); +} + +int Config::minorVersion() const +{ + return d->minorVersion(); +} + +int Config::patchVersion() const +{ + return d->patchVersion(); +} + +QString Config::version() const +{ + return d->version(); +} + +QUrl Config::mygpoBaseUrl() const +{ + return d->mygpoBaseUrl(); +} + +void Config::setMygpoBaseUrl(const QUrl& mygpoBaseUrl) +{ + d->setMygpoBaseUrl( mygpoBaseUrl ); +} + +QString Config::userAgent() const +{ + return d->userAgent(); +} + +QString Config::userAgentPrefix() const +{ + return d->userAgentPrefix(); +} + +void Config::setUserAgentPrefix(const QString& prefix) +{ + d->setUserAgentPrefix( prefix ); +} + +Config* Config::instance() +{ + if ( !s_instance ) { + s_instance = new Config; + } + + return s_instance; +} diff --git a/3rdparty/libmygpo-qt/Config.h b/3rdparty/libmygpo-qt/Config.h new file mode 100644 index 000000000..0a8d69f72 --- /dev/null +++ b/3rdparty/libmygpo-qt/Config.h @@ -0,0 +1,64 @@ +/*************************************************************************** +* This file is part of libmygpo-qt * +* Copyright (c) 2012 - 2013 Stefan Derkits * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Lesser General Public * +* License as published by the Free Software Foundation; either * +* version 2.1 of the License, or (at your option) any later version. * +* * +* This library 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 * +* Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public * +* License along with this library; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * +* USA * +***************************************************************************/ + +#ifndef LIBMYGPO_QT_CONFIG_H +#define LIBMYGPO_QT_CONFIG_H + +#include "mygpo_export.h" + +#include +#include + +namespace mygpo +{ + +class ConfigPrivate; +//TODO: More config entries (mygpo-feedservice baseurl), let class inherit from QObject, set everything as a Property +class MYGPO_EXPORT Config +{ + +public: + static Config* instance(); + + int majorVersion() const; + int minorVersion() const; + int patchVersion() const; + + QString version() const; + + QUrl mygpoBaseUrl() const; + void setMygpoBaseUrl( const QUrl& mygpoBaseUrl ); + + QString userAgent() const; + + QString userAgentPrefix() const; + void setUserAgentPrefix( const QString& prefix ); +private: + Config(); + ~Config(); + + static Config* s_instance; + + ConfigPrivate* const d; +}; + +} + +#endif // LIBMYGPO_QT_CONFIG_H diff --git a/3rdparty/libmygpo-qt/Config_p.h b/3rdparty/libmygpo-qt/Config_p.h new file mode 100644 index 000000000..42920839c --- /dev/null +++ b/3rdparty/libmygpo-qt/Config_p.h @@ -0,0 +1,58 @@ +/*************************************************************************** +* This file is part of libmygpo-qt * +* Copyright (c) 2012 - 2013 Stefan Derkits * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Lesser General Public * +* License as published by the Free Software Foundation; either * +* version 2.1 of the License, or (at your option) any later version. * +* * +* This library 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 * +* Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public * +* License along with this library; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * +* USA * +***************************************************************************/ + +#ifndef LIBMYGPO_QT_CONFIG_PRIVATE_H +#define LIBMYGPO_QT_CONFIG_PRIVATE_H + +#include "Config.h" + +namespace mygpo +{ + +class ConfigPrivate +{ + +public: + ConfigPrivate( Config* qq ); + ~ConfigPrivate(); + + int majorVersion() const; + int minorVersion() const; + int patchVersion() const; + + QString version() const; + + QUrl mygpoBaseUrl() const; + void setMygpoBaseUrl( const QUrl& mygpoBaseUrl ); + + QString userAgent() const; + + QString userAgentPrefix() const; + void setUserAgentPrefix( const QString& prefix ); +private: + Config* q; + QUrl m_mygpoBaseUrl; + QString m_userAgentPrefix; + +}; + +} + +#endif // LIBMYGPO_QT_CONFIG_PRIVATE_H \ No newline at end of file diff --git a/3rdparty/libmygpo-qt/Device.cpp b/3rdparty/libmygpo-qt/Device.cpp index 00724e5d9..6a2c2046d 100644 --- a/3rdparty/libmygpo-qt/Device.cpp +++ b/3rdparty/libmygpo-qt/Device.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Device.h b/3rdparty/libmygpo-qt/Device.h index c1874a433..8519c8d45 100644 --- a/3rdparty/libmygpo-qt/Device.h +++ b/3rdparty/libmygpo-qt/Device.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/DeviceList.cpp b/3rdparty/libmygpo-qt/DeviceList.cpp index 20fae9eb1..46defc258 100644 --- a/3rdparty/libmygpo-qt/DeviceList.cpp +++ b/3rdparty/libmygpo-qt/DeviceList.cpp @@ -22,7 +22,7 @@ #include "DeviceList_p.h" -#include +#include using namespace mygpo; diff --git a/3rdparty/libmygpo-qt/DeviceList.h b/3rdparty/libmygpo-qt/DeviceList.h index c5c7c819b..04109fefe 100644 --- a/3rdparty/libmygpo-qt/DeviceList.h +++ b/3rdparty/libmygpo-qt/DeviceList.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/DeviceList_p.h b/3rdparty/libmygpo-qt/DeviceList_p.h index 5f15c2747..91dfd26f6 100644 --- a/3rdparty/libmygpo-qt/DeviceList_p.h +++ b/3rdparty/libmygpo-qt/DeviceList_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/DeviceSyncResult.cpp b/3rdparty/libmygpo-qt/DeviceSyncResult.cpp index 6ac733b00..b71f05588 100644 --- a/3rdparty/libmygpo-qt/DeviceSyncResult.cpp +++ b/3rdparty/libmygpo-qt/DeviceSyncResult.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2011 Stefan Derkits * +* Copyright (c) 2011 - 2013 Stefan Derkits * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * @@ -20,7 +20,7 @@ #include "DeviceSyncResult_p.h" -#include +#include using namespace mygpo; diff --git a/3rdparty/libmygpo-qt/DeviceSyncResult.h b/3rdparty/libmygpo-qt/DeviceSyncResult.h index fef366f53..82925d24b 100644 --- a/3rdparty/libmygpo-qt/DeviceSyncResult.h +++ b/3rdparty/libmygpo-qt/DeviceSyncResult.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2011 Stefan Derkits * +* Copyright (c) 2011 - 2013 Stefan Derkits * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * diff --git a/3rdparty/libmygpo-qt/DeviceSyncResult_p.h b/3rdparty/libmygpo-qt/DeviceSyncResult_p.h index 5be540c8a..8bcca95fd 100644 --- a/3rdparty/libmygpo-qt/DeviceSyncResult_p.h +++ b/3rdparty/libmygpo-qt/DeviceSyncResult_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2011 Stefan Derkits * +* Copyright (c) 2011 - 2013 Stefan Derkits * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * diff --git a/3rdparty/libmygpo-qt/DeviceUpdates.cpp b/3rdparty/libmygpo-qt/DeviceUpdates.cpp index ff03ca736..c74b52fcb 100644 --- a/3rdparty/libmygpo-qt/DeviceUpdates.cpp +++ b/3rdparty/libmygpo-qt/DeviceUpdates.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,7 +22,7 @@ #include "DeviceUpdates_p.h" -#include +#include using namespace mygpo; diff --git a/3rdparty/libmygpo-qt/DeviceUpdates.h b/3rdparty/libmygpo-qt/DeviceUpdates.h index 7923a58a0..a1308f5b9 100644 --- a/3rdparty/libmygpo-qt/DeviceUpdates.h +++ b/3rdparty/libmygpo-qt/DeviceUpdates.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/DeviceUpdates_p.h b/3rdparty/libmygpo-qt/DeviceUpdates_p.h index ff3054594..18197b31d 100644 --- a/3rdparty/libmygpo-qt/DeviceUpdates_p.h +++ b/3rdparty/libmygpo-qt/DeviceUpdates_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Device_p.h b/3rdparty/libmygpo-qt/Device_p.h index 05d9e2ce6..9ff1c0d3c 100644 --- a/3rdparty/libmygpo-qt/Device_p.h +++ b/3rdparty/libmygpo-qt/Device_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Episode.cpp b/3rdparty/libmygpo-qt/Episode.cpp index 1139b2ce2..921b72f7d 100644 --- a/3rdparty/libmygpo-qt/Episode.cpp +++ b/3rdparty/libmygpo-qt/Episode.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,7 +22,7 @@ #include "Episode_p.h" -#include +#include using namespace mygpo; diff --git a/3rdparty/libmygpo-qt/Episode.h b/3rdparty/libmygpo-qt/Episode.h index fc22b3266..7121f7819 100644 --- a/3rdparty/libmygpo-qt/Episode.h +++ b/3rdparty/libmygpo-qt/Episode.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/EpisodeAction.cpp b/3rdparty/libmygpo-qt/EpisodeAction.cpp index 383634cc1..ad1f0e5e3 100644 --- a/3rdparty/libmygpo-qt/EpisodeAction.cpp +++ b/3rdparty/libmygpo-qt/EpisodeAction.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,13 +22,16 @@ #include "EpisodeAction_p.h" -#include +#include using namespace mygpo; +static qulonglong c_maxlonglong = (2^64)-1; + EpisodeActionPrivate::EpisodeActionPrivate( EpisodeAction* qq, const QVariant& variant, QObject* parent ) : QObject( parent ), q( qq ) { - parse( variant ); + bool valid = parse( variant ); + qq->setProperty("valid", QVariant( valid ) ); } EpisodeActionPrivate::EpisodeActionPrivate( EpisodeAction* qq, const QUrl& podcastUrl, const QUrl& episodeUrl, const QString& deviceName, EpisodeAction::ActionType action, qulonglong timestamp, qulonglong started, qulonglong position, qulonglong total, QObject* parent ) @@ -147,6 +150,11 @@ bool EpisodeActionPrivate::parseActionType( const QString& data ) m_action = EpisodeAction::New; return true; } + else if ( data.compare( QLatin1String( "flattr" ) ) == 0 ) + { + m_action = EpisodeAction::Flattr; + return true; + } else { return false; @@ -222,6 +230,18 @@ EpisodeAction::EpisodeAction( const QUrl& podcastUrl, const QUrl& episodeUrl, co } +EpisodeAction::EpisodeAction(const QUrl& podcastUrl, const QUrl& episodeUrl, const QString& deviceName, EpisodeAction::ActionType action, qulonglong timestamp, qulonglong position, QObject* parent) + : QObject( parent ), d( new EpisodeActionPrivate( this, podcastUrl, episodeUrl, deviceName, action, timestamp, c_maxlonglong, position, c_maxlonglong ) ) +{ + +} + +EpisodeAction::EpisodeAction(const QUrl& podcastUrl, const QUrl& episodeUrl, const QString& deviceName, EpisodeAction::ActionType action, qulonglong timestamp, QObject* parent) + : QObject( parent ), d( new EpisodeActionPrivate( this, podcastUrl, episodeUrl, deviceName, action, timestamp, c_maxlonglong, c_maxlonglong, c_maxlonglong ) ) +{ + +} + EpisodeAction::~EpisodeAction() { delete d; diff --git a/3rdparty/libmygpo-qt/EpisodeAction.h b/3rdparty/libmygpo-qt/EpisodeAction.h index 321761ff8..a7cbdc52e 100644 --- a/3rdparty/libmygpo-qt/EpisodeAction.h +++ b/3rdparty/libmygpo-qt/EpisodeAction.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -49,9 +49,11 @@ class MYGPO_EXPORT EpisodeAction : public QObject Q_PROPERTY( qulonglong total READ total CONSTANT ) public: - enum ActionType { Download, Play, Delete, New }; + enum ActionType { Download, Play, Delete, New, Flattr }; EpisodeAction( const QVariant& variant, QObject* parent = 0 ); EpisodeAction( const QUrl& podcastUrl, const QUrl& episodeUrl, const QString& deviceName, EpisodeAction::ActionType action, qulonglong timestamp, qulonglong started, qulonglong position, qulonglong total, QObject* parent = 0 ); + EpisodeAction( const QUrl& podcastUrl, const QUrl& episodeUrl, const QString& deviceName, EpisodeAction::ActionType action, qulonglong timestamp, qulonglong position, QObject* parent = 0 ); + EpisodeAction( const QUrl& podcastUrl, const QUrl& episodeUrl, const QString& deviceName, EpisodeAction::ActionType action, qulonglong timestamp, QObject* parent = 0 ); virtual ~EpisodeAction(); QUrl podcastUrl() const; diff --git a/3rdparty/libmygpo-qt/EpisodeActionList.cpp b/3rdparty/libmygpo-qt/EpisodeActionList.cpp index 82873c58e..426f0e895 100644 --- a/3rdparty/libmygpo-qt/EpisodeActionList.cpp +++ b/3rdparty/libmygpo-qt/EpisodeActionList.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,7 +22,7 @@ #include "EpisodeActionList_p.h" -#include +#include using namespace mygpo; @@ -72,8 +72,14 @@ bool EpisodeActionListPrivate::parse( const QVariant& data ) foreach( QVariant var, varList ) { QVariant v; - v.setValue ( mygpo::EpisodeActionPtr( new EpisodeAction( var ) ) ); - episodeActionList.append( v ); + EpisodeAction* episodeActionTmpPtr = new EpisodeAction( var ); + if ( episodeActionTmpPtr->property("valid").toBool() ) + { + v.setValue ( mygpo::EpisodeActionPtr( episodeActionTmpPtr ) ); + episodeActionList.append( v ); + } + else + delete episodeActionTmpPtr; } m_episodeActions = QVariant( episodeActionList ); return true; diff --git a/3rdparty/libmygpo-qt/EpisodeActionList.h b/3rdparty/libmygpo-qt/EpisodeActionList.h index e61984a2b..416b536ef 100644 --- a/3rdparty/libmygpo-qt/EpisodeActionList.h +++ b/3rdparty/libmygpo-qt/EpisodeActionList.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/EpisodeActionList_p.h b/3rdparty/libmygpo-qt/EpisodeActionList_p.h index 3ae91c6d7..0e93e9c2e 100644 --- a/3rdparty/libmygpo-qt/EpisodeActionList_p.h +++ b/3rdparty/libmygpo-qt/EpisodeActionList_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/EpisodeAction_p.h b/3rdparty/libmygpo-qt/EpisodeAction_p.h index c27c515c3..760dbff4a 100644 --- a/3rdparty/libmygpo-qt/EpisodeAction_p.h +++ b/3rdparty/libmygpo-qt/EpisodeAction_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/EpisodeList.cpp b/3rdparty/libmygpo-qt/EpisodeList.cpp index e25c9c3ea..e003f2333 100644 --- a/3rdparty/libmygpo-qt/EpisodeList.cpp +++ b/3rdparty/libmygpo-qt/EpisodeList.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,7 +22,7 @@ #include "EpisodeList_p.h" -#include +#include using namespace mygpo; diff --git a/3rdparty/libmygpo-qt/EpisodeList.h b/3rdparty/libmygpo-qt/EpisodeList.h index 3258f7770..b75e33d07 100644 --- a/3rdparty/libmygpo-qt/EpisodeList.h +++ b/3rdparty/libmygpo-qt/EpisodeList.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/EpisodeList_p.h b/3rdparty/libmygpo-qt/EpisodeList_p.h index ddc613aa9..f8153eefa 100644 --- a/3rdparty/libmygpo-qt/EpisodeList_p.h +++ b/3rdparty/libmygpo-qt/EpisodeList_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Episode_p.h b/3rdparty/libmygpo-qt/Episode_p.h index f013954ca..2b84f7817 100644 --- a/3rdparty/libmygpo-qt/Episode_p.h +++ b/3rdparty/libmygpo-qt/Episode_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/JsonCreator.cpp b/3rdparty/libmygpo-qt/JsonCreator.cpp index a701822bf..fc148a0f6 100644 --- a/3rdparty/libmygpo-qt/JsonCreator.cpp +++ b/3rdparty/libmygpo-qt/JsonCreator.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -26,12 +26,14 @@ #include #include -#include +#include #include "JsonCreator.h" using namespace mygpo; +static qulonglong c_maxlonglong = (2^64)-1; + QByteArray JsonCreator::addRemoveSubsToJSON( const QList< QUrl >& add, const QList< QUrl >& remove ) { QJson::Serializer serializer; @@ -70,7 +72,7 @@ QByteArray JsonCreator::episodeActionListToJSON( const QList& return jsonByteArray; } -QByteArray mygpo::JsonCreator::renameDeviceStringToJSON( const QString& caption, const QString& type ) +QByteArray JsonCreator::renameDeviceStringToJSON( const QString& caption, const QString& type ) { QJson::Serializer serializer; QVariantMap jsonData; @@ -83,6 +85,55 @@ QByteArray mygpo::JsonCreator::renameDeviceStringToJSON( const QString& caption, } +QByteArray JsonCreator::deviceSynchronizationListsToJSON(const QList< QStringList >& synchronize, const QList< QString >& stopSynchronize) +{ + QString syncVar; + if (synchronize.size() != 0) + { + syncVar.append(QLatin1String("[")); + foreach( const QStringList& syncEntry, synchronize ) + { + QString syncEntryStr; + if (syncEntry.size() != 0) { + syncEntryStr.append(QLatin1String("[")); + foreach( const QString& str, syncEntry) { + syncEntryStr.append(QString(QLatin1String("\"") + str + QLatin1String("\","))); + } + syncEntryStr.replace(syncEntryStr.size()-1,1,QLatin1String("]")); + } + else { + syncEntryStr.append(QLatin1String("[ ]")); + } + syncVar.append(syncEntryStr); + syncVar.append(QLatin1String(",")); + } + syncVar.replace(syncVar.size()-1,1,QLatin1String("]")); + } + else + { + syncVar.append(QLatin1String("[ ]")); + } + QString stopVar; + if (stopSynchronize.size() != 0) + { + stopVar.append(QLatin1String("[")); + foreach( const QString& str, stopSynchronize) { + stopVar.append(QString(QLatin1String("\"") + str + QLatin1String("\","))); + } + stopVar.replace(stopVar.size()-1,1,QLatin1String("]")); + } + else + { + stopVar.append(QLatin1String("[ ]")); + } + QString jsonStr(QLatin1String("{\"synchronize\" : ")); + jsonStr.append(syncVar); + jsonStr.append(QLatin1String(" ,\"stop-synchronize\" : ")); + jsonStr.append(stopVar); + jsonStr.append(QLatin1String(" }\n")); + return jsonStr.toLocal8Bit(); +} + QVariantList JsonCreator::urlListToQVariantList( const QList< QUrl >& urls ) { QVariantList list; @@ -133,6 +184,8 @@ QVariantMap JsonCreator::episodeActionToQVariantMap( const EpisodeActionPtr epis map.insert( QLatin1String( "action" ), QLatin1String( "play" ) ); else if( actionType == EpisodeAction::Download ) map.insert( QLatin1String( "action" ), QLatin1String( "download" ) ); + else if( actionType == EpisodeAction::Flattr ) + map.insert( QLatin1String( "action" ), QLatin1String( "flattr" ) ); if( episodeAction->timestamp() != 0 ) { #if QT_VERSION >= 0x040700 @@ -145,12 +198,17 @@ QVariantMap JsonCreator::episodeActionToQVariantMap( const EpisodeActionPtr epis #endif map.insert( QLatin1String( "timestamp" ), dateTime.toString(Qt::ISODate) ); } - if( episodeAction->started() != 0 ) - map.insert( QLatin1String( "started" ), episodeAction->started() ); - if( episodeAction->position() != 0 ) - map.insert( QLatin1String( "position" ), episodeAction->position() ); - if( episodeAction->total() != 0 ) - map.insert( QLatin1String( "total" ), episodeAction->total() ); - + if( actionType == EpisodeAction::Play ) + { + if ( episodeAction->position() != c_maxlonglong ) + { + map.insert( QLatin1String( "position" ), episodeAction->position() ); + if ( episodeAction->started() != c_maxlonglong && episodeAction->total() != c_maxlonglong ) + { + map.insert( QLatin1String( "started" ), episodeAction->started() ); + map.insert( QLatin1String( "total" ), episodeAction->total() ); + } + } + } return map; } diff --git a/3rdparty/libmygpo-qt/JsonCreator.h b/3rdparty/libmygpo-qt/JsonCreator.h index 06bab6827..102319a2c 100644 --- a/3rdparty/libmygpo-qt/JsonCreator.h +++ b/3rdparty/libmygpo-qt/JsonCreator.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -27,6 +27,8 @@ #include #include #include +#include + #include "EpisodeAction.h" class QUrl; @@ -43,7 +45,7 @@ public: static QByteArray saveSettingsToJSON( const QMap& set, const QList& remove ); static QByteArray episodeActionListToJSON( const QList& episodeActions ); static QByteArray renameDeviceStringToJSON( const QString& caption, const QString& type ); - + static QByteArray deviceSynchronizationListsToJSON( const QList& synchronize, const QList& stopSynchronize ); private: static QVariantList urlListToQVariantList( const QList& urls ); static QVariantList stringListToQVariantList( const QList& strings ); diff --git a/3rdparty/libmygpo-qt/Podcast.cpp b/3rdparty/libmygpo-qt/Podcast.cpp index 29d878c8c..589505452 100644 --- a/3rdparty/libmygpo-qt/Podcast.cpp +++ b/3rdparty/libmygpo-qt/Podcast.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,7 +22,7 @@ #include "Podcast_p.h" -#include +#include using namespace mygpo; diff --git a/3rdparty/libmygpo-qt/Podcast.h b/3rdparty/libmygpo-qt/Podcast.h index d3be273bf..9905c9a05 100644 --- a/3rdparty/libmygpo-qt/Podcast.h +++ b/3rdparty/libmygpo-qt/Podcast.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/PodcastList.cpp b/3rdparty/libmygpo-qt/PodcastList.cpp index 0bf0c645f..7e2d9c4a4 100644 --- a/3rdparty/libmygpo-qt/PodcastList.cpp +++ b/3rdparty/libmygpo-qt/PodcastList.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,7 +22,7 @@ #include "PodcastList_p.h" -#include +#include using namespace mygpo; diff --git a/3rdparty/libmygpo-qt/PodcastList.h b/3rdparty/libmygpo-qt/PodcastList.h index 8716c9859..e650736f5 100644 --- a/3rdparty/libmygpo-qt/PodcastList.h +++ b/3rdparty/libmygpo-qt/PodcastList.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/PodcastList_p.h b/3rdparty/libmygpo-qt/PodcastList_p.h index 1abf5bef8..07706c199 100644 --- a/3rdparty/libmygpo-qt/PodcastList_p.h +++ b/3rdparty/libmygpo-qt/PodcastList_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Podcast_p.h b/3rdparty/libmygpo-qt/Podcast_p.h index 1a9c84c29..83cbed9c5 100644 --- a/3rdparty/libmygpo-qt/Podcast_p.h +++ b/3rdparty/libmygpo-qt/Podcast_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/RequestHandler.cpp b/3rdparty/libmygpo-qt/RequestHandler.cpp index a5c8e7ddc..dea1a62db 100644 --- a/3rdparty/libmygpo-qt/RequestHandler.cpp +++ b/3rdparty/libmygpo-qt/RequestHandler.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -24,6 +24,7 @@ #include #include "RequestHandler.h" +#include "Config.h" using namespace mygpo; @@ -43,6 +44,7 @@ QNetworkReply* RequestHandler::getRequest( const QString& url ) { QUrl reqUrl( url ); QNetworkRequest request( reqUrl ); + addUserAgent( request ); QNetworkReply* reply = m_nam->get( request ); return reply; } @@ -50,6 +52,7 @@ QNetworkReply* RequestHandler::getRequest( const QString& url ) QNetworkReply* RequestHandler::authGetRequest( const QString& url ) { QNetworkRequest request( url ); + addUserAgent( request ); addAuthData( request ); QNetworkReply* reply = m_nam->get( request ); return reply; @@ -59,7 +62,9 @@ QNetworkReply* RequestHandler::authGetRequest( const QString& url ) QNetworkReply* RequestHandler::postRequest( const QByteArray data, const QString& url ) { QNetworkRequest request( url ); + addUserAgent( request ); addAuthData( request ); + request.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/json")); QNetworkReply* reply = m_nam->post( request, data ); return reply; } @@ -69,3 +74,8 @@ void RequestHandler::addAuthData( QNetworkRequest& request ) QByteArray headerData = "Basic " + QString(m_username + QLatin1String(":") + m_password).toLocal8Bit().toBase64(); request.setRawHeader("Authorization", headerData ); } + +void RequestHandler::addUserAgent( QNetworkRequest &request ) +{ + request.setRawHeader("User-Agent", Config::instance()->userAgent().toAscii() ); +} diff --git a/3rdparty/libmygpo-qt/RequestHandler.h b/3rdparty/libmygpo-qt/RequestHandler.h index 4c58ddfaf..dc2db159e 100644 --- a/3rdparty/libmygpo-qt/RequestHandler.h +++ b/3rdparty/libmygpo-qt/RequestHandler.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -77,7 +77,8 @@ private: QString m_password; QNetworkAccessManager* m_nam; - void addAuthData( QNetworkRequest& url ); + void addAuthData( QNetworkRequest& request ); + void addUserAgent( QNetworkRequest& request ); }; } diff --git a/3rdparty/libmygpo-qt/Settings.cpp b/3rdparty/libmygpo-qt/Settings.cpp index 62d106b6f..a9045d9a1 100644 --- a/3rdparty/libmygpo-qt/Settings.cpp +++ b/3rdparty/libmygpo-qt/Settings.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,7 +22,7 @@ #include "Settings_p.h" -#include +#include using namespace mygpo; diff --git a/3rdparty/libmygpo-qt/Settings.h b/3rdparty/libmygpo-qt/Settings.h index d18c32f5a..0c8c2fdeb 100644 --- a/3rdparty/libmygpo-qt/Settings.h +++ b/3rdparty/libmygpo-qt/Settings.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Settings_p.h b/3rdparty/libmygpo-qt/Settings_p.h index 2e7bccc72..8de1b76bc 100644 --- a/3rdparty/libmygpo-qt/Settings_p.h +++ b/3rdparty/libmygpo-qt/Settings_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Tag.cpp b/3rdparty/libmygpo-qt/Tag.cpp index e7abcd744..035bb7c10 100644 --- a/3rdparty/libmygpo-qt/Tag.cpp +++ b/3rdparty/libmygpo-qt/Tag.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Tag.h b/3rdparty/libmygpo-qt/Tag.h index b35358685..c2c35503a 100644 --- a/3rdparty/libmygpo-qt/Tag.h +++ b/3rdparty/libmygpo-qt/Tag.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/TagList.cpp b/3rdparty/libmygpo-qt/TagList.cpp index 940a4077a..d975a7273 100644 --- a/3rdparty/libmygpo-qt/TagList.cpp +++ b/3rdparty/libmygpo-qt/TagList.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,7 +22,7 @@ #include "TagList_p.h" -#include +#include using namespace mygpo; diff --git a/3rdparty/libmygpo-qt/TagList.h b/3rdparty/libmygpo-qt/TagList.h index 2963644e2..f641307bb 100644 --- a/3rdparty/libmygpo-qt/TagList.h +++ b/3rdparty/libmygpo-qt/TagList.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/TagList_p.h b/3rdparty/libmygpo-qt/TagList_p.h index c2bdc98af..5320241b9 100644 --- a/3rdparty/libmygpo-qt/TagList_p.h +++ b/3rdparty/libmygpo-qt/TagList_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Tag_p.h b/3rdparty/libmygpo-qt/Tag_p.h index 5dcc113f6..441e3c2eb 100644 --- a/3rdparty/libmygpo-qt/Tag_p.h +++ b/3rdparty/libmygpo-qt/Tag_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/UrlBuilder.cpp b/3rdparty/libmygpo-qt/UrlBuilder.cpp index 5ef07e63f..e0ba7649a 100644 --- a/3rdparty/libmygpo-qt/UrlBuilder.cpp +++ b/3rdparty/libmygpo-qt/UrlBuilder.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -22,6 +22,7 @@ #include "UrlBuilder.h" +#include "Config.h" #include #include @@ -29,7 +30,7 @@ using namespace mygpo; -const QString UrlBuilder::s_server = QLatin1String( "http://gpodder.net" ); +const QString UrlBuilder::s_server = Config::instance()->mygpoBaseUrl().toString(); const QString UrlBuilder::s_api2 = QLatin1String( "/api/2" ); const QString UrlBuilder::s_api1 = QLatin1String( "/api/1" ); diff --git a/3rdparty/libmygpo-qt/UrlBuilder.h b/3rdparty/libmygpo-qt/UrlBuilder.h index 46a40e5ba..6f2c2c5d3 100644 --- a/3rdparty/libmygpo-qt/UrlBuilder.h +++ b/3rdparty/libmygpo-qt/UrlBuilder.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * diff --git a/3rdparty/libmygpo-qt/Version.h.in b/3rdparty/libmygpo-qt/Version.h.in new file mode 100644 index 000000000..444d3e9d3 --- /dev/null +++ b/3rdparty/libmygpo-qt/Version.h.in @@ -0,0 +1,28 @@ +/*************************************************************************** +* This file is part of libmygpo-qt * +* Copyright (c) 2012 - 2013 Stefan Derkits * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Lesser General Public * +* License as published by the Free Software Foundation; either * +* version 2.1 of the License, or (at your option) any later version. * +* * +* This library 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 * +* Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public * +* License along with this library; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * +* USA * +***************************************************************************/ + +#ifndef LIBMYGPO_QT_VERSION_H +#define LIBMYGPO_QT_VERSION_H + +#define MYGPO_QT_VERSION_MAJOR ${MYGPO_QT_VERSION_MAJOR} +#define MYGPO_QT_VERSION_MINOR ${MYGPO_QT_VERSION_MINOR} +#define MYGPO_QT_VERSION_PATCH ${MYGPO_QT_VERSION_PATCH} + +#endif // LIBMYGPO_QT_VERSION_H \ No newline at end of file diff --git a/3rdparty/libmygpo-qt/mygpo_export.h b/3rdparty/libmygpo-qt/mygpo_export.h index 7ee1b07b9..d2a8c3a58 100644 --- a/3rdparty/libmygpo-qt/mygpo_export.h +++ b/3rdparty/libmygpo-qt/mygpo_export.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of libmygpo-qt * -* Copyright (c) 2010 - 2011 Stefan Derkits * +* Copyright (c) 2010 - 2013 Stefan Derkits * * Copyright (c) 2010 - 2011 Christian Wagner * * Copyright (c) 2010 - 2011 Felix Winter * * * @@ -25,6 +25,14 @@ #include -#define MYGPO_EXPORT +#ifndef MYGPO_EXPORT +# if defined(MYGPO_MAKEDLL) +/* We are building this library */ +# define MYGPO_EXPORT Q_DECL_EXPORT +# else +/* We are using this library */ +# define MYGPO_EXPORT Q_DECL_IMPORT +# endif +#endif #endif // MYGPO_EXPORT_H