Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/movementwidget.cpp
Show All 16 Lines | |||||
17 | */ | 17 | */ | ||
18 | #include <QHBoxLayout> | 18 | #include <QHBoxLayout> | ||
19 | #include <QPushButton> | 19 | #include <QPushButton> | ||
20 | #include <QVBoxLayout> | 20 | #include <QVBoxLayout> | ||
21 | 21 | | |||
22 | #include "axiscontrol.h" | 22 | #include "axiscontrol.h" | ||
23 | #include "movementwidget.h" | 23 | #include "movementwidget.h" | ||
24 | 24 | | |||
25 | MovementWidget::MovementWidget(QWidget *parent) : | 25 | MovementWidget::MovementWidget(bool showHomeAndDisableWidgets, QWidget *parent) : | ||
26 | QWidget(parent) | 26 | QWidget(parent) | ||
27 | { | 27 | { | ||
28 | auto mainLayout = new QVBoxLayout; | 28 | auto mainLayout = new QVBoxLayout; | ||
29 | auto hBoxLayout = new QHBoxLayout; | 29 | auto hBoxLayout = new QHBoxLayout; | ||
30 | auto newButton = new QPushButton; | ||||
30 | 31 | | |||
31 | auto newButton = new QPushButton(tr("Home All")); | 32 | if( showHomeAndDisableWidgets) { | ||
33 | newButton = new QPushButton(tr("Home All")); | ||||
32 | hBoxLayout->addWidget(newButton); | 34 | hBoxLayout->addWidget(newButton); | ||
33 | connect(newButton, &QPushButton::clicked, [this] { | 35 | connect(newButton, &QPushButton::clicked, [this] { | ||
34 | emit(homeAllPressed()); | 36 | emit(homeAllPressed()); | ||
35 | }); | 37 | }); | ||
36 | 38 | | |||
37 | newButton = new QPushButton(tr("Home X")); | 39 | newButton = new QPushButton(tr("Home X")); | ||
38 | hBoxLayout->addWidget(newButton); | 40 | hBoxLayout->addWidget(newButton); | ||
39 | connect(newButton, &QPushButton::clicked, [this] { | 41 | connect(newButton, &QPushButton::clicked, [this] { | ||
40 | emit(homeXPressed()); | 42 | emit(homeXPressed()); | ||
41 | }); | 43 | }); | ||
42 | 44 | | |||
43 | newButton = new QPushButton(tr("Home Y")); | 45 | newButton = new QPushButton(tr("Home Y")); | ||
44 | hBoxLayout->addWidget(newButton); | 46 | hBoxLayout->addWidget(newButton); | ||
45 | connect(newButton, &QPushButton::clicked, [this] { | 47 | connect(newButton, &QPushButton::clicked, [this] { | ||
46 | emit(homeYPressed()); | 48 | emit(homeYPressed()); | ||
47 | }); | 49 | }); | ||
48 | 50 | | |||
49 | newButton = new QPushButton(tr("Home Z")); | 51 | newButton = new QPushButton(tr("Home Z")); | ||
50 | hBoxLayout->addWidget(newButton); | 52 | hBoxLayout->addWidget(newButton); | ||
51 | connect(newButton, &QPushButton::clicked, [this] { | 53 | connect(newButton, &QPushButton::clicked, [this] { | ||
52 | emit(homeZPressed()); | 54 | emit(homeZPressed()); | ||
53 | }); | 55 | }); | ||
54 | mainLayout->addLayout(hBoxLayout); | 56 | mainLayout->addLayout(hBoxLayout); | ||
55 | 57 | | |||
58 | newButton = new QPushButton(tr("Disable Motors")); | ||||
59 | mainLayout->addWidget(newButton); | ||||
60 | connect(newButton, &QPushButton::clicked, [this] { | ||||
61 | emit(disableMotorsPressed()); | ||||
62 | }); | ||||
63 | | ||||
64 | } | ||||
56 | comboMoveAxis = new QComboBox; | 65 | comboMoveAxis = new QComboBox; | ||
57 | comboMoveAxis->addItem(tr("Move X Axis to")); | 66 | comboMoveAxis->addItem(tr("Move X Axis to")); | ||
58 | comboMoveAxis->addItem(tr("Move Y Axis to")); | 67 | comboMoveAxis->addItem(tr("Move Y Axis to")); | ||
59 | comboMoveAxis->addItem(tr("Move Z Axis to")); | 68 | comboMoveAxis->addItem(tr("Move Z Axis to")); | ||
60 | 69 | | |||
61 | sbMoveAxis = new QDoubleSpinBox; | 70 | sbMoveAxis = new QDoubleSpinBox; | ||
62 | sbMoveAxis->setRange(0, 200); | 71 | sbMoveAxis->setRange(0, 200); | ||
63 | 72 | | |||
Show All 12 Lines | |||||
76 | }); | 85 | }); | ||
77 | 86 | | |||
78 | hBoxLayout = new QHBoxLayout; | 87 | hBoxLayout = new QHBoxLayout; | ||
79 | hBoxLayout->addWidget(comboMoveAxis); | 88 | hBoxLayout->addWidget(comboMoveAxis); | ||
80 | hBoxLayout->addWidget(sbMoveAxis); | 89 | hBoxLayout->addWidget(sbMoveAxis); | ||
81 | hBoxLayout->addWidget(newButton); | 90 | hBoxLayout->addWidget(newButton); | ||
82 | mainLayout->addLayout(hBoxLayout); | 91 | mainLayout->addLayout(hBoxLayout); | ||
83 | 92 | | |||
84 | newButton = new QPushButton(tr("Disable Motors")); | | |||
85 | mainLayout->addWidget(newButton); | | |||
86 | connect(newButton, &QPushButton::clicked, [this] { | | |||
87 | emit(disableMotorsPressed()); | | |||
88 | }); | | |||
89 | | ||||
90 | auto axisControl = new AxisControl; | 93 | auto axisControl = new AxisControl; | ||
91 | mainLayout->addWidget(axisControl); | 94 | mainLayout->addWidget(axisControl); | ||
92 | connect(axisControl, &AxisControl::clicked, this, &MovementWidget::relativeMove); | 95 | connect(axisControl, &AxisControl::clicked, this, &MovementWidget::relativeMove); | ||
93 | 96 | | |||
94 | setLayout(mainLayout); | 97 | setLayout(mainLayout); | ||
95 | } | 98 | } |