PageRenderTime 153ms CodeModel.GetById 71ms app.highlight 4ms RepoModel.GetById 76ms app.codeStats 0ms

/src/libtomahawk/database/DatabaseCommand_FileMTimes.h

http://github.com/tomahawk-player/tomahawk
C Header | 74 lines | 38 code | 16 blank | 20 comment | 0 complexity | 869fee51bc058eac0feab2fefe0957b1 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_FILEMTIMES_H
21#define DATABASECOMMAND_FILEMTIMES_H
22
23#include <QObject>
24#include <QVariantMap>
25#include <QMap>
26#include <QDir>
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_FileMtimes : public DatabaseCommand
38{
39Q_OBJECT
40
41public:
42    explicit DatabaseCommand_FileMtimes( const QString& prefix = QString(), QObject* parent = 0 )
43        : DatabaseCommand( parent ), m_prefix( prefix ), m_checkonly( false )
44    {}
45
46    explicit DatabaseCommand_FileMtimes( const QStringList& prefixes, QObject* parent = 0 )
47    : DatabaseCommand( parent ), m_prefixes( prefixes ), m_checkonly( false )
48    {}
49
50    //NOTE: when this is called we actually ignore the boolean flag; it's just used to give us the right constructor
51    explicit DatabaseCommand_FileMtimes( bool /*checkonly*/, QObject* parent = 0 )
52    : DatabaseCommand( parent ), m_checkonly( true )
53    {}
54    
55    virtual void exec( DatabaseImpl* );
56    virtual bool doesMutates() const { return false; }
57    virtual QString commandname() const { return "filemtimes"; }
58
59signals:
60    void done( const QMap< QString, QMap< unsigned int, unsigned int > >& );
61
62public slots:
63
64private:
65    void execSelectPath( DatabaseImpl *dbi, const QDir& path, QMap< QString, QMap< unsigned int, unsigned int > > &mtimes );
66    void execSelect( DatabaseImpl* dbi );
67    QString m_prefix;
68    QStringList m_prefixes;
69    bool m_checkonly;
70};
71
72}
73
74#endif // DATABASECOMMAND_FILEMTIMES_H