diff options
author | Marcos CARDINOT <mcardinot@gmail.com> | 2014-08-14 13:02:00 +0100 |
---|---|---|
committer | Marcos CARDINOT <mcardinot@gmail.com> | 2014-08-14 13:02:00 +0100 |
commit | c253becd2d4b3fe298dcf11068923ef5f82200ed (patch) | |
tree | d504fe9e79da1f52054e3d36d8d0348d84f031a8 /src/dlgcoverartfullsize.cpp | |
parent | ebed7ec1a1e97b70c23377579df66b3742fb12b1 (diff) |
DlgCoverArtFullSize - listening CoverCache::pixmapFound()
Diffstat (limited to 'src/dlgcoverartfullsize.cpp')
-rw-r--r-- | src/dlgcoverartfullsize.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/dlgcoverartfullsize.cpp b/src/dlgcoverartfullsize.cpp index c30600b0a5..ce473c9ecb 100644 --- a/src/dlgcoverartfullsize.cpp +++ b/src/dlgcoverartfullsize.cpp @@ -1,30 +1,40 @@ #include <QtDebug> #include "dlgcoverartfullsize.h" +#include "library/coverartcache.h" DlgCoverArtFullSize::DlgCoverArtFullSize() { setupUi(this); + + connect(CoverArtCache::instance(), SIGNAL(pixmapFound(int, QPixmap)), + this, SLOT(slotPixmapFound(int, QPixmap)), Qt::DirectConnection); } DlgCoverArtFullSize::~DlgCoverArtFullSize() { } -void DlgCoverArtFullSize::init(QPixmap cover, QString title) { - if (cover.isNull()) { - return; - } - - setWindowTitle(title); +void DlgCoverArtFullSize::slotPixmapFound(int trackId, QPixmap pixmap) { + Q_UNUSED(trackId); + m_cover = pixmap; // If cover is bigger than Mixxx, it must be resized! // In this case, it need to do a small adjust to make // this dlg a bit smaller than the Mixxx window. QSize mixxxSize = QApplication::activeWindow()->size() / qreal(1.2); - if (cover.height() > mixxxSize.height() - || cover.width() > mixxxSize.width()) { - cover.scaled(mixxxSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); + if (m_cover.height() > mixxxSize.height() + || m_cover.width() > mixxxSize.width()) { + m_cover.scaled(mixxxSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); } - coverArt->setPixmap(cover); + if (isVisible()) { + init(); + } +} +void DlgCoverArtFullSize::init(QString title) { + if (m_cover.isNull()) { + return; + } + setWindowTitle(title); + coverArt->setPixmap(m_cover); show(); } |