Sun, 10 Jun 2018 23:25:08 +0300
some rework in description
--- a/src/linetypes/circularprimitive.cpp Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/circularprimitive.cpp Sun Jun 10 23:25:08 2018 +0300 @@ -157,12 +157,22 @@ QString LDCircularPrimitive::objectListText() const { + QString prefix; + + if (m_divisions == HighResolution) + prefix = "Hi-Res"; + else if (m_divisions == LowResolution) + prefix = "Lo-Res"; + else if (m_divisions != MediumResolution) + prefix = format("%1-resolution", m_divisions); + QString result = format( - "%1 %2 %3, (", + "%1 %2 %3 %4, (", + prefix, PrimitiveModel::typeName(m_type), m_segments / m_divisions, position().toString(true) - ); + ).simplified(); for (int i = 0; i < 9; ++i) result += format("%1%2", transformationMatrix().value(i), (i != 8) ? " " : ""); @@ -193,9 +203,28 @@ return 0; } -QString LDCircularPrimitive::typeName() const +QString LDCircularPrimitive::iconName() const { - return "circular-primitive"; + switch (m_type) + { + case PrimitiveModel::Ring: + case PrimitiveModel::Cone: + break; + + case PrimitiveModel::Cylinder: + return "cylinder"; + + case PrimitiveModel::Disc: + return "disc"; + + case PrimitiveModel::DiscNegative: + return "disc-negative"; + + case PrimitiveModel::Circle: + return "circle"; + } + + return ""; } void LDCircularPrimitive::serialize(class Serializer& serializer)
--- a/src/linetypes/circularprimitive.h Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/circularprimitive.h Sun Jun 10 23:25:08 2018 +0300 @@ -30,7 +30,7 @@ QVector<LDPolygon> rasterizePolygons(DocumentManager* context, Winding parentWinding) override; QString objectListText() const override; int triangleCount(DocumentManager*) const override; - QString typeName() const override; + QString iconName() const override; void serialize(class Serializer& serializer) override; private:
--- a/src/linetypes/comment.cpp Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/comment.cpp Sun Jun 10 23:25:08 2018 +0300 @@ -27,7 +27,7 @@ return LDObjectType::Comment; } -QString LDComment::typeName() const +QString LDComment::iconName() const { return "comment"; }
--- a/src/linetypes/comment.h Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/comment.h Sun Jun 10 23:25:08 2018 +0300 @@ -35,7 +35,7 @@ QString objectListText() const override; QString text() const; LDObjectType type() const override; - QString typeName() const override; + QString iconName() const override; void setText(QString value); void serialize(class Serializer& serializer) override;
--- a/src/linetypes/conditionaledge.h Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/conditionaledge.h Sun Jun 10 23:25:08 2018 +0300 @@ -39,5 +39,5 @@ int numVertices() const override { return 4; } int numPolygonVertices() const override { return 2; } LDColor defaultColor() const override { return EdgeColor; } - QString typeName() const override { return "condline"; } + QString iconName() const override { return "condline"; } };
--- a/src/linetypes/edgeline.h Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/edgeline.h Sun Jun 10 23:25:08 2018 +0300 @@ -38,5 +38,5 @@ virtual QString asText() const override; int numVertices() const override { return 2; } LDColor defaultColor() const override { return EdgeColor; } - QString typeName() const override { return "line"; } + QString iconName() const override { return "line"; } };
--- a/src/linetypes/empty.cpp Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/empty.cpp Sun Jun 10 23:25:08 2018 +0300 @@ -19,7 +19,7 @@ #include "empty.h" -QString LDEmpty::typeName() const +QString LDEmpty::iconName() const { return "empty"; }
--- a/src/linetypes/empty.h Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/empty.h Sun Jun 10 23:25:08 2018 +0300 @@ -30,5 +30,5 @@ QString asText() const override; QString objectListText() const override; LDObjectType type() const override; - QString typeName() const override; + QString iconName() const override; };
--- a/src/linetypes/modelobject.cpp Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/modelobject.cpp Sun Jun 10 23:25:08 2018 +0300 @@ -556,7 +556,7 @@ } else { - return typeName(); + return iconName(); } }
--- a/src/linetypes/modelobject.h Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/modelobject.h Sun Jun 10 23:25:08 2018 +0300 @@ -86,7 +86,7 @@ void setInverted(bool value); virtual int triangleCount(DocumentManager* context) const; virtual LDObjectType type() const = 0; - virtual QString typeName() const = 0; + virtual QString iconName() const = 0; const Vertex& vertex (int i) const; virtual void serialize(class Serializer& serializer); @@ -154,7 +154,7 @@ QString contents() const; QString objectListText() const override; bool isColored() const override { return false; } - QString typeName() const override { return "error"; } + QString iconName() const override { return "error"; } void serialize(class Serializer& serializer) override; private: @@ -193,7 +193,7 @@ QString objectListText() const override; QString referenceName() const; int triangleCount(DocumentManager *context) const override; - QString typeName() const override { return "subfilereference"; } + QString iconName() const override { return "subfilereference"; } void serialize(class Serializer& serializer) override; void setReferenceName(const QString& newReferenceName); @@ -226,7 +226,7 @@ QVector<LDPolygon> rasterizePolygons (int segments); int numVertices() const override { return 4; } LDColor defaultColor() const override { return EdgeColor; } - QString typeName() const override { return "beziercurve"; } + QString iconName() const override { return "beziercurve"; } }; enum
--- a/src/linetypes/quadrilateral.cpp Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/quadrilateral.cpp Sun Jun 10 23:25:08 2018 +0300 @@ -31,7 +31,7 @@ return 4; } -QString LDQuadrilateral::typeName() const +QString LDQuadrilateral::iconName() const { return "quad"; }
--- a/src/linetypes/quadrilateral.h Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/quadrilateral.h Sun Jun 10 23:25:08 2018 +0300 @@ -36,5 +36,5 @@ int numVertices() const override; int triangleCount(DocumentManager*) const override; LDObjectType type() const override; - QString typeName() const override; + QString iconName() const override; };
--- a/src/linetypes/triangle.h Sun Jun 10 23:07:24 2018 +0300 +++ b/src/linetypes/triangle.h Sun Jun 10 23:25:08 2018 +0300 @@ -38,5 +38,5 @@ virtual QString asText() const override; int triangleCount(DocumentManager*) const override; int numVertices() const override { return 3; } - QString typeName() const override { return "triangle"; } + QString iconName() const override { return "triangle"; } };
--- a/src/model.cpp Sun Jun 10 23:07:24 2018 +0300 +++ b/src/model.cpp Sun Jun 10 23:25:08 2018 +0300 @@ -337,7 +337,7 @@ } case Qt::DecorationRole: - return MainWindow::getIcon(object->typeName()); + return MainWindow::getIcon(object->iconName()); case Qt::BackgroundColorRole: if (object->type() == LDObjectType::Error)