1286:2a0316eb374c | 1287:f1da43b7f5c6 |
---|---|
18 | 18 |
19 #pragma once | 19 #pragma once |
20 #include "main.h" | 20 #include "main.h" |
21 #include "model.h" | 21 #include "model.h" |
22 | 22 |
23 struct LDHeader; | |
24 | |
23 // | 25 // |
24 // DocumentLoader | 26 // DocumentLoader |
25 // | 27 // |
26 // Loads the given file and parses it to LDObjects. It's a separate class so as to be able to do the work progressively | 28 // Loads the given file and parses it to LDObjects. It's a separate class so as to be able to do the work progressively |
27 // through the event loop, allowing the program to maintain responsivity during loading. | 29 // through the event loop, allowing the program to maintain responsivity during loading. |
29 class DocumentLoader : public QObject | 31 class DocumentLoader : public QObject |
30 { | 32 { |
31 Q_OBJECT | 33 Q_OBJECT |
32 | 34 |
33 public: | 35 public: |
34 DocumentLoader (Model* model, bool onForeground = false, QObject* parent = 0); | 36 DocumentLoader( |
37 Model* model, | |
38 LDHeader& header, | |
39 bool onForeground = false, | |
40 QObject* parent = nullptr, | |
41 ); | |
35 | 42 |
36 Q_SLOT void abort(); | 43 Q_SLOT void abort(); |
37 bool hasAborted(); | 44 bool hasAborted(); |
38 bool isDone() const; | 45 bool isDone() const; |
39 bool isOnForeground() const; | 46 bool isOnForeground() const; |
44 int warningCount() const; | 51 int warningCount() const; |
45 | 52 |
46 private: | 53 private: |
47 class OpenProgressDialog* m_progressDialog; | 54 class OpenProgressDialog* m_progressDialog; |
48 Model* _model; | 55 Model* _model; |
56 LDHeader& _header; | |
49 QStringList m_lines; | 57 QStringList m_lines; |
50 int m_progress; | 58 int m_progress; |
51 int m_warningCount; | 59 int m_warningCount = 0; |
52 bool m_isDone; | 60 bool m_isDone = false; |
53 bool m_hasAborted; | 61 bool m_hasAborted = false; |
54 bool m_isOnForeground; | 62 const bool m_isOnForeground = false; |
55 | 63 |
56 private slots: | 64 private slots: |
57 void work (int i); | 65 void work (int i); |
58 | 66 |
59 signals: | 67 signals: |