WCoverArtLabel::WCoverArtLabel(QWidget* parent) : QLabel(parent), m_pCoverMenu(new WCoverArtMenu(this)), m_pDlgFullSize(new DlgCoverArtFullSize(this, nullptr)), m_defaultCover(CoverArtUtils::defaultCoverLocation()) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setFrameShape(QFrame::Box); setAlignment(Qt::AlignCenter); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotCoverMenu(QPoint))); connect(m_pCoverMenu, SIGNAL(coverInfoSelected(const CoverInfoRelative&)), this, SIGNAL(coverInfoSelected(const CoverInfoRelative&))); connect(m_pCoverMenu, SIGNAL(reloadCoverArt()), this, SIGNAL(reloadCoverArt())); m_defaultCover = m_defaultCover.scaled(s_labelDisplaySize, Qt::KeepAspectRatio, Qt::SmoothTransformation); setPixmap(m_defaultCover); }
void WCoverArtMenu::createActions() { m_pChange = new QAction(tr("Choose new cover", "change cover art location"), this); connect(m_pChange, SIGNAL(triggered()), this, SLOT(slotChange())); addAction(m_pChange); m_pUnset = new QAction(tr("Clear cover", "clears the set cover art -- does not touch files on disk"), this); connect(m_pUnset, SIGNAL(triggered()), this, SLOT(slotUnset())); addAction(m_pUnset); m_pReload = new QAction(tr("Reload from file/folder", "reload cover art from file metadata or folder"), this); connect(m_pReload, SIGNAL(triggered()), this, SIGNAL(reloadCoverArt())); addAction(m_pReload); }
m_pTapFilter.data(), SLOT(tap())); connect(m_pTapFilter.data(), SIGNAL(tapped(double, int)), this, SLOT(slotBpmTap(double, int))); connect(btnReloadFromFile, SIGNAL(clicked()), this, SLOT(reloadTrackMetadata())); connect(btnOpenFileBrowser, SIGNAL(clicked()), this, SLOT(slotOpenInFileBrowser())); CoverArtCache* pCache = CoverArtCache::instance(); if (pCache != NULL) { connect(pCache, SIGNAL(coverFound(const QObject*, const int, const CoverInfo&, QPixmap, bool)), this, SLOT(slotCoverFound(const QObject*, const int, const CoverInfo&, QPixmap, bool))); } connect(m_pWCoverArtLabel, SIGNAL(coverArtSelected(const CoverArt&)), this, SLOT(slotCoverArtSelected(const CoverArt&))); connect(m_pWCoverArtLabel, SIGNAL(reloadCoverArt()), this, SLOT(slotReloadCoverArt())); } void DlgTrackInfo::OK() { unloadTrack(true); accept(); } void DlgTrackInfo::apply() { saveTrack(); } void DlgTrackInfo::cancel() { unloadTrack(false); reject();
m_pPlayer(pPlayer), m_pCoverMenu(new WCoverArtMenu(this)) { CoverArtCache* pCache = CoverArtCache::instance(); if (pCache != nullptr) { connect(pCache, SIGNAL(coverFound(const QObject*, const CoverInfoRelative&, QPixmap, bool)), this, SLOT(slotCoverFound(const QObject*, const CoverInfoRelative&, QPixmap, bool))); } setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotCoverMenu(QPoint))); connect(m_pCoverMenu, SIGNAL(coverInfoSelected(const CoverInfoRelative&)), this, SLOT(slotCoverInfoSelected(const CoverInfoRelative&))); connect(m_pCoverMenu, SIGNAL(reloadCoverArt()), this, SLOT(slotReloadCoverArt())); if (m_pPlayer != nullptr) { connect(pPlayer, SIGNAL(newTrackLoaded(TrackPointer)), this, SLOT(slotLoadTrack(TrackPointer))); } setupUi(this); } DlgCoverArtFullSize::~DlgCoverArtFullSize() { delete m_pCoverMenu; } void DlgCoverArtFullSize::init(TrackPointer pTrack) {