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.
This commit is contained in:
parent
4487da1ae6
commit
2028d0f25b
@ -172,26 +172,32 @@ QLabel* LogsWindow::tabIcon()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Popup and animate a big icon
|
||||||
void LogsWindow::alert(State state)
|
void LogsWindow::alert(State state)
|
||||||
{
|
{
|
||||||
if (state == kInfo)
|
if (state == kInfo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// start - center of main window
|
||||||
QRect start;
|
QRect start;
|
||||||
QWidget *view = isVisible_ ? dynamic_cast<QWidget*>(this) : mainWindow;
|
QWidget *view = mainWindow;
|
||||||
alert_->setParent(view);
|
alert_->setParent(view);
|
||||||
|
alert_->raise();
|
||||||
start.setSize(QSize(256, 256).scaled(view->size()/2, Qt::KeepAspectRatio));
|
start.setSize(QSize(256, 256).scaled(view->size()/2, Qt::KeepAspectRatio));
|
||||||
start.moveCenter(QPoint(view->size().width()/2,
|
start.moveCenter(QPoint(view->size().width()/2,
|
||||||
view->size().height()/2));
|
view->size().height()/2));
|
||||||
|
// end - center of logs window if visible, tab icon otherwise
|
||||||
QPoint c;
|
QPoint c;
|
||||||
QLabel *icon = tabIcon();
|
QLabel *icon = tabIcon();
|
||||||
|
view = isVisible_ ? dynamic_cast<QWidget*>(this) : mainWindow;
|
||||||
if (icon && !isVisible_) {
|
if (icon && !isVisible_) {
|
||||||
c = icon->geometry().center(); // in icon's parent (tabBar) coords
|
c = icon->geometry().center(); // in icon's parent (tabBar) coords
|
||||||
c = icon->mapFromParent(c); // in icon's own coords
|
c = icon->mapFromParent(c); // in icon's own coords
|
||||||
c = icon->mapTo(view, c); // in view's coords
|
c = icon->mapTo(view, c); // in mainWindow's coords
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
c = view->geometry().center();
|
c = view->geometry().center();
|
||||||
|
c = view->mapTo(mainWindow, c); // in mainWindow's coords
|
||||||
|
}
|
||||||
|
|
||||||
QRect end;
|
QRect end;
|
||||||
end.moveCenter(c);
|
end.moveCenter(c);
|
||||||
@ -214,6 +220,7 @@ void LogsWindow::alert(State state)
|
|||||||
alertAnime_->start();
|
alertAnime_->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Show tab icon
|
||||||
void LogsWindow::notify()
|
void LogsWindow::notify()
|
||||||
{
|
{
|
||||||
QString annotation;
|
QString annotation;
|
||||||
|
Loading…
Reference in New Issue
Block a user