1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #ifndef DOLPHINSTATUSBAR_H
22 #define DOLPHINSTATUSBAR_H
24 #include "konq_statusbarmessagelabel.h"
30 class StatusBarSpaceInfo
;
37 * @brief Represents the statusbar of a Dolphin view.
39 * The statusbar allows to show messages and progress
42 class DolphinStatusBar
: public QWidget
48 * Describes the type of the message text. Dependent
49 * from the type a corresponding icon and color is
50 * used for the message text.
53 Default
= KonqStatusBarMessageLabel::Default
,
54 OperationCompleted
= KonqStatusBarMessageLabel::OperationCompleted
,
55 Information
= KonqStatusBarMessageLabel::Information
,
56 Error
= KonqStatusBarMessageLabel::Error
59 explicit DolphinStatusBar(QWidget
* parent
, DolphinView
* view
);
61 virtual ~DolphinStatusBar();
64 * Sets the message text to \a msg. Dependant
65 * from the given type \a type an icon is shown and
66 * the color of the text is adjusted. The height of
67 * the statusbar is automatically adjusted in a way,
68 * that the full text fits into the available width.
70 * If a progress is ongoing and a message
71 * with the type Type::Error is set, the progress
72 * is cleared automatically.
74 void setMessage(const QString
& msg
, Type type
);
75 QString
message() const;
80 * Sets the text for the progress information.
81 * DolphinStatusBar::setProgress() should be invoked
82 * afterwards each time the progress changes.
84 void setProgressText(const QString
& text
);
85 QString
progressText() const;
88 * Sets the progress in percent (0 - 100). The
89 * progress is shown with a delay of 300 milliseconds:
90 * if the progress does reach 100 % within 300 milliseconds,
91 * the progress is not shown at all. This assures that
92 * no flickering occurs for showing a progress of fast
95 void setProgress(int percent
);
99 * Clears the message text of the status bar by replacing
100 * the message with the default text, which can be set
101 * by DolphinStatusBar::setDefaultText(). The progress
102 * information is not cleared.
107 * Sets the default text, which is shown if the status bar
108 * is cleared by DolphinStatusBar::clear().
110 void setDefaultText(const QString
& text
);
111 QString
defaultText() const;
114 * Refreshes the status bar to get synchronized with the (updated) Dolphin settings.
119 /** @see QWidget::contextMenuEvent() */
120 virtual void contextMenuEvent(QContextMenuEvent
* event
);
124 * Is invoked, when the URL of the DolphinView, where the
125 * statusbar belongs too, has been changed. The space information
126 * content is updated.
128 void updateSpaceInfoContent(const KUrl
& url
);
131 * Sets the zoom level of the item view to \a zoomLevel.
133 void setZoomLevel(int zoomLevel
);
137 void showZoomSliderToolTip(int zoomLevel
);
140 void updateProgressInfo();
143 * Makes the space information widget and zoom slider widget
144 * visible, if \a visible is true and the settings allow to show
145 * the widgets. showUnknownProgressIf \a visible is false, it is assured that both
146 * widgets are hidden.
148 void setExtensionsVisible(bool visible
);
151 * Updates the text of the zoom slider tooltip to show
152 * the currently used size.
154 void updateZoomSliderToolTip(int zoomLevel
);
158 KonqStatusBarMessageLabel
* m_messageLabel
;
159 StatusBarSpaceInfo
* m_spaceInfo
;
161 QWidget
* m_zoomWidget
;
162 QToolButton
* m_zoomOut
;
163 QSlider
* m_zoomSlider
;
164 QToolButton
* m_zoomIn
;
166 QLabel
* m_progressText
;
167 QProgressBar
* m_progressBar
;
170 // Timestamp when the last message has been set that has not the type
171 // 'Default'. The timestamp is used to prevent that default messages
172 // hide more important messages after a very short delay.
173 QTime m_messageTimeStamp
;