1 #include "src/ui/circletooloptionswidget.h" |
1 #include "src/ui/circletooloptionswidget.h" |
2 |
2 |
3 static QString circularPrimitiveTypeName(CircularPrimitive::Type type) |
3 static QString circularPrimitiveTypeName(circular_primitive_type_e type) |
4 { |
4 { |
5 switch (type) { |
5 switch (type) { |
6 case CircularPrimitive::Circle: |
6 case circular_primitive_type_e::circle: |
7 return CircleToolOptionsWidget::tr("Circle"); |
7 return CircleToolOptionsWidget::tr("Circle"); |
8 case CircularPrimitive::Disc: |
8 case circular_primitive_type_e::disc: |
9 return CircleToolOptionsWidget::tr("Disc"); |
9 return CircleToolOptionsWidget::tr("Disc"); |
10 case CircularPrimitive::Cylinder: |
10 case circular_primitive_type_e::cylinder: |
11 return CircleToolOptionsWidget::tr("Cylinder"); |
11 return CircleToolOptionsWidget::tr("Cylinder"); |
12 case CircularPrimitive::CylinderOpen: |
12 case circular_primitive_type_e::cylinder_open: |
13 return CircleToolOptionsWidget::tr("Cylinder open"); |
13 return CircleToolOptionsWidget::tr("Cylinder open"); |
14 case CircularPrimitive::CylinderClosed: |
14 case circular_primitive_type_e::cylinder_closed: |
15 return CircleToolOptionsWidget::tr("Cylinder closed"); |
15 return CircleToolOptionsWidget::tr("Cylinder closed"); |
16 case CircularPrimitive::DiscNegative: |
16 case circular_primitive_type_e::disc_negative: |
17 return CircleToolOptionsWidget::tr("Disc negative"); |
17 return CircleToolOptionsWidget::tr("Disc negative"); |
18 case CircularPrimitive::Chord: |
18 case circular_primitive_type_e::chord: |
19 return CircleToolOptionsWidget::tr("Chord"); |
19 return CircleToolOptionsWidget::tr("Chord"); |
20 } |
20 } |
21 return ""; |
21 return ""; |
22 } |
22 } |
23 |
23 |
24 CircleToolOptionsWidget::CircleToolOptionsWidget(QWidget *parent) : |
24 CircleToolOptionsWidget::CircleToolOptionsWidget(QWidget *parent) : |
25 QWidget{parent} |
25 QWidget{parent} |
26 { |
26 { |
27 this->ui.setupUi(this); |
27 this->ui.setupUi(this); |
28 for (int i = 0; i < CircularPrimitive::NUM_TYPES; ++i) { |
28 for (int i = 0; i < circular_primitive::NUM_TYPES; ++i) { |
29 const auto type = static_cast<CircularPrimitive::Type>(i); |
29 const auto type = static_cast<circular_primitive_type_e>(i); |
30 this->ui.type->addItem(circularPrimitiveTypeName(type), type); |
30 this->ui.type->addItem(circularPrimitiveTypeName(type), QVariant::fromValue(type)); |
31 } |
31 } |
32 connect(ui.segments, qOverload<int>(&QSpinBox::valueChanged), this, &CircleToolOptionsWidget::handleInputChange); |
32 connect(ui.segments, qOverload<int>(&QSpinBox::valueChanged), this, &CircleToolOptionsWidget::handleInputChange); |
33 connect(ui.divisions, &QComboBox::currentTextChanged, this, &CircleToolOptionsWidget::handleInputChange); |
33 connect(ui.divisions, &QComboBox::currentTextChanged, this, &CircleToolOptionsWidget::handleInputChange); |
34 connect(ui.type, &QComboBox::currentTextChanged, this, &CircleToolOptionsWidget::handleInputChange); |
34 connect(ui.type, &QComboBox::currentTextChanged, this, &CircleToolOptionsWidget::handleInputChange); |
35 } |
35 } |