48 // A file is implicit when they are opened automatically for caching purposes |
48 // A file is implicit when they are opened automatically for caching purposes |
49 // and are hidden from the user. User-opened files are explicit (not implicit). |
49 // and are hidden from the user. User-opened files are explicit (not implicit). |
50 // ============================================================================= |
50 // ============================================================================= |
51 class LDOpenFile : public QObject { |
51 class LDOpenFile : public QObject { |
52 Q_OBJECT |
52 Q_OBJECT |
53 READ_PROPERTY (vector<LDObject*>, objs, setObjects) |
53 READ_PROPERTY (List<LDObject*>, objs, setObjects) |
54 READ_PROPERTY (History, history, setHistory) |
54 READ_PROPERTY (History, history, setHistory) |
55 READ_PROPERTY (vector<LDObject*>, vertices, setVertices) |
55 READ_PROPERTY (List<LDObject*>, vertices, setVertices) |
56 PROPERTY (str, name, setName) |
56 PROPERTY (str, name, setName) |
57 PROPERTY (bool, implicit, setImplicit) |
57 PROPERTY (bool, implicit, setImplicit) |
58 PROPERTY (vector<LDObject*>, cache, setCache) |
58 PROPERTY (List<LDObject*>, cache, setCache) |
59 PROPERTY (long, savePos, setSavePos) |
59 PROPERTY (long, savePos, setSavePos) |
60 DECLARE_PROPERTY (QListWidgetItem*, listItem, setListItem) |
60 DECLARE_PROPERTY (QListWidgetItem*, listItem, setListItem) |
61 |
61 |
62 public: |
62 public: |
63 typedef vector<LDObject*>::it it; |
63 typedef List<LDObject*>::it it; |
64 typedef vector<LDObject*>::c_it c_it; |
64 typedef List<LDObject*>::c_it c_it; |
65 |
65 |
66 LDOpenFile(); |
66 LDOpenFile(); |
67 ~LDOpenFile(); |
67 ~LDOpenFile(); |
68 |
68 |
69 ulong addObject (LDObject* obj); // Adds an object to this file at the end of the file. |
69 ulong addObject (LDObject* obj); // Adds an object to this file at the end of the file. |
162 void reloadAllSubfiles(); |
162 void reloadAllSubfiles(); |
163 |
163 |
164 // Is it safe to close all files? |
164 // Is it safe to close all files? |
165 bool safeToCloseAll(); |
165 bool safeToCloseAll(); |
166 |
166 |
167 vector<LDObject*> loadFileContents (File* f, ulong* numWarnings, bool* ok = null); |
167 List<LDObject*> loadFileContents (File* f, ulong* numWarnings, bool* ok = null); |
168 |
168 |
169 extern vector<LDOpenFile*> g_loadedFiles; |
169 extern List<LDOpenFile*> g_loadedFiles; |
170 |
170 |
171 void addRecentFile (str path); |
171 void addRecentFile (str path); |
172 str basename (str path); |
172 str basename (str path); |
173 str dirname (str path); |
173 str dirname (str path); |
174 |
174 |
175 extern vector<LDOpenFile*> g_loadedFiles; // Vector of all currently opened files. |
175 extern List<LDOpenFile*> g_loadedFiles; // Vector of all currently opened files. |
176 |
176 |
177 // ============================================================================= |
177 // ============================================================================= |
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
179 // ============================================================================= |
179 // ============================================================================= |
180 // FileLoader |
180 // FileLoader |
182 // Loads the given file and parses it to LDObjects using parseLine. It's a |
182 // Loads the given file and parses it to LDObjects using parseLine. It's a |
183 // separate class so as to be able to do the work in a separate thread. |
183 // separate class so as to be able to do the work in a separate thread. |
184 // ============================================================================= |
184 // ============================================================================= |
185 class FileLoader : public QObject { |
185 class FileLoader : public QObject { |
186 Q_OBJECT |
186 Q_OBJECT |
187 READ_PROPERTY (vector<LDObject*>, objs, setObjects) |
187 READ_PROPERTY (List<LDObject*>, objs, setObjects) |
188 READ_PROPERTY (bool, done, setDone) |
188 READ_PROPERTY (bool, done, setDone) |
189 READ_PROPERTY (ulong, progress, setProgress) |
189 READ_PROPERTY (ulong, progress, setProgress) |
190 READ_PROPERTY (bool, aborted, setAborted) |
190 READ_PROPERTY (bool, aborted, setAborted) |
191 PROPERTY (vector<str>, lines, setLines) |
191 PROPERTY (List<str>, lines, setLines) |
192 PROPERTY (ulong*, warningsPointer, setWarningsPointer) |
192 PROPERTY (ulong*, warningsPointer, setWarningsPointer) |
193 PROPERTY (bool, concurrent, setConcurrent) |
193 PROPERTY (bool, concurrent, setConcurrent) |
194 |
194 |
195 public slots: |
195 public slots: |
196 void start(); |
196 void start(); |