From 4cfd039c40a57633c830335670351fcaa2e1200e Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 6 Aug 2011 12:40:29 -0400 Subject: [PATCH] social action stuff --- .../database/databasecommand_socialaction.h | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/libtomahawk/database/databasecommand_socialaction.h b/src/libtomahawk/database/databasecommand_socialaction.h index 578075189..9f62259e9 100644 --- a/src/libtomahawk/database/databasecommand_socialaction.h +++ b/src/libtomahawk/database/databasecommand_socialaction.h @@ -6,7 +6,7 @@ * 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 @@ -20,7 +20,7 @@ #define DATABASECOMMAND_SOCIALACTION_H #include -#include "database/databasecommand.h" +#include "database/databasecommandloggable.h" #include "sourcelist.h" #include "typedefs.h" @@ -31,43 +31,45 @@ /** * \class DatabaseCommand_SocialAction * \brief Database command used to write social actions to database. - * + * * This Database command allows Tomahawk to write social actions to * the local database. These social actions can be interfaced with social * networking API's such as LastFm, Facebook, or Twitter to allow the user * to sync these actions with their accounts on these sites. - * + * * \see DatabaseCommand_LoadSocialActions */ -class DLLEXPORT DatabaseCommand_SocialAction : public DatabaseCommand +class DLLEXPORT DatabaseCommand_SocialAction : public DatabaseCommandLoggable { -Q_OBJECT -Q_PROPERTY( QString action READ action WRITE setAction ) -Q_PROPERTY( QString comment READ comment WRITE setComment ) -Q_PROPERTY( int timestamp READ timestamp WRITE setTimestamp ) + Q_OBJECT + Q_PROPERTY( QString action READ action WRITE setAction ) + Q_PROPERTY( QString comment READ comment WRITE setComment ) + Q_PROPERTY( int timestamp READ timestamp WRITE setTimestamp ) + Q_PROPERTY( QString artist READ artist WRITE setArtist ) + Q_PROPERTY( QString track READ track WRITE setTrack ) public: - + /** * \brief Default constructor for DatabaseCommand_SocialAction. - * + * * Constructs an empty database command for a social action. */ explicit DatabaseCommand_SocialAction( QObject* parent = 0 ) - : DatabaseCommand( parent ) + : DatabaseCommandLoggable( parent ) {} - + /** * \brief Overloaded constructor for DatabaseCommand_SocialAction. * \param result Pointer to a Tomahawk::Result. * \param action Name of the social action to be written to the database. * \param comment Comment associated with this social action. * \param parent Parent class. - * + * * Constructor which creates a new database command for the specified social action. */ explicit DatabaseCommand_SocialAction( const Tomahawk::result_ptr& result, QString action, QString comment="", QObject* parent = 0 ) - : DatabaseCommand( parent ), m_result( result ), m_action( action ) + : DatabaseCommandLoggable( parent ), m_result( result ), m_action( action ) { setSource( SourceList::instance()->getLocal() ); @@ -86,12 +88,12 @@ public: /** * \brief Executes the database command. * \param dbi Database instance. - * + * * This method prepares an sql query to write this social action * into the local database. */ virtual void exec( DatabaseImpl* dbi ); - + /** * \brief Triggers a Database Sync. */ @@ -103,7 +105,7 @@ public: * \see setArtist() */ QString artist() const { return m_artist; } - + /** * \brief Sets the artist name for this database command. * \param s QString containing the artist name. @@ -117,49 +119,49 @@ public: * \see setTrack() */ QString track() const { return m_track; } - + /** * \brief Sets the track name associated with this database command. * \param track QString containing the track name. * \see track() */ void setTrack( const QString& track ) { m_track = track; } - + /** * \brief Returns the social action for this database command instance. * \return QString containing the action name. * \see setAction() */ QString action() const { return m_action; } - + /** * \brief Sets the social actions * \param a QString containing action to be set in this class. * \see action() */ void setAction( QString a ) { m_action = a; } - + /** * \brief Returns comment associated with this social action. * \return QString containing comment associated with this social action. * \see setComment() */ QString comment() const { return m_comment; } - + /** * \brief Sets the comment associated with this social action. * \param com Comment associated with this social action. * \see comment() */ void setComment( const QString& com ) { m_comment = com; } - + /** * \brief Returns the timestamp associated with this social action. * \return unsigned integer containing timestamp * \see setTimesetamp() */ int timestamp() const { return m_timestamp; } - + /** * \brief Sets the timestamp associated with this social action. * \param ts unsigned integer associated with this social action. @@ -167,6 +169,8 @@ public: */ void setTimestamp( const int ts ) { m_timestamp = ts; } + virtual bool doesMutates() const { return true; } + private: Tomahawk::result_ptr m_result;