Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
filemanager.h
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2017 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program 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 */
17 
18 #ifndef OBJECTSAVELOADER_H
19 #define OBJECTSAVELOADER_H
20 
21 
22 #include <QObject>
23 #include <QString>
24 #include <QDomElement>
25 #include "log.h"
26 #include "pencildef.h"
27 #include "pencilerror.h"
28 #include "colourref.h"
29 
30 class Object;
31 class ObjectData;
32 
33 
34 class FileManager : public QObject
35 {
36  Q_OBJECT
37 
38 public:
39  FileManager( QObject* parent = 0 );
40 
41  Object* load( QString strFilenNme );
42  Status save( Object*, QString strFileName );
43 
44  QList<ColourRef> loadPaletteFile( QString strFilename );
45  Status error() { return mError; }
46  Status verifyObject( Object* obj );
47 
48 Q_SIGNALS:
49  void progressUpdated( float );
50 
51 private:
52  void unzip( const QString& strZipFile, const QString& strUnzipTarget );
53 
54  bool loadObject( Object*, const QDomElement& root );
55  bool loadObjectOldWay( Object*, const QDomElement& root );
56  bool isOldForamt( const QString& fileName );
57  bool loadPalette( Object* );
58 
59  ObjectData* loadProjectData( const QDomElement& element );
60  QDomElement saveProjectData( ObjectData*, QDomDocument& xmlDoc );
61 
62  void extractProjectData( const QDomElement& element, ObjectData* data );
63 
64 
65 
66  Object* cleanUpWithErrorCode( Status );
67 
68 private:
69  Status mError = Status::OK;
70  QString mstrLastTempFolder;
71 
72  QLoggingCategory mLog;
73 };
74 
75 #endif // OBJECTSAVELOADER_H
Definition: object.h:71