-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilesystem.h
196 lines (160 loc) · 5.89 KB
/
filesystem.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#ifndef FILESYSTEM_H
#define FILESYSTEM_H
#include "codeeditor.h"
#include <QObject>
#include <QDir>
class Property
{
public:
QString name;
QString text;
Property(QString name, QString text);
};
/**
* @brief The FileSystem class handles all file related operations, including execution of mCRL2 tools
*/
class FileSystem : public QObject
{
Q_OBJECT
public:
/**
* @brief FileSystem Constructor
* @param specificationEditor The specification editor in the main window
* @parent The main widget (main window)
*/
explicit FileSystem(CodeEditor *specificationEditor, QWidget *parent);
/**
* @brief makeSureProjectFolderExists Checks whether the projects folder exists, if not creates it
*/
void makeSureProjectsFolderExists();
/**
* @brief makeSureProjectFolderExists Checks whether the project folder exists, if not creates it
*/
void makeSureProjectFolderExists();
/**
* @brief makeSureProjectFolderExists Checks whether the properties folder exists, if not creates it
*/
void makeSurePropertiesFolderExists();
/**
* @brief projectFolderPath Defines the file path of the current project folder
* @param projectName The name of the current project
* @return The file path of the project folder
*/
QString projectFolderPath(QString projectName);
/**
* @brief propertiesFolderPath Defines the file path of the current properties folder
* @param projectName The name of the current project
* @return The file path of the properties folder
*/
QString propertiesFolderPath(QString projectName);
/**
* @brief specificationFilePath Defines the file path of a specification
* @return The file path of the specification
*/
QString specificationFilePath();
/**
* @brief lpsFilePath Defines the file path of a lps
* @return The file path of the lps
*/
QString lpsFilePath();
/**
* @brief propertyFilePath Defines the file path of a property
* @param propertyName The name of the property
* @return The file path of the property
*/
QString propertyFilePath(QString propertyName);
/**
* @brief pbesFilePath Defines the file path of a pbes
* @param propertyName The name of the property this pbes correspeonds to
* @return The file path of the pbes
*/
QString pbesFilePath(QString propertyName);
/**
* @brief getExecutablesFolder Gets the folder containing the mCRL2 tool executables
* @return The folder with the executables
*/
const QDir *getExecutablesFolder();
/**
* @brief projectOpened Checks whether a project is opened
* @return Whether a project is opened
*/
bool projectOpened();
/**
* @brief getCurrentSpecification Gets the specification that is in the specification editor
* @return the current specification ion the specification editor
*/
QString getCurrentSpecification();
/**
* @brief specificationModified Checks whether the specification has been modified since it has been saved
* @return Whether the specification has been modified since it has been saved
*/
bool isSpecificationModified();
/**
* @brief propertyModified Checks whether the property has been modified since it has been saved
* @param propertyName The name of the property
* @return Whether the property has been modified since it has been saved
*/
bool isPropertyModified(QString propertyName);
/**
* @brief setPropertyModified Sets the property to modified
* @param PropertyName The name of the property
*/
void setPropertyModified(QString propertyName);
/**
* @brief lpsFileExists Checks whether an lps file exists that is created from the current specification
* @return Whether an lps file exists that is created from the current specification
*/
bool upToDateLpsFileExists();
/**
* @brief upToDatePbesFileExists Checks whether a pbes file exists that is created from the current specification and property
* @param propertyName The name of the property
* @return Whether a pbes file exists that is created from the current specification and property
*/
bool upToDatePbesFileExists(QString propertyName);
/**
* @brief newProject Creates a new project with the corresponding file structure
* @return An error message if unsuccessful, else the empty string
*/
QString newProject(QString projectName);
/**
* @brief getAllProjects Gets all projects that are in the project folder
* @return The names of all projects
*/
QStringList getAllProjects();
/**
* @brief openProject Opens the project with the given project name
* @return The list of the properties that need to be added
*/
std::list<Property*> openProject(QString projectName);
/**
* @brief saveProject Saves the current specification
*/
void saveSpecification();
/**
* @brief saveProperty Saves the given property
* @param propertyName The name of the property
* @param propertyText The text of the property
*/
void saveProperty(Property *property);
public slots:
/**
* @brief setSpecificationModified Sets the specification to modified
*/
void setSpecificationModified();
signals:
/**
* @brief modified Is emitted whenever the specification or a property is changed
*/
void hasChanges(bool changes);
private:
QString projectsFolderPath = QDir::currentPath() + QDir::separator() + "projects";
QString propertiesFolderName = "properties";
QDir *executablesFolder = new QDir("C:\\Users\\s123188\\Documents\\QtProjects\\mCRL2-IDE\\execs");
QWidget *parent;
CodeEditor *specificationEditor;
QString projectName;
bool projectOpen;
bool specificationModified;
std::map<QString, bool> propertymodified;
};
#endif // FILESYSTEM_H