Changeset View
Changeset View
Standalone View
Standalone View
testclient/mainwindow.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 59 | { | |||
---|---|---|---|---|---|
67 | actionShowDockTitles->setCheckable(true); | 67 | actionShowDockTitles->setCheckable(true); | ||
68 | actionShowDockTitles->setChecked(true); | 68 | actionShowDockTitles->setChecked(true); | ||
69 | connect(actionShowDockTitles, &QAction::toggled, this, &MainWindow::toggleDockTitles); | 69 | connect(actionShowDockTitles, &QAction::toggled, this, &MainWindow::toggleDockTitles); | ||
70 | menuView->addAction(actionShowDockTitles); | 70 | menuView->addAction(actionShowDockTitles); | ||
71 | 71 | | |||
72 | QMenu *menuHelp = new QMenu(tr("Help")); | 72 | QMenu *menuHelp = new QMenu(tr("Help")); | ||
73 | QAction *actionAbout = new QAction(tr("About")); | 73 | QAction *actionAbout = new QAction(tr("About")); | ||
74 | actionAbout->setShortcut(QKeySequence(Qt::Key_F1)); | 74 | actionAbout->setShortcut(QKeySequence(Qt::Key_F1)); | ||
75 | connect(actionAbout, &QAction::triggered, [] { | 75 | connect(actionAbout, &QAction::triggered, this, [] { | ||
76 | auto *dialog = new About; | 76 | auto *dialog = new About; | ||
77 | dialog->exec(); | 77 | dialog->exec(); | ||
78 | }); | 78 | }); | ||
79 | menuHelp->addAction(actionAbout); | 79 | menuHelp->addAction(actionAbout); | ||
80 | 80 | | |||
81 | menuBar()->addMenu(menuFile); | 81 | menuBar()->addMenu(menuFile); | ||
82 | menuBar()->addMenu(menuView); | 82 | menuBar()->addMenu(menuView); | ||
83 | menuBar()->addMenu(menuHelp); | 83 | menuBar()->addMenu(menuHelp); | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | |||||
147 | 147 | | |||
148 | void MainWindow::makePrintDock() | 148 | void MainWindow::makePrintDock() | ||
149 | { | 149 | { | ||
150 | printWidget = new PrintWidget; | 150 | printWidget = new PrintWidget; | ||
151 | connect(printWidget, &PrintWidget::printPressed, this, &MainWindow::printPBClicked); | 151 | connect(printWidget, &PrintWidget::printPressed, this, &MainWindow::printPBClicked); | ||
152 | connect(printWidget, &PrintWidget::emergencyStopPressed, core, &AtCore::emergencyStop); | 152 | connect(printWidget, &PrintWidget::emergencyStopPressed, core, &AtCore::emergencyStop); | ||
153 | connect(printWidget, &PrintWidget::fanSpeedChanged, core, &AtCore::setFanSpeed); | 153 | connect(printWidget, &PrintWidget::fanSpeedChanged, core, &AtCore::setFanSpeed); | ||
154 | 154 | | |||
155 | connect(printWidget, &PrintWidget::printSpeedChanged, [this](const int speed) { | 155 | connect(printWidget, &PrintWidget::printSpeedChanged, this, [this](const int speed) { | ||
156 | core->setPrinterSpeed(speed); | 156 | core->setPrinterSpeed(speed); | ||
157 | }); | 157 | }); | ||
158 | 158 | | |||
159 | connect(printWidget, &PrintWidget::flowRateChanged, [this](const int rate) { | 159 | connect(printWidget, &PrintWidget::flowRateChanged, [this](const int rate) { | ||
160 | core->setFlowRate(rate); | 160 | core->setFlowRate(rate); | ||
161 | }); | 161 | }); | ||
162 | 162 | | |||
163 | printDock = new QDockWidget(tr("Print"), this); | 163 | printDock = new QDockWidget(tr("Print"), this); | ||
164 | printDock->setWidget(printWidget); | 164 | printDock->setWidget(printWidget); | ||
165 | 165 | | |||
166 | menuView->insertAction(nullptr, printDock->toggleViewAction()); | 166 | menuView->insertAction(nullptr, printDock->toggleViewAction()); | ||
167 | addDockWidget(Qt::LeftDockWidgetArea, printDock); | 167 | addDockWidget(Qt::LeftDockWidgetArea, printDock); | ||
168 | } | 168 | } | ||
169 | 169 | | |||
170 | void MainWindow::makeTempTimelineDock() | 170 | void MainWindow::makeTempTimelineDock() | ||
171 | { | 171 | { | ||
172 | plotWidget = new PlotWidget; | 172 | plotWidget = new PlotWidget; | ||
173 | //make and connect our plots in the widget. | 173 | //make and connect our plots in the widget. | ||
174 | plotWidget->addPlot(tr("Actual Bed")); | 174 | plotWidget->addPlot(tr("Actual Bed")); | ||
175 | connect(&core->temperature(), &Temperature::bedTemperatureChanged, [ this ](float temp) { | 175 | connect(&core->temperature(), &Temperature::bedTemperatureChanged, this, [this](float temp) { | ||
176 | checkTemperature(0x00, 0, temp); | 176 | checkTemperature(0x00, 0, temp); | ||
177 | plotWidget->appendPoint(tr("Actual Bed"), temp); | 177 | plotWidget->appendPoint(tr("Actual Bed"), temp); | ||
178 | }); | 178 | }); | ||
179 | 179 | | |||
180 | plotWidget->addPlot(tr("Target Bed")); | 180 | plotWidget->addPlot(tr("Target Bed")); | ||
181 | connect(&core->temperature(), &Temperature::bedTargetTemperatureChanged, [ this ](float temp) { | 181 | connect(&core->temperature(), &Temperature::bedTargetTemperatureChanged, this, [this](float temp) { | ||
182 | checkTemperature(0x01, 0, temp); | 182 | checkTemperature(0x01, 0, temp); | ||
183 | plotWidget->appendPoint(tr("Target Bed"), temp); | 183 | plotWidget->appendPoint(tr("Target Bed"), temp); | ||
184 | }); | 184 | }); | ||
185 | 185 | | |||
186 | plotWidget->addPlot(tr("Actual Ext.1")); | 186 | plotWidget->addPlot(tr("Actual Ext.1")); | ||
187 | connect(&core->temperature(), &Temperature::extruderTemperatureChanged, [ this ](float temp) { | 187 | connect(&core->temperature(), &Temperature::extruderTemperatureChanged, this, [this](float temp) { | ||
188 | checkTemperature(0x02, 0, temp); | 188 | checkTemperature(0x02, 0, temp); | ||
189 | plotWidget->appendPoint(tr("Actual Ext.1"), temp); | 189 | plotWidget->appendPoint(tr("Actual Ext.1"), temp); | ||
190 | }); | 190 | }); | ||
191 | 191 | | |||
192 | plotWidget->addPlot(tr("Target Ext.1")); | 192 | plotWidget->addPlot(tr("Target Ext.1")); | ||
193 | connect(&core->temperature(), &Temperature::extruderTargetTemperatureChanged, [ this ](float temp) { | 193 | connect(&core->temperature(), &Temperature::extruderTargetTemperatureChanged, this, [this](float temp) { | ||
194 | checkTemperature(0x03, 0, temp); | 194 | checkTemperature(0x03, 0, temp); | ||
195 | plotWidget->appendPoint(tr("Target Ext.1"), temp); | 195 | plotWidget->appendPoint(tr("Target Ext.1"), temp); | ||
196 | }); | 196 | }); | ||
197 | 197 | | |||
198 | tempTimelineDock = new QDockWidget(tr("Temperature Timeline"), this); | 198 | tempTimelineDock = new QDockWidget(tr("Temperature Timeline"), this); | ||
199 | tempTimelineDock->setWidget(plotWidget); | 199 | tempTimelineDock->setWidget(plotWidget); | ||
200 | menuView->insertAction(nullptr, tempTimelineDock->toggleViewAction()); | 200 | menuView->insertAction(nullptr, tempTimelineDock->toggleViewAction()); | ||
201 | addDockWidget(Qt::RightDockWidgetArea, tempTimelineDock); | 201 | addDockWidget(Qt::RightDockWidgetArea, tempTimelineDock); | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 215 | { | |||
258 | menuView->insertAction(nullptr, connectDock->toggleViewAction()); | 258 | menuView->insertAction(nullptr, connectDock->toggleViewAction()); | ||
259 | addDockWidget(Qt::LeftDockWidgetArea, connectDock); | 259 | addDockWidget(Qt::LeftDockWidgetArea, connectDock); | ||
260 | } | 260 | } | ||
261 | 261 | | |||
262 | void MainWindow::makeMoveDock() | 262 | void MainWindow::makeMoveDock() | ||
263 | { | 263 | { | ||
264 | movementWidget = new MovementWidget; | 264 | movementWidget = new MovementWidget; | ||
265 | 265 | | |||
266 | connect(movementWidget, &MovementWidget::homeAllPressed, [this] { | 266 | connect(movementWidget, &MovementWidget::homeAllPressed, this, [this] { | ||
267 | logWidget->appendLog(tr("Home All")); | 267 | logWidget->appendLog(tr("Home All")); | ||
268 | core->home(); | 268 | core->home(); | ||
269 | }); | 269 | }); | ||
270 | 270 | | |||
271 | connect(movementWidget, &MovementWidget::homeXPressed, [this] { | 271 | connect(movementWidget, &MovementWidget::homeXPressed, this, [this] { | ||
272 | logWidget->appendLog(tr("Home X")); | 272 | logWidget->appendLog(tr("Home X")); | ||
273 | core->home(AtCore::X); | 273 | core->home(AtCore::X); | ||
274 | }); | 274 | }); | ||
275 | 275 | | |||
276 | connect(movementWidget, &MovementWidget::homeYPressed, [this] { | 276 | connect(movementWidget, &MovementWidget::homeYPressed, this, [this] { | ||
277 | logWidget->appendLog(tr("Home Y")); | 277 | logWidget->appendLog(tr("Home Y")); | ||
278 | core->home(AtCore::Y); | 278 | core->home(AtCore::Y); | ||
279 | }); | 279 | }); | ||
280 | 280 | | |||
281 | connect(movementWidget, &MovementWidget::homeZPressed, [this] { | 281 | connect(movementWidget, &MovementWidget::homeZPressed, this, [this] { | ||
282 | logWidget->appendLog(tr("Home Z")); | 282 | logWidget->appendLog(tr("Home Z")); | ||
283 | core->home(AtCore::Z); | 283 | core->home(AtCore::Z); | ||
284 | }); | 284 | }); | ||
285 | 285 | | |||
286 | connect(movementWidget, &MovementWidget::absoluteMove, [this](const QLatin1Char & axis, const double & value) { | 286 | connect(movementWidget, &MovementWidget::absoluteMove, this, [this](const QLatin1Char & axis, const double & value) { | ||
287 | logWidget->appendLog(GCode::description(GCode::G1)); | 287 | logWidget->appendLog(GCode::description(GCode::G1)); | ||
288 | core->move(axis, value); | 288 | core->move(axis, value); | ||
289 | }); | 289 | }); | ||
290 | 290 | | |||
291 | connect(movementWidget, &MovementWidget::disableMotorsPressed, [this] { | 291 | connect(movementWidget, &MovementWidget::disableMotorsPressed, this, [this] { | ||
292 | core->disableMotors(0); | 292 | core->disableMotors(0); | ||
293 | }); | 293 | }); | ||
294 | 294 | | |||
295 | connect(movementWidget, &MovementWidget::relativeMove, [this](const QLatin1Char & axis, const double & value) { | 295 | connect(movementWidget, &MovementWidget::relativeMove, this, [this](const QLatin1Char & axis, const double & value) { | ||
296 | core->setRelativePosition(); | 296 | core->setRelativePosition(); | ||
297 | core->move(axis, value); | 297 | core->move(axis, value); | ||
298 | core->setAbsolutePosition(); | 298 | core->setAbsolutePosition(); | ||
299 | }); | 299 | }); | ||
300 | 300 | | |||
301 | moveDock = new QDockWidget(tr("Movement"), this); | 301 | moveDock = new QDockWidget(tr("Movement"), this); | ||
302 | moveDock->setWidget(movementWidget); | 302 | moveDock->setWidget(movementWidget); | ||
303 | 303 | | |||
Show All 14 Lines | |||||
318 | } | 318 | } | ||
319 | 319 | | |||
320 | void MainWindow::makeSdDock() | 320 | void MainWindow::makeSdDock() | ||
321 | { | 321 | { | ||
322 | 322 | | |||
323 | sdWidget = new SdWidget; | 323 | sdWidget = new SdWidget; | ||
324 | connect(sdWidget, &SdWidget::requestSdList, core, &AtCore::sdFileList); | 324 | connect(sdWidget, &SdWidget::requestSdList, core, &AtCore::sdFileList); | ||
325 | 325 | | |||
326 | connect(sdWidget, &SdWidget::printSdFile, [this](const QString & fileName) { | 326 | connect(sdWidget, &SdWidget::printSdFile, this, [this](const QString & fileName) { | ||
327 | if (fileName.isEmpty()) { | 327 | if (fileName.isEmpty()) { | ||
328 | QMessageBox::information(this, tr("Print Error"), tr("You must Select a file from the list")); | 328 | QMessageBox::information(this, tr("Print Error"), tr("You must Select a file from the list")); | ||
329 | } else { | 329 | } else { | ||
330 | core->print(fileName, true); | 330 | core->print(fileName, true); | ||
331 | } | 331 | } | ||
332 | }); | 332 | }); | ||
333 | 333 | | |||
334 | connect(sdWidget, &SdWidget::deleteSdFile, [this](const QString & fileName) { | 334 | connect(sdWidget, &SdWidget::deleteSdFile, this, [this](const QString & fileName) { | ||
335 | if (fileName.isEmpty()) { | 335 | if (fileName.isEmpty()) { | ||
336 | QMessageBox::information(this, tr("Delete Error"), tr("You must Select a file from the list")); | 336 | QMessageBox::information(this, tr("Delete Error"), tr("You must Select a file from the list")); | ||
337 | } else { | 337 | } else { | ||
338 | core->sdDelete(fileName); | 338 | core->sdDelete(fileName); | ||
339 | } | 339 | } | ||
340 | }); | 340 | }); | ||
341 | 341 | | |||
342 | sdDock = new QDockWidget(tr("Sd Card"), this); | 342 | sdDock = new QDockWidget(tr("Sd Card"), this); | ||
▲ Show 20 Lines • Show All 228 Lines • Show Last 20 Lines |