PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/src/libtomahawk/database/DatabaseCommand_LoadAllPlaylists.h

http://github.com/tomahawk-player/tomahawk
C Header | 81 lines | 36 code | 15 blank | 30 comment | 0 complexity | 084b8ff8d506543076e64c446868d5da MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
 4 *   Copyright 2011, Leo Franchi <lfranchi@kde.org>
 5 *   Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
 6 *
 7 *   Tomahawk is free software: you can redistribute it and/or modify
 8 *   it under the terms of the GNU General Public License as published by
 9 *   the Free Software Foundation, either version 3 of the License, or
10 *   (at your option) any later version.
11 *
12 *   Tomahawk is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22#ifndef DATABASECOMMAND_LOADALLPLAYLIST_H
23#define DATABASECOMMAND_LOADALLPLAYLIST_H
24
25#include "DatabaseCommand.h"
26
27namespace Tomahawk
28{
29
30class DatabaseCommand_LoadAllPlaylistsPrivate;
31
32class DLLEXPORT DatabaseCommand_LoadAllPlaylists : public DatabaseCommand
33{
34    Q_OBJECT
35
36public:
37    enum SortOrder {
38        None = 0,
39        ModificationTime = 1
40    };
41    enum SortAscDesc {
42        NoOrder = 0,
43        Ascending = 1,
44        Descending = 2
45    };
46
47    explicit DatabaseCommand_LoadAllPlaylists( const Tomahawk::source_ptr& s, QObject* parent = 0 );
48
49    virtual void exec( DatabaseImpl* );
50    virtual bool doesMutates() const { return false; }
51    virtual QString commandname() const { return "loadallplaylists"; }
52
53    void setLimit( unsigned int limit );
54    void setSortOrder( SortOrder order );
55    void setSortDescending( bool descending );
56
57    /**
58     * By default, only playlists with no revision will be loaded as fully
59     * loading a revision is a lot of work which cannot be integrated into
60     * one query.
61     *
62     * Often one only needs to know the trackIds of a playlist, not the
63     * whole revision information.
64     */
65    void setReturnPlEntryIds( bool returnPlEntryIds );
66
67signals:
68    void done( const QList<Tomahawk::playlist_ptr>& playlists );
69
70    /**
71     * This signal is only emitted if returnTrackIds == true.
72     */
73    void done( const QHash< Tomahawk::playlist_ptr, QStringList >& playlists );
74
75private:
76    Q_DECLARE_PRIVATE( DatabaseCommand_LoadAllPlaylists )
77};
78
79} // namespace Tomahawk
80
81#endif // DATABASECOMMAND_LOADALLPLAYLIST_H