PageRenderTime 56ms CodeModel.GetById 34ms app.highlight 4ms RepoModel.GetById 16ms app.codeStats 0ms

/src/libtomahawk/database/DatabaseCommand_CreateDynamicPlaylist.h

http://github.com/tomahawk-player/tomahawk
C Header | 70 lines | 32 code | 15 blank | 23 comment | 0 complexity | 8dbb03f64173e6b2db7e162b3f790218 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_CREATEDYNAMICPLAYLIST_H
20#define DATABASECOMMAND_CREATEDYNAMICPLAYLIST_H
21
22#include "Typedefs.h"
23#include "DatabaseCommand_CreatePlaylist.h"
24
25namespace Tomahawk
26{
27
28/**
29 * Create a new dynamic playlist in the database, based on an existing playlist.
30 *
31 * If autoLoad is true, this playlist will *not* show up in the sidebar under the playlist tree, and
32 *  it will *not* be replicated to peers. It is useful to show a "specially crafted" playlist in other places
33 */
34
35class DatabaseCommand_CreateDynamicPlaylist : public DatabaseCommand_CreatePlaylist
36{
37    Q_OBJECT
38    Q_PROPERTY( QVariant playlist READ playlistV WRITE setPlaylistV )
39
40public:
41    explicit DatabaseCommand_CreateDynamicPlaylist( QObject* parent = 0 );
42    explicit DatabaseCommand_CreateDynamicPlaylist( const Tomahawk::source_ptr& author, const Tomahawk::dynplaylist_ptr& playlist, bool autoLoad = true );
43    virtual ~DatabaseCommand_CreateDynamicPlaylist();
44
45    QString commandname() const { return "createdynamicplaylist"; }
46
47    virtual void exec( DatabaseImpl* lib );
48    virtual void postCommitHook();
49    virtual bool doesMutates() const { return true; }
50
51    virtual bool loggable() const { return m_autoLoad; }
52
53    QVariant playlistV() const;
54
55    void setPlaylistV( const QVariant& v )
56    {
57        m_v = v;
58    }
59
60protected:
61    virtual bool report() { return m_autoLoad; }
62
63private:
64    Tomahawk::dynplaylist_ptr m_playlist;
65    bool m_autoLoad;
66};
67
68}
69
70#endif // DATABASECOMMAND_CREATEDYNAMICPLAYLIST_H