From 2028d0f25b8bcd45058e7918176a709310e3aab9 Mon Sep 17 00:00:00 2001 From: Srivats P Date: Sun, 31 May 2020 20:57:16 +0530 Subject: [PATCH] Start the error/warn animation from center of app Irrespective of whether logs window is visible or not, show and animate the icon from the center of the main window; end point is center of logs window if visible, or the logs window tab icon if not visible. --- client/logswindow.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/client/logswindow.cpp b/client/logswindow.cpp index 9231576..0626268 100644 --- a/client/logswindow.cpp +++ b/client/logswindow.cpp @@ -172,26 +172,32 @@ QLabel* LogsWindow::tabIcon() return nullptr; } +//! Popup and animate a big icon void LogsWindow::alert(State state) { if (state == kInfo) return; + // start - center of main window QRect start; - QWidget *view = isVisible_ ? dynamic_cast(this) : mainWindow; + QWidget *view = mainWindow; alert_->setParent(view); + alert_->raise(); start.setSize(QSize(256, 256).scaled(view->size()/2, Qt::KeepAspectRatio)); start.moveCenter(QPoint(view->size().width()/2, view->size().height()/2)); + // end - center of logs window if visible, tab icon otherwise QPoint c; QLabel *icon = tabIcon(); + view = isVisible_ ? dynamic_cast(this) : mainWindow; if (icon && !isVisible_) { c = icon->geometry().center(); // in icon's parent (tabBar) coords c = icon->mapFromParent(c); // in icon's own coords - c = icon->mapTo(view, c); // in view's coords - } - else + c = icon->mapTo(view, c); // in mainWindow's coords + } else { c = view->geometry().center(); + c = view->mapTo(mainWindow, c); // in mainWindow's coords + } QRect end; end.moveCenter(c); @@ -214,6 +220,7 @@ void LogsWindow::alert(State state) alertAnime_->start(); } +//! Show tab icon void LogsWindow::notify() { QString annotation;