Changeset View
Changeset View
Standalone View
Standalone View
testclient/mainwindow.cpp
Show First 20 Lines • Show All 410 Lines • ▼ Show 20 Line(s) | |||||
411 | } | 411 | } | ||
412 | 412 | | |||
413 | void MainWindow::connectPBClicked() | 413 | void MainWindow::connectPBClicked() | ||
414 | { | 414 | { | ||
415 | if (core->state() == AtCore::DISCONNECTED) { | 415 | if (core->state() == AtCore::DISCONNECTED) { | ||
416 | if (core->initSerial(comboPort->currentText(), comboBAUD->currentText().toInt())) { | 416 | if (core->initSerial(comboPort->currentText(), comboBAUD->currentText().toInt())) { | ||
417 | connect(core, &AtCore::receivedMessage, logWidget, &LogWidget::appendRLog); | 417 | connect(core, &AtCore::receivedMessage, logWidget, &LogWidget::appendRLog); | ||
418 | connect(core->serial(), &SerialLayer::pushedCommand, logWidget, &LogWidget::appendSLog); | 418 | connect(core->serial(), &SerialLayer::pushedCommand, logWidget, &LogWidget::appendSLog); | ||
419 | buttonConnect->setText(tr("Disconnect")); | | |||
420 | logWidget->appendLog(tr("Serial connected")); | 419 | logWidget->appendLog(tr("Serial connected")); | ||
421 | if (!comboPlugin->currentText().contains(tr("Autodetect"))) { | 420 | if (!comboPlugin->currentText().contains(tr("Autodetect"))) { | ||
422 | core->loadFirmwarePlugin(comboPlugin->currentText()); | 421 | core->loadFirmwarePlugin(comboPlugin->currentText()); | ||
423 | } | 422 | } | ||
424 | } | 423 | } | ||
425 | } else { | 424 | } else { | ||
426 | disconnect(core, &AtCore::receivedMessage, logWidget, &LogWidget::appendRLog); | 425 | disconnect(core, &AtCore::receivedMessage, logWidget, &LogWidget::appendRLog); | ||
427 | disconnect(core->serial(), &SerialLayer::pushedCommand, logWidget, &LogWidget::appendSLog); | 426 | disconnect(core->serial(), &SerialLayer::pushedCommand, logWidget, &LogWidget::appendSLog); | ||
428 | core->closeConnection(); | 427 | core->closeConnection(); | ||
429 | core->setState(AtCore::DISCONNECTED); | 428 | core->setState(AtCore::DISCONNECTED); | ||
430 | logWidget->appendLog(tr("Disconnected")); | 429 | logWidget->appendLog(tr("Disconnected")); | ||
431 | buttonConnect->setText(tr("Connect")); | 430 | | ||
432 | } | 431 | } | ||
433 | } | 432 | } | ||
434 | 433 | | |||
435 | void MainWindow::printPBClicked() | 434 | void MainWindow::printPBClicked() | ||
436 | { | 435 | { | ||
437 | QString fileName; | 436 | QString fileName; | ||
438 | switch (core->state()) { | 437 | switch (core->state()) { | ||
439 | 438 | | |||
Show All 39 Lines | 472 | { | |||
479 | } | 478 | } | ||
480 | } | 479 | } | ||
481 | 480 | | |||
482 | void MainWindow::printerStateChanged(AtCore::STATES state) | 481 | void MainWindow::printerStateChanged(AtCore::STATES state) | ||
483 | { | 482 | { | ||
484 | QString stateString; | 483 | QString stateString; | ||
485 | switch (state) { | 484 | switch (state) { | ||
486 | case AtCore::IDLE: | 485 | case AtCore::IDLE: | ||
486 | buttonConnect->setText(tr("Disconnect")); | ||||
487 | printWidget->setPrintText(tr("Print File")); | 487 | printWidget->setPrintText(tr("Print File")); | ||
488 | stateString = tr("Connected to ") + core->connectedPort(); | 488 | stateString = tr("Connected to ") + core->connectedPort(); | ||
489 | sdDock->setVisible(core->firmwarePlugin()->isSdSupported()); | 489 | sdDock->setVisible(core->firmwarePlugin()->isSdSupported()); | ||
490 | break; | 490 | break; | ||
491 | 491 | | |||
492 | case AtCore::STARTPRINT: | 492 | case AtCore::STARTPRINT: | ||
493 | stateString = tr("START PRINT"); | 493 | stateString = tr("START PRINT"); | ||
494 | printWidget->setPrintText(tr("Pause Print")); | 494 | printWidget->setPrintText(tr("Pause Print")); | ||
Show All 13 Lines | |||||
508 | 508 | | |||
509 | case AtCore::BUSY: | 509 | case AtCore::BUSY: | ||
510 | stateString = tr("Printing"); | 510 | stateString = tr("Printing"); | ||
511 | printWidget->setPrintText(tr("Pause Print")); | 511 | printWidget->setPrintText(tr("Pause Print")); | ||
512 | break; | 512 | break; | ||
513 | 513 | | |||
514 | case AtCore::DISCONNECTED: | 514 | case AtCore::DISCONNECTED: | ||
515 | stateString = QStringLiteral("Not Connected"); | 515 | stateString = QStringLiteral("Not Connected"); | ||
516 | buttonConnect->setText(tr("Connect")); | ||||
516 | setDangeriousDocksDisabled(true); | 517 | setDangeriousDocksDisabled(true); | ||
517 | break; | 518 | break; | ||
518 | 519 | | |||
519 | case AtCore::CONNECTING: | 520 | case AtCore::CONNECTING: | ||
520 | stateString = QStringLiteral("Connecting"); | 521 | stateString = QStringLiteral("Connecting"); | ||
521 | setDangeriousDocksDisabled(false); | 522 | setDangeriousDocksDisabled(false); | ||
522 | break; | 523 | break; | ||
523 | 524 | | |||
Show All 37 Lines | 560 | { | |||
561 | moveDock->widget()->setDisabled(disabled); | 562 | moveDock->widget()->setDisabled(disabled); | ||
562 | tempControlsDock->widget()->setDisabled(disabled); | 563 | tempControlsDock->widget()->setDisabled(disabled); | ||
563 | printDock->widget()->setDisabled(disabled); | 564 | printDock->widget()->setDisabled(disabled); | ||
564 | sdDock->widget()->setDisabled(disabled); | 565 | sdDock->widget()->setDisabled(disabled); | ||
565 | 566 | | |||
566 | if (!disabled) { | 567 | if (!disabled) { | ||
567 | temperatureWidget->updateExtruderCount(core->extruderCount()); | 568 | temperatureWidget->updateExtruderCount(core->extruderCount()); | ||
568 | printWidget->updateFanCount(fanCount); | 569 | printWidget->updateFanCount(fanCount); | ||
570 | } else { | ||||
571 | printWidget->setPrintText(tr("Print File")); | ||||
572 | statusWidget->showPrintArea(false); | ||||
569 | } | 573 | } | ||
570 | } | 574 | } |