]>
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
;
99 void showZoomSliderToolTip(int zoomLevel
);
100 void updateProgressInfo();
103 * Updates the text for m_label and does an eliding in
104 * case if the text does not fit into the available width.
106 void updateLabelText();
109 * Updates the text of the zoom slider tooltip to show
110 * the currently used size.
112 void updateZoomSliderToolTip(int zoomLevel
);
116 * Makes the space information widget and zoom slider widget
117 * visible, if \a visible is true and the settings allow to show
118 * the widgets. showUnknownProgressIf \a visible is false, it is assured that both
119 * widgets are hidden.
121 void setExtensionsVisible(bool visible
);
125 QString m_defaultText
;
126 KSqueezedTextLabel
* m_label
;
128 StatusBarSpaceInfo
* m_spaceInfo
;
130 QSlider
* m_zoomSlider
;
132 QLabel
* m_progressTextLabel
;
133 QProgressBar
* m_progressBar
;
134 QToolButton
* m_stopButton
;
136 QTimer
* m_showProgressBarTimer
;
138 QTimer
* m_delayUpdateTimer
;
139 QTime m_textTimestamp
;