┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/statusbar/dolphinstatusbar.h
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2026-04-23 18:22:49 +0200
committerFelix Ernst <[email protected]>2026-04-27 13:26:59 +0200
commit1e13c6abb6fc179fa8da32fe62df89560a801b3d (patch)
treea154114e7144f5b6678e7b394bf7c7423b56051b /src/statusbar/dolphinstatusbar.h
parent2d7dac81ad66672aa2332cc37e3439755fe1f930 (diff)
Show type-ahead typing feedback in the status bar
The typed keys are displayed in the status bar while also displaying which file name they were auto-completed to (i.e. which file was selected because of the typing). This commit contains some refactoring to keep the original status bar functionality working as expected. This commit also separates DolphinMainWindow from DolphinStatusBar which is great news architecture-wise. The status bar is encapsulated within the DolphinViewContainer.
Diffstat (limited to 'src/statusbar/dolphinstatusbar.h')
-rw-r--r--src/statusbar/dolphinstatusbar.h42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/statusbar/dolphinstatusbar.h b/src/statusbar/dolphinstatusbar.h
index b4ddcd95e..232a4ba07 100644
--- a/src/statusbar/dolphinstatusbar.h
+++ b/src/statusbar/dolphinstatusbar.h
@@ -11,8 +11,6 @@
#include <KMessageWidget>
-#include <QTime>
-
class QUrl;
class StatusBarSpaceInfo;
class QLabel;
@@ -37,8 +35,6 @@ public:
explicit DolphinStatusBar(QWidget *parent);
~DolphinStatusBar() override;
- QString text() const;
-
enum class CancelLoading {
Allowed,
Disallowed
@@ -62,18 +58,21 @@ public:
int progress() const;
/**
- * Replaces the text set by setText() by the text that
- * has been set by setDefaultText(). DolphinStatusBar::text()
- * will return an empty string after the reset has been done.
+ * Sets a text that is shown with priority as a Qt::RichText for a short amount of time.
*/
- void resetToDefaultText();
-
+ void setTemporaryRichText(const QString &temporaryRichText);
+ /**
+ * Sets a text describing the hovered item. This text is immediately shown if no m_temporaryRichText is currently shown.
+ * When no item is hovered, call this method with an empty string so the m_defaultText is shown.
+ * @see setTemporaryRichText()
+ * @see setDefaultText()
+ */
+ void setHoveredItemText(const QString &hoveredItemText);
/**
- * Sets the default text, which is shown if the status bar
- * is rest by DolphinStatusBar::resetToDefaultText().
+ * Sets the default text. This text is immediately shown if no m_temporaryRichText is currently shown.
+ * @see setTemporaryRichText()
*/
void setDefaultText(const QString &text);
- QString defaultText() const;
QUrl url() const;
int zoomLevel() const;
@@ -105,7 +104,6 @@ public:
int clippingAmount() const;
public Q_SLOTS:
- void setText(const QString &text);
void setUrl(const QUrl &url);
void setZoomLevel(int zoomLevel);
@@ -147,6 +145,12 @@ private Q_SLOTS:
void updateProgressInfo();
/**
+ * Replaces the text set by setTemporaryRichText() by the text set by setHoveredItemText() or setDefaultText().
+ * Is only called when m_clearTemporaryRichTextTimer times out.
+ */
+ void clearTemporaryRichText();
+
+ /**
* Updates the text for m_label and does an eliding in
* case if the text does not fit into the available width.
*/
@@ -173,7 +177,11 @@ private:
int preferredHeight() const override;
private:
- QString m_text;
+ /** @see setTemporaryRichText() */
+ QString m_temporaryRichText;
+ /** @see setHoveredItemText() */
+ QString m_hoveredItemText;
+ /** @see setDefaultText() */
QString m_defaultText;
KSqueezedTextLabel *m_label;
QLabel *m_zoomLabel;
@@ -188,8 +196,10 @@ private:
int m_progress;
QTimer *m_showProgressBarTimer;
- QTimer *m_delayUpdateTimer;
- QTime m_textTimestamp;
+ /** Clears the temporary rich text from the status bar and shows a non-temporary text instead. */
+ QTimer *m_clearTemporaryRichTextTimer;
+ /** Very frequent updates to the status bar text look ugly. Most updates go through this timer to avoid this. */
+ QTimer *m_updateLabelTextTimer;
QHBoxLayout *m_topLayout;
};