From c137195e04f4882be95227d7fcc2d7b485b04575 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Fri, 30 Aug 2013 14:56:21 +0200 Subject: [PATCH] Make hatchet account plugin Qt5 compatible --- src/accounts/hatchet/account/HatchetAccount.cpp | 5 +++-- src/accounts/hatchet/account/HatchetAccount.h | 8 +++++--- src/accounts/hatchet/sip/WebSocket.cpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/accounts/hatchet/account/HatchetAccount.cpp b/src/accounts/hatchet/account/HatchetAccount.cpp index 2cb606016..8e375389a 100644 --- a/src/accounts/hatchet/account/HatchetAccount.cpp +++ b/src/accounts/hatchet/account/HatchetAccount.cpp @@ -20,6 +20,7 @@ #include #include "HatchetAccountConfig.h" +#include "TomahawkPlugin.h" #include "utils/Closure.h" #include "utils/Logger.h" #include "sip/HatchetSip.h" @@ -116,7 +117,7 @@ AccountConfigWidget* HatchetAccount::configurationWidget() { if ( m_configWidget.isNull() ) - m_configWidget = QWeakPointer( new HatchetAccountConfig( this ) ); + m_configWidget = QPointer( new HatchetAccountConfig( this ) ); return m_configWidget.data(); } @@ -172,7 +173,7 @@ HatchetAccount::sipPlugin() if ( m_tomahawkSipPlugin.isNull() ) { tLog() << Q_FUNC_INFO; - m_tomahawkSipPlugin = QWeakPointer< HatchetSipPlugin >( new HatchetSipPlugin( this ) ); + m_tomahawkSipPlugin = QPointer< HatchetSipPlugin >( new HatchetSipPlugin( this ) ); connect( m_tomahawkSipPlugin.data(), SIGNAL( authUrlDiscovered( Tomahawk::Accounts::HatchetAccount::Service, QString ) ), this, SLOT( authUrlDiscovered( Tomahawk::Accounts::HatchetAccount::Service, QString ) ) ); diff --git a/src/accounts/hatchet/account/HatchetAccount.h b/src/accounts/hatchet/account/HatchetAccount.h index 163d611fe..4d00c9368 100644 --- a/src/accounts/hatchet/account/HatchetAccount.h +++ b/src/accounts/hatchet/account/HatchetAccount.h @@ -40,6 +40,8 @@ class ACCOUNTDLLEXPORT HatchetAccountFactory : public AccountFactory { Q_OBJECT Q_INTERFACES( Tomahawk::Accounts::AccountFactory ) + Q_PLUGIN_METADATA( IID "org.tomahawk-player.Player.AccountFactory" ) + public: HatchetAccountFactory(); virtual ~HatchetAccountFactory(); @@ -48,7 +50,7 @@ public: virtual QString prettyName() const { return "Hatchet"; } virtual QString description() const { return tr( "Connect to your Hatchet account" ); } virtual bool isUnique() const { return true; } - AccountTypes types() const { return AccountTypes( SipType ); }; + AccountTypes types() const { return AccountTypes( SipType ); } // virtual bool allowUserCreation() const { return false; } #ifndef ENABLE_HEADLESS virtual QPixmap icon() const; @@ -111,11 +113,11 @@ private: QVariantMap parseReply( QNetworkReply* reply, bool& ok ) const; - QWeakPointer m_configWidget; + QPointer m_configWidget; Account::ConnectionState m_state; - QWeakPointer< HatchetSipPlugin > m_tomahawkSipPlugin; + QPointer< HatchetSipPlugin > m_tomahawkSipPlugin; QHash< Service, QString > m_extraAuthUrls; static HatchetAccount* s_instance; diff --git a/src/accounts/hatchet/sip/WebSocket.cpp b/src/accounts/hatchet/sip/WebSocket.cpp index 0a536e02b..2e918d389 100644 --- a/src/accounts/hatchet/sip/WebSocket.cpp +++ b/src/accounts/hatchet/sip/WebSocket.cpp @@ -105,7 +105,7 @@ WebSocket::disconnectWs( websocketpp::close::status::value status, const QString error_code ec; if ( m_connection ) { - m_connection->close( status, reason.toAscii().constData(), ec ); + m_connection->close( status, reason.toLatin1().constData(), ec ); QMetaObject::invokeMethod( this, "readOutput", Qt::QueuedConnection ); QTimer::singleShot( 5000, this, SLOT( disconnectSocket() ) ); //safety return;