92 // Finds an OpenFile by name or null if not open |
94 // Finds an OpenFile by name or null if not open |
93 LDOpenFile* findLoadedFile (str name); |
95 LDOpenFile* findLoadedFile (str name); |
94 |
96 |
95 // Opens the given file and parses the LDraw code within. Returns a pointer |
97 // Opens the given file and parses the LDraw code within. Returns a pointer |
96 // to the opened file or null on error. |
98 // to the opened file or null on error. |
97 LDOpenFile* openDATFile (str path, bool search, bool mainfile); |
99 LDOpenFile* openDATFile (str path, bool search); |
98 |
100 |
99 // Opens the given file and returns a pointer to it, potentially looking in /parts and /p |
101 // Opens the given file and returns a pointer to it, potentially looking in /parts and /p |
100 FILE* openLDrawFile (str path, bool bSubDirectories); |
102 FILE* openLDrawFile (str path, bool bSubDirectories); |
101 |
103 |
102 // Close all open files, whether user-opened or subfile caches. |
104 // Close all open files, whether user-opened or subfile caches. |
119 } partListEntry; |
121 } partListEntry; |
120 |
122 |
121 // Init and parse parts.lst |
123 // Init and parse parts.lst |
122 void initPartList (); |
124 void initPartList (); |
123 |
125 |
124 std::vector< LDObject* > loadFileContents (FILE* fp, ulong* numWarnings); |
126 std::vector<LDObject*> loadFileContents (FILE* fp, ulong* numWarnings, bool* ok = null); |
125 |
127 |
126 extern vector<LDOpenFile*> g_loadedFiles; |
128 extern vector<LDOpenFile*> g_loadedFiles; |
127 extern vector<partListEntry> g_PartList; |
129 extern vector<partListEntry> g_PartList; |
128 |
130 |
129 str basename (str path); |
131 str basename (str path); |
130 str dirname (str path); |
132 str dirname (str path); |
131 |
133 |
|
134 class FileLoader : public QObject { |
|
135 Q_OBJECT |
|
136 |
|
137 READ_PROPERTY (std::vector<LDObject*>, objs) |
|
138 READ_PROPERTY (bool, done) |
|
139 READ_PROPERTY (ulong, progress) |
|
140 PROPERTY (FILE*, filePointer, setFilePointer) |
|
141 PROPERTY (ulong*, warningsPointer, setWarningsPointer) |
|
142 |
|
143 public: |
|
144 bool abortflag; |
|
145 |
|
146 public slots: |
|
147 void work (); |
|
148 |
|
149 signals: |
|
150 void progressUpdate (int progress); |
|
151 void workDone (); |
|
152 }; |
|
153 |
132 #endif // FILE_H |
154 #endif // FILE_H |