diff --git a/src/libtomahawk/database/databasecommand_socialaction.h b/src/libtomahawk/database/databasecommand_socialaction.h index 070cb38bb..20188a95c 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 @@ -28,7 +28,17 @@ #include "dllmacro.h" - +/** + * \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_LoadSocialAction + */ class DLLEXPORT DatabaseCommand_SocialAction : public DatabaseCommand { Q_OBJECT @@ -38,10 +48,24 @@ Q_PROPERTY( int timestamp READ timestamp WRITE setTimestamp ) public: + /** + * \brief Default constructor for DatabaseCommand_SocialAction. + * + * Constructs an empty database command for a social action. + */ explicit DatabaseCommand_SocialAction( QObject* parent = 0 ) : DatabaseCommand( 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 ) { @@ -53,26 +77,94 @@ public: setTimestamp( QDateTime::currentDateTime().toTime_t() ); } + /** + * \brief Returns the name of this database command. + * \return QString containing the database command name 'socialaction'. + */ virtual QString commandname() const { return "socialaction"; } - virtual void exec( DatabaseImpl* ); + /** + * \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. + */ virtual void postCommitHook(); + /** + * \brief Returns the artist associated with this database command. + * \return Name of the artist. + * \see setArtist() + */ QString artist() const { return m_artist; } + + /** + * \brief Sets the artist name for this database command. + * \param s QString containing the artist name. + * \see artist() + */ void setArtist( const QString& s ) { m_artist = s; } + /** + * \brief Returns the track name associated with this social action. + * \return QString containing the track name. + * \see setTrack() + */ QString track() const { return m_track; } - void setTrack( const QString& s ) { m_track = s; } - // key + /** + * \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; } - // value + /** + * \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. + * \see timestamp() + */ void setTimestamp( const int ts ) { m_timestamp = ts; } private: