diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -6,7 +6,6 @@ bedextruderwidget.cpp pushgcodewidget.cpp ratescontrolwidget.cpp - printprogresswidget.cpp videomonitorwidget.cpp atcoreinstancewidget.cpp thermowidget.cpp diff --git a/src/widgets/atcoreinstancewidget.h b/src/widgets/atcoreinstancewidget.h --- a/src/widgets/atcoreinstancewidget.h +++ b/src/widgets/atcoreinstancewidget.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -77,6 +78,7 @@ LogWidget *m_logWidget; PlotWidget *m_plotWidget; SdWidget *m_sdWidget; + StatusWidget *m_statusWidget; void initConnectsToAtCore(); void printFile(const QUrl& fileName); void pausePrint(); diff --git a/src/widgets/atcoreinstancewidget.cpp b/src/widgets/atcoreinstancewidget.cpp --- a/src/widgets/atcoreinstancewidget.cpp +++ b/src/widgets/atcoreinstancewidget.cpp @@ -52,9 +52,12 @@ m_sdWidget = new SdWidget; + m_statusWidget = new StatusWidget(false); + m_statusWidget->showPrintArea(false); + ui->statusLayout->addWidget(m_statusWidget); + ui->mainTab->addTab(m_sdWidget, i18n("Sd Card")); - ui->printProgressWidget->setVisible(false); buildToolbar(); buildConnectionToolbar(); enableControls(false); @@ -276,8 +279,10 @@ } else { m_core.sdDelete(fileName); } -}); + }); + //Status Area + connect(&m_core, &AtCore::sdMountChanged, m_statusWidget, &StatusWidget::setSD); } void AtCoreInstanceWidget::printFile(const QUrl& fileName) @@ -358,13 +363,13 @@ } break; case AtCore::STARTPRINT: { stateString = i18n("Starting Print"); - ui->printProgressWidget->setVisible(true); - connect(&m_core, &AtCore::printProgressChanged, ui->printProgressWidget, &PrintProgressWidget::updateProgressBar); + m_statusWidget->showPrintArea(true); + connect(&m_core, &AtCore::printProgressChanged, m_statusWidget, &StatusWidget::updatePrintProgress); } break; case AtCore::FINISHEDPRINT: { stateString = i18n("Finished Print"); - ui->printProgressWidget->setVisible(false); - disconnect(&m_core, &AtCore::printProgressChanged, ui->printProgressWidget, &PrintProgressWidget::updateProgressBar); + m_statusWidget->showPrintArea(false); + disconnect(&m_core, &AtCore::printProgressChanged, m_statusWidget, &StatusWidget::updatePrintProgress); m_printAction->setText(i18n("Print")); m_printAction->setIcon(QIcon::fromTheme("media-playback-start", QIcon(QString(":/%1/start").arg(m_theme)))); } break; @@ -389,7 +394,7 @@ qWarning("AtCore State not Recognized."); break; } - ui->lblState->setText(stateString); + m_statusWidget->setState(stateString); } void AtCoreInstanceWidget::checkTemperature(uint sensorType, uint number, uint temp) diff --git a/src/widgets/atcoreinstancewidget.ui b/src/widgets/atcoreinstancewidget.ui --- a/src/widgets/atcoreinstancewidget.ui +++ b/src/widgets/atcoreinstancewidget.ui @@ -27,9 +27,6 @@ Controllers - - - @@ -51,45 +48,12 @@ - - - - - Printer Status: - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - + - - PrintProgressWidget - QWidget -
printprogresswidget.h
- 1 -
BedExtruderWidget QWidget diff --git a/src/widgets/printprogresswidget.h b/src/widgets/printprogresswidget.h deleted file mode 100644 --- a/src/widgets/printprogresswidget.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Atelier KDE Printer Host for 3D Printing - Copyright (C) <2017> - Author: Lays Rodrigues - laysrodriguessilva@gmail.com - - 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#pragma once -#include -#include - -class PrintProgressWidget : public QWidget -{ - Q_OBJECT -public: - explicit PrintProgressWidget(QWidget *parent = nullptr); - void updateProgressBar(const float value); - -private: - QProgressBar *progressbar; - -}; diff --git a/src/widgets/printprogresswidget.cpp b/src/widgets/printprogresswidget.cpp deleted file mode 100644 --- a/src/widgets/printprogresswidget.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* Atelier KDE Printer Host for 3D Printing - Copyright (C) <2017> - Author: Lays Rodrigues - laysrodriguessilva@gmail.com - - 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "printprogresswidget.h" -#include -#include -#include - -PrintProgressWidget::PrintProgressWidget(QWidget *parent) : - QWidget(parent), - progressbar(new QProgressBar(this)) -{ - QVBoxLayout *layout = new QVBoxLayout(); - progressbar->setValue(0); - layout->addWidget(progressbar); - this->setLayout(layout); -} - -void PrintProgressWidget::updateProgressBar(const float value) -{ - progressbar->setValue(value); -}