From 4f84158bdc9b645af2f10c81457f743e173f1265 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Fri, 16 Mar 2012 14:53:34 -0400 Subject: [PATCH] Migrate spotify config to tomahawk, and set up for playlist work --- data/images/spotifycore-logo.png | Bin 0 -> 7082 bytes resources.qrc | 1 + src/CMakeLists.txt | 2 + src/accounts/lastfm/lastfmplugin.h | 2 - src/accounts/spotify/SpotifyAccount.cpp | 75 +++++++++++- src/accounts/spotify/SpotifyAccount.h | 23 ++-- src/accounts/spotify/SpotifyAccountConfig.cpp | 45 +++++++ src/accounts/spotify/SpotifyAccountConfig.h | 41 +++++++ src/accounts/spotify/SpotifyAccountConfig.ui | 112 ++++++++++++------ src/libtomahawk/resolvers/scriptresolver.cpp | 12 ++ src/libtomahawk/resolvers/scriptresolver.h | 3 + src/tomahawkapp.h | 5 - 12 files changed, 265 insertions(+), 56 deletions(-) create mode 100644 data/images/spotifycore-logo.png create mode 100644 src/accounts/spotify/SpotifyAccountConfig.cpp create mode 100644 src/accounts/spotify/SpotifyAccountConfig.h diff --git a/data/images/spotifycore-logo.png b/data/images/spotifycore-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..e52ecc4b9d6d539313ee5d555e798c1389ee6bce GIT binary patch literal 7082 zcma)ARajL|wBK}hcXvrkcXxwG#~}p)<0!_nEz0RX`3c?KXugA-DzyX_l!jTlIp zhKD{0I=#Mp9E3Q9m6HJjUpmS8u0bZBJnkXJSoli3r% zM{l%e@P1-K0Pce&CAk>;(0Tv_@FEsE(5D6Mdqo}nf_EyP{T2ZdfzaoZ@>&BOLJY|I zC(4%svdRdMyew7&;0rQfJ!xlq0O;}n)@&g^76C}!eRco>V4lW6g775;peJ&OQ3RYM zfa+P}SS7&p6+rB$F(d}8@&K>YOdM5#`c|NC1|O>dK*t7N>BU5H0LTG=^%xTq7>LLQ zh?TEQBrmyY@sBy-E0x_K+0HDc6l#vn^B&E_gqN0mMvaV%Si}a=CP$Wcz%QFZAXEr% z_j(EdzN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zcip|!#j&?Q32j> z@8Fp$%@B1=1kJeukRvc z@+E#28?JMNwN0XZ#hPxfVpu~m|828|m<+2?IWtGBS|@Aah;mZ3gtubieEh+_psMQb zC59!Ku|e|O%8l~-L=Rr3Iv%3u;q!qo=DYTkMy!s#dcWQbVz*AEJo`e4z`uFEahTxhi+Q0sWVbETXNM>c=?@IpV} z77uh|P$R+>huN-`W(mywo%e%lYv69Nx^UDqk%Eq; z^`Jb7i3$#gydMRfR%LUjDa%*ASAGPDG4vZ)y))ewTy>)uAN0CecX%xxXk@jpqy7n@bO;gIN@7^CN|>Sm1K5sD){a7M}_BP{Z9% zxzWxw!_=Hd)|Kd$ROW~%T^EvvP602sD_b~cdLb2zkHsmRM%7`VLqt3&3OdhP=Y|RQ zkFlX*xH4^>0;LC=vq>71rBD)=OZWf1)X2IPBW}>P43sx<8!;`Tu5`^mM{=7xPiedX z$`_qbX`iXwC#rM+>CRHvpZBF@2YT^&=R7f`MPqv;^3Eg-9UImy60sYbmTiw)rxWzh zbiahPp#lGJ93ze$$}{de%Al&_$m00+t{q)U=O3&iHnkPO$g2$`aw#fd9n5h7+IA&8%5+c{Yp$ib#H67$i?NE_*s33^ZW~ONjC( zl82Gp!Gy*lZ;2{d{Rf2R-R#dIOTkv^m|%j#t26Vi5v!u_t~f7N6r%5*i?9m>EeUI3 zO4M#!`453CJ=8AEfJYODsj2Nwji87$)I|ga*%2nH;g%}RC+>Ya0n&31NUOx^HAw^l zfz?<#lum@M3GmvN9gNK*_&FZ|T@gSefXE`#|L@&1PsBj2!Ft!r4>%Az#jq{sKw$Ja a1eo94_E-c7wZSh#05v6T#aemmu>S$3cQsQ0 literal 0 HcmV?d00001 diff --git a/resources.qrc b/resources.qrc index ad8118fc5..d3072599e 100644 --- a/resources.qrc +++ b/resources.qrc @@ -135,6 +135,7 @@ data/images/rdio.png data/images/grooveshark.png data/images/lastfm-icon.png + data/images/spotifycore-logo.png data/sql/dbmigrate-27_to_28.sql data/images/process-stop.png diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 669440e86..3a3283d6b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -77,6 +77,7 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui} accounts/lastfm/lastfmplugin.cpp accounts/spotify/SpotifyAccount.cpp + accounts/spotify/SpotifyAccountConfig.cpp tomahawktrayicon.cpp audiocontrols.cpp @@ -98,6 +99,7 @@ SET( tomahawkUI ${tomahawkUI} proxydialog.ui accounts/lastfm/LastFmConfig.ui + accounts/spotify/SpotifyAccountConfig.ui audiocontrols.ui diff --git a/src/accounts/lastfm/lastfmplugin.h b/src/accounts/lastfm/lastfmplugin.h index 00b133a58..b19b0b74e 100644 --- a/src/accounts/lastfm/lastfmplugin.h +++ b/src/accounts/lastfm/lastfmplugin.h @@ -94,5 +94,3 @@ private: } #endif // LASTFMPLUGIN_H - -class A; diff --git a/src/accounts/spotify/SpotifyAccount.cpp b/src/accounts/spotify/SpotifyAccount.cpp index 2c750e75c..2f0b1e820 100644 --- a/src/accounts/spotify/SpotifyAccount.cpp +++ b/src/accounts/spotify/SpotifyAccount.cpp @@ -22,7 +22,8 @@ #include "utils/tomahawkutils.h" #include "playlist/PlaylistUpdaterInterface.h" #include "sourcelist.h" - +#include "SpotifyAccountConfig.h" +#include "resolvers/scriptresolver.h" #include using namespace Tomahawk; @@ -65,14 +66,52 @@ SpotifyAccountFactory::icon() const SpotifyAccount::SpotifyAccount( const QString& accountId ) : ResolverAccount( accountId ) { - + init(); } SpotifyAccount::SpotifyAccount( const QString& accountId, const QString& path ) : ResolverAccount( accountId, path ) { + init(); +} + +void +SpotifyAccount::init() +{ + m_spotifyResolver = dynamic_cast< ScriptResolver* >( m_resolver.data() ); + + connect( m_spotifyResolver.data(), SIGNAL( customMessage( QString,QVariantMap ) ), this, SLOT( resolverMessage( QString, QVariantMap ) ) ); + + const bool hasMigrated = configuration().value( "hasMigrated" ).toBool(); + if ( !hasMigrated ) + { + qDebug() << "Getting credentials from spotify resolver to migrate to in-app config"; + QVariantMap msg; + msg[ "_msgtype" ] = "getCredentials"; + m_spotifyResolver.data()->sendMessage( msg ); + } +} + + +void +SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg ) +{ + if ( msgType == "credentials" ) + { + QVariantHash creds = credentials(); + creds[ "username" ] = msg.value( "username" ); + creds[ "password" ] = msg.value( "password" ); + creds[ "highQuality" ] = msg.value( "highQuality" ); + setCredentials( creds ); + sync(); + + QVariantHash config = configuration(); + config[ "hasMigrated" ] = true; + setConfiguration( config ); + sync(); + } } @@ -86,6 +125,36 @@ SpotifyAccount::icon() const } +QWidget* +SpotifyAccount::configurationWidget() +{ + if ( m_configWidget.isNull() ) + m_configWidget = QWeakPointer< SpotifyAccountConfig >( new SpotifyAccountConfig( this ) ); + else + m_configWidget.data()->loadFromConfig(); + + return static_cast< QWidget* >( m_configWidget.data() ); +} + + +void +SpotifyAccount::saveConfig() +{ + Q_ASSERT( !m_configWidget.isNull() ); + if ( m_configWidget.isNull() ) + return; + + // Send the result to the resolver + QVariantMap msg; + msg[ "_msgtype" ] = "saveSettings"; + msg[ "username" ] = m_configWidget.data()->username(); + msg[ "password" ] = m_configWidget.data()->password(); + msg[ "highQuality" ] = m_configWidget.data()->highQuality(); + + m_spotifyResolver.data()->sendMessage( msg ); +} + + void SpotifyAccount::addPlaylist( const QString &qid, const QString& title, QList< Tomahawk::query_ptr > tracks ) { @@ -140,7 +209,7 @@ SpotifyAccount::addPlaylist( const QString &qid, const QString& title, QList< To bool -operator==( Tomahawk::Accounts::SpotifyAccount::Sync one, Tomahawk::Accounts::SpotifyAccount::Sync two ) +operator==( Accounts::SpotifyAccount::Sync one, Accounts::SpotifyAccount::Sync two ) { if( one.id_ == two.id_ ) return true; diff --git a/src/accounts/spotify/SpotifyAccount.h b/src/accounts/spotify/SpotifyAccount.h index 0bbb5f9b5..4a54da19b 100644 --- a/src/accounts/spotify/SpotifyAccount.h +++ b/src/accounts/spotify/SpotifyAccount.h @@ -27,12 +27,12 @@ class QTimer; +class ScriptResolver; + namespace Tomahawk { - -class ExternalResolverGui; - namespace Accounts { +class SpotifyAccountConfig; class SpotifyAccountFactory : public AccountFactory { @@ -64,6 +64,8 @@ public: virtual ~SpotifyAccount() {} virtual QPixmap icon() const; + virtual QWidget* configurationWidget(); + virtual void saveConfig(); virtual QWidget* aclWidget() { return 0; } virtual InfoSystem::InfoPlugin* infoPlugin() { return 0; } @@ -77,11 +79,18 @@ public: Tomahawk::playlist_ptr playlist; }; -private: - QList m_syncPlaylists; -}; -} +private slots: + void resolverMessage( const QString& msgType, const QVariantMap& msg ); +private: + void init(); + + QList m_syncPlaylists; + QWeakPointer m_configWidget; + QWeakPointer m_spotifyResolver; +}; + +} } #endif // SpotifyAccount_H diff --git a/src/accounts/spotify/SpotifyAccountConfig.cpp b/src/accounts/spotify/SpotifyAccountConfig.cpp new file mode 100644 index 000000000..c39eac08e --- /dev/null +++ b/src/accounts/spotify/SpotifyAccountConfig.cpp @@ -0,0 +1,45 @@ +#include "SpotifyAccountConfig.h" + +#include "SpotifyAccount.h" +#include "ui_SpotifyAccountConfig.h" + +using namespace Tomahawk; +using namespace Accounts; + +SpotifyAccountConfig::SpotifyAccountConfig( SpotifyAccount *account ) + : QWidget( 0 ) + , m_ui( new Ui::SpotifyConfig ) + , m_account( account ) +{ + m_ui->setupUi( this ); + + loadFromConfig(); +} + + +void +SpotifyAccountConfig::loadFromConfig() +{ + m_ui->usernameEdit->setText( m_account->credentials().value( "username" ).toString() ); + m_ui->passwordEdit->setText( m_account->credentials().value( "password" ).toString() ); + m_ui->streamingCheckbox->setChecked( m_account->credentials().value( "highQuality" ).toBool() ); +} + + +QString +SpotifyAccountConfig::username() const +{ + return m_ui->usernameEdit->text().trimmed(); +} + +QString +SpotifyAccountConfig::password() const +{ + return m_ui->passwordEdit->text().trimmed(); +} + +bool +SpotifyAccountConfig::highQuality() const +{ + return m_ui->streamingCheckbox->isChecked(); +} diff --git a/src/accounts/spotify/SpotifyAccountConfig.h b/src/accounts/spotify/SpotifyAccountConfig.h new file mode 100644 index 000000000..da1f4ae60 --- /dev/null +++ b/src/accounts/spotify/SpotifyAccountConfig.h @@ -0,0 +1,41 @@ +#ifndef SPOTIFYACCOUNTCONFIG_H +#define SPOTIFYACCOUNTCONFIG_H + +#include + +namespace Ui +{ + class SpotifyConfig; +} + +namespace Tomahawk +{ +namespace Accounts +{ + +class SpotifyAccount; + +class SpotifyAccountConfig : public QWidget +{ + Q_OBJECT +public: + explicit SpotifyAccountConfig( SpotifyAccount* account ); + + QString username() const; + QString password() const; + bool highQuality() const; + + QStringList playlistsToSync() const; + + void loadFromConfig(); + +private: + Ui::SpotifyConfig* m_ui; + SpotifyAccount* m_account; + +}; + +} +} + +#endif // SPOTIFYACCOUNTCONFIG_H diff --git a/src/accounts/spotify/SpotifyAccountConfig.ui b/src/accounts/spotify/SpotifyAccountConfig.ui index 709a96dc6..d2c377e9e 100644 --- a/src/accounts/spotify/SpotifyAccountConfig.ui +++ b/src/accounts/spotify/SpotifyAccountConfig.ui @@ -6,8 +6,8 @@ 0 0 - 397 - 487 + 457 + 479 @@ -20,21 +20,33 @@ Form - - - - - - - spotify-logo.png - - - Qt::AlignCenter - - - + + 4 + + + + + + 64 + 64 + + + + + + + :/data/images/spotify-logo.png + + + true + + + Qt::AlignCenter + + + @@ -45,7 +57,7 @@ - Configure your Spotify credentials + Configure your Spotify account Qt::PlainText @@ -69,7 +81,10 @@ - placeholderUsername + + + + Username or Facebook Email @@ -83,7 +98,7 @@ - placeholderPw + QLineEdit::Password @@ -95,7 +110,7 @@ - + Qt::Horizontal @@ -113,15 +128,15 @@ Qt::RightToLeft - High Quality Streaming + High Quality Streams - STREAMING_DEFAULT + false - + Qt::Horizontal @@ -135,6 +150,16 @@ + + + + Spotify playlists to keep in sync: + + + + + + @@ -152,11 +177,35 @@ + + + 64 + 64 + + - spotifycore-logo.png + :/data/images/spotifycore-logo.png + + + true + + + + + + + + 9 + + + + This product uses SPOTIFY(R) CORE but is not endorsed, certified or otherwise approved in any way by Spotify. Spotify is the registered trade mark of the Spotify Group. + + + true @@ -175,25 +224,10 @@ - - - - - 9 - - - - This product uses SPOTIFY(R) CORE but is not endorsed, certified or otherwise approved in any way by Spotify. Spotify is the registered trade mark of the Spotify Group. - - - true - - - - + diff --git a/src/libtomahawk/resolvers/scriptresolver.cpp b/src/libtomahawk/resolvers/scriptresolver.cpp index bc72bb1f1..be4b90b04 100644 --- a/src/libtomahawk/resolvers/scriptresolver.cpp +++ b/src/libtomahawk/resolvers/scriptresolver.cpp @@ -144,6 +144,13 @@ ScriptResolver::running() const return !m_stopped; } +void +ScriptResolver::sendMessage( const QVariantMap& map ) +{ + QByteArray data = m_serializer.serialize( map ); + sendMsg( data ); +} + void ScriptResolver::readStderr() @@ -285,6 +292,11 @@ ScriptResolver::handleMsg( const QByteArray& msg ) } } } + else + { + // Unknown message, give up for custom implementations + emit customMessage( msgtype, m ); + } } diff --git a/src/libtomahawk/resolvers/scriptresolver.h b/src/libtomahawk/resolvers/scriptresolver.h index ffe4e5ae5..098df8212 100644 --- a/src/libtomahawk/resolvers/scriptresolver.h +++ b/src/libtomahawk/resolvers/scriptresolver.h @@ -54,8 +54,11 @@ public: virtual bool running() const; + void sendMessage( const QVariantMap& map ); + signals: void terminated(); + void customMessage( const QString& msgType, const QVariantMap& msg ); public slots: virtual void stop(); diff --git a/src/tomahawkapp.h b/src/tomahawkapp.h index dcfe6336d..b9752b15a 100644 --- a/src/tomahawkapp.h +++ b/src/tomahawkapp.h @@ -150,8 +150,3 @@ Q_DECLARE_METATYPE( QPersistentModelIndex ) Q_DECLARE_METATYPE( PairList ) #endif // TOMAHAWKAPP_H - - -struct A; - -struct A;