┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/statusbarmessagelabel.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-01-31 22:03:35 +0000
committerPeter Penz <[email protected]>2007-01-31 22:03:35 +0000
commitcd3df82730865636c92c5bb9f38a0490c0deffaa (patch)
treec95b4c58a7944681b676cf27c425ec00757e84eb /src/statusbarmessagelabel.h
parent5a0b3330d66db6ef72e8c302065968f1886526e3 (diff)
Queue error messages so that a currently shown error message is not replaced until the user confirmed the reading. If there are no pending error messages and a timeout has been exceeded, the currently shown error messages automatically fades out as soon as the user triggered another action. This behavior should correspond to Ellens suggestions (I hope :-)).
svn path=/trunk/playground/utils/dolphin/; revision=628905
Diffstat (limited to 'src/statusbarmessagelabel.h')
-rw-r--r--src/statusbarmessagelabel.h33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/statusbarmessagelabel.h b/src/statusbarmessagelabel.h
index b75e499fb..154915e4c 100644
--- a/src/statusbarmessagelabel.h
+++ b/src/statusbarmessagelabel.h
@@ -23,6 +23,7 @@
#include <dolphinstatusbar.h>
+#include <QList>
#include <QPixmap>
#include <QString>
#include <QWidget>
@@ -48,12 +49,14 @@ public:
explicit StatusBarMessageLabel(QWidget* parent);
virtual ~StatusBarMessageLabel();
- void setType(DolphinStatusBar::Type type);
- DolphinStatusBar::Type type() const { return m_type; }
+ void setMessage(const QString& text, DolphinStatusBar::Type type);
- void setText(const QString& text);
+ DolphinStatusBar::Type type() const { return m_type; }
const QString& text() const { return m_text; }
+ void setDefaultText(const QString& text) { m_defaultText = text; }
+ const QString& defaultText() const { return m_defaultText; }
+
// TODO: maybe a better approach is possible with the size hint
void setMinimumTextHeight(int min);
int minimumTextHeight() const { return m_minTextHeight; }
@@ -92,6 +95,26 @@ private slots:
*/
void updateCloseButtonPosition();
+ /**
+ * Closes the currently shown error message and replaces it
+ * by the next pending message.
+ */
+ void closeErrorMessage();
+
+private:
+ /**
+ * Shows the next pending error message. If no pending message
+ * was in the queue, false is returned.
+ */
+ bool showPendingMessage();
+
+ /**
+ * Resets the message label properties. This is useful when the
+ * result of invoking StatusBarMessageLabel::setMessage() should
+ * not rely on previous states.
+ */
+ void reset();
+
private:
enum State {
Default,
@@ -108,6 +131,8 @@ private:
int m_minTextHeight;
QTimer* m_timer;
QString m_text;
+ QString m_defaultText;
+ QList<QString> m_pendingMessages;
QPixmap m_pixmap;
QPushButton* m_closeButton;
@@ -115,7 +140,7 @@ private:
const QColor& c2,
int percent) const;
- int borderGap() const { return 3; }
+ int borderGap() const { return 2; }
};
#endif