File indexing completed on 2024-04-28 04:37:27
0001 /* 0002 SPDX-FileCopyrightText: 2007 Hamish Rodda <rodda@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_STATUSBAR_H 0008 #define KDEVPLATFORM_STATUSBAR_H 0009 0010 #include <QElapsedTimer> 0011 #include <QHash> 0012 #include <QStatusBar> 0013 0014 class QTimer; 0015 0016 namespace Sublime { 0017 class View; 0018 } 0019 0020 namespace KDevelop 0021 { 0022 0023 class IStatus; 0024 class IPlugin; 0025 class ProgressItem; 0026 class ProgressDialog; 0027 class StatusbarProgressWidget; 0028 class ProgressManager; 0029 0030 /** 0031 * Status bar 0032 */ 0033 class StatusBar : public QStatusBar 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 /** 0039 * Constructs a status bar. 0040 */ 0041 explicit StatusBar(QWidget* parent); 0042 ~StatusBar() override; 0043 0044 void registerStatus(QObject* status); 0045 0046 void updateMessage(); 0047 0048 void viewChanged(Sublime::View* view); 0049 0050 public Q_SLOTS: 0051 void showErrorMessage(const QString& message, int timeout); 0052 0053 private Q_SLOTS: 0054 void clearMessage( KDevelop::IStatus* ); 0055 void showMessage( KDevelop::IStatus*, const QString & message, int timeout); 0056 void hideProgress( KDevelop::IStatus* ); 0057 void showProgress( KDevelop::IStatus*, int minimum, int maximum, int value); 0058 void slotTimeout(); 0059 void viewStatusChanged(Sublime::View* view); 0060 0061 void pluginLoaded(KDevelop::IPlugin*); 0062 void removeError(QWidget*); 0063 0064 private: 0065 QTimer* errorTimeout(QWidget* error, int timeout); 0066 0067 private: 0068 struct Message { 0069 QString text; 0070 int timeout; 0071 }; 0072 0073 QHash<IStatus*, Message> m_messages; 0074 QTimer* const m_timer; 0075 QElapsedTimer m_time; 0076 Sublime::View* m_currentView; 0077 QHash<IStatus*,ProgressItem*> m_progressItems; 0078 StatusbarProgressWidget* m_progressWidget; // embedded in the statusbar, shows a single progressbar & button to expand the overlay widget 0079 ProgressDialog* m_progressDialog; // the actual overlay widget that contains multiple progressbars and status messages 0080 ProgressManager* m_progressController; // progress item model 0081 }; 0082 0083 } 0084 0085 #endif // KDEVPLATFORM_STATUSBAR_H