diff --git a/src/widgets/commandwidget.cpp b/src/widgets/commandwidget.cpp
index 8948a4b..fafadd5 100644
--- a/src/widgets/commandwidget.cpp
+++ b/src/widgets/commandwidget.cpp
@@ -1,70 +1,70 @@
/* AtCore Test Client
Copyright (C) <2018>
Author: 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
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 "commandwidget.h"
#include
#include
#include
CommandWidget::CommandWidget(QWidget *parent) :
QWidget(parent)
{
//Expose the least amount of object outside the creation function.
// First we make our mainLayout
auto mainLayout = new QVBoxLayout;
//Begin making content from top to bottom or left to right.
//Making child layouts in the order you want to put them
// onto the mainLayout
lineCommand = new QLineEdit;
lineCommand->setPlaceholderText(tr("Send Command"));
//we have a few buttons to make here. Lets name this newButton so its easier to reuse
auto newButton = new QPushButton(tr("Send"));
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(commandPressed(lineCommand->text()));
+ emit commandPressed(lineCommand->text());
lineCommand->clear();
});
//When you have created a Row put the items into layout.
auto hBoxLayout = new QHBoxLayout;
hBoxLayout->addWidget(lineCommand);
hBoxLayout->addWidget(newButton);
//Put the Layout or Widget on the mainLayout when its finished.
//This will free your pointers for reuse.
mainLayout->addLayout(hBoxLayout);
//Start making items for the next layout to place onto the mainLayout.
lineMessage = new QLineEdit;
lineMessage->setPlaceholderText(tr("Show Message"));
//Reuse our button pointer.
newButton = new QPushButton(tr("Send"));
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(messagePressed(lineMessage->text()));
+ emit messagePressed(lineMessage->text());
lineMessage->clear();
});
//We reuse the hBoxLayout pointer in the same way as the button pointer.
hBoxLayout = new QHBoxLayout;
hBoxLayout->addWidget(lineMessage);
hBoxLayout->addWidget(newButton);
mainLayout->addLayout(hBoxLayout);
setLayout(mainLayout);
}
diff --git a/src/widgets/movementwidget.cpp b/src/widgets/movementwidget.cpp
index 8c11cd8..4e58aa7 100644
--- a/src/widgets/movementwidget.cpp
+++ b/src/widgets/movementwidget.cpp
@@ -1,98 +1,98 @@
/* AtCore Test Client
Copyright (C) <2018>
Author: 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
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
#include
#include
#include "axiscontrol.h"
#include "movementwidget.h"
MovementWidget::MovementWidget(bool showHomeAndDisableWidgets, QWidget *parent) :
QWidget(parent)
{
auto mainLayout = new QVBoxLayout;
auto hBoxLayout = new QHBoxLayout;
auto newButton = new QPushButton;
if (showHomeAndDisableWidgets) {
newButton = new QPushButton(tr("Home All"));
hBoxLayout->addWidget(newButton);
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(homeAllPressed());
+ emit homeAllPressed();
});
newButton = new QPushButton(tr("Home X"));
hBoxLayout->addWidget(newButton);
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(homeXPressed());
+ emit homeXPressed();
});
newButton = new QPushButton(tr("Home Y"));
hBoxLayout->addWidget(newButton);
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(homeYPressed());
+ emit homeYPressed();
});
newButton = new QPushButton(tr("Home Z"));
hBoxLayout->addWidget(newButton);
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(homeZPressed());
+ emit homeZPressed();
});
mainLayout->addLayout(hBoxLayout);
newButton = new QPushButton(tr("Disable Motors"));
mainLayout->addWidget(newButton);
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(disableMotorsPressed());
+ emit disableMotorsPressed();
});
}
comboMoveAxis = new QComboBox;
comboMoveAxis->addItem(tr("Move X Axis to"));
comboMoveAxis->addItem(tr("Move Y Axis to"));
comboMoveAxis->addItem(tr("Move Z Axis to"));
sbMoveAxis = new QDoubleSpinBox;
sbMoveAxis->setRange(0, 200);
newButton = new QPushButton(tr("Go"));
connect(newButton, &QPushButton::clicked, this, [this] {
if (comboMoveAxis->currentIndex() == 0)
{
- emit(absoluteMove(QLatin1Char('X'), sbMoveAxis->value()));
+ emit absoluteMove(QLatin1Char('X'), sbMoveAxis->value());
} else if (comboMoveAxis->currentIndex() == 1)
{
- emit(absoluteMove(QLatin1Char('Y'), sbMoveAxis->value()));
+ emit absoluteMove(QLatin1Char('Y'), sbMoveAxis->value());
} else if (comboMoveAxis->currentIndex() == 2)
{
- emit(absoluteMove(QLatin1Char('Z'), sbMoveAxis->value()));
+ emit absoluteMove(QLatin1Char('Z'), sbMoveAxis->value());
}
});
hBoxLayout = new QHBoxLayout;
hBoxLayout->addWidget(comboMoveAxis);
hBoxLayout->addWidget(sbMoveAxis);
hBoxLayout->addWidget(newButton);
mainLayout->addLayout(hBoxLayout);
auto axisControl = new AxisControl;
mainLayout->addWidget(axisControl);
connect(axisControl, &AxisControl::clicked, this, &MovementWidget::relativeMove);
setLayout(mainLayout);
}
diff --git a/src/widgets/printwidget.cpp b/src/widgets/printwidget.cpp
index 2086dd0..e2208f1 100644
--- a/src/widgets/printwidget.cpp
+++ b/src/widgets/printwidget.cpp
@@ -1,125 +1,125 @@
/* AtCore Test Client
Copyright (C) <2018>
Author: 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
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 "printwidget.h"
#include
#include
#include
#include
PrintWidget::PrintWidget(bool showAllControls, QWidget *parent) :
QWidget(parent)
{
auto mainLayout = new QVBoxLayout;
QPushButton *newButton = nullptr;
QLabel *newLabel = nullptr;
QHBoxLayout *hBoxLayout = nullptr;
if (showAllControls) {
buttonPrint = new QPushButton(tr("Print File"));
connect(buttonPrint, &QPushButton::clicked, this, [this] {
- emit(printPressed());
+ emit printPressed();
});
newButton = new QPushButton(tr("Emergency Stop"));
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(emergencyStopPressed());
+ emit emergencyStopPressed();
});
hBoxLayout = new QHBoxLayout;
hBoxLayout->addWidget(buttonPrint);
hBoxLayout->addWidget(newButton);
mainLayout->addLayout(hBoxLayout);
newLabel = new QLabel(tr("On Pause:"));
linePostPause = new QLineEdit;
linePostPause->setPlaceholderText(QStringLiteral("G91,G0 Z1,G90,G1 X0 Y195"));
hBoxLayout = new QHBoxLayout;
hBoxLayout->addWidget(newLabel);
hBoxLayout->addWidget(linePostPause);
mainLayout->addLayout(hBoxLayout);
}
newLabel = new QLabel(tr("Printer Speed"));
sbPrintSpeed = new QSpinBox;
sbPrintSpeed->setRange(1, 300);
sbPrintSpeed->setValue(100);
sbPrintSpeed->setSuffix(QStringLiteral("%"));
newButton = new QPushButton(tr("Set"));
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(printSpeedChanged(sbPrintSpeed->value()));
+ emit printSpeedChanged(sbPrintSpeed->value());
});
hBoxLayout = new QHBoxLayout;
hBoxLayout->addWidget(newLabel, 60);
hBoxLayout->addWidget(sbPrintSpeed, 20);
hBoxLayout->addWidget(newButton, 20);
mainLayout->addLayout(hBoxLayout);
newLabel = new QLabel(tr("Flow Rate"));
sbFlowRate = new QSpinBox;
sbFlowRate->setRange(1, 300);
sbFlowRate->setValue(100);
sbFlowRate->setSuffix(QStringLiteral("%"));
newButton = new QPushButton(tr("Set"));
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(flowRateChanged(sbFlowRate->value()));
+ emit flowRateChanged(sbFlowRate->value());
});
hBoxLayout = new QHBoxLayout;
hBoxLayout->addWidget(newLabel, 60);
hBoxLayout->addWidget(sbFlowRate, 20);
hBoxLayout->addWidget(newButton, 20);
mainLayout->addLayout(hBoxLayout);
comboFanSelect = new QComboBox;
sbFanSpeed = new QSpinBox;
sbFanSpeed->setRange(0, 100);
sbFanSpeed->setSuffix(QStringLiteral("%"));
newButton = new QPushButton(tr("Set"));
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(fanSpeedChanged(sbFanSpeed->value(), comboFanSelect->currentIndex()));
+ emit fanSpeedChanged(sbFanSpeed->value(), comboFanSelect->currentIndex());
});
hBoxLayout = new QHBoxLayout;
hBoxLayout->addWidget(comboFanSelect, 60);
hBoxLayout->addWidget(sbFanSpeed, 20);
hBoxLayout->addWidget(newButton, 20);
mainLayout->addLayout(hBoxLayout);
setLayout(mainLayout);
}
QString PrintWidget::postPauseCommand(void) const
{
return linePostPause->text();
}
void PrintWidget::setPrintText(const QString &text)
{
buttonPrint->setText(text);
}
void PrintWidget::updateFanCount(const int count)
{
for (int i = 0; i < count; i++) {
comboFanSelect->insertItem(i, tr("Fan %1 speed").arg(i));
}
}
diff --git a/src/widgets/sdwidget.cpp b/src/widgets/sdwidget.cpp
index 3fe9b4e..c2820aa 100644
--- a/src/widgets/sdwidget.cpp
+++ b/src/widgets/sdwidget.cpp
@@ -1,72 +1,72 @@
/* AtCore Test Client
Copyright (C) <2018>
Author: 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
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
#include
#include
#include
#include "sdwidget.h"
SdWidget::SdWidget(QWidget *parent) :
QWidget(parent)
{
auto hBoxLayout = new QHBoxLayout;
auto newButton = new QPushButton(tr("Get List"));
hBoxLayout->addWidget(newButton);
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(requestSdList());
+ emit requestSdList();
});
newButton = new QPushButton(tr("Print Selected"));
hBoxLayout->addWidget(newButton);
connect(newButton, &QPushButton::clicked, this, [this] {
if (listSdFiles->currentRow() != -1)
{
- emit(printSdFile(listSdFiles->currentItem()->text()));
+ emit printSdFile(listSdFiles->currentItem()->text());
}
});
newButton = new QPushButton(tr("Delete Selected"));
hBoxLayout->addWidget(newButton);
connect(newButton, &QPushButton::clicked, this, [this] {
if (listSdFiles->currentRow() != -1)
{
- emit(deleteSdFile(listSdFiles->currentItem()->text()));
+ emit deleteSdFile(listSdFiles->currentItem()->text());
listSdFiles->setCurrentRow(-1);
}
});
auto groupFiles = new QGroupBox(tr("Files On Sd Card"));
listSdFiles = new QListWidget;
auto groupLayout = new QVBoxLayout;
groupLayout->addWidget(listSdFiles);
groupFiles->setLayout(groupLayout);
auto mainLayout = new QVBoxLayout;
mainLayout->addItem(hBoxLayout);
mainLayout->addWidget(groupFiles);
setLayout(mainLayout);
}
void SdWidget::updateFilelist(const QStringList &fileList)
{
listSdFiles->clear();
listSdFiles->addItems(fileList);
}
diff --git a/src/widgets/statuswidget.cpp b/src/widgets/statuswidget.cpp
index c4cf4a5..944a71b 100644
--- a/src/widgets/statuswidget.cpp
+++ b/src/widgets/statuswidget.cpp
@@ -1,118 +1,118 @@
/* AtCore Test Client
Copyright (C) <2018>
Author: 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
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
#include
#include
#include
#include "statuswidget.h"
StatusWidget::StatusWidget(bool showStop, QWidget *parent) :
QWidget(parent)
{
//first create the item for the print Progress.
auto hBoxLayout = new QHBoxLayout;
printingProgress = new QProgressBar;
printingProgress->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
hBoxLayout->addWidget(printingProgress);
if (showStop) {
auto newButton = new QPushButton(style()->standardIcon(QStyle::SP_BrowserStop), QString());
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(stopPressed());
+ emit stopPressed();
});
hBoxLayout->addWidget(newButton);
}
lblTime = new QLabel(QStringLiteral("00:00:00"));
lblTime->setAlignment(Qt::AlignHCenter);
auto newLabel = new QLabel(QStringLiteral(" / "));
lblTimeLeft = new QLabel(QStringLiteral("??:??:??"));
lblTimeLeft->setAlignment(Qt::AlignHCenter);
hBoxLayout->addWidget(lblTime);
hBoxLayout->addWidget(newLabel);
hBoxLayout->addWidget(lblTimeLeft);
printProgressWidget = new QWidget();
printProgressWidget->setLayout(hBoxLayout);
//Then Create the full bar.
newLabel = new QLabel(tr("AtCore State:"));
lblState = new QLabel(tr("Not Connected"));
lblSd = new QLabel();
spacer = new QSpacerItem(10, 20, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
hBoxLayout = new QHBoxLayout;
hBoxLayout->addWidget(newLabel);
hBoxLayout->addWidget(lblState);
hBoxLayout->addSpacerItem(new QSpacerItem(5, 20, QSizePolicy::Fixed));
hBoxLayout->addWidget(lblSd);
hBoxLayout->addSpacerItem(spacer);
hBoxLayout->addWidget(printProgressWidget);
setLayout(hBoxLayout);
printTime = new QTime();
printTimer = new QTimer();
printTimer->setInterval(1000);
printTimer->setSingleShot(false);
connect(printTimer, &QTimer::timeout, this, &StatusWidget::updatePrintTime);
}
void StatusWidget::setSD(bool hasSd)
{
QString labelText = hasSd ? tr("SD") : QString();
lblSd->setText(labelText);
}
void StatusWidget::setState(const QString &state)
{
lblState->setText(state);
}
void StatusWidget::showPrintArea(bool visible)
{
printProgressWidget->setVisible(visible);
if (visible) {
spacer->changeSize(10, 20, QSizePolicy::Fixed, QSizePolicy::Fixed);
printTime->start();
printTimer->start();
} else {
printTimer->stop();
spacer->changeSize(10, 20, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
}
}
void StatusWidget::updatePrintTime()
{
QTime temp(0, 0, 0);
lblTime->setText(temp.addMSecs(printTime->elapsed()).toString(QStringLiteral("hh:mm:ss")));
}
void StatusWidget::updatePrintProgress(const float &progress)
{
printingProgress->setValue(progress);
if (progress >= 1) {
QTime temp(0, 0, 0);
lblTimeLeft->setText(temp.addMSecs((100 - progress) * (printTime->elapsed() / progress)).toString(QStringLiteral("hh:mm:ss")));
} else {
lblTimeLeft->setText(QStringLiteral("??:??:??"));
}
}
diff --git a/src/widgets/temperaturewidget.cpp b/src/widgets/temperaturewidget.cpp
index ef48778..85283ef 100644
--- a/src/widgets/temperaturewidget.cpp
+++ b/src/widgets/temperaturewidget.cpp
@@ -1,72 +1,72 @@
/* AtCore Test Client
Copyright (C) <2018>
Author: Chris Rizzitello - rizzitello@kde.org
Lays Rodrigues - lays.rodrigues@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
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 "temperaturewidget.h"
#include
#include
#include
#include
TemperatureWidget::TemperatureWidget(QWidget *parent) :
QWidget(parent)
{
auto *mainLayout = new QVBoxLayout;
checkAndWait = new QCheckBox(tr("Wait Until Temperature Stabilizes"));
mainLayout->addWidget(checkAndWait);
auto label = new QLabel(tr("Bed Temp"));
sbBedTemp = new QSpinBox;
sbBedTemp->setRange(0, 120);
sbBedTemp->setSuffix(QStringLiteral("°C"));
auto *newButton = new QPushButton(tr("Set"));
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(bedTempChanged(sbBedTemp->value(), checkAndWait->isChecked()));
+ emit bedTempChanged(sbBedTemp->value(), checkAndWait->isChecked());
});
auto *hboxLayout = new QHBoxLayout;
hboxLayout->addWidget(label, 80);
hboxLayout->addWidget(sbBedTemp);
hboxLayout->addWidget(newButton);
mainLayout->addItem(hboxLayout);
comboExtruderSelect = new QComboBox;
sbExtruderTemp = new QSpinBox;
sbExtruderTemp->setRange(0, 275);
sbExtruderTemp->setSuffix(QStringLiteral("°C"));
newButton = new QPushButton(tr("Set"));
connect(newButton, &QPushButton::clicked, this, [this] {
- emit(extTempChanged(sbExtruderTemp->value(), comboExtruderSelect->currentIndex(), checkAndWait->isChecked()));
+ emit extTempChanged(sbExtruderTemp->value(), comboExtruderSelect->currentIndex(), checkAndWait->isChecked());
});
hboxLayout = new QHBoxLayout;
hboxLayout->addWidget(comboExtruderSelect, 80);
hboxLayout->addWidget(sbExtruderTemp);
hboxLayout->addWidget(newButton);
mainLayout->addItem(hboxLayout);
setLayout(mainLayout);
}
void TemperatureWidget::updateExtruderCount(const int count)
{
for (int i = 0; i < count; i++) {
comboExtruderSelect->insertItem(i, tr("Extruder %1").arg(i));
}
}