mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-24 14:42:53 +02:00
some further work
This commit is contained in:
@@ -110,13 +110,16 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
|
||||
creds[ "password" ] = msg.value( "password" );
|
||||
creds[ "highQuality" ] = msg.value( "highQuality" );
|
||||
setCredentials( creds );
|
||||
sync();
|
||||
|
||||
qDebug() << "Set creds:" << creds.value( "username" ) << creds.value( "password" ) << msg.value( "username" ) << msg.value( "password" );
|
||||
|
||||
QVariantHash config = configuration();
|
||||
config[ "hasMigrated" ] = true;
|
||||
setConfiguration( config );
|
||||
sync();
|
||||
|
||||
qDebug() << "SET SPOTIFY CREDS:" << credentials().value( "username" ) << credentials().value( "password" );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -226,6 +229,19 @@ SpotifyAccount::saveConfig()
|
||||
|
||||
m_spotifyResolver.data()->sendMessage( msg );
|
||||
}
|
||||
|
||||
m_configWidget.data()->saveSettings();
|
||||
foreach ( SpotifyPlaylist* pl, m_allSpotifyPlaylists )
|
||||
{
|
||||
if ( pl->changed )
|
||||
{
|
||||
pl->changed = false;
|
||||
if ( pl->sync )
|
||||
startPlaylistSync( pl );
|
||||
else
|
||||
stopPlaylistSync( pl );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -295,6 +311,21 @@ SpotifyAccount::sendMessage( const QVariantMap &m, const QString& slot )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccount::startPlaylistSync( SpotifyPlaylist* playlist )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccount::stopPlaylistSync( SpotifyPlaylist* playlist )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccount::loadPlaylists()
|
||||
{
|
||||
@@ -305,10 +336,10 @@ SpotifyAccount::loadPlaylists()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
operator==( Accounts::SpotifyAccount::Sync one, Accounts::SpotifyAccount::Sync two )
|
||||
{
|
||||
if( one.id_ == two.id_ )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
// bool
|
||||
// operator==( Accounts::SpotifyAccount::Sync one, Accounts::SpotifyAccount::Sync two )
|
||||
// {
|
||||
// if( one.id_ == two.id_ )
|
||||
// return true;
|
||||
// return false;
|
||||
// }
|
||||
|
@@ -36,12 +36,12 @@ class SpotifyAccountConfig;
|
||||
|
||||
struct SpotifyPlaylist {
|
||||
QString name, plid, revid;
|
||||
bool sync;
|
||||
bool sync, changed;
|
||||
|
||||
SpotifyPlaylist( const QString& nname, const QString& pid, const QString& rrevid, bool ssync )
|
||||
: name( nname ), plid( pid ), revid( rrevid ), sync( ssync ) {}
|
||||
: name( nname ), plid( pid ), revid( rrevid ), sync( ssync ), changed( false ) {}
|
||||
|
||||
SpotifyPlaylist() : sync( false ) {}
|
||||
SpotifyPlaylist() : sync( false ), changed( false ) {}
|
||||
};
|
||||
|
||||
class SpotifyAccountFactory : public AccountFactory
|
||||
@@ -82,12 +82,12 @@ public:
|
||||
virtual SipPlugin* sipPlugin() { return 0; }
|
||||
|
||||
void addPlaylist( const QString &qid, const QString& title, QList< Tomahawk::query_ptr > tracks );
|
||||
|
||||
/*
|
||||
struct Sync {
|
||||
QString id_;
|
||||
QString uuid;
|
||||
Tomahawk::playlist_ptr playlist;
|
||||
};
|
||||
};*/
|
||||
|
||||
private slots:
|
||||
void resolverMessage( const QString& msgType, const QVariantMap& msg );
|
||||
@@ -99,7 +99,10 @@ private:
|
||||
void loadPlaylists();
|
||||
void sendMessage( const QVariantMap& msg, const QString& slot );
|
||||
|
||||
QList<Sync> m_syncPlaylists;
|
||||
void startPlaylistSync( SpotifyPlaylist* playlist );
|
||||
void stopPlaylistSync( SpotifyPlaylist* playlist );
|
||||
|
||||
// QList<Sync> m_syncPlaylists;
|
||||
QWeakPointer<SpotifyAccountConfig> m_configWidget;
|
||||
QWeakPointer<ScriptResolver> m_spotifyResolver;
|
||||
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2012, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk 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.
|
||||
*
|
||||
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "SpotifyAccountConfig.h"
|
||||
|
||||
#include "SpotifyAccount.h"
|
||||
@@ -35,7 +53,12 @@ SpotifyAccountConfig::saveSettings()
|
||||
{
|
||||
const QListWidgetItem* item = m_ui->playlistList->itemAt( i, 0 );
|
||||
SpotifyPlaylist* pl = item->data( Qt::UserRole ).value< SpotifyPlaylist* >();
|
||||
pl->sync = ( item->checkState() == Qt::Checked );
|
||||
const bool toSync = ( item->checkState() == Qt::Checked );
|
||||
if ( pl->sync != toSync )
|
||||
{
|
||||
pl->changed = true;
|
||||
pl->sync = toSync;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2012, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk 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.
|
||||
*
|
||||
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SPOTIFYACCOUNTCONFIG_H
|
||||
#define SPOTIFYACCOUNTCONFIG_H
|
||||
|
||||
@@ -34,7 +52,7 @@ public:
|
||||
private:
|
||||
Ui::SpotifyConfig* m_ui;
|
||||
SpotifyAccount* m_account;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user