PageRenderTime 187ms CodeModel.GetById 80ms app.highlight 13ms RepoModel.GetById 88ms app.codeStats 0ms

/src/libtomahawk/database/DatabaseCommand_AddFiles.h

http://github.com/tomahawk-player/tomahawk
C Header | 70 lines | 38 code | 15 blank | 17 comment | 0 complexity | 515fcddd0e5d9c013ddd743b1a84a843 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 *
 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_ADDFILES_H
20#define DATABASECOMMAND_ADDFILES_H
21
22#include <QObject>
23#include <QVariantMap>
24
25#include "database/DatabaseCommandLoggable.h"
26#include "Typedefs.h"
27#include "Query.h"
28
29#include "DllMacro.h"
30
31namespace Tomahawk
32{
33
34class DLLEXPORT DatabaseCommand_AddFiles : public DatabaseCommandLoggable
35{
36Q_OBJECT
37Q_PROPERTY( QVariantList files READ files WRITE setFiles )
38
39public:
40    explicit DatabaseCommand_AddFiles( QObject* parent = 0 )
41        : DatabaseCommandLoggable( parent )
42    {}
43
44    explicit DatabaseCommand_AddFiles( const QList<QVariant>& files, const Tomahawk::source_ptr& source, QObject* parent = 0 )
45        : DatabaseCommandLoggable( parent ), m_files( files )
46    {
47        setSource( source );
48    }
49
50    virtual QString commandname() const { return "addfiles"; }
51
52    virtual void exec( DatabaseImpl* );
53    virtual bool doesMutates() const { return true; }
54    virtual void postCommitHook();
55
56    QVariantList files() const;
57    void setFiles( const QVariantList& f ) { m_files = f; }
58
59signals:
60    void done( const QList<QVariant>&, const Tomahawk::collection_ptr& );
61    void notify( const QList<unsigned int>& ids );
62
63private:
64    QVariantList m_files;
65    QList<unsigned int> m_ids;
66};
67
68}
69
70#endif // DATABASECOMMAND_ADDFILES_H