diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -4,7 +4,6 @@ set(widgets_SRCS gcodeeditorwidget.cpp bedextruderwidget.cpp - pushgcodewidget.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 @@ -18,6 +18,7 @@ #pragma once #include +#include #include #include #include @@ -75,6 +76,7 @@ QAction *m_stopAction; QSettings m_settings; QString m_theme; + CommandWidget *m_commandWidget; LogWidget *m_logWidget; MovementWidget *m_movementWidget; PlotWidget *m_plotWidget; diff --git a/src/widgets/atcoreinstancewidget.cpp b/src/widgets/atcoreinstancewidget.cpp --- a/src/widgets/atcoreinstancewidget.cpp +++ b/src/widgets/atcoreinstancewidget.cpp @@ -43,7 +43,10 @@ ui->controlTabLayout->addWidget(m_plotWidget); m_printWidget = new PrintWidget(false); - ui->advancedTabLayout->insertWidget(0, m_printWidget); + ui->advancedTabLayout->addWidget(m_printWidget); + + m_commandWidget = new CommandWidget; + ui->advancedTabLayout->addWidget(m_commandWidget); m_logWidget = new LogWidget(new QTemporaryFile(QDir::tempPath() + QStringLiteral("/Atelier_"))); ui->advancedTabLayout->addWidget(m_logWidget); @@ -250,12 +253,17 @@ m_plotWidget->update(); ui->bedExtWidget->updateExtTargetTemp(temp); }); - - connect(ui->pushGCodeWidget, &PushGCodeWidget::push, [ this ](QString command) { - m_logWidget->appendLog("Push " + command); + //command Widget + connect(m_commandWidget, &CommandWidget::commandPressed, [ this ](const QString &command) { + m_logWidget->appendLog("Push: " + command); m_core.pushCommand(command); }); + connect(m_commandWidget, &CommandWidget::messagePressed, [ this ](const QString &message) { + m_logWidget->appendLog("Display: " + message); + m_core.showMessage(message); + }); + // Fan, Flow and Speed management connect(m_printWidget, &PrintWidget::fanSpeedChanged, &m_core, &AtCore::setFanSpeed); connect(m_printWidget, &PrintWidget::flowRateChanged, &m_core, &AtCore::setFlowRate); diff --git a/src/widgets/atcoreinstancewidget.ui b/src/widgets/atcoreinstancewidget.ui --- a/src/widgets/atcoreinstancewidget.ui +++ b/src/widgets/atcoreinstancewidget.ui @@ -41,9 +41,6 @@ Advanced - - - @@ -61,12 +58,6 @@
bedextruderwidget.h
1 - - PushGCodeWidget - QWidget -
pushgcodewidget.h
- 1 -
diff --git a/src/widgets/pushgcodewidget.h b/src/widgets/pushgcodewidget.h deleted file mode 100644 --- a/src/widgets/pushgcodewidget.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 PushGCodeWidget : public QWidget -{ - Q_OBJECT -public: - explicit PushGCodeWidget(QWidget *parent = nullptr); - -private: - QLineEdit *input; - -signals: - void push(QString command); -}; diff --git a/src/widgets/pushgcodewidget.cpp b/src/widgets/pushgcodewidget.cpp deleted file mode 100644 --- a/src/widgets/pushgcodewidget.cpp +++ /dev/null @@ -1,44 +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 "pushgcodewidget.h" -#include -#include -#include -#include -#include - -PushGCodeWidget::PushGCodeWidget(QWidget *parent) : QWidget(parent), - input(new QLineEdit(this)) -{ - QVBoxLayout *layout = new QVBoxLayout(); - QHBoxLayout *items = new QHBoxLayout(); - QLabel *lb = new QLabel(i18n("Push Gcode")); - lb->setAlignment(Qt::AlignHCenter); - QPushButton *bt = new QPushButton(i18n("Send")); - items->setSpacing(3); - layout->addWidget(lb); - items->addWidget(input); - items->addWidget(bt); - layout->addItem(items); - this->setLayout(layout); - - connect(bt, &QPushButton::clicked, [ this ] { - push(input->text()); - }); -}