diff -r 6fd1597b688e -r 2a48c0fff107 src/primitives.h --- a/src/primitives.h Wed Nov 16 00:52:22 2016 +0200 +++ b/src/primitives.h Wed Nov 16 01:28:42 2016 +0200 @@ -35,22 +35,25 @@ PrimitiveCategory* category; }; -enum PrimitiveType +struct PrimitiveModel { - Circle, - Cylinder, - Disc, - DiscNegative, - Ring, - Cone, -}; - -struct PrimitiveSpec -{ - PrimitiveType type; + enum Type + { + Circle, + Cylinder, + Disc, + DiscNegative, + Ring, + Cone, + } type; int segments; int divisions; int ringNumber; + + QString typeName() const; + LDObjectList generateBody() const; + static QString typeName(Type type); + QString makeFileName() const; }; class PrimitiveCategory : public QObject @@ -89,24 +92,22 @@ PrimitiveManager(QObject* parent); PrimitiveScanner* activeScanner(); - LDDocument* generatePrimitive(const PrimitiveSpec &spec); - LDDocument* getPrimitive(const PrimitiveSpec &spec); + LDDocument* generatePrimitive(const PrimitiveModel &spec); + LDDocument* getPrimitive(const PrimitiveModel &spec); QString getPrimitivesCfgPath() const; void loadPrimitives(); - void makeCircle(int segs, int divs, double radius, QList& lines); - QString makeRadialFileName(const PrimitiveSpec &spec); - void populateTreeWidget(QTreeWidget* tree, const QString& selectByDefault = QString()); - QString primitiveTypeName(PrimitiveType type); - Q_SLOT void scanDone(); + void populateTreeWidget(QTreeWidget* tree, const QString& selectByDefault = {}); void startScan(); +public slots: + void scanDone(); + private: QList m_categories; PrimitiveScanner* m_activeScanner; QList m_primitives; PrimitiveCategory* m_unmatched; - LDObjectList makePrimitiveBody(const PrimitiveSpec &spec); void loadCategories(); void populateCategories(); void clearCategories();