]>
cloud.milkyroute.net Git - dolphin.git/blob - src/statusbar/dolphinstatusbar.h
2 * SPDX-FileCopyrightText: 2006-2012 Peter Penz <peter.penz19@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #ifndef DOLPHINSTATUSBAR_H
8 #define DOLPHINSTATUSBAR_H
10 #include "animatedheightwidget.h"
15 class StatusBarSpaceInfo
;
21 class KSqueezedTextLabel
;
25 * @brief Represents the statusbar of a Dolphin view.
27 * The statusbar allows to show messages, progress
28 * information and space-information of a disk.
30 class DolphinStatusBar
: public AnimatedHeightWidget
35 explicit DolphinStatusBar(QWidget
*parent
);
36 ~DolphinStatusBar() override
;
41 * Sets the text for the progress information.
42 * DolphinStatusBar::setProgress() should be invoked
43 * afterwards each time the progress changes.
45 void setProgressText(const QString
&text
);
46 QString
progressText() const;
49 * Sets the progress in percent (0 - 100). The
50 * progress is shown delayed by 500 milliseconds:
51 * If the progress does reach 100 % within 500 milliseconds,
52 * the progress is not shown at all.
54 void setProgress(int percent
);
58 * Replaces the text set by setText() by the text that
59 * has been set by setDefaultText(). DolphinStatusBar::text()
60 * will return an empty string after the reset has been done.
62 void resetToDefaultText();
65 * Sets the default text, which is shown if the status bar
66 * is rest by DolphinStatusBar::resetToDefaultText().
68 void setDefaultText(const QString
&text
);
69 QString
defaultText() const;
72 int zoomLevel() const;
75 * Refreshes the status bar to get synchronized with the (updated) Dolphin settings.
80 * Refreshes the disk space information.
82 void updateSpaceInfo();
85 void setText(const QString
&text
);
86 void setUrl(const QUrl
&url
);
87 void setZoomLevel(int zoomLevel
);
91 * Is emitted if the stop-button has been pressed during showing a progress.
95 void zoomLevelChanged(int zoomLevel
);
98 void contextMenuEvent(QContextMenuEvent
*event
) override
;
99 void paintEvent(QPaintEvent
*paintEvent
) override
;
102 void showZoomSliderToolTip(int zoomLevel
);
103 void updateProgressInfo();
106 * Updates the text for m_label and does an eliding in
107 * case if the text does not fit into the available width.
109 void updateLabelText();
112 * Updates the text of the zoom slider tooltip to show
113 * the currently used size.
115 void updateZoomSliderToolTip(int zoomLevel
);
119 * Makes the space information widget and zoom slider widget
120 * visible, if \a visible is true and the settings allow to show
121 * the widgets. showUnknownProgressIf \a visible is false, it is assured that both
122 * widgets are hidden.
124 void setExtensionsVisible(bool visible
);
126 void updateContentsMargins();
128 /** @see AnimatedHeightWidget::preferredHeight() */
129 int preferredHeight() const override
;
133 QString m_defaultText
;
134 KSqueezedTextLabel
*m_label
;
136 StatusBarSpaceInfo
*m_spaceInfo
;
138 QSlider
*m_zoomSlider
;
140 QLabel
*m_progressTextLabel
;
141 QProgressBar
*m_progressBar
;
142 QToolButton
*m_stopButton
;
144 QTimer
*m_showProgressBarTimer
;
146 QTimer
*m_delayUpdateTimer
;
147 QTime m_textTimestamp
;
149 QHBoxLayout
*m_topLayout
;