-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYaffsManager.h
65 lines (53 loc) · 2 KB
/
YaffsManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* yaffey: Utility for reading, editing and writing YAFFS2 images
* Copyright (C) 2012 David Place <david.t.place@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef YAFFSMANAGER_H
#define YAFFSMANAGER_H
#include <QList>
#include <QFile>
#include "YaffsModel.h"
struct YaffsExportInfo {
int numFilesExported;
int numDirsExported;
QList<const YaffsItem*> listFileExportFailures;
QList<const YaffsItem*> listDirExportFailures;
};
class YaffsManager : public QObject {
Q_OBJECT
public:
static YaffsManager* getInstance();
~YaffsManager();
YaffsModel* newModel();
YaffsExportInfo* exportItems(QModelIndexList itemIndices, const QString& path);
YaffsModel* getModel() { return mYaffsModel; }
signals:
void modelChanged();
private slots:
void on_model_DataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
void on_model_LayoutChanged();
private:
YaffsManager();
void exportItem(const YaffsItem* item, const QString& path);
void exportFile(const YaffsItem* item, const QString& path);
void exportDirectory(const YaffsItem* item, const QString& path);
bool saveDataToFile(const QString& filename, const char* data, int length);
private:
static YaffsManager* mSelf;
YaffsModel* mYaffsModel;
YaffsExportInfo* mYaffsExportInfo;
};
#endif //YAFFSMANAGER_H