Skip to content

Commit

Permalink
can't close() when we have just have called show() before. Fixing lp1…
Browse files Browse the repository at this point in the history
…807450
  • Loading branch information
daschuer authored and uklotzde committed Apr 17, 2019
1 parent a508612 commit 7e11254
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions src/library/dlgcoverartfullsize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,33 +117,29 @@ void DlgCoverArtFullSize::slotCoverFound(const QObject* pRequestor,
// qDebug() << "DlgCoverArtFullSize::slotCoverFound" << pRequestor << info
// << pixmap.size();
m_pixmap = pixmap;
if (m_pixmap.isNull()) {
close();
} else {
// Scale down dialog if the pixmap is larger than the screen.
// Use 90% of screen size instead of 100% to prevent an issue with
// whitespace appearing on the side when resizing a window whose
// borders touch the edges of the screen.
QSize dialogSize = m_pixmap.size();
const QSize availableScreenSpace =
QApplication::desktop()->availableGeometry().size() * 0.9;
if (dialogSize.height() > availableScreenSpace.height()) {
dialogSize.scale(dialogSize.width(), availableScreenSpace.height(),
Qt::KeepAspectRatio);
} else if (dialogSize.width() > availableScreenSpace.width()) {
dialogSize.scale(availableScreenSpace.width(), dialogSize.height(),
Qt::KeepAspectRatio);
}
QPixmap resizedPixmap = m_pixmap.scaled(size(),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
coverArt->setPixmap(resizedPixmap);
// center the window
setGeometry(QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
dialogSize,
QApplication::desktop()->availableGeometry()));
// Scale down dialog if the pixmap is larger than the screen.
// Use 90% of screen size instead of 100% to prevent an issue with
// whitespace appearing on the side when resizing a window whose
// borders touch the edges of the screen.
QSize dialogSize = m_pixmap.size();
const QSize availableScreenSpace =
QApplication::desktop()->availableGeometry().size() * 0.9;
if (dialogSize.height() > availableScreenSpace.height()) {
dialogSize.scale(dialogSize.width(), availableScreenSpace.height(),
Qt::KeepAspectRatio);
} else if (dialogSize.width() > availableScreenSpace.width()) {
dialogSize.scale(availableScreenSpace.width(), dialogSize.height(),
Qt::KeepAspectRatio);
}
QPixmap resizedPixmap = m_pixmap.scaled(size(),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
coverArt->setPixmap(resizedPixmap);
// center the window
setGeometry(QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
dialogSize,
QApplication::desktop()->availableGeometry()));
}
}

Expand Down

0 comments on commit 7e11254

Please sign in to comment.