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
;
38 * @brief Represents the statusbar of a Dolphin view.
40 * The statusbar allows to show messages and progress
43 class DolphinStatusBar
: public QWidget
49 * Describes the type of the message text. Dependent
50 * from the type a corresponding icon and color is
51 * used for the message text.
54 Default
= KonqStatusBarMessageLabel::Default
,
55 OperationCompleted
= KonqStatusBarMessageLabel::OperationCompleted
,
56 Information
= KonqStatusBarMessageLabel::Information
,
57 Error
= KonqStatusBarMessageLabel::Error
60 DolphinStatusBar(QWidget
* parent
, DolphinView
* view
);
62 virtual ~DolphinStatusBar();
65 * Sets the message text to \a msg. Dependant
66 * from the given type \a type an icon is shown and
67 * the color of the text is adjusted. The height of
68 * the statusbar is automatically adjusted in a way,
69 * that the full text fits into the available width.
71 * If a progress is ongoing and a message
72 * with the type Type::Error is set, the progress
73 * is cleared automatically.
75 void setMessage(const QString
& msg
, Type type
);
76 QString
message() const;
81 * Sets the text for the progress information.
82 * DolphinStatusBar::setProgress() should be invoked
83 * afterwards each time the progress changes.
85 void setProgressText(const QString
& text
);
86 QString
progressText() const;
89 * Sets the progress in percent (0 - 100). The
90 * progress is shown delayed by 1 second:
91 * If the progress does reach 100 % within 1 second,
92 * the progress is not shown at all.
94 void setProgress(int percent
);
98 * Clears the message text of the status bar by replacing
99 * the message with the default text, which can be set
100 * by DolphinStatusBar::setDefaultText(). The progress
101 * information is not cleared.
106 * Sets the default text, which is shown if the status bar
107 * is cleared by DolphinStatusBar::clear().
109 void setDefaultText(const QString
& text
);
110 QString
defaultText() const;
113 * Refreshes the status bar to get synchronized with the (updated) Dolphin settings.
119 * Is emitted if the stop-button has been pressed during showing a progress.
124 /** @see QWidget::contextMenuEvent() */
125 virtual void contextMenuEvent(QContextMenuEvent
* event
);
129 * Is invoked, when the URL of the DolphinView, where the
130 * statusbar belongs too, has been changed. The space information
131 * content is updated.
133 void updateSpaceInfoContent(const KUrl
& url
);
136 * Sets the zoom level of the item view to \a zoomLevel.
138 void setZoomLevel(int zoomLevel
);
142 void showZoomSliderToolTip(int zoomLevel
);
144 void updateProgressInfo();
148 * Makes the space information widget and zoom slider widget
149 * visible, if \a visible is true and the settings allow to show
150 * the widgets. showUnknownProgressIf \a visible is false, it is assured that both
151 * widgets are hidden.
153 void setExtensionsVisible(bool visible
);
156 * Updates the text of the zoom slider tooltip to show
157 * the currently used size.
159 void updateZoomSliderToolTip(int zoomLevel
);
163 KonqStatusBarMessageLabel
* m_messageLabel
;
164 StatusBarSpaceInfo
* m_spaceInfo
;
166 QWidget
* m_zoomWidget
;
167 QToolButton
* m_zoomOut
;
168 QSlider
* m_zoomSlider
;
169 QToolButton
* m_zoomIn
;
171 QLabel
* m_progressText
;
172 QProgressBar
* m_progressBar
;
173 QToolButton
* m_stopButton
;
175 QTimer
* m_showProgressBarTimer
;
177 // Timestamp when the last message has been set that has not the type
178 // 'Default'. The timestamp is used to prevent that default messages
179 // hide more important messages after a very short delay.
180 QTime m_messageTimeStamp
;