diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1,6 +1,7 @@ /* Atelier KDE Printer Host for 3D Printing Copyright (C) <2016> Author: Lays Rodrigues - laysrodrigues@gmail.com + Chris Rizzitello - rizzitello@kde.org This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -108,14 +109,14 @@ ui->printProgressDockWidget->setVisible(false); ui->logDockWidget->setWidget(logWidget); + ui->statusBar->addWidget(ui->statusBarWidget); // When a new profile is added on the Profile Dialog it needs to update the profiles on connection dialog connect(generalSettingsDialog, &GeneralSettingsDialog::updateProfiles, connectSettingsDialog, &ConnectSettingsDialog::updateProfiles); connectSettingsDialog->setFirmwareList(core.availablePlugins()); generalSettingsDialog->setBaudRates(core.serial()->validBaudRates()); - } void MainWindow::setupActions() @@ -220,36 +221,52 @@ void MainWindow::handlePrinterStatusChanged(AtCore::STATES newState) { + QString stateString; switch (newState) { case AtCore::CONNECTING: { + stateString = i18n("Connecting..."); connect(core.serial(), &SerialLayer::receivedCommand, this, &MainWindow::checkReceivedCommand); connect(core.serial(), &SerialLayer::pushedCommand, this, &MainWindow::checkPushedCommands); } break; case AtCore::IDLE: { + stateString = i18n("Connected to ") + core.serial()->portName(); ui->toolboxTabWidget->setEnabled(true); emit extruderCountChanged(core.extruderCount()); logWidget->addLog(i18n("Serial connected")); _connect->setText(i18n("&Disconnect")); } break; case AtCore::DISCONNECTED: { + stateString = i18n("Not Connected"); ui->toolboxTabWidget->setEnabled(false); disconnect(core.serial(), &SerialLayer::receivedCommand, this, &MainWindow::checkReceivedCommand); disconnect(core.serial(), &SerialLayer::pushedCommand, this, &MainWindow::checkPushedCommands); logWidget->addLog(i18n("Serial disconnected")); } break; case AtCore::STARTPRINT: { + stateString = i18n("Starting Print"); ui->printProgressDockWidget->setVisible(true); connect(&core, &AtCore::printProgressChanged, ui->printProgressWidget, &PrintProgressWidget::updateProgressBar); } break; case AtCore::FINISHEDPRINT: { + stateString = i18n("Finished Print"); ui->printProgressDockWidget->setVisible(false); disconnect(&core, &AtCore::printProgressChanged, ui->printProgressWidget, &PrintProgressWidget::updateProgressBar); } break; - - default: - return; + case AtCore::BUSY: { + stateString = i18n("Printing"); + } break; + case AtCore::PAUSE: { + stateString = i18n("Paused"); + } break; + case AtCore::STOP: { + stateString = i18n("Stoping Print"); + } break; + case AtCore::ERRORSTATE: { + stateString = i18n("Error"); + } break; } + ui->lblState->setText(stateString); } void MainWindow::checkTemperature(uint sensorType, uint number, uint temp) diff --git a/src/mainwindow.ui b/src/mainwindow.ui --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -36,6 +36,66 @@ + + + + 6 + 418 + 801 + 46 + + + + + 100 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Printer State: + + + + + + + Not Connected + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + @@ -175,6 +235,14 @@ + + + Qt::NoContextMenu + + + false + +