diff --git a/src/widgets/bedextruderwidget.cpp b/src/widgets/bedextruderwidget.cpp index 90c0c33..1268ea7 100644 --- a/src/widgets/bedextruderwidget.cpp +++ b/src/widgets/bedextruderwidget.cpp @@ -1,130 +1,130 @@ /* Atelier KDE Printer Host for 3D Printing Copyright (C) <2016> 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 "bedextruderwidget.h" #include "ui_bedextruderwidget.h" #include #include BedExtruderWidget::BedExtruderWidget(QWidget *parent) : QWidget(parent), ui(new Ui::BedExtruderWidget) { ui->setupUi(this); //Add Default Extruder setExtruderCount(1); connect(ui->heatBedPB, &QPushButton::clicked, this, &BedExtruderWidget::heatBedClicked); connect(ui->heatExtPB, &QPushButton::clicked, this, &BedExtruderWidget::heatExtruderClicked); connect(ui->bedTempSB, static_cast(&QDoubleSpinBox::valueChanged), [ = ](double tmp) { if (ui->heatBedPB->isChecked()) { - emit bedTemperatureChanged(tmp); + emit bedTemperatureChanged(tmp,ui->bedAndWaitCB->isChecked()); } }); connect(ui->extTempSB, static_cast(&QDoubleSpinBox::valueChanged), [ = ](double tmp) { if (ui->heatExtPB->isChecked()) { - emit extTemperatureChanged(tmp, currentExtruder()); + emit extTemperatureChanged(tmp, currentExtruder(),ui->extAndWaitCB->isChecked()); } }); } BedExtruderWidget::~BedExtruderWidget() { delete ui; } void BedExtruderWidget::setExtruderCount(int value) { if (value == extruderCount) { return; } else if (extruderCount < value) { //loop for the new buttons for (int i = extruderCount; i < value; i++) { auto *rb = new QRadioButton(QString::number(i + 1)); ui->extRadioButtonLayout->addWidget(rb); extruderMap.insert(i, rb); } } else { //remove buttons - need to test it! for (int i = extruderCount; i >= value; i--) { auto *rb = extruderMap.value(i); ui->extRadioButtonLayout->removeWidget(rb); extruderMap.remove(i); delete (rb); } } extruderCount = value; } void BedExtruderWidget::updateBedTemp(const float temp) { ui->bedCurrTempLB->setText(QString::number(temp)); } void BedExtruderWidget::updateExtTemp(const float temp) { ui->extCurrTempLB->setText(QString::number(temp)); } void BedExtruderWidget::updateBedTargetTemp(const float temp) { ui->bedTargetTempLB->setText(QString::number(temp) + " ºC"); } void BedExtruderWidget::updateExtTargetTemp(const float temp) { ui->extTargetTempLB->setText(QString::number(temp) + " ºC"); } void BedExtruderWidget::stopHeating() { - emit bedTemperatureChanged(0); + emit bedTemperatureChanged(0,ui->bedAndWaitCB->isChecked()); for (int i = 0; i < extruderCount; i++) { - emit extTemperatureChanged(0, i); + emit extTemperatureChanged(0, i,ui->extAndWaitCB->isChecked()); } ui->heatBedPB->setChecked(false); ui->heatExtPB->setChecked(false); } void BedExtruderWidget::heatExtruderClicked(bool clicked) { int temp = ui->extTempSB->value() * clicked; - emit extTemperatureChanged(temp, currentExtruder()); + emit extTemperatureChanged(temp, currentExtruder(),ui->extAndWaitCB->isChecked()); } void BedExtruderWidget::heatBedClicked(bool clicked) { int temp = ui->bedTempSB->value() * clicked; - emit bedTemperatureChanged(temp); + emit bedTemperatureChanged(temp,ui->bedAndWaitCB->isChecked()); } int BedExtruderWidget::currentExtruder() { int currExt = 0; if (extruderMap.size() > 1) { for (int i = 0; i < extruderMap.size(); i++) { if (extruderMap.value(i)->isChecked()) { currExt = i; break; } } } return currExt; } diff --git a/src/widgets/bedextruderwidget.h b/src/widgets/bedextruderwidget.h index cbd143e..ee2c6fa 100644 --- a/src/widgets/bedextruderwidget.h +++ b/src/widgets/bedextruderwidget.h @@ -1,54 +1,54 @@ /* Atelier KDE Printer Host for 3D Printing Copyright (C) <2016> 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 #include namespace Ui { class BedExtruderWidget; } class BedExtruderWidget : public QWidget { Q_OBJECT public: explicit BedExtruderWidget(QWidget *parent = nullptr); ~BedExtruderWidget(); void setExtruderCount(int value); void updateBedTemp(const float temp); void updateExtTemp(const float temp); void updateBedTargetTemp(const float temp); void updateExtTargetTemp(const float temp); void stopHeating(); private: Ui::BedExtruderWidget *ui; QMap extruderMap; void heatExtruderClicked(bool clicked); void heatBedClicked(bool clicked); int currentExtruder(); int extruderCount = 0; signals: - void bedTemperatureChanged(int tmp); - void extTemperatureChanged(int tmp, int currExt); + void bedTemperatureChanged(int tmp, bool andWait); + void extTemperatureChanged(int tmp, int currExt, bool andWait); }; diff --git a/src/widgets/bedextruderwidget.ui b/src/widgets/bedextruderwidget.ui index 8417926..4c39524 100644 --- a/src/widgets/bedextruderwidget.ui +++ b/src/widgets/bedextruderwidget.ui @@ -1,178 +1,192 @@ BedExtruderWidget 0 0 266 247 Form 3 3 3 3 3 ºC 0 150.000000000000000 Heat true Target Temperature: 0 ºC Current Temperature: 0 ºC Qt::Horizontal Hotend Qt::AlignCenter ºC 0 250.000000000000000 Bed Qt::AlignCenter Heat true Target Temperature: 0 ºC Current Temperature: 0 ºC Bed Qt::AlignCenter + + + + andWait + + + + + + + andWait + + +