roviz  0.7
Code Documentation of roviz
file_project.h
1 /*
2  * file_project.h
3  *
4  * Created on: Feb 3, 2016
5  * Author: Marcus Pfaff
6  */
7 
8 #ifndef FILEPROJECT_H
9 #define FILEPROJECT_H
10 
11 #include <QFileSystemWatcher>
12 #include <QFileInfo>
13 
14 #include "abstract_project.h"
15 #include "file_helper.h"
16 
18 {
19 public:
20  FileProject(SettingsScope* parentSettingsScope, const QString& filePath, const QDomDocument& domDocument);
21  ~FileProject();
22  bool autosaveExists() override;
23  void cleanAutosave() override;
24  QString autosaveInfo() override;
25  bool save() override;
26  bool autosave() override;
27  void reset() override;
28  QString connectionString() override;
29  void setLoaded(bool isLoaded) override;
30  QDomDocument autosaveDomDocument() const override;
31  bool setAutosaveDomDocument(const QDomDocument& domDocument);
32  QDomDocument domDocument() const override;
33  bool setDomDocument(const QDomDocument& domDocument) override;
34  void setFilePath(const QString& filePath);
35  QString filePath() const;
36  QString fileName() const;
37  QString path() const;
38 
39  QString relativFilePath() const;
40  void setRelativFilePath(const QString &relativFilePath);
41 
42 private:
43  void setAutosaveFilePath(const QString &autosaveFilePath);
44  void setFallbackAttributes();
45  QDomDocument _domDocument;
46  QDomDocument _autosaveDomDocument;
47  QFileSystemWatcher _fileSystemWatcher;
48  QString _autosaveFilePath;
49  QString _relativFilePath;
50  QFileInfo _fileInfo;
51  bool _internalSave = false;
52 
53 private slots:
54  void onProjectFileChanged();
55 };
56 
57 #endif // FILEPROJECT_H
void setLoaded(bool isLoaded) override
Set the project loaded property. This indicates, that the project is currently loaded by the related ...
Definition: file_project.cpp:291
bool isLoaded() const
Definition: abstract_project.cpp:120
bool save() override
Save the project in a xml structure.
Definition: file_project.cpp:119
bool autosaveExists() override
Check autosave project xml exists.
Definition: file_project.cpp:39
The SettingsScope class acts as a container for scoped settings.
Definition: settings_scope.h:21
QDomDocument domDocument() const override
Definition: file_project.cpp:221
Definition: file_project.h:17
QDomDocument autosaveDomDocument() const override
Definition: file_project.cpp:264
void reset() override
Reload the complete project structure from xml. All settings, which are not saved will be discarded a...
Definition: file_project.cpp:171
void cleanAutosave() override
Remove the autosave project xml structure.
Definition: file_project.cpp:50
Definition: abstract_project.h:16
QString connectionString() override
The connection string defines the link to the project xml source (e.g file, sql). ...
Definition: file_project.cpp:201
bool autosave() override
Save the project in a xml structure.
Definition: file_project.cpp:151
QString autosaveInfo() override
Information about the autosave project xml structure.
Definition: file_project.cpp:56
bool setDomDocument(const QDomDocument &domDocument) override
Set and validate the project domDocument xml structure.
Definition: file_project.cpp:226