~ubuntu-branches/ubuntu/trusty/tomahawk/trusty-proposed

« back to all changes in this revision

Viewing changes to src/libtomahawk/database/DatabaseCommand_SetDynamicPlaylistRevision.h

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-03-07 21:50:13 UTC
  • Revision ID: package-import@ubuntu.com-20130307215013-6gdjkdds7i9uenvs
Tags: upstream-0.6.0+dfsg
ImportĀ upstreamĀ versionĀ 0.6.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
25
using namespace Tomahawk;
 
26
 
 
27
class DatabaseCommand_SetDynamicPlaylistRevision : public DatabaseCommand_SetPlaylistRevision
 
28
{
 
29
    Q_OBJECT
 
30
    Q_PROPERTY( QString type                     READ type          WRITE setType )
 
31
    Q_PROPERTY( int           mode               READ mode          WRITE setMode )
 
32
    Q_PROPERTY( QVariantList controls            READ controlsV     WRITE setControlsV )
 
33
 
 
34
public:
 
35
    explicit DatabaseCommand_SetDynamicPlaylistRevision( QObject* parent = 0 )
 
36
    : DatabaseCommand_SetPlaylistRevision( parent )
 
37
    {}
 
38
 
 
39
    explicit DatabaseCommand_SetDynamicPlaylistRevision( const source_ptr& s,
 
40
                                                  const QString& playlistguid,
 
41
                                                  const QString& newrev,
 
42
                                                  const QString& oldrev,
 
43
                                                  const QStringList& orderedguids,
 
44
                                                  const QList<Tomahawk::plentry_ptr>& addedentries,
 
45
                                                  const QList<plentry_ptr>& entries,
 
46
                                                  const QString& type,
 
47
                                                  GeneratorMode mode,
 
48
                                                  const QList< dyncontrol_ptr >& controls );
 
49
 
 
50
    explicit DatabaseCommand_SetDynamicPlaylistRevision( const source_ptr& s,
 
51
                                                  const QString& playlistguid,
 
52
                                                  const QString& newrev,
 
53
                                                  const QString& oldrev,
 
54
                                                  const QString& type,
 
55
                                                  GeneratorMode mode,
 
56
                                                  const QList< dyncontrol_ptr >& controls );
 
57
 
 
58
    QString commandname() const { return "setdynamicplaylistrevision"; }
 
59
 
 
60
    virtual void exec( DatabaseImpl* lib );
 
61
    virtual void postCommitHook();
 
62
    virtual bool doesMutates() const { return true; }
 
63
    virtual bool groupable() const { return true; }
 
64
 
 
65
    void setControlsV( const QVariantList& vlist )
 
66
    {
 
67
        m_controlsV = vlist;
 
68
    }
 
69
 
 
70
    QVariantList controlsV();
 
71
 
 
72
    QString type() const { return m_type; }
 
73
    int mode() const { return (int)m_mode; }
 
74
 
 
75
    void setType( const QString& type ) { m_type = type; }
 
76
    void setMode( int mode ) { m_mode = (GeneratorMode)mode; }
 
77
 
 
78
    void setPlaylist( DynamicPlaylist* pl ); // raw pointer b/c we don't have the shared pointer from inside the shared pointer
 
79
 
 
80
private:
 
81
    QString m_type;
 
82
    GeneratorMode m_mode;
 
83
    QList< dyncontrol_ptr > m_controls;
 
84
    QList< QVariant > m_controlsV;
 
85
 
 
86
    // ARG i hate sharedpointers sometimes
 
87
    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
#endif // DATABASECOMMAND_SETDYNAMICPLAYLISTREVISION_H