diff --git a/src/widgets/3dview/gcodeto4d.cpp b/src/widgets/3dview/gcodeto4d.cpp
index 50a9967..db923ef 100644
--- a/src/widgets/3dview/gcodeto4d.cpp
+++ b/src/widgets/3dview/gcodeto4d.cpp
@@ -1,50 +1,46 @@
/* Atelier KDE Printer Host for 3D Printing
Copyright (C) <2017>
Author: Patrick José Pereira - patrickjp@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 any later version accepted by the membership of
KDE e.V. (or its successor approved by the membership of KDE
e.V.), which shall act as a proxy defined in Section 14 of
version 3 of the license.
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
#include "fileloader.h"
#include "gcodeto4d.h"
GcodeTo4D::GcodeTo4D(QObject *parent) : QObject(parent)
{
}
-GcodeTo4D::~GcodeTo4D()
-{
-}
-
void GcodeTo4D::read(const QString &url)
{
- _thread = new QThread;
+ _thread = new QThread(this);
QString path = QUrl(url).path();
auto fileLoader = new FileLoader(path);
fileLoader->moveToThread(_thread);
connect(fileLoader, &FileLoader::percentUpdate, this, &GcodeTo4D::percentUpdate);
connect(fileLoader, &FileLoader::posFinished, this, &GcodeTo4D::posFinished);
connect(fileLoader, &FileLoader::posFinished, _thread, &QThread::quit);
connect(_thread, &QThread::started, fileLoader, &FileLoader::run);
connect(_thread, &QThread::finished, fileLoader, &FileLoader::deleteLater);
_thread->start();
}
diff --git a/src/widgets/3dview/gcodeto4d.h b/src/widgets/3dview/gcodeto4d.h
index ca362bf..ccf2dc5 100644
--- a/src/widgets/3dview/gcodeto4d.h
+++ b/src/widgets/3dview/gcodeto4d.h
@@ -1,43 +1,43 @@
/* Atelier KDE Printer Host for 3D Printing
Copyright (C) <2017>
Author: Patrick José Pereira - patrickjp@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 any later version accepted by the membership of
KDE e.V. (or its successor approved by the membership of KDE
e.V.), which shall act as a proxy defined in Section 14 of
version 3 of the license.
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
class GcodeTo4D : public QObject
{
Q_OBJECT
public:
explicit GcodeTo4D(QObject *parent = 0);
- ~GcodeTo4D();
+ ~GcodeTo4D() = default;
public:
void read(const QString &url);
signals:
void percentUpdate(const QVariant &percent);
void posFinished(const QVector &pos);
private:
- QThread *_thread;
- bool _wait;
+ QThread *_thread = nullptr;
+ bool _wait = false;
};