File indexing completed on 2024-05-12 04:41:11

0001 /* AtCore KDE Libary for 3D Printers
0002     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0003     SPDX-FileCopyrightText: 2018-2020 Chris Rizzitello <rizzitello@kde.org>
0004 */
0005 
0006 #pragma once
0007 
0008 #include <QWidget>
0009 
0010 #include "atcorewidgets_export.h"
0011 
0012 class QComboBox;
0013 class QLineEdit;
0014 class QPushButton;
0015 class QSpinBox;
0016 
0017 /**
0018  * @brief PrintWidget
0019  * provide a basic print widget.
0020  */
0021 class ATCOREWIDGETS_EXPORT PrintWidget : public QWidget
0022 {
0023     Q_OBJECT
0024 public:
0025     /**
0026      * @brief Make a new PrintWidget.
0027      * @param showAllControls: if true show Print , Emergency Stop and On Pause Controls
0028      * @param parent: Parent of this widget.
0029      */
0030     explicit PrintWidget(bool showAllControls = true, QWidget *parent = nullptr);
0031 
0032     /**
0033      * @brief set Post Pause string text.
0034      * @param text: text to set to.
0035      */
0036     void setPrintText(const QString &text);
0037 
0038     /**
0039      * @brief Update Fan count.
0040      * @param count new fan count
0041      */
0042     void updateFanCount(const int count);
0043 
0044 signals:
0045     /**
0046      * @brief emergencyStopPressed
0047      * Connect to AtCore::emergencyStop
0048      */
0049     void emergencyStopPressed();
0050 
0051     /**
0052      * @brief flowRateChanged
0053      * Connect to AtCore::setFlowRate
0054      * @param rate
0055      */
0056     void flowRateChanged(const int rate);
0057 
0058     /**
0059      * @brief printPressed
0060      * Users requested to print a file.
0061      */
0062     void printPressed();
0063 
0064     /**
0065      * @brief printSpeedChanged
0066      * Connect to AtCore::setPrinterSpeed
0067      * @param speed
0068      */
0069     void printSpeedChanged(const int speed);
0070 
0071     /**
0072      * @brief The Fan Speed has Changed.
0073      * @param speed : new Speed.
0074      * @param fanNum : fan to set the speed on.
0075      */
0076     void fanSpeedChanged(const int speed, const int fanNum);
0077 
0078 private:
0079     QPushButton *buttonPrint = nullptr;
0080     QComboBox *comboFanSelect = nullptr;
0081     QLineEdit *linePostPause = nullptr;
0082     QSpinBox *sbFlowRate = nullptr;
0083     QSpinBox *sbPrintSpeed = nullptr;
0084     QSpinBox *sbFanSpeed = nullptr;
0085 };