File indexing completed on 2024-05-19 05:51:03
0001 /* Atelier KDE Printer Host for 3D Printing 0002 Copyright (C) <2017> 0003 Author: Lays Rodrigues - lays.rodrigues@kde.org 0004 Chris Rizzitello - rizzitello@kde.org 0005 0006 This program is free software: you can redistribute it and/or modify 0007 it under the terms of the GNU General Public License as published by 0008 the Free Software Foundation, either version 3 of the License, or 0009 (at your option) any later version. 0010 0011 This program is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 GNU General Public License for more details. 0015 0016 You should have received a copy of the GNU General Public License 0017 along with this program. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #pragma once 0021 #include "bedextruderwidget.h" 0022 #include <AtCore> 0023 #include <CommandWidget> 0024 #include <LogWidget> 0025 #include <MachineInfo> 0026 #include <MovementWidget> 0027 #include <PlotWidget> 0028 #include <PrintWidget> 0029 #include <QComboBox> 0030 #include <QList> 0031 #include <QPushButton> 0032 #include <QSettings> 0033 #include <QToolBar> 0034 #include <QUrl> 0035 #include <QWidget> 0036 #include <SdWidget> 0037 #include <StatusWidget> 0038 0039 /** 0040 * @todo write docs 0041 */ 0042 class AtCoreInstanceWidget : public QWidget 0043 { 0044 Q_OBJECT 0045 0046 public: 0047 AtCoreInstanceWidget(QWidget *parent = nullptr); 0048 ~AtCoreInstanceWidget(); 0049 bool connected(); 0050 void setFileCount(int count); 0051 void startConnection(const QString &serialPort, const QMap<QString, QVariant> &profile); 0052 0053 public slots: 0054 bool isPrinting(); 0055 QSize bedSize(); 0056 void printFile(const QUrl &fileName); 0057 void updateProfileData(); 0058 0059 private: 0060 AtCore m_core; 0061 BedExtruderWidget *m_bedExtWidget = nullptr; 0062 CommandWidget *m_commandWidget = nullptr; 0063 int m_fileCount = 0; 0064 LogWidget *m_logWidget = nullptr; 0065 MovementWidget *m_movementWidget = nullptr; 0066 PlotWidget *m_plotWidget = nullptr; 0067 PrintWidget *m_printWidget = nullptr; 0068 SdWidget *m_sdWidget = nullptr; 0069 StatusWidget *m_statusWidget = nullptr; 0070 QAction *m_printAction = nullptr; 0071 QAction *m_stopAction = nullptr; 0072 QComboBox *m_comboPort = nullptr; 0073 QComboBox *m_comboProfile = nullptr; 0074 QVariantMap m_profileData; 0075 QPushButton *m_connectButton = nullptr; 0076 QSettings m_settings; 0077 QSize m_iconSize; 0078 QString m_theme; 0079 QTabWidget *m_tabWidget = nullptr; 0080 QToolBar *m_connectToolBar = nullptr; 0081 QToolBar *m_toolBar = nullptr; 0082 QWidget *m_advancedTab = nullptr; 0083 QWidget *m_connectWidget = nullptr; 0084 QSize m_bedSize; 0085 QTimer *m_connectionTimer = nullptr; 0086 void buildConnectionToolbar(); 0087 void buildToolbar(); 0088 void checkTemperature(uint sensorType, uint number, float temp); 0089 void connectButtonClicked(); 0090 void connectBedTemperatureData(bool connected); 0091 void connectExtruderTemperatureData(bool connected); 0092 void disableMotors(); 0093 void enableControls(bool b); 0094 void handlePrinterStatusChanged(AtCore::STATES newState); 0095 void initConnectsToAtCore(); 0096 void stopPrint(); 0097 void saveProfile(); 0098 void pausePrint(); 0099 void print(); 0100 void updateSerialPort(QStringList ports); 0101 void togglePrintButtons(bool shown); 0102 static const QMap<MachineInfo::KEY, QString> keyString; 0103 0104 signals: 0105 void bedSizeChanged(QSize bedSize); 0106 void connectionChanged(QString name); 0107 void disableDisconnect(bool b); 0108 void extruderCountChanged(int count); 0109 void requestProfileDialog(); 0110 void requestFileChooser(); 0111 };