File indexing completed on 2025-01-19 03:56:13

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-01-24
0007  * Description : a progress bar used to display action
0008  *               progress or a text in status bar.
0009  *               Progress events are dispatched to ProgressManager.
0010  *
0011  * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_STATUS_PROGRESS_BAR_H
0018 #define DIGIKAM_STATUS_PROGRESS_BAR_H
0019 
0020 // Qt includes
0021 
0022 #include <QStackedWidget>
0023 #include <QString>
0024 
0025 // Local includes
0026 
0027 #include "digikam_export.h"
0028 
0029 namespace Digikam
0030 {
0031 class ProgressItem;
0032 
0033 class DIGIKAM_EXPORT StatusProgressBar : public QStackedWidget
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038 
0039     enum StatusProgressBarMode
0040     {
0041         TextMode = 0,
0042         ProgressBarMode,
0043         CancelProgressBarMode
0044     };
0045 
0046 public:
0047 
0048     explicit StatusProgressBar(QWidget* const parent = nullptr);
0049     ~StatusProgressBar() override;
0050 
0051     void setAlignment(Qt::Alignment a);
0052 
0053     void setProgressBarMode(int mode, const QString& text = QString());
0054 
0055     int  progressValue()      const;
0056 
0057     int  progressTotalSteps() const;
0058     void setProgressTotalSteps(int v);
0059 
0060     void setNotify(bool b);
0061     void setNotificationTitle(const QString& title, const QIcon& icon);
0062 
0063 public Q_SLOTS:
0064 
0065     void setText(const QString& text);
0066     void setProgressValue(int v);
0067     void setProgressText(const QString& text);
0068 
0069 Q_SIGNALS:
0070 
0071     void signalCancelButtonPressed();
0072 
0073 private:
0074 
0075     ProgressItem* currentProgressItem() const;
0076 
0077 private:
0078 
0079     class Private;
0080     Private* const d;
0081 };
0082 
0083 } // namespace Digikam
0084 
0085 #endif // DIGIKAM_STATUS_PROGRESS_BAR_H