Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/printwidget.cpp
Show All 24 Lines | 24 | PrintWidget::PrintWidget(bool showAllControls, QWidget *parent) : | |||
---|---|---|---|---|---|
25 | QWidget(parent) | 25 | QWidget(parent) | ||
26 | { | 26 | { | ||
27 | auto mainLayout = new QVBoxLayout; | 27 | auto mainLayout = new QVBoxLayout; | ||
28 | QPushButton *newButton = nullptr; | 28 | QPushButton *newButton = nullptr; | ||
29 | QLabel *newLabel = nullptr; | 29 | QLabel *newLabel = nullptr; | ||
30 | QHBoxLayout *hBoxLayout = nullptr; | 30 | QHBoxLayout *hBoxLayout = nullptr; | ||
31 | if (showAllControls) { | 31 | if (showAllControls) { | ||
32 | buttonPrint = new QPushButton(tr("Print File")); | 32 | buttonPrint = new QPushButton(tr("Print File")); | ||
33 | connect(buttonPrint, &QPushButton::clicked, [this] { | 33 | connect(buttonPrint, &QPushButton::clicked, this, [this] { | ||
34 | emit(printPressed()); | 34 | emit(printPressed()); | ||
35 | }); | 35 | }); | ||
36 | 36 | | |||
37 | newButton = new QPushButton(tr("Emergency Stop")); | 37 | newButton = new QPushButton(tr("Emergency Stop")); | ||
38 | connect(newButton, &QPushButton::clicked, [this] { | 38 | connect(newButton, &QPushButton::clicked, this, [this] { | ||
39 | emit(emergencyStopPressed()); | 39 | emit(emergencyStopPressed()); | ||
40 | }); | 40 | }); | ||
41 | 41 | | |||
42 | hBoxLayout = new QHBoxLayout; | 42 | hBoxLayout = new QHBoxLayout; | ||
43 | hBoxLayout->addWidget(buttonPrint); | 43 | hBoxLayout->addWidget(buttonPrint); | ||
44 | hBoxLayout->addWidget(newButton); | 44 | hBoxLayout->addWidget(newButton); | ||
45 | mainLayout->addLayout(hBoxLayout); | 45 | mainLayout->addLayout(hBoxLayout); | ||
46 | 46 | | |||
Show All 10 Lines | |||||
57 | 57 | | |||
58 | newLabel = new QLabel(tr("Printer Speed")); | 58 | newLabel = new QLabel(tr("Printer Speed")); | ||
59 | sbPrintSpeed = new QSpinBox; | 59 | sbPrintSpeed = new QSpinBox; | ||
60 | sbPrintSpeed->setRange(1, 300); | 60 | sbPrintSpeed->setRange(1, 300); | ||
61 | sbPrintSpeed->setValue(100); | 61 | sbPrintSpeed->setValue(100); | ||
62 | sbPrintSpeed->setSuffix(QStringLiteral("%")); | 62 | sbPrintSpeed->setSuffix(QStringLiteral("%")); | ||
63 | 63 | | |||
64 | newButton = new QPushButton(tr("Set")); | 64 | newButton = new QPushButton(tr("Set")); | ||
65 | connect(newButton, &QPushButton::clicked, [this] { | 65 | connect(newButton, &QPushButton::clicked, this, [this] { | ||
66 | emit(printSpeedChanged(sbPrintSpeed->value())); | 66 | emit(printSpeedChanged(sbPrintSpeed->value())); | ||
67 | }); | 67 | }); | ||
68 | 68 | | |||
69 | hBoxLayout = new QHBoxLayout; | 69 | hBoxLayout = new QHBoxLayout; | ||
70 | hBoxLayout->addWidget(newLabel, 60); | 70 | hBoxLayout->addWidget(newLabel, 60); | ||
71 | hBoxLayout->addWidget(sbPrintSpeed, 20); | 71 | hBoxLayout->addWidget(sbPrintSpeed, 20); | ||
72 | hBoxLayout->addWidget(newButton, 20); | 72 | hBoxLayout->addWidget(newButton, 20); | ||
73 | mainLayout->addLayout(hBoxLayout); | 73 | mainLayout->addLayout(hBoxLayout); | ||
74 | 74 | | |||
75 | newLabel = new QLabel(tr("Flow Rate")); | 75 | newLabel = new QLabel(tr("Flow Rate")); | ||
76 | sbFlowRate = new QSpinBox; | 76 | sbFlowRate = new QSpinBox; | ||
77 | sbFlowRate->setRange(1, 300); | 77 | sbFlowRate->setRange(1, 300); | ||
78 | sbFlowRate->setValue(100); | 78 | sbFlowRate->setValue(100); | ||
79 | sbFlowRate->setSuffix(QStringLiteral("%")); | 79 | sbFlowRate->setSuffix(QStringLiteral("%")); | ||
80 | 80 | | |||
81 | newButton = new QPushButton(tr("Set")); | 81 | newButton = new QPushButton(tr("Set")); | ||
82 | connect(newButton, &QPushButton::clicked, [this] { | 82 | connect(newButton, &QPushButton::clicked, this, [this] { | ||
83 | emit(flowRateChanged(sbFlowRate->value())); | 83 | emit(flowRateChanged(sbFlowRate->value())); | ||
84 | }); | 84 | }); | ||
85 | hBoxLayout = new QHBoxLayout; | 85 | hBoxLayout = new QHBoxLayout; | ||
86 | hBoxLayout->addWidget(newLabel, 60); | 86 | hBoxLayout->addWidget(newLabel, 60); | ||
87 | hBoxLayout->addWidget(sbFlowRate, 20); | 87 | hBoxLayout->addWidget(sbFlowRate, 20); | ||
88 | hBoxLayout->addWidget(newButton, 20); | 88 | hBoxLayout->addWidget(newButton, 20); | ||
89 | mainLayout->addLayout(hBoxLayout); | 89 | mainLayout->addLayout(hBoxLayout); | ||
90 | 90 | | |||
91 | comboFanSelect = new QComboBox; | 91 | comboFanSelect = new QComboBox; | ||
92 | sbFanSpeed = new QSpinBox; | 92 | sbFanSpeed = new QSpinBox; | ||
93 | sbFanSpeed->setRange(0, 100); | 93 | sbFanSpeed->setRange(0, 100); | ||
94 | sbFanSpeed->setSuffix(QStringLiteral("%")); | 94 | sbFanSpeed->setSuffix(QStringLiteral("%")); | ||
95 | 95 | | |||
96 | newButton = new QPushButton(tr("Set")); | 96 | newButton = new QPushButton(tr("Set")); | ||
97 | connect(newButton, &QPushButton::clicked, [this] { | 97 | connect(newButton, &QPushButton::clicked, this, [this] { | ||
98 | emit(fanSpeedChanged(sbFanSpeed->value(), comboFanSelect->currentIndex())); | 98 | emit(fanSpeedChanged(sbFanSpeed->value(), comboFanSelect->currentIndex())); | ||
99 | }); | 99 | }); | ||
100 | 100 | | |||
101 | hBoxLayout = new QHBoxLayout; | 101 | hBoxLayout = new QHBoxLayout; | ||
102 | hBoxLayout->addWidget(comboFanSelect, 60); | 102 | hBoxLayout->addWidget(comboFanSelect, 60); | ||
103 | hBoxLayout->addWidget(sbFanSpeed, 20); | 103 | hBoxLayout->addWidget(sbFanSpeed, 20); | ||
104 | hBoxLayout->addWidget(newButton, 20); | 104 | hBoxLayout->addWidget(newButton, 20); | ||
105 | mainLayout->addLayout(hBoxLayout); | 105 | mainLayout->addLayout(hBoxLayout); | ||
Show All 20 Lines |