/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. #ifndef DATABASECOMMAND_FILEMTIMES_H
  20. #define DATABASECOMMAND_FILEMTIMES_H
  21. #include <QObject>
  22. #include <QVariantMap>
  23. #include <QMap>
  24. #include <QDir>
  25. #include "DatabaseCommand.h"
  26. #include "DllMacro.h"
  27. // Not loggable, mtimes only used to speed up our local scanner.
  28. namespace Tomahawk
  29. {
  30. class DLLEXPORT DatabaseCommand_FileMtimes : public DatabaseCommand
  31. {
  32. Q_OBJECT
  33. public:
  34. explicit DatabaseCommand_FileMtimes( const QString& prefix = QString(), QObject* parent = 0 )
  35. : DatabaseCommand( parent ), m_prefix( prefix ), m_checkonly( false )
  36. {}
  37. explicit DatabaseCommand_FileMtimes( const QStringList& prefixes, QObject* parent = 0 )
  38. : DatabaseCommand( parent ), m_prefixes( prefixes ), m_checkonly( false )
  39. {}
  40. //NOTE: when this is called we actually ignore the boolean flag; it's just used to give us the right constructor
  41. explicit DatabaseCommand_FileMtimes( bool /*checkonly*/, QObject* parent = 0 )
  42. : DatabaseCommand( parent ), m_checkonly( true )
  43. {}
  44. virtual void exec( DatabaseImpl* );
  45. virtual bool doesMutates() const { return false; }
  46. virtual QString commandname() const { return "filemtimes"; }
  47. signals:
  48. void done( const QMap< QString, QMap< unsigned int, unsigned int > >& );
  49. public slots:
  50. private:
  51. void execSelectPath( DatabaseImpl *dbi, const QDir& path, QMap< QString, QMap< unsigned int, unsigned int > > &mtimes );
  52. void execSelect( DatabaseImpl* dbi );
  53. QString m_prefix;
  54. QStringList m_prefixes;
  55. bool m_checkonly;
  56. };
  57. }
  58. #endif // DATABASECOMMAND_FILEMTIMES_H