From 1468d3c0dc1cd86d43e189b3ded6caf831ee3adb Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sun, 18 Mar 2012 15:45:55 -0400 Subject: [PATCH] Add beginning of spotify playlist updater --- src/CMakeLists.txt | 1 + .../spotify/SpotifyPlaylistUpdater.cpp | 61 +++++++++++++++++++ src/accounts/spotify/SpotifyPlaylistUpdater.h | 61 +++++++++++++++++++ src/tomahawkapp.cpp | 1 + 4 files changed, 124 insertions(+) create mode 100644 src/accounts/spotify/SpotifyPlaylistUpdater.cpp create mode 100644 src/accounts/spotify/SpotifyPlaylistUpdater.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3a3283d6b..177127d02 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -78,6 +78,7 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui} accounts/spotify/SpotifyAccount.cpp accounts/spotify/SpotifyAccountConfig.cpp + accounts/spotify/SpotifyPlaylistUpdater.cpp tomahawktrayicon.cpp audiocontrols.cpp diff --git a/src/accounts/spotify/SpotifyPlaylistUpdater.cpp b/src/accounts/spotify/SpotifyPlaylistUpdater.cpp new file mode 100644 index 000000000..1c7958125 --- /dev/null +++ b/src/accounts/spotify/SpotifyPlaylistUpdater.cpp @@ -0,0 +1,61 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2010-2012, Leo Franchi + * + * 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 . + */ + +#include "SpotifyPlaylistUpdater.h" + +SpotifyPlaylistUpdater::SpotifyPlaylistUpdater(const Tomahawk::playlist_ptr& pl): PlaylistUpdaterInterface(pl) +{ + +} + + +SpotifyPlaylistUpdater::~SpotifyPlaylistUpdater() +{ + +} + +void +SpotifyPlaylistUpdater::loadFromSettings( const QString& group ) +{ + +} + +void +SpotifyPlaylistUpdater::removeFromSettings( const QString& group ) const +{ + +} + + +void +SpotifyPlaylistUpdater::saveToSettings( const QString& group ) const +{ + +} + + +QString +SpotifyPlaylistUpdater::type() const +{ + return QString(); +} + +void +SpotifyPlaylistUpdater::updateNow() +{ +} diff --git a/src/accounts/spotify/SpotifyPlaylistUpdater.h b/src/accounts/spotify/SpotifyPlaylistUpdater.h new file mode 100644 index 000000000..fc29a4d3f --- /dev/null +++ b/src/accounts/spotify/SpotifyPlaylistUpdater.h @@ -0,0 +1,61 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2010-2012, Leo Franchi + * + * 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 . + */ + +#ifndef SPOTIFYPLAYLISTUPDATER_H +#define SPOTIFYPLAYLISTUPDATER_H + +#include "playlist/PlaylistUpdaterInterface.h" + +namespace Tomahawk { +namespace Accounts { + class SpotifyAccount; +} +} + + +class SpotifyPlaylistUpdater : public Tomahawk::PlaylistUpdaterInterface +{ + Q_OBJECT +public: + SpotifyPlaylistUpdater( const Tomahawk::playlist_ptr& pl ); + + virtual ~SpotifyPlaylistUpdater(); + + virtual QString type() const; + virtual void updateNow(); + +protected: + virtual void removeFromSettings(const QString& group) const; + virtual void saveToSettings(const QString& group) const; + virtual void loadFromSettings(const QString& group); + +private: + Tomahawk::Accounts::SpotifyAccount* m_spotify; +}; + + +class SpotifyUpdaterFactory : public Tomahawk::PlaylistUpdaterFactory +{ +public: + SpotifyUpdaterFactory() {} + + virtual Tomahawk::PlaylistUpdaterInterface* create( const Tomahawk::playlist_ptr& pl ) { return new SpotifyPlaylistUpdater( pl ); } + virtual QString type() const { return "spotify"; } +}; + +#endif // SPOTIFYPLAYLISTUPDATER_H diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 15f93115e..a87e8eb98 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -62,6 +62,7 @@ #include "utils/tomahawkutilsgui.h" #include "accounts/lastfm/LastFmAccount.h" #include "accounts/spotify/SpotifyAccount.h" +#include "accounts/spotify/SpotifyPlaylistUpdater.h" #include "config.h"