]>
cloud.milkyroute.net Git - dolphin.git/blob - src/statusbar/dolphinstatusbar.h
1 /***************************************************************************
2 * Copyright (C) 2006-2012 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef DOLPHINSTATUSBAR_H
21 #define DOLPHINSTATUSBAR_H
26 class StatusBarSpaceInfo
;
34 * @brief Represents the statusbar of a Dolphin view.
36 * The statusbar allows to show messages, progress
37 * information and space-information of a disk.
39 class DolphinStatusBar
: public QWidget
44 DolphinStatusBar(QWidget
* parent
);
45 virtual ~DolphinStatusBar();
50 * Sets the text for the progress information.
51 * DolphinStatusBar::setProgress() should be invoked
52 * afterwards each time the progress changes.
54 void setProgressText(const QString
& text
);
55 QString
progressText() const;
58 * Sets the progress in percent (0 - 100). The
59 * progress is shown delayed by 1 second:
60 * If the progress does reach 100 % within 1 second,
61 * the progress is not shown at all.
63 void setProgress(int percent
);
67 * Replaces the text set by setText() by the text that
68 * has been set by setDefaultText(). DolphinStatusBar::text()
69 * will return an empty string afterwards.
71 void resetToDefaultText();
74 * Sets the default text, which is shown if the status bar
75 * is rest by DolphinStatusBar::resetToDefaultText().
77 void setDefaultText(const QString
& text
);
78 QString
defaultText() const;
81 int zoomLevel() const;
84 * Refreshes the status bar to get synchronized with the (updated) Dolphin settings.
89 void setText(const QString
& text
);
90 void setUrl(const KUrl
& url
);
91 void setZoomLevel(int zoomLevel
);
95 * Is emitted if the stop-button has been pressed during showing a progress.
99 void zoomLevelChanged(int zoomLevel
);
102 virtual void contextMenuEvent(QContextMenuEvent
* event
);
103 virtual bool eventFilter(QObject
* obj
, QEvent
* event
);
106 void showZoomSliderToolTip(int zoomLevel
);
107 void updateProgressInfo();
110 * Updates the text for m_label and does an eliding in
111 * case if the text does not fit into the available width.
113 void updateLabelText();
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
);
125 * Updates the text of the zoom slider tooltip to show
126 * the currently used size.
128 void updateZoomSliderToolTip(int zoomLevel
);
130 void applyFixedWidgetSize(QWidget
* widget
, const QSize
& size
);
134 QString m_defaultText
;
136 StatusBarSpaceInfo
* m_spaceInfo
;
138 QSlider
* m_zoomSlider
;
140 QLabel
* m_progressTextLabel
;
141 QProgressBar
* m_progressBar
;
142 QToolButton
* m_stopButton
;
144 QTimer
* m_showProgressBarTimer
;