Ability to disable animation of message widget

* Allows for persistent messages that can change text without disturbing the user interface
* Immediate improvement to KeeShare group edit window
This commit is contained in:
Jonathan White committed 2020-04-12 18:15:15 -04:00
1 parent 7ef1ee916b
commit 730367557f
3 files changed
+26 -2

No files matched your search

+21 -2
View File
@@ -36,6 +36,11 @@ MessageWidget::MessageWidget(QWidget* parent)
connect(this, SIGNAL(hideAnimationFinished()), m_autoHideTimer, SLOT(stop()));
}
void MessageWidget::setAnimate(bool state)
{
m_animate = state;
}
int MessageWidget::autoHideTimeout() const
{
return m_autoHideTimeout;
@@ -50,8 +55,15 @@ void MessageWidget::showMessage(const QString& text, KMessageWidget::MessageType
{
setMessageType(type);
setText(text);
emit showAnimationStarted();
animatedShow();
if (m_animate) {
animatedShow();
} else {
show();
emit showAnimationFinished();
}
if (autoHideTimeout > 0) {
m_autoHideTimer->start(autoHideTimeout);
} else {
@@ -61,7 +73,14 @@ void MessageWidget::showMessage(const QString& text, KMessageWidget::MessageType
void MessageWidget::hideMessage()
{
animatedHide();
emit hideAnimationStarted();
if (m_animate) {
animatedHide();
} else {
hide();
emit hideAnimationFinished();
}
m_autoHideTimer->stop();
}