File indexing completed on 2025-01-05 04:55:50
0001 /* 0002 progressbar.h 0003 0004 This file is part of libkleopatra, the KDE keymanagement library 0005 SPDX-FileCopyrightText: 2004 Klarälvdalens Datakonsult AB 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #pragma once 0011 0012 #include "kleo_export.h" 0013 0014 #include <QProgressBar> 0015 0016 class QTimer; 0017 0018 namespace Kleo 0019 { 0020 0021 /** 0022 @short A QProgressBar with self-powered busy indicator 0023 */ 0024 class KLEO_EXPORT ProgressBar : public QProgressBar 0025 { 0026 Q_OBJECT 0027 public: 0028 explicit ProgressBar(QWidget *parent = nullptr); 0029 0030 public Q_SLOTS: 0031 void slotProgress(const QString &message, int type, int current, int total); 0032 void slotProgress(const QString &message, int current, int total); 0033 /*! reimplementation to support self-powered busy indicator */ 0034 void setValue(int progress); 0035 /*! reimplementation to support self-powered busy indicator */ 0036 void setMaximum(int total); 0037 /*! reimplementation to support self-powered busy indicator */ 0038 void reset(); 0039 /*! reimplementation to preserve visibility */ 0040 void setRange(int cur, int tot) 0041 { 0042 QProgressBar::setRange(cur, tot); 0043 } 0044 0045 private Q_SLOTS: 0046 void slotBusyTimerTick(); 0047 0048 private: 0049 void fixup(bool); 0050 0051 private: 0052 QTimer *mBusyTimer = nullptr; 0053 int mRealProgress; 0054 }; 0055 }