File indexing completed on 2024-05-19 05:51:02

0001 /* Atelier KDE Printer Host for 3D Printing
0002     Copyright (C) <2017>
0003     Author: Patrick José Pereira - patrickjp@kde.org
0004             Chris Rizzitello - rizzitello@kde.org
0005 
0006     This program is free software; you can redistribute it and/or
0007     modify it under the terms of the GNU General Public License as
0008     published by the Free Software Foundation; either version 3 of
0009     the License or any later version accepted by the membership of
0010     KDE e.V. (or its successor approved by the membership of KDE
0011     e.V.), which shall act as a proxy defined in Section 14 of
0012     version 3 of the license.
0013 
0014     This program is distributed in the hope that it will be useful,
0015     but WITHOUT ANY WARRANTY; without even the implied warranty of
0016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017     GNU General Public License for more details.
0018 
0019     You should have received a copy of the GNU General Public License
0020     along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 #pragma once
0023 
0024 #include <QQmlApplicationEngine>
0025 #include <QQuickView>
0026 #include <QWidget>
0027 
0028 class LineMesh;
0029 class QString;
0030 
0031 class Viewer3D : public QWidget
0032 {
0033     Q_OBJECT
0034     Q_PROPERTY(QSize bedSize READ bedSize WRITE setBedSize NOTIFY bedSizeChanged)
0035 
0036 public slots:
0037     void dropCatch(const QVariant &var);
0038     void setBedSize(const QSize &newBedSize);
0039 
0040 public:
0041     explicit Viewer3D(QWidget *parent = nullptr);
0042     ~Viewer3D() override = default;
0043     QSize bedSize();
0044     void drawModel(const QString &file);
0045 
0046 private:
0047     LineMesh *_lineMesh;
0048     QQmlApplicationEngine _engine;
0049     QQuickView *_view;
0050     QSize _bedSize = QSize(50, 50);
0051 
0052 signals:
0053     void droppedUrls(QList<QUrl> fileList);
0054     void bedSizeChanged(QSize bedSize);
0055 };