]>
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
14 class StatusBarSpaceInfo
;
20 class KSqueezedTextLabel
;
23 * @brief Represents the statusbar of a Dolphin view.
25 * The statusbar allows to show messages, progress
26 * information and space-information of a disk.
28 class DolphinStatusBar
: public QWidget
33 explicit DolphinStatusBar(QWidget
*parent
);
34 ~DolphinStatusBar() override
;
39 * Sets the text for the progress information.
40 * DolphinStatusBar::setProgress() should be invoked
41 * afterwards each time the progress changes.
43 void setProgressText(const QString
&text
);
44 QString
progressText() const;
47 * Sets the progress in percent (0 - 100). The
48 * progress is shown delayed by 500 milliseconds:
49 * If the progress does reach 100 % within 500 milliseconds,
50 * the progress is not shown at all.
52 void setProgress(int percent
);
56 * Replaces the text set by setText() by the text that
57 * has been set by setDefaultText(). DolphinStatusBar::text()
58 * will return an empty string after the reset has been done.
60 void resetToDefaultText();
63 * Sets the default text, which is shown if the status bar
64 * is rest by DolphinStatusBar::resetToDefaultText().
66 void setDefaultText(const QString
&text
);
67 QString
defaultText() const;
70 int zoomLevel() const;
73 * Refreshes the status bar to get synchronized with the (updated) Dolphin settings.
78 * Refreshes the disk space information.
80 void updateSpaceInfo();
83 void setText(const QString
&text
);
84 void setUrl(const QUrl
&url
);
85 void setZoomLevel(int zoomLevel
);
89 * Is emitted if the stop-button has been pressed during showing a progress.
93 void zoomLevelChanged(int zoomLevel
);
96 void contextMenuEvent(QContextMenuEvent
*event
) override
;
97 void paintEvent(QPaintEvent
*paintEvent
) override
;
100 void showZoomSliderToolTip(int zoomLevel
);
101 void updateProgressInfo();
104 * Updates the text for m_label and does an eliding in
105 * case if the text does not fit into the available width.
107 void updateLabelText();
110 * Updates the text of the zoom slider tooltip to show
111 * the currently used size.
113 void updateZoomSliderToolTip(int zoomLevel
);
117 * Makes the space information widget and zoom slider widget
118 * visible, if \a visible is true and the settings allow to show
119 * the widgets. showUnknownProgressIf \a visible is false, it is assured that both
120 * widgets are hidden.
122 void setExtensionsVisible(bool visible
);
126 QString m_defaultText
;
127 KSqueezedTextLabel
*m_label
;
129 StatusBarSpaceInfo
*m_spaceInfo
;
131 QSlider
*m_zoomSlider
;
133 QLabel
*m_progressTextLabel
;
134 QProgressBar
*m_progressBar
;
135 QToolButton
*m_stopButton
;
137 QTimer
*m_showProgressBarTimer
;
139 QTimer
*m_delayUpdateTimer
;
140 QTime m_textTimestamp
;