PageRenderTime 233ms CodeModel.GetById 131ms app.highlight 4ms RepoModel.GetById 97ms app.codeStats 0ms

/src/libtomahawk/database/DatabaseCommand_SetTrackAttributes.h

http://github.com/tomahawk-player/tomahawk
C Header | 62 lines | 30 code | 13 blank | 19 comment | 0 complexity | c7819011481c22a267952379a801ef58 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_SETTRACKATTRIBUTES
20#define DATABASECOMMAND_SETTRACKATTRIBUTES
21
22#include "Typedefs.h"
23#include "DatabaseCommandLoggable.h"
24
25#include <QByteArray>
26
27namespace Tomahawk
28{
29
30class DatabaseCommand_SetTrackAttributes : public DatabaseCommandLoggable
31{
32    Q_OBJECT
33public:
34    enum AttributeType {
35        EchonestCatalogId = 0,
36    };
37
38    // Takes a list of <track_id, value> pairs. key is always type
39    DatabaseCommand_SetTrackAttributes( AttributeType type, QList< QPair< Tomahawk::QID, QString > > ids, bool toDelete = false );
40    // Deletes *all tracks with attribute*
41    DatabaseCommand_SetTrackAttributes( AttributeType type );
42    DatabaseCommand_SetTrackAttributes() {} // JSON
43
44    virtual void exec( DatabaseImpl* lib );
45    virtual bool doesMutates() const { return true; }
46    virtual bool loggable() const { return m_loggable; }
47
48    virtual QString commandname() const { return "settrackattributes"; }
49
50    void setType( int type ) { m_type = (AttributeType)type; }
51    int type() const { return (int)m_type; }
52
53private:
54    bool m_loggable, m_delete;
55
56    AttributeType m_type;
57    QList< QPair< Tomahawk::QID, QString > > m_tracks;
58};
59
60}
61
62#endif // DATABASECOMMAND_SETTRACKATTRIBUTES