]>
cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinstatusbar.h
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
28 class StatusBarMessageLabel
;
29 class StatusBarSpaceInfo
;
34 * @brief Represents the statusbar of a Dolphin view.
36 * The statusbar allows to show messages and progress
39 class DolphinStatusBar
: public KHBox
45 * Describes the type of the message text. Dependent
46 * from the type a corresponding icon and color is
47 * used for the message text.
56 DolphinStatusBar(QWidget
* parent
,
59 virtual ~DolphinStatusBar();
62 * Sets the message text to \a msg. Dependant
63 * from the given type \a type an icon is shown and
64 * the color of the text is adjusted. The height of
65 * the statusbar is automatically adjusted in a way,
66 * that the full text fits into the available width.
68 * If a progress is ongoing and a message
69 * with the type Type::Error is set, the progress
70 * is cleared automatically.
72 void setMessage(const QString
& msg
, Type type
);
73 QString
message() const;
78 * Sets the text for the progress information.
79 * The text is shown with a delay of 300 milliseconds:
80 * if the progress set by DolphinStatusBar::setProgress()
81 * does reach 100 % within 300 milliseconds,
82 * the progress text is not shown at all. This assures that
83 * no flickering occurs for showing a progress of fast
86 void setProgressText(const QString
& text
);
87 QString
progressText() const;
90 * Sets the progress in percent (0 - 100). The
91 * progress is shown with a delay of 300 milliseconds:
92 * if the progress does reach 100 % within 300 milliseconds,
93 * the progress is not shown at all. This assures that
94 * no flickering occurs for showing a progress of fast
97 void setProgress(int percent
);
104 * Clears the message text of the status bar by replacing
105 * the message with the default text, which can be set
106 * by DolphinStatusBar::setDefaultText(). The progress
107 * information is not cleared.
112 * Sets the default text, which is shown if the status bar
113 * is cleared by DolphinStatusBar::clear().
115 void setDefaultText(const QString
& text
);
116 const QString
& defaultText() const;
119 /** @see QWidget::resizeEvent() */
120 virtual void resizeEvent(QResizeEvent
* event
);
123 void updateProgressInfo();
126 * Is invoked, when the URL of the DolphinView, where the
127 * statusbar belongs too, has been changed. The space information
128 * content is updated.
130 void updateSpaceInfoContent(const KUrl
& url
);
133 * Shows the space information if there is enough room to show it
134 * without the need to clip the status bar text. If the progress
135 * bar is shown, the space information won't be shown.
137 void showSpaceInfo();
140 StatusBarMessageLabel
* m_messageLabel
;
141 StatusBarSpaceInfo
* m_spaceInfo
;
143 QLabel
* m_progressText
;
144 QProgressBar
* m_progressBar
;