File indexing completed on 2024-11-10 04:48:57
0001 #pragma once 0002 /* 0003 statusbarprogresswidget.h 0004 0005 SPDX-FileCopyrightText: 2004 Till Adam <adam@kde.org> 0006 SPDX-FileCopyrightText: 2004 Don Sanders 0007 SPDX-FileCopyrightText: 2004 David Faure <faure@kde.org> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 /** 0012 * A specialized progress widget class, heavily based on 0013 * kio_littleprogress_dlg (it looks similar) 0014 */ 0015 0016 #include "kdepim_export.h" 0017 0018 #include <QFrame> 0019 0020 class QEvent; 0021 class QProgressBar; 0022 class QPushButton; 0023 class QStackedWidget; 0024 class QLabel; 0025 class QTimer; 0026 0027 namespace KPIM 0028 { 0029 class SSLLabel; 0030 class ProgressItem; 0031 class ProgressDialog; 0032 0033 class KDEPIM_EXPORT StatusbarProgressWidget : public QFrame 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 explicit StatusbarProgressWidget(ProgressDialog *progressDialog, QWidget *parent, bool button = true); 0039 0040 void setShowTypeProgressItem(unsigned int type); 0041 public Q_SLOTS: 0042 0043 void slotClean(); 0044 0045 void slotProgressItemAdded(KPIM::ProgressItem *i); 0046 void slotProgressItemCompleted(KPIM::ProgressItem *i); 0047 void slotProgressItemProgress(KPIM::ProgressItem *i, unsigned int value); 0048 void slotProgressButtonClicked(); 0049 0050 protected Q_SLOTS: 0051 void slotProgressDialogVisible(bool); 0052 void slotShowItemDelayed(); 0053 void slotBusyIndicator(); 0054 void updateBusyMode(KPIM::ProgressItem *); 0055 0056 protected: 0057 bool eventFilter(QObject *, QEvent *) override; 0058 0059 private: 0060 enum Mode { Progress, Clean }; 0061 KDEPIM_NO_EXPORT void setMode(Mode mode); 0062 KDEPIM_NO_EXPORT void updateProgressButton(bool showingProgress); 0063 KDEPIM_NO_EXPORT void connectSingleItem(); 0064 KDEPIM_NO_EXPORT void activateSingleItemMode(); 0065 0066 unsigned int mShowTypeProgressItem = 0; 0067 QProgressBar *mProgressBar = nullptr; 0068 QLabel *mLabel = nullptr; 0069 SSLLabel *mSslLabel = nullptr; 0070 QPushButton *mButton = nullptr; 0071 0072 Mode mMode = Clean; 0073 const bool mShowButton = false; 0074 bool mShowDetailedProgress = false; 0075 0076 QStackedWidget *mStackedWidget = nullptr; 0077 ProgressItem *mCurrentItem = nullptr; 0078 ProgressDialog *const mProgressDialog; 0079 QTimer *mDelayTimer = nullptr; 0080 QTimer *mBusyTimer = nullptr; 0081 QTimer *mCleanTimer = nullptr; 0082 }; 0083 } // namespace