src/file.h

changeset 539
72ad83a67165
parent 538
2f85d4d286e5
child 540
0334789cb4d7
equal deleted inserted replaced
538:2f85d4d286e5 539:72ad83a67165
51 // The default name is a placeholder, initially suggested name for a file. The 51 // The default name is a placeholder, initially suggested name for a file. The
52 // primitive generator uses this to give initial names to primitives. 52 // primitive generator uses this to give initial names to primitives.
53 // ============================================================================= 53 // =============================================================================
54 class LDFile : public QObject 54 class LDFile : public QObject
55 { Q_OBJECT 55 { Q_OBJECT
56 READ_PROPERTY (QList<LDObject*>, objects, setObjects) 56 PROPERTY (private, QList<LDObject*>, Objects, NO_OPS, NO_CB)
57 READ_PROPERTY (History, history, setHistory) 57 PROPERTY (private, History*, History, NO_OPS, NO_CB)
58 READ_PROPERTY (QList<LDObject*>, vertices, setVertices) 58 PROPERTY (private, QList<LDObject*>, Vertices, NO_OPS, NO_CB)
59 PROPERTY (str, name, setName) 59 PROPERTY (public, str, Name, STR_OPS, NO_CB)
60 PROPERTY (str, defaultName, setDefaultName) 60 PROPERTY (public, str, DefaultName, STR_OPS, NO_CB)
61 PROPERTY (bool, implicit, setImplicit) 61 PROPERTY (public, bool, Implicit, BOOL_OPS, NO_CB)
62 PROPERTY (QList<LDObject*>, cache, setCache) 62 PROPERTY (public, QList<LDObject*>, Cache, NO_OPS, NO_CB)
63 PROPERTY (long, savePos, setSavePos) 63 PROPERTY (public, long, SavePosition, NUM_OPS, NO_CB)
64 DECLARE_PROPERTY (QListWidgetItem*, listItem, setListItem) 64 PROPERTY (public, QListWidgetItem*, ListItem, NO_OPS, NO_CB)
65 65
66 public: 66 public:
67 LDFile(); 67 LDFile();
68 ~LDFile(); 68 ~LDFile();
69 69
85 inline LDFile& operator<< (LDObject* obj) 85 inline LDFile& operator<< (LDObject* obj)
86 { addObject (obj); 86 { addObject (obj);
87 return *this; 87 return *this;
88 } 88 }
89 89
90 inline void openHistory() 90 inline void addHistoryStep()
91 { m_history.open(); 91 { m_History->addStep();
92 }
93
94 inline void closeHistory()
95 { m_history.close();
96 } 92 }
97 93
98 inline void undo() 94 inline void undo()
99 { m_history.undo(); 95 { m_History->undo();
100 } 96 }
101 97
102 inline void redo() 98 inline void redo()
103 { m_history.redo(); 99 { m_History->redo();
104 } 100 }
105 101
106 inline void clearHistory() 102 inline void clearHistory()
107 { m_history.clear(); 103 { m_History->clear();
108 } 104 }
109 105
110 inline void addToHistory (AbstractHistoryEntry* entry) 106 inline void addToHistory (AbstractHistoryEntry* entry)
111 { m_history << entry; 107 { *m_History << entry;
112 } 108 }
113 109
114 static void closeUnused(); 110 static void closeUnused();
115 static LDFile* current(); 111 static LDFile* current();
116 static void setCurrent (LDFile* f); 112 static void setCurrent (LDFile* f);
182 // Loads the given file and parses it to LDObjects using parseLine. It's a 178 // 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 progressively through the 179 // separate class so as to be able to do the work progressively through the
184 // event loop, allowing the program to maintain responsivity during loading. 180 // event loop, allowing the program to maintain responsivity during loading.
185 // ============================================================================= 181 // =============================================================================
186 class FileLoader : public QObject 182 class FileLoader : public QObject
187 { Q_OBJECT 183 { Q_OBJECT
188 READ_PROPERTY (QList<LDObject*>, objs, setObjects) 184 PROPERTY (private, QList<LDObject*>, Objects, NO_OPS, NO_CB)
189 READ_PROPERTY (bool, done, setDone) 185 PROPERTY (private, bool, Done, BOOL_OPS, NO_CB)
190 READ_PROPERTY (int, progress, setProgress) 186 PROPERTY (private, int, Progress, NUM_OPS, NO_CB)
191 READ_PROPERTY (bool, aborted, setAborted) 187 PROPERTY (private, bool, Aborted, BOOL_OPS, NO_CB)
192 PROPERTY (QList<str>, lines, setLines) 188 PROPERTY (public, QStringList, Lines, NO_OPS, NO_CB)
193 PROPERTY (int*, warningsPointer, setWarningsPointer) 189 PROPERTY (public, int*, Warnings, NO_OPS, NO_CB)
194 PROPERTY (bool, concurrent, setConcurrent) 190 PROPERTY (public, bool, OnForeground, BOOL_OPS, NO_CB)
195 191
196 public slots: 192 public slots:
197 void start(); 193 void start();
198 void abort(); 194 void abort();
199 195

mercurial