File indexing completed on 2025-01-26 05:19:14
0001 /* Atelier KDE Printer Host for 3D Printing 0002 Copyright (C) <2017> 0003 Author: Patrick José Pereira - patrickjp@kde.org 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU General Public License as 0007 published by the Free Software Foundation; either version 3 of 0008 the License or any later version accepted by the membership of 0009 KDE e.V. (or its successor approved by the membership of KDE 0010 e.V.), which shall act as a proxy defined in Section 14 of 0011 version 3 of the license. 0012 0013 This program is distributed in the hope that it will be useful, 0014 but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0016 GNU General Public License for more details. 0017 0018 You should have received a copy of the GNU General Public License 0019 along with this program. If not, see <http://www.gnu.org/licenses/>. 0020 */ 0021 #include "gcodeto4d.h" 0022 #include "fileloader.h" 0023 #include <QFile> 0024 #include <QThread> 0025 #include <QUrl> 0026 #include <QVariant> 0027 #include <QVector4D> 0028 0029 GcodeTo4D::GcodeTo4D(QObject *parent) 0030 : QObject(parent) 0031 { 0032 } 0033 0034 void GcodeTo4D::read(const QString &url) 0035 { 0036 _thread = new QThread(this); 0037 QString path = QUrl(url).path(); 0038 auto fileLoader = new FileLoader(path); 0039 fileLoader->moveToThread(_thread); 0040 connect(fileLoader, &FileLoader::percentUpdate, this, &GcodeTo4D::percentUpdate); 0041 connect(fileLoader, &FileLoader::posFinished, this, &GcodeTo4D::posFinished); 0042 connect(fileLoader, &FileLoader::posFinished, _thread, &QThread::quit); 0043 connect(_thread, &QThread::started, fileLoader, &FileLoader::run); 0044 connect(_thread, &QThread::finished, fileLoader, &FileLoader::deleteLater); 0045 _thread->start(); 0046 }