Fri, 22 Jun 2018 12:13:01 +0300
replaced uses of QList with QVector
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
1326 | 3 | * Copyright (C) 2013 - 2018 Teemu Piippo |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include <QRegExp> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include <QDialog> |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
22 | #include <QTreeWidgetItem> |
1021
f40c792c9334
Replaced GetRecursiveFilenames with QDirIterator
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
23 | #include <QDirIterator> |
1309
c72e7e09bda8
reworked primitive scanning
Teemu Piippo <teemu@hecknology.net>
parents:
1297
diff
changeset
|
24 | #include <QStack> |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
25 | #include "main.h" |
1080
6dac2d52bd9a
Removed the LDSpawn function and replaced its last use cases.
Teemu Piippo <teemu@hecknology.net>
parents:
1072
diff
changeset
|
26 | #include "model.h" |
1159
6ad8cdcd88d9
print() is no longer a global function but is tied to HierarchyElement.
Teemu Piippo <teemu@hecknology.net>
parents:
1080
diff
changeset
|
27 | #include "hierarchyelement.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | class LDDocument; |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
30 | class Ui_GeneratePrimitiveDialog; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | class PrimitiveCategory; |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
32 | class PrimitiveScanner; |
794 | 33 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | struct Primitive |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | { |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
36 | QString name; |
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
37 | QString title; |
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
38 | PrimitiveCategory* category; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | |
1053 | 41 | struct PrimitiveModel |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
42 | { |
1345
1e345ed80a1d
added support for new style primitive names
Teemu Piippo <teemu@hecknology.net>
parents:
1334
diff
changeset
|
43 | enum FilenameStyle { NewStyleName, LegacyStyleName }; |
1e345ed80a1d
added support for new style primitive names
Teemu Piippo <teemu@hecknology.net>
parents:
1334
diff
changeset
|
44 | |
1053 | 45 | enum Type |
46 | { | |
47 | Circle, | |
48 | Cylinder, | |
49 | Disc, | |
50 | DiscNegative, | |
51 | Ring, | |
52 | Cone, | |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
53 | CylinderClosed, |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
54 | CylinderOpen, |
1408
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
55 | Chord, |
1053 | 56 | } type; |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
57 | int segments; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
58 | int divisions; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
59 | int ringNumber; |
1053 | 60 | |
61 | QString typeName() const; | |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
62 | void generateBody(Model& model, bool deep = false) const; |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
1347
diff
changeset
|
63 | void generateCylinder(Model& model, Winding winding = CounterClockwise) const; |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
64 | void generateCircle(Model& model, const QMatrix4x4& matrix = {}) const; |
1053 | 65 | static QString typeName(Type type); |
1345
1e345ed80a1d
added support for new style primitive names
Teemu Piippo <teemu@hecknology.net>
parents:
1334
diff
changeset
|
66 | QString makeFileName(FilenameStyle style) const; |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
67 | void generateDisc(Model& model) const; |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
68 | |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
69 | private: |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
70 | void generateDiscNegative(Model& model) const; |
1408
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
71 | void generateChord(Model& model) const; |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
72 | }; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
73 | |
1401
59b578c77111
fixed bugs regarding circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
74 | Q_DECLARE_METATYPE(PrimitiveModel::Type) |
59b578c77111
fixed bugs regarding circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
75 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | class PrimitiveCategory : public QObject |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | Q_OBJECT |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | |
794 | 80 | public: |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
81 | enum PatternType |
794 | 82 | { |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
83 | FilenamePattern, |
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
84 | TitlePattern |
794 | 85 | }; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | |
794 | 87 | struct RegexEntry |
88 | { | |
89 | QRegExp regex; | |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
90 | PatternType type; |
794 | 91 | }; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | |
1419
f7c53002a990
replaced uses of QList with QVector
Teemu Piippo <teemu@hecknology.net>
parents:
1408
diff
changeset
|
93 | QVector<RegexEntry> patterns; |
f7c53002a990
replaced uses of QList with QVector
Teemu Piippo <teemu@hecknology.net>
parents:
1408
diff
changeset
|
94 | QVector<Primitive> primitives; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | |
794 | 96 | explicit PrimitiveCategory (QString name, QObject* parent = 0); |
97 | bool isValidToInclude(); | |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
98 | QString name() const; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
100 | private: |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
101 | QString m_name; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | |
1283
3c3a5eb965f7
added an MVC interface to the primitives tree
Teemu Piippo <teemu@hecknology.net>
parents:
1159
diff
changeset
|
104 | class PrimitiveManager : public QAbstractItemModel, HierarchyElement |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
105 | { |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
106 | Q_OBJECT |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
107 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
108 | public: |
1297
389516787a4c
added subfile reference editor
Teemu Piippo <teemu@hecknology.net>
parents:
1283
diff
changeset
|
109 | enum |
389516787a4c
added subfile reference editor
Teemu Piippo <teemu@hecknology.net>
parents:
1283
diff
changeset
|
110 | { |
389516787a4c
added subfile reference editor
Teemu Piippo <teemu@hecknology.net>
parents:
1283
diff
changeset
|
111 | PrimitiveNameRole = Qt::UserRole + 10, |
389516787a4c
added subfile reference editor
Teemu Piippo <teemu@hecknology.net>
parents:
1283
diff
changeset
|
112 | PrimitiveDescriptionRole, |
389516787a4c
added subfile reference editor
Teemu Piippo <teemu@hecknology.net>
parents:
1283
diff
changeset
|
113 | }; |
389516787a4c
added subfile reference editor
Teemu Piippo <teemu@hecknology.net>
parents:
1283
diff
changeset
|
114 | |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
115 | PrimitiveManager(QObject* parent); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
116 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
117 | PrimitiveScanner* activeScanner(); |
1053 | 118 | LDDocument* generatePrimitive(const PrimitiveModel &spec); |
119 | LDDocument* getPrimitive(const PrimitiveModel &spec); | |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
120 | QString getPrimitivesCfgPath() const; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
121 | void loadPrimitives(); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
122 | void startScan(); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
123 | |
1283
3c3a5eb965f7
added an MVC interface to the primitives tree
Teemu Piippo <teemu@hecknology.net>
parents:
1159
diff
changeset
|
124 | int columnCount(const QModelIndex &parent = {}) const override; |
3c3a5eb965f7
added an MVC interface to the primitives tree
Teemu Piippo <teemu@hecknology.net>
parents:
1159
diff
changeset
|
125 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; |
3c3a5eb965f7
added an MVC interface to the primitives tree
Teemu Piippo <teemu@hecknology.net>
parents:
1159
diff
changeset
|
126 | QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override; |
3c3a5eb965f7
added an MVC interface to the primitives tree
Teemu Piippo <teemu@hecknology.net>
parents:
1159
diff
changeset
|
127 | QModelIndex parent(const QModelIndex &index) const override; |
3c3a5eb965f7
added an MVC interface to the primitives tree
Teemu Piippo <teemu@hecknology.net>
parents:
1159
diff
changeset
|
128 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
3c3a5eb965f7
added an MVC interface to the primitives tree
Teemu Piippo <teemu@hecknology.net>
parents:
1159
diff
changeset
|
129 | QVariant headerData(int section, Qt::Orientation orientation, int role) const override; |
3c3a5eb965f7
added an MVC interface to the primitives tree
Teemu Piippo <teemu@hecknology.net>
parents:
1159
diff
changeset
|
130 | |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
131 | private: |
1419
f7c53002a990
replaced uses of QList with QVector
Teemu Piippo <teemu@hecknology.net>
parents:
1408
diff
changeset
|
132 | QVector<PrimitiveCategory*> m_categories; |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
133 | PrimitiveScanner* m_activeScanner; |
1055
c28d07a583ac
Cleaned up PrimitiveScanner
Teemu Piippo <teemu@hecknology.net>
parents:
1054
diff
changeset
|
134 | QVector<Primitive> m_primitives; |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
135 | PrimitiveCategory* m_unmatched; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
136 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
137 | void loadCategories(); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
138 | void populateCategories(); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
139 | void clearCategories(); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
140 | }; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1018
diff
changeset
|
141 | |
1055
c28d07a583ac
Cleaned up PrimitiveScanner
Teemu Piippo <teemu@hecknology.net>
parents:
1054
diff
changeset
|
142 | /* |
c28d07a583ac
Cleaned up PrimitiveScanner
Teemu Piippo <teemu@hecknology.net>
parents:
1054
diff
changeset
|
143 | * PrimitiveScanner |
c28d07a583ac
Cleaned up PrimitiveScanner
Teemu Piippo <teemu@hecknology.net>
parents:
1054
diff
changeset
|
144 | * |
c28d07a583ac
Cleaned up PrimitiveScanner
Teemu Piippo <teemu@hecknology.net>
parents:
1054
diff
changeset
|
145 | * Worker object that scans the primitives folder for primitives and builds an index of them. |
c28d07a583ac
Cleaned up PrimitiveScanner
Teemu Piippo <teemu@hecknology.net>
parents:
1054
diff
changeset
|
146 | */ |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
147 | class PrimitiveScanner : public QObject, HierarchyElement |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | Q_OBJECT |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
150 | |
794 | 151 | public: |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
152 | PrimitiveScanner(PrimitiveManager* parent); |
1309
c72e7e09bda8
reworked primitive scanning
Teemu Piippo <teemu@hecknology.net>
parents:
1297
diff
changeset
|
153 | ~PrimitiveScanner(); |
1055
c28d07a583ac
Cleaned up PrimitiveScanner
Teemu Piippo <teemu@hecknology.net>
parents:
1054
diff
changeset
|
154 | const QVector<Primitive>& scannedPrimitives() const; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | |
794 | 156 | public slots: |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
157 | void work(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | |
794 | 159 | signals: |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
160 | void workDone(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | |
794 | 162 | private: |
1018
49358df9495b
Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
163 | PrimitiveManager* m_manager; |
1055
c28d07a583ac
Cleaned up PrimitiveScanner
Teemu Piippo <teemu@hecknology.net>
parents:
1054
diff
changeset
|
164 | QVector<Primitive> m_scannedPrimitives; |
1309
c72e7e09bda8
reworked primitive scanning
Teemu Piippo <teemu@hecknology.net>
parents:
1297
diff
changeset
|
165 | QStack<QDir> directories; |
c72e7e09bda8
reworked primitive scanning
Teemu Piippo <teemu@hecknology.net>
parents:
1297
diff
changeset
|
166 | QDirIterator* currentIterator = nullptr; |
1021
f40c792c9334
Replaced GetRecursiveFilenames with QDirIterator
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
167 | int m_basePathLength; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | }; |