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

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 QElapsedTimer;
0013 class QLabel;
0014 class QProgressBar;
0015 class QSpacerItem;
0016 class QTimer;
0017 /**
0018  * @brief The StatusWidget class Status Bar information for atcore
0019  */
0020 class ATCOREWIDGETS_EXPORT StatusWidget : public QWidget
0021 {
0022     Q_OBJECT
0023 public:
0024     /**
0025      * @brief Make A new Status widget
0026      * @param showStop: Set False if your client has the print job stop in another widget.
0027      * @param parent: parent of this widget.
0028      */
0029     explicit StatusWidget(bool showStop = true, QWidget *parent = nullptr);
0030     ~StatusWidget() = default;
0031     /**
0032      * @brief Set if the status area should show SD card inserted.
0033      * @param hasSd
0034      */
0035     void setSD(bool hasSd);
0036     /**
0037      * @brief Set the State String
0038      * @param state: String to be shown
0039      */
0040     void setState(const QString &state);
0041     /**
0042      * @brief Show or hide the Print progress and time
0043      * @param visible : true for show
0044      */
0045     void showPrintArea(bool visible);
0046     /**
0047      * @brief Update the progres to the new progress
0048      * @param progress: new progress.
0049      */
0050     void updatePrintProgress(const int progress);
0051 
0052 signals:
0053     void stopPressed();
0054 
0055 private slots:
0056     void updatePrintTime();
0057 
0058 private:
0059     QLabel *lblState = nullptr;
0060     QLabel *lblSd = nullptr;
0061     QLabel *lblTime = nullptr;
0062     QLabel *lblTimeLeft = nullptr;
0063     QElapsedTimer *printTime = nullptr;
0064     QTimer *printTimer = nullptr;
0065     QSpacerItem *spacer = nullptr;
0066     QProgressBar *printingProgress = nullptr;
0067     QWidget *printProgressWidget = nullptr;
0068 };