Imported more functionality from old db classes to new models.
[emufront] / src / utils / fileutil.h
1 /*
2 ** EmuFront
3 ** Copyright 2010 Mikko Keinänen
4 **
5 ** This file is part of EmuFront.
6 **
7 **
8 ** EmuFront is free software: you can redistribute it and/or modify
9 ** it under the terms of the GNU General Public License version 2 as published by
10 ** the Free Software Foundation and appearing in the file gpl.txt included in the
11 ** packaging of this file.
12 **
13 ** EmuFront is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ** GNU General Public License for more details.
17 **
18 ** You should have received a copy of the GNU General Public License
19 ** along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef FILEUTIL_H
23 #define FILEUTIL_H
24
25 #include <QObject>
26 #include "emufrontfileobject.h"
27 #include "filepathobject.h"
28
29 #define READ_BUFFER (256*1024)
30
31 class QStringList;
32 class MediaImageContainer;
33 class MediaImage;
34 class DbMediaImageContainer;
35 class UnzipHelper;
36 class QProgressDialog;
37
38 class FileUtil : public QObject
39 {
40     Q_OBJECT
41 public:
42     FileUtil(QObject *parent);
43     ~FileUtil();
44     int scanFilePath(FilePathObject *fpo, const QStringList filters, QProgressDialog *);
45 signals:
46     void dbUpdateInProgress();
47     void dbUpdateFinished();
48
49 private:
50     char *buf;
51     quint32 readCrc32(QString filePath);
52     bool isSupportedFile(const QString filename, const QStringList supportedFileExtensions);
53     static const int MIC_BUFFER_SIZE = 50;
54     UnzipHelper *unzipHelper;
55     void showDbUpdating(QProgressDialog*);
56     void hideDbUpdating(QProgressDialog*);
57
58 };
59
60 #endif // FILEUTIL_H