/src/libtomahawk/database/DatabaseCommand_SetDynamicPlaylistRevision.h
C Header | 92 lines | 57 code | 18 blank | 17 comment | 0 complexity | 49c49c5b63ba8682a443e8483afbe812 MD5 | raw file
1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === 2 * 3 * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org> 4 * 5 * Tomahawk is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * Tomahawk is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19#ifndef DATABASECOMMAND_SETDYNAMICPLAYLISTREVISION_H 20#define DATABASECOMMAND_SETDYNAMICPLAYLISTREVISION_H 21 22#include "DatabaseCommand_SetPlaylistRevision.h" 23#include "playlist/dynamic/GeneratorInterface.h" 24 25namespace Tomahawk 26{ 27 28class DatabaseCommand_SetDynamicPlaylistRevision : public DatabaseCommand_SetPlaylistRevision 29{ 30 Q_OBJECT 31 Q_PROPERTY( QString type READ type WRITE setType ) 32 Q_PROPERTY( int mode READ mode WRITE setMode ) 33 Q_PROPERTY( QVariantList controls READ controlsV WRITE setControlsV ) 34 35public: 36 explicit DatabaseCommand_SetDynamicPlaylistRevision( QObject* parent = 0 ) 37 : DatabaseCommand_SetPlaylistRevision( parent ) 38 {} 39 40 explicit DatabaseCommand_SetDynamicPlaylistRevision( const source_ptr& s, 41 const QString& playlistguid, 42 const QString& newrev, 43 const QString& oldrev, 44 const QStringList& orderedguids, 45 const QList<Tomahawk::plentry_ptr>& addedentries, 46 const QList<plentry_ptr>& entries, 47 const QString& type, 48 GeneratorMode mode, 49 const QList< dyncontrol_ptr >& controls ); 50 51 explicit DatabaseCommand_SetDynamicPlaylistRevision( const source_ptr& s, 52 const QString& playlistguid, 53 const QString& newrev, 54 const QString& oldrev, 55 const QString& type, 56 GeneratorMode mode, 57 const QList< dyncontrol_ptr >& controls ); 58 59 QString commandname() const { return "setdynamicplaylistrevision"; } 60 61 virtual void exec( DatabaseImpl* lib ); 62 virtual void postCommitHook(); 63 virtual bool doesMutates() const { return true; } 64 virtual bool groupable() const { return true; } 65 66 void setControlsV( const QVariantList& vlist ) 67 { 68 m_controlsV = vlist; 69 } 70 71 QVariantList controlsV(); 72 73 QString type() const { return m_type; } 74 int mode() const { return (int)m_mode; } 75 76 void setType( const QString& type ) { m_type = type; } 77 void setMode( int mode ) { m_mode = (GeneratorMode)mode; } 78 79 void setPlaylist( QWeakPointer<DynamicPlaylist> pl ); // raw pointer b/c we don't have the shared pointer from inside the shared pointer 80 81private: 82 QString m_type; 83 GeneratorMode m_mode; 84 QList< dyncontrol_ptr > m_controls; 85 QList< QVariant > m_controlsV; 86 87 QSharedPointer<DynamicPlaylist> m_playlist; // Only used if setting revision of a non-autoloaded playlist, as those aren't able to be looked up by guid 88}; 89 90} 91 92#endif // DATABASECOMMAND_SETDYNAMICPLAYLISTREVISION_H