]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/statusbar/dolphinstatusbar.h
Avoid wrapping text in the status bar
[dolphin.git] / src / statusbar / dolphinstatusbar.h
index 7b4434539c47141d1bc424f228d819c0514dea01..75a2cdc6f0c3020520fbbea2ec6f0388f3284e05 100644 (file)
@@ -7,8 +7,9 @@
 #ifndef DOLPHINSTATUSBAR_H
 #define DOLPHINSTATUSBAR_H
 
+#include "animatedheightwidget.h"
+
 #include <QTime>
-#include <QWidget>
 
 class QUrl;
 class StatusBarSpaceInfo;
@@ -18,6 +19,7 @@ class QToolButton;
 class QSlider;
 class QTimer;
 class KSqueezedTextLabel;
+class QHBoxLayout;
 
 /**
  * @brief Represents the statusbar of a Dolphin view.
@@ -25,12 +27,12 @@ class KSqueezedTextLabel;
  * The statusbar allows to show messages, progress
  * information and space-information of a disk.
  */
-class DolphinStatusBar : public QWidget
+class DolphinStatusBar : public AnimatedHeightWidget
 {
     Q_OBJECT
 
 public:
-    explicit DolphinStatusBar(QWidgetparent);
+    explicit DolphinStatusBar(QWidget *parent);
     ~DolphinStatusBar() override;
 
     QString text() const;
@@ -40,7 +42,7 @@ public:
      * DolphinStatusBar::setProgress() should be invoked
      * afterwards each time the progress changes.
      */
-    void setProgressText(const QStringtext);
+    void setProgressText(const QString &text);
     QString progressText() const;
 
     /**
@@ -63,7 +65,7 @@ public:
      * Sets the default text, which is shown if the status bar
      * is rest by DolphinStatusBar::resetToDefaultText().
      */
-    void setDefaultText(const QStringtext);
+    void setDefaultText(const QString &text);
     QString defaultText() const;
 
     QUrl url() const;
@@ -80,8 +82,8 @@ public:
     void updateSpaceInfo();
 
 public Q_SLOTS:
-    void setText(const QStringtext);
-    void setUrl(const QUrlurl);
+    void setText(const QString &text);
+    void setUrl(const QUrl &url);
     void setZoomLevel(int zoomLevel);
 
 Q_SIGNALS:
@@ -93,7 +95,8 @@ Q_SIGNALS:
     void zoomLevelChanged(int zoomLevel);
 
 protected:
-    void contextMenuEvent(QContextMenuEvent* event) override;
+    void contextMenuEvent(QContextMenuEvent *event) override;
+    void paintEvent(QPaintEvent *paintEvent) override;
 
 private Q_SLOTS:
     void showZoomSliderToolTip(int zoomLevel);
@@ -120,23 +123,30 @@ private:
      */
     void setExtensionsVisible(bool visible);
 
+    void updateContentsMargins();
+
+    /** @see AnimatedHeightWidget::preferredHeight() */
+    int preferredHeight() const override;
+
 private:
     QString m_text;
     QString m_defaultText;
-    KSqueezedTextLabelm_label;
-    QLabelm_zoomLabel;
-    StatusBarSpaceInfom_spaceInfo;
+    KSqueezedTextLabel *m_label;
+    QLabel *m_zoomLabel;
+    StatusBarSpaceInfo *m_spaceInfo;
 
-    QSliderm_zoomSlider;
+    QSlider *m_zoomSlider;
 
-    QLabelm_progressTextLabel;
-    QProgressBarm_progressBar;
-    QToolButtonm_stopButton;
+    QLabel *m_progressTextLabel;
+    QProgressBar *m_progressBar;
+    QToolButton *m_stopButton;
     int m_progress;
-    QTimerm_showProgressBarTimer;
+    QTimer *m_showProgressBarTimer;
 
-    QTimerm_delayUpdateTimer;
+    QTimer *m_delayUpdateTimer;
     QTime m_textTimestamp;
+
+    QHBoxLayout *m_topLayout;
 };
 
 #endif