File indexing completed on 2024-05-12 16:18:06

0001 /***************************************************************************
0002  *   Copyright (C) 2010 Ralf Engels <ralf-engels@gmx.de>                   *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  *                                                                         *
0009  *   This program is distributed in the hope that it will be useful,       *
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0012  *   GNU General Public License for more details.                          *
0013  *                                                                         *
0014  *   You should have received a copy of the GNU General Public License     *
0015  *   along with this program; if not, write to the                         *
0016  *   Free Software Foundation, Inc.,                                       *
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0018  ***************************************************************************/
0019 
0020 #ifndef COLLECTIONSCANNER_BATCHFILE_H
0021 #define COLLECTIONSCANNER_BATCHFILE_H
0022 
0023 #include "amarokshared_export.h"
0024 
0025 #include <QString>
0026 #include <QStringList>
0027 #include <QPair>
0028 #include <QList>
0029 
0030 namespace CollectionScanner
0031 {
0032 
0033 
0034 /**
0035  * @class BatchFile
0036  * @short This class can be used to read and write batch files for the collection scanner.
0037  */
0038 
0039 class AMAROKSHARED_EXPORT BatchFile
0040 {
0041 public:
0042     /** Constructs and empty BatchFile */
0043     BatchFile();
0044 
0045     /** Reads the BatchFile from the disk */
0046     explicit BatchFile( const QString &path );
0047 
0048     /** This type is a pair of directory path and modification time */
0049     typedef QPair<QString, uint> TimeDefinition;
0050 
0051     /** Those are the directories that should be added to the scanning list */
0052     const QStringList &directories() const;
0053     void setDirectories( const QStringList &value );
0054 
0055     const QList<TimeDefinition> &timeDefinitions() const;
0056     void setTimeDefinitions( const QList<TimeDefinition> &value );
0057 
0058     /** Writes the BatchFile to the disk.
0059         @returns true if writing was successful.
0060     */
0061     bool write( const QString &path );
0062 
0063 private:
0064     QStringList m_directories;
0065     QList<TimeDefinition> m_timeDefinitions;
0066 };
0067 
0068 }
0069 #endif // COLLECTIONSCANNER_BATCHFILE_H