30 struct Primitive |
30 struct Primitive |
31 { str name, title; |
31 { str name, title; |
32 PrimitiveCategory* cat; |
32 PrimitiveCategory* cat; |
33 }; |
33 }; |
34 |
34 |
35 class PrimitiveCategory |
35 class PrimitiveCategory : public QObject |
36 { PROPERTY (public, str, Name, STR_OPS, STOCK_WRITE) |
36 { Q_OBJECT |
|
37 PROPERTY (public, str, Name, STR_OPS, STOCK_WRITE) |
37 |
38 |
38 public: |
39 public: |
39 enum Type |
40 enum ERegexType |
40 { Filename, |
41 { EFilenameRegex, |
41 Title |
42 ETitleRegex |
42 }; |
43 }; |
43 |
44 |
44 struct RegexEntry |
45 struct RegexEntry |
45 { QRegExp regex; |
46 { QRegExp regex; |
46 Type type; |
47 ERegexType type; |
47 }; |
48 }; |
48 |
49 |
49 QList<RegexEntry> regexes; |
50 QList<RegexEntry> regexes; |
50 QList<Primitive> prims; |
51 QList<Primitive> prims; |
51 static QList<Primitive> uncat; |
52 |
|
53 explicit PrimitiveCategory (str name, QObject* parent = 0); |
|
54 bool isValidToInclude(); |
|
55 |
|
56 static void loadCategories(); |
|
57 static void populateCategories(); |
52 }; |
58 }; |
53 |
59 |
54 // ============================================================================= |
60 // ============================================================================= |
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
56 // ============================================================================= |
62 // ============================================================================= |
58 // |
64 // |
59 // Worker object that scans the primitives folder for primitives and |
65 // Worker object that scans the primitives folder for primitives and |
60 // builds an index of them. |
66 // builds an index of them. |
61 // ============================================================================= |
67 // ============================================================================= |
62 class PrimitiveLister : public QObject |
68 class PrimitiveLister : public QObject |
63 { Q_OBJECT |
69 { Q_OBJECT |
64 |
70 |
65 public: |
71 public: |
|
72 explicit PrimitiveLister (QObject* parent = 0); |
|
73 virtual ~PrimitiveLister(); |
66 static void start(); |
74 static void start(); |
67 |
75 |
68 public slots: |
76 public slots: |
69 void work(); |
77 void work(); |
70 |
78 |
72 void starting (int num); |
80 void starting (int num); |
73 void workDone(); |
81 void workDone(); |
74 void update (int i); |
82 void update (int i); |
75 |
83 |
76 private: |
84 private: |
77 QList<Primitive> m_prims; |
85 QList<Primitive> m_prims; |
|
86 QStringList m_files; |
|
87 int m_i; |
|
88 int m_baselen; |
78 }; |
89 }; |
79 |
90 |
80 extern QList<PrimitiveCategory> g_PrimitiveCategories; |
91 extern QList<PrimitiveCategory*> g_PrimitiveCategories; |
81 |
92 |
82 void loadPrimitives(); |
93 void loadPrimitives(); |
83 bool isPrimitiveLoaderBusy(); |
94 PrimitiveLister* getPrimitiveLister(); |
84 |
95 |
85 enum PrimitiveType |
96 enum PrimitiveType |
86 { Circle, |
97 { Circle, |
87 Cylinder, |
98 Cylinder, |
88 Disc, |
99 Disc, |