PageRenderTime 163ms CodeModel.GetById 101ms app.highlight 5ms RepoModel.GetById 55ms app.codeStats 0ms

/src/libtomahawk/database/DatabaseCommand_AllArtists.h

http://github.com/tomahawk-player/tomahawk
C Header | 78 lines | 45 code | 15 blank | 18 comment | 0 complexity | c562900033398fcf1d20ec7ce9a2773f 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 2013,      Teo Mrnjavac <teo@kde.org>
 5 *
 6 *   Tomahawk is free software: you can redistribute it and/or modify
 7 *   it under the terms of the GNU General Public License as published by
 8 *   the Free Software Foundation, either version 3 of the License, or
 9 *   (at your option) any later version.
10 *
11 *   Tomahawk is distributed in the hope that it will be useful,
12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *   GNU General Public License for more details.
15 *
16 *   You should have received a copy of the GNU General Public License
17 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef DATABASECOMMAND_ALLARTISTS_H
21#define DATABASECOMMAND_ALLARTISTS_H
22
23#include <QObject>
24#include <QVariantMap>
25
26#include "Artist.h"
27#include "collection/ArtistsRequest.h"
28#include "collection/Collection.h"
29#include "Typedefs.h"
30#include "DatabaseCommand.h"
31#include "Database.h"
32#include "DatabaseCollection.h"
33
34#include "DllMacro.h"
35
36namespace Tomahawk
37{
38
39class DLLEXPORT DatabaseCommand_AllArtists : public DatabaseCommand, public Tomahawk::ArtistsRequest
40{
41Q_OBJECT
42public:
43    enum SortOrder
44    {
45        None = 0,
46        ModificationTime = 1
47    };
48
49    explicit DatabaseCommand_AllArtists( const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr(), QObject* parent = 0 );
50    virtual ~DatabaseCommand_AllArtists();
51
52    void exec( DatabaseImpl* ) Q_DECL_OVERRIDE;
53
54    bool doesMutates() const Q_DECL_OVERRIDE { return false; }
55    QString commandname() const Q_DECL_OVERRIDE { return "allartists"; }
56
57    void enqueue() Q_DECL_OVERRIDE { Database::instance()->enqueue( Tomahawk::dbcmd_ptr( this ) ); }
58
59    void setLimit( unsigned int amount ) { m_amount = amount; }
60    void setSortOrder( DatabaseCommand_AllArtists::SortOrder order ) { m_sortOrder = order; }
61    void setSortDescending( bool descending ) { m_sortDescending = descending; }
62    void setFilter( const QString& filter ) override { m_filter = filter; }
63
64signals:
65    void artists( const QList<Tomahawk::artist_ptr>& ) override;
66    void done();
67
68private:
69    QSharedPointer< DatabaseCollection > m_collection;
70    unsigned int m_amount;
71    DatabaseCommand_AllArtists::SortOrder m_sortOrder;
72    bool m_sortDescending;
73    QString m_filter;
74};
75
76}
77
78#endif // DATABASECOMMAND_ALLARTISTS_H