File indexing completed on 2022-09-27 16:29:09

0001 /**
0002  * SPDX-FileCopyrightText: (C) 2003 by Sébastien Laoût <slaout@linux62.org>
0003  * SPDX-License-Identifier: GPL-2.0-or-later
0004  */
0005 #ifndef BASKETSTATUSBAR_H
0006 #define BASKETSTATUSBAR_H
0007 
0008 #include <QtCore/QObject>
0009 #include <QtGui/QPixmap>
0010 
0011 #include "basket_export.h"
0012 
0013 class QStatusBar;
0014 namespace KParts
0015 {
0016 class StatusBarExtension;
0017 }
0018 
0019 class QWidget;
0020 class QLabel;
0021 
0022 /**
0023     @author Sébastien Laoût <slaout@linux62.org>
0024 */
0025 class BASKET_EXPORT BasketStatusBar : public QObject
0026 {
0027     Q_OBJECT
0028 public:
0029     explicit BasketStatusBar(QStatusBar *bar);
0030     BasketStatusBar(KParts::StatusBarExtension *extension);
0031     ~BasketStatusBar() override;
0032 
0033 public Q_SLOTS:
0034     /** GUI Main Window actions **/
0035     void setStatusBarHint(const QString &hint); /// << Set a specific message or update if hint is empty
0036     void updateStatusBarHint();                 /// << Display the current state message (dragging, editing) or reset the startsbar message
0037     void postStatusbarMessage(const QString &text);
0038     void setSelectionStatus(const QString &s);
0039     void setLockStatus(bool isLocked);
0040     void setupStatusBar();
0041     void setUnsavedStatus(bool isUnsaved);
0042 
0043 protected:
0044     QStatusBar *statusBar() const;
0045     void addWidget(QWidget *widget, int stretch = 0, bool permanent = false);
0046     void setStatusText(const QString &txt);
0047     bool eventFilter(QObject *obj, QEvent *event) override;
0048 
0049 private:
0050     QStatusBar *m_bar;
0051     KParts::StatusBarExtension *m_extension;
0052     QLabel *m_selectionStatus;
0053     QLabel *m_lockStatus;
0054     QLabel *m_basketStatus;
0055     QLabel *m_savedStatus;
0056     QPixmap m_savedStatusPixmap;
0057 };
0058 
0059 #endif