]>
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 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef DOLPHINSTATUSBAR_H
22 #define DOLPHINSTATUSBAR_H
30 class StatusBarMessageLabel
;
31 class StatusBarSpaceInfo
;
36 * @brief Represents the statusbar of a Dolphin view.
38 * The statusbar allows to show messages and progress
43 class DolphinStatusBar
: public Q3HBox
{
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.
59 DolphinStatusBar(DolphinView
* parent
= 0);
60 virtual ~DolphinStatusBar();
63 * Sets the message text to \a msg. Dependant
64 * from the given type \a type an icon is shown and
65 * the color of the text is adjusted. The height of
66 * the statusbar is automatically adjusted in a way,
67 * that the full text fits into the available width.
69 * If a progress is ongoing and a message
70 * with the type Type::Error is set, the progress
71 * is cleared automatically.
73 void setMessage(const QString
& msg
, Type type
);
75 QString
message() const;
79 * Sets the text for the progress information.
80 * The text is shown with a delay of 300 milliseconds:
81 * if the progress set by DolphinStatusBar::setProgress()
82 * does reach 100 % within 300 milliseconds,
83 * the progress text is not shown at all. This assures that
84 * no flickering occurs for showing a progress of fast
87 void setProgressText(const QString
& text
);
88 QString
progressText() const;
91 * Sets the progress in percent (0 - 100). The
92 * progress is shown with a delay of 300 milliseconds:
93 * if the progress does reach 100 % within 300 milliseconds,
94 * the progress is not shown at all. This assures that
95 * no flickering occurs for showing a progress of fast
98 void setProgress(int percent
);
99 int progress() const { return m_progress
; }
102 * Clears the message text of the status bar by replacing
103 * the message with the default text, which can be set
104 * by DolphinStatusBar::setDefaultText(). The progress
105 * information is not cleared.
110 * Sets the default text, which is shown if the status bar
111 * is cleared by DolphinStatusBar::clear().
113 void setDefaultText(const QString
& text
);
114 const QString
& defaultText() const { return m_defaultText
; }
117 void slotProgressTimer();
120 * Is invoked, when the URL of the DolphinView, where the
121 * statusbar belongs too, has been changed.
123 void slotURLChanged(const KUrl
& url
);
126 StatusBarMessageLabel
* m_messageLabel
;
127 StatusBarSpaceInfo
* m_spaceInfo
;
128 QLabel
* m_progressText
;
129 QProgressBar
* m_progressBar
;
130 QTimer
* m_progressTimer
;
132 QString m_defaultText
;