| 363 |
Kevin |
1 |
#include "PasteController.h"
|
|
|
2 |
|
|
|
3 |
PasteController::PasteController(QWidget *parent) : QWidget(parent)
|
|
|
4 |
{
|
|
|
5 |
QString helpString = "";
|
|
|
6 |
helpString.append("XY Control: Arrow Keys or H/J/K/L\n");
|
|
|
7 |
helpString.append("Z Control: PgUp/PgDown\n");
|
|
|
8 |
helpString.append("Extruder Control: Space");
|
|
|
9 |
labelHelp = new QLabel(helpString);
|
|
|
10 |
|
|
|
11 |
QVBoxLayout *helpLayout = new QVBoxLayout();
|
|
|
12 |
helpLayout->addWidget(labelHelp);
|
|
|
13 |
|
|
|
14 |
QGroupBox *helpBox = new QGroupBox("Hotkeys:");
|
|
|
15 |
helpBox->setLayout(helpLayout);
|
|
|
16 |
|
|
|
17 |
btnEnableHotkeys = new QPushButton("Enable Hotkeys");
|
|
|
18 |
btnInit = new QPushButton("Initialize Printer");
|
|
|
19 |
btnHome = new QPushButton("Home Printhead");
|
|
|
20 |
|
|
|
21 |
QVBoxLayout *miscBtnLayout = new QVBoxLayout();
|
|
|
22 |
miscBtnLayout->addWidget(btnEnableHotkeys);
|
|
|
23 |
miscBtnLayout->addWidget(btnInit);
|
|
|
24 |
miscBtnLayout->addWidget(btnHome);
|
|
|
25 |
|
|
|
26 |
QGroupBox *miscBtnBox = new QGroupBox("Preset Commands");
|
|
|
27 |
miscBtnBox->setLayout(miscBtnLayout);
|
|
|
28 |
miscBtnBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
|
|
|
29 |
|
|
|
30 |
// Icons from http://ikons.piotrkwiatkowski.co.uk/index.html
|
|
|
31 |
QIcon iconUp(":/External/Resources/arrow_up.png");
|
|
|
32 |
QIcon iconDown(":/External/Resources/arrow_down.png");
|
|
|
33 |
QIcon iconLeft(":/External/Resources/arrow_left.png");
|
|
|
34 |
QIcon iconRight(":/External/Resources/arrow_right.png");
|
|
|
35 |
QIcon iconAdd(":/External/Resources/upload.png");
|
|
|
36 |
QIcon iconRemove(":/External/Resources/download.png");
|
|
|
37 |
QIcon iconDelete(":/External/Resources/close.png");
|
|
|
38 |
|
|
|
39 |
btnForward = new QToolButton();
|
|
|
40 |
btnForward->setIcon(iconUp);
|
|
|
41 |
btnForward->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
|
|
|
42 |
btnForward->setAutoRaise(true);
|
|
|
43 |
btnBackward = new QToolButton();
|
|
|
44 |
btnBackward->setIcon(iconDown);
|
|
|
45 |
btnBackward->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
|
|
|
46 |
btnBackward->setAutoRaise(true);
|
|
|
47 |
btnLeft = new QToolButton();
|
|
|
48 |
btnLeft->setIcon(iconLeft);
|
|
|
49 |
btnLeft->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
|
|
|
50 |
btnLeft->setAutoRaise(true);
|
|
|
51 |
btnRight = new QToolButton();
|
|
|
52 |
btnRight->setIcon(iconRight);
|
|
|
53 |
btnRight->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
|
|
|
54 |
btnRight->setAutoRaise(true);
|
|
|
55 |
btnUp = new QToolButton();
|
|
|
56 |
btnUp->setIcon(iconAdd);
|
|
|
57 |
btnUp->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
|
|
|
58 |
btnUp->setAutoRaise(true);
|
|
|
59 |
btnDown = new QToolButton();
|
|
|
60 |
btnDown->setIcon(iconRemove);
|
|
|
61 |
btnDown->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
|
|
|
62 |
btnDown->setAutoRaise(true);
|
|
|
63 |
btnExtrude = new QToolButton();
|
|
|
64 |
btnExtrude->setIcon(iconDelete);
|
|
|
65 |
btnExtrude->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
|
|
|
66 |
btnExtrude->setAutoRaise(true);
|
|
|
67 |
|
|
|
68 |
QGridLayout *btnXYELayout = new QGridLayout();
|
|
|
69 |
btnXYELayout->addWidget(btnForward, 0, 1, 1, 1);
|
|
|
70 |
btnXYELayout->addWidget(btnLeft, 1, 0, 1, 1);
|
|
|
71 |
btnXYELayout->addWidget(btnExtrude, 1, 1, 1, 1);
|
|
|
72 |
btnXYELayout->addWidget(btnRight, 1, 2, 1, 1);
|
|
|
73 |
btnXYELayout->addWidget(btnBackward, 2, 1, 1, 1);
|
|
|
74 |
|
|
|
75 |
QVBoxLayout *btnZLayout = new QVBoxLayout();
|
|
|
76 |
btnZLayout->addWidget(btnUp);
|
|
|
77 |
btnZLayout->addWidget(btnDown);
|
|
|
78 |
|
|
|
79 |
QHBoxLayout *btnNavLayout = new QHBoxLayout();
|
|
|
80 |
btnNavLayout->addLayout(btnXYELayout);
|
|
|
81 |
btnNavLayout->addLayout(btnZLayout);
|
|
|
82 |
|
|
|
83 |
QGroupBox *controlBox = new QGroupBox("Manual Printer Control");
|
|
|
84 |
controlBox->setLayout(btnNavLayout);
|
|
|
85 |
controlBox->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
|
|
86 |
|
|
|
87 |
labelXPos = new QLabel("X :");
|
|
|
88 |
labelXPos->setFont(QFont("", 14, 1));
|
|
|
89 |
labelYPos = new QLabel("Y :");
|
|
|
90 |
labelYPos->setFont(QFont("", 14, 1));
|
|
|
91 |
labelZPos = new QLabel("Z :");
|
|
|
92 |
labelZPos->setFont(QFont("", 14, 1));
|
|
|
93 |
textXValue = new QLineEdit();
|
|
|
94 |
textXValue->setReadOnly(true);
|
|
|
95 |
textXValue->setMaximumWidth(60);
|
|
|
96 |
textYValue = new QLineEdit();
|
|
|
97 |
textYValue->setReadOnly(true);
|
|
|
98 |
textYValue->setMaximumWidth(60);
|
|
|
99 |
textZValue = new QLineEdit();
|
|
|
100 |
textZValue->setReadOnly(true);
|
|
|
101 |
textZValue->setMaximumWidth(60);
|
|
|
102 |
|
|
|
103 |
QHBoxLayout *posValueLayout = new QHBoxLayout();
|
|
|
104 |
posValueLayout->addWidget(labelXPos);
|
|
|
105 |
posValueLayout->addWidget(textXValue);
|
|
|
106 |
posValueLayout->addWidget(labelYPos);
|
|
|
107 |
posValueLayout->addWidget(textYValue);
|
|
|
108 |
posValueLayout->addWidget(labelZPos);
|
|
|
109 |
posValueLayout->addWidget(textZValue);
|
|
|
110 |
|
|
|
111 |
QGroupBox *toolheadPosBox = new QGroupBox("Toolhead Position");
|
|
|
112 |
toolheadPosBox->setLayout(posValueLayout);
|
|
|
113 |
toolheadPosBox->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
|
|
114 |
|
|
|
115 |
labelXYSpeed = new QLabel("XY Axis Speed:");
|
|
|
116 |
sliderXYSpeed = new QSlider(Qt::Horizontal);
|
|
|
117 |
textXYSpeed = new QSpinBox();
|
|
|
118 |
textXYSpeed->setMinimumWidth(60);
|
|
|
119 |
labelXYAmount = new QLabel("XY Axis Steps:");
|
|
|
120 |
sliderXYAmount = new QSlider(Qt::Horizontal);
|
|
|
121 |
textXYAmount = new QSpinBox();
|
|
|
122 |
textXYAmount->setMinimumWidth(60);
|
|
|
123 |
labelZSpeed = new QLabel("Z Axis Speed:");
|
|
|
124 |
sliderZSpeed = new QSlider(Qt::Horizontal);
|
|
|
125 |
textZSpeed = new QSpinBox();
|
|
|
126 |
textZSpeed->setMinimumWidth(60);
|
|
|
127 |
labelZAmount = new QLabel("Z Axis Steps:");
|
|
|
128 |
sliderZAmount = new QSlider(Qt::Horizontal);
|
|
|
129 |
textZAmount = new QSpinBox();
|
|
|
130 |
textZAmount->setMinimumWidth(60);
|
|
|
131 |
labelRepeatDelay = new QLabel("Repeat Delay:");
|
|
|
132 |
sliderRepeatDelay = new QSlider(Qt::Horizontal);
|
|
|
133 |
textRepeatDelay = new QSpinBox();
|
|
|
134 |
textRepeatDelay->setMinimumWidth(60);
|
|
|
135 |
|
|
|
136 |
QGridLayout *xyRepeatLayout = new QGridLayout();
|
|
|
137 |
xyRepeatLayout->addWidget(labelXYAmount, 0, 0);
|
|
|
138 |
xyRepeatLayout->addWidget(sliderXYAmount, 0, 1);
|
|
|
139 |
xyRepeatLayout->addWidget(textXYAmount, 0, 2);
|
|
|
140 |
xyRepeatLayout->addWidget(labelXYSpeed, 1, 0);
|
|
|
141 |
xyRepeatLayout->addWidget(sliderXYSpeed, 1, 1);
|
|
|
142 |
xyRepeatLayout->addWidget(textXYSpeed, 1, 2);
|
|
|
143 |
xyRepeatLayout->addWidget(labelZAmount, 2, 0);
|
|
|
144 |
xyRepeatLayout->addWidget(sliderZAmount, 2, 1);
|
|
|
145 |
xyRepeatLayout->addWidget(textZAmount, 2, 2);
|
|
|
146 |
xyRepeatLayout->addWidget(labelZSpeed, 3, 0);
|
|
|
147 |
xyRepeatLayout->addWidget(sliderZSpeed, 3, 1);
|
|
|
148 |
xyRepeatLayout->addWidget(textZSpeed, 3, 2);
|
|
|
149 |
xyRepeatLayout->addWidget(labelRepeatDelay, 4, 0);
|
|
|
150 |
xyRepeatLayout->addWidget(sliderRepeatDelay, 4, 1);
|
|
|
151 |
xyRepeatLayout->addWidget(textRepeatDelay, 4, 2);
|
|
|
152 |
|
|
|
153 |
QGroupBox *xyRepeatBox = new QGroupBox("Movement Settings");
|
|
|
154 |
xyRepeatBox->setLayout(xyRepeatLayout);
|
|
|
155 |
|
|
|
156 |
labelEForwardSpeed = new QLabel("Extrude Speed:");
|
|
|
157 |
sliderEForwardSpeed = new QSlider(Qt::Horizontal);
|
|
|
158 |
textEForwardSpeed = new QSpinBox();
|
|
|
159 |
textEForwardSpeed->setMinimumWidth(60);
|
|
|
160 |
labelEBackwardSpeed = new QLabel("Retract Speed:");
|
|
|
161 |
sliderEBackwardSpeed = new QSlider(Qt::Horizontal);
|
|
|
162 |
textEBackwardSpeed = new QSpinBox();
|
|
|
163 |
textEBackwardSpeed->setMinimumWidth(60);
|
|
|
164 |
labelEForwardAmount = new QLabel("Extrude Steps:");
|
|
|
165 |
sliderEForwardAmount = new QSlider(Qt::Horizontal);
|
|
|
166 |
textEForwardAmount = new QSpinBox();
|
|
|
167 |
textEForwardAmount->setMinimumWidth(60);
|
|
|
168 |
labelEBackwardAmount = new QLabel("Retract Steps:");
|
|
|
169 |
sliderEBackwardAmount = new QSlider(Qt::Horizontal);
|
|
|
170 |
textEBackwardAmount = new QSpinBox();
|
|
|
171 |
textEBackwardAmount->setMinimumWidth(60);
|
|
|
172 |
|
|
|
173 |
QGridLayout *extruderLayout = new QGridLayout();
|
|
|
174 |
extruderLayout->addWidget(labelEForwardAmount, 0, 0);
|
|
|
175 |
extruderLayout->addWidget(sliderEForwardAmount, 0, 1);
|
|
|
176 |
extruderLayout->addWidget(textEForwardAmount, 0, 2);
|
|
|
177 |
extruderLayout->addWidget(labelEForwardSpeed, 1, 0);
|
|
|
178 |
extruderLayout->addWidget(sliderEForwardSpeed, 1, 1);
|
|
|
179 |
extruderLayout->addWidget(textEForwardSpeed, 1, 2);
|
|
|
180 |
extruderLayout->addWidget(labelEBackwardAmount, 2, 0);
|
|
|
181 |
extruderLayout->addWidget(sliderEBackwardAmount, 2, 1);
|
|
|
182 |
extruderLayout->addWidget(textEBackwardAmount, 2, 2);
|
|
|
183 |
extruderLayout->addWidget(labelEBackwardSpeed, 4, 0);
|
|
|
184 |
extruderLayout->addWidget(sliderEBackwardSpeed, 4, 1);
|
|
|
185 |
extruderLayout->addWidget(textEBackwardSpeed, 4, 2);
|
|
|
186 |
|
|
|
187 |
QGroupBox *extruderBox = new QGroupBox("Extruder Settings");
|
|
|
188 |
extruderBox->setLayout(extruderLayout);
|
|
|
189 |
|
|
|
190 |
QVBoxLayout *column1Layout = new QVBoxLayout();
|
|
|
191 |
column1Layout->addWidget(controlBox, 0, Qt::AlignTop);
|
|
|
192 |
column1Layout->addWidget(miscBtnBox, 0, Qt::AlignTop);
|
|
|
193 |
column1Layout->addWidget(helpBox, 1, Qt::AlignTop);
|
|
|
194 |
|
|
|
195 |
QVBoxLayout *column2Layout = new QVBoxLayout();
|
|
|
196 |
column2Layout->addWidget(toolheadPosBox);
|
|
|
197 |
column2Layout->addWidget(xyRepeatBox);
|
|
|
198 |
column2Layout->addWidget(extruderBox);
|
|
|
199 |
|
|
|
200 |
QHBoxLayout *mainLayout = new QHBoxLayout();
|
|
|
201 |
mainLayout->addLayout(column1Layout);
|
|
|
202 |
mainLayout->addLayout(column2Layout);
|
|
|
203 |
|
|
|
204 |
setLayout(mainLayout);
|
|
|
205 |
setFixedSize(sizeHint());
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
PasteController::~PasteController()
|
|
|
209 |
{
|
|
|
210 |
|
|
|
211 |
}
|
|
|
212 |
|