File indexing completed on 2024-04-28 07:29:29

0001 /*
0002     KmPlot - a math. function plotter for the KDE-Desktop
0003 
0004     SPDX-FileCopyrightText: 2004 Fredrik Edemar <f_edemar@linux.se>
0005     SPDX-FileCopyrightText: 2006 David Saxton <david@bluehaze.org>
0006 
0007     This file is part of the KDE Project.
0008     KmPlot is part of the KDE-EDU Project.
0009 
0010     SPDX-License-Identifier: GPL-2.0-or-later
0011 
0012 */
0013 
0014 #ifndef kmplotprogress_included
0015 #define kmplotprogress_included
0016 
0017 #include <QWidget>
0018 
0019 class QPushButton;
0020 class QProgressBar;
0021 class QTimer;
0022 
0023 /// The progress-widget in the statusbar which appears when drawing integrals
0024 class KmPlotProgress : public QWidget
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit KmPlotProgress(QWidget *parent = nullptr);
0029     ~KmPlotProgress();
0030     /**
0031      * Sets proportion done (\p progress should be between 0 and 1). The
0032      * progress bar won't be shown immediately, but only after a small
0033      * delay.
0034      *
0035      * If \p progress is >= 1, then this progress bar will be hidden.
0036      */
0037     void setProgress(double progress);
0038 
0039 Q_SIGNALS:
0040     /**
0041      * Emitted when the stop button is clicked.
0042      */
0043     void cancelDraw();
0044 
0045 private Q_SLOTS:
0046     /**
0047      * Called from timeout of m_showTimer.
0048      */
0049     void showProgressBar();
0050 
0051 private:
0052     QTimer *m_showTimer;
0053     QPushButton *m_button;
0054     QProgressBar *m_progress;
0055 };
0056 
0057 #endif // kmplotprogress_included