PageRenderTime 132ms CodeModel.GetById 70ms app.highlight 5ms RepoModel.GetById 56ms app.codeStats 0ms

/src/libtomahawk/database/DatabaseCommand_DirMtimes.h

http://github.com/tomahawk-player/tomahawk
C Header | 76 lines | 40 code | 17 blank | 19 comment | 0 complexity | dbc37601bac547deb36a0856fbce5200 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 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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_DIRMTIMES_H
21#define DATABASECOMMAND_DIRMTIMES_H
22
23#include <QObject>
24#include <QVariantMap>
25#include <QDir>
26#include <QMap>
27
28#include "DatabaseCommand.h"
29
30#include "DllMacro.h"
31
32// Not loggable, mtimes only used to speed up our local scanner.
33
34namespace Tomahawk
35{
36
37class DLLEXPORT DatabaseCommand_DirMtimes : public DatabaseCommand
38{
39Q_OBJECT
40
41public:
42    explicit DatabaseCommand_DirMtimes( const QString& prefix = QString(), QObject* parent = 0 )
43        : DatabaseCommand( parent ), m_prefix( prefix ), m_update( false )
44    {}
45
46    explicit DatabaseCommand_DirMtimes( const QStringList& prefixes, QObject* parent = 0 )
47    : DatabaseCommand( parent ), m_prefixes( prefixes ), m_update( false )
48    {}
49
50    explicit DatabaseCommand_DirMtimes( QMap<QString, unsigned int> tosave, QObject* parent = 0 )
51        : DatabaseCommand( parent ), m_update( true ), m_tosave( tosave )
52    {}
53
54    virtual void exec( DatabaseImpl* );
55    virtual bool doesMutates() const { return m_update; }
56    virtual QString commandname() const { return "dirmtimes"; }
57
58signals:
59    void done( const QMap<QString, unsigned int>& );
60
61public slots:
62
63private:
64    void execSelectPath( DatabaseImpl *dbi, const QDir& path, QMap<QString, unsigned int> &mtimes );
65
66    void execSelect( DatabaseImpl* dbi );
67    void execUpdate( DatabaseImpl* dbi );
68    QString m_prefix;
69    QStringList m_prefixes;
70    bool m_update;
71    QMap<QString, unsigned int> m_tosave;
72};
73
74}
75
76#endif // DATABASECOMMAND_DIRMTIMES_H