diff options
-rw-r--r-- | src/dlganalysis.cpp | 4 | ||||
-rw-r--r-- | src/dlganalysis.h | 3 | ||||
-rw-r--r-- | src/dlgautodj.cpp | 4 | ||||
-rw-r--r-- | src/dlgautodj.h | 3 | ||||
-rw-r--r-- | src/dlghidden.cpp | 4 | ||||
-rw-r--r-- | src/dlghidden.h | 3 | ||||
-rw-r--r-- | src/dlgmissing.cpp | 4 | ||||
-rw-r--r-- | src/dlgmissing.h | 3 | ||||
-rw-r--r-- | src/library/analysisfeature.cpp | 4 | ||||
-rw-r--r-- | src/library/autodjfeature.cpp | 4 | ||||
-rw-r--r-- | src/library/library.cpp | 8 | ||||
-rw-r--r-- | src/library/library.h | 2 | ||||
-rw-r--r-- | src/library/libraryfeature.h | 2 | ||||
-rw-r--r-- | src/library/mixxxlibraryfeature.cpp | 8 | ||||
-rw-r--r-- | src/skin/legacyskinparser.cpp | 36 | ||||
-rw-r--r-- | src/widget/wcoverart.cpp | 56 | ||||
-rw-r--r-- | src/widget/wcoverart.h | 11 | ||||
-rw-r--r-- | src/widget/wlibrarytableview.h | 2 | ||||
-rw-r--r-- | src/widget/wtracktableview.cpp | 44 | ||||
-rw-r--r-- | src/widget/wtracktableview.h | 1 |
20 files changed, 111 insertions, 95 deletions
diff --git a/src/dlganalysis.cpp b/src/dlganalysis.cpp index b845d68bcd..e6746d8f73 100644 --- a/src/dlganalysis.cpp +++ b/src/dlganalysis.cpp @@ -27,8 +27,8 @@ DlgAnalysis::DlgAnalysis(QWidget* parent, connect(m_pAnalysisLibraryTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); - connect(m_pAnalysisLibraryTableView, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(m_pAnalysisLibraryTableView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); Q_ASSERT(box); // Assumes the form layout is a QVBox/QHBoxLayout! diff --git a/src/dlganalysis.h b/src/dlganalysis.h index de8b35e6ad..48318868dc 100644 --- a/src/dlganalysis.h +++ b/src/dlganalysis.h @@ -4,7 +4,6 @@ #include <QItemSelection> #include "ui_dlganalysis.h" #include "configobject.h" -#include "library/coverartcache.h" #include "library/libraryview.h" #include "library/trackcollection.h" #include "library/analysislibrarytablemodel.h" @@ -48,7 +47,7 @@ class DlgAnalysis : public QWidget, public Ui::DlgAnalysis, public virtual Libra void loadTrackToPlayer(TrackPointer pTrack, QString player); void analyzeTracks(QList<int> trackIds); void stopAnalysis(); - void loadCoverArt(CoverInfo info, bool cachedOnly); + void trackSelected(TrackPointer pTrack); private: //Note m_pTrackTablePlaceholder is defined in the .ui file diff --git a/src/dlgautodj.cpp b/src/dlgautodj.cpp index 7961362711..bdd46fdeb6 100644 --- a/src/dlgautodj.cpp +++ b/src/dlgautodj.cpp @@ -39,8 +39,8 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig, connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); - connect(m_pTrackTableView, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); Q_ASSERT(box); //Assumes the form layout is a QVBox/QHBoxLayout! diff --git a/src/dlgautodj.h b/src/dlgautodj.h index 7f044ecf03..22a55c3cad 100644 --- a/src/dlgautodj.h +++ b/src/dlgautodj.h @@ -6,7 +6,6 @@ #include "configobject.h" #include "controlpushbutton.h" #include "trackinfoobject.h" -#include "library/coverartcache.h" #include "library/libraryview.h" #include "library/trackcollection.h" #include "library/dao/playlistdao.h" @@ -52,7 +51,7 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView { void addRandomButton(bool buttonChecked); void loadTrack(TrackPointer tio); void loadTrackToPlayer(TrackPointer tio, QString group, bool); - void loadCoverArt(CoverInfo info, bool cachedOnly); + void trackSelected(TrackPointer pTrack); private: enum ADJstates { diff --git a/src/dlghidden.cpp b/src/dlghidden.cpp index b95a1d9779..ffc37a27f8 100644 --- a/src/dlghidden.cpp +++ b/src/dlghidden.cpp @@ -38,8 +38,8 @@ DlgHidden::DlgHidden(QWidget* parent, ConfigObject<ConfigValue>* pConfig, this, SLOT(selectionChanged(const QItemSelection&, const QItemSelection&))); - connect(m_pTrackTableView, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); } DlgHidden::~DlgHidden() { diff --git a/src/dlghidden.h b/src/dlghidden.h index 68cf5de3b9..ffbbff2c91 100644 --- a/src/dlghidden.h +++ b/src/dlghidden.h @@ -3,7 +3,6 @@ #include "ui_dlghidden.h" #include "configobject.h" -#include "library/coverartcache.h" #include "library/libraryview.h" #include "library/trackcollection.h" #include "mixxxkeyboard.h" @@ -28,7 +27,7 @@ class DlgHidden : public QWidget, public Ui::DlgHidden, public LibraryView { void selectionChanged(const QItemSelection&, const QItemSelection&); signals: - void loadCoverArt(CoverInfo info, bool cachedOnly); + void trackSelected(TrackPointer pTrack); private: void activateButtons(bool enable); diff --git a/src/dlgmissing.cpp b/src/dlgmissing.cpp index e1aa06d20e..55fef44a25 100644 --- a/src/dlgmissing.cpp +++ b/src/dlgmissing.cpp @@ -33,8 +33,8 @@ DlgMissing::DlgMissing(QWidget* parent, ConfigObject<ConfigValue>* pConfig, this, SLOT(selectionChanged(const QItemSelection&, const QItemSelection&))); - connect(m_pTrackTableView, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); } DlgMissing::~DlgMissing() { diff --git a/src/dlgmissing.h b/src/dlgmissing.h index 270c427398..734a98ff8e 100644 --- a/src/dlgmissing.h +++ b/src/dlgmissing.h @@ -3,7 +3,6 @@ #include "ui_dlgmissing.h" #include "configobject.h" -#include "library/coverartcache.h" #include "library/libraryview.h" #include "library/trackcollection.h" #include "mixxxkeyboard.h" @@ -27,7 +26,7 @@ class DlgMissing : public QWidget, public Ui::DlgMissing, public LibraryView { void selectionChanged(const QItemSelection&, const QItemSelection&); signals: - void loadCoverArt(CoverInfo info, bool cachedOnly); + void trackSelected(TrackPointer pTrack); private: void activateButtons(bool enable); diff --git a/src/library/analysisfeature.cpp b/src/library/analysisfeature.cpp index ceccef879b..c4bd1af03f 100644 --- a/src/library/analysisfeature.cpp +++ b/src/library/analysisfeature.cpp @@ -77,8 +77,8 @@ void AnalysisFeature::bindWidget(WLibrary* libraryWidget, connect(m_pAnalysisView, SIGNAL(stopAnalysis()), this, SLOT(stopAnalysis())); - connect(m_pAnalysisView, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(m_pAnalysisView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); connect(this, SIGNAL(analysisActive(bool)), m_pAnalysisView, SLOT(analysisActive(bool))); diff --git a/src/library/autodjfeature.cpp b/src/library/autodjfeature.cpp index 1371e25754..cb923089a7 100644 --- a/src/library/autodjfeature.cpp +++ b/src/library/autodjfeature.cpp @@ -94,8 +94,8 @@ void AutoDJFeature::bindWidget(WLibrary* libraryWidget, connect(m_pAutoDJView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); - connect(m_pAutoDJView, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(m_pAutoDJView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); #ifdef __AUTODJCRATES__ // Be informed when the user wants to add another random track. diff --git a/src/library/library.cpp b/src/library/library.cpp index ef74cd8952..b4ef64ea46 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -161,8 +161,8 @@ void Library::bindWidget(WLibrary* pLibraryWidget, connect(this, SIGNAL(switchToView(const QString&)), pLibraryWidget, SLOT(switchToView(const QString&))); - connect(pTrackTableView, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(pTrackTableView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); m_pLibraryControl->bindWidget(pLibraryWidget, pKeyboard); @@ -189,8 +189,8 @@ void Library::addFeature(LibraryFeature* feature) { this, SLOT(slotRestoreSearch(const QString&))); connect(feature, SIGNAL(enableCoverArtDisplay(bool)), this, SIGNAL(enableCoverArtDisplay(bool))); - connect(feature, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(feature, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); } void Library::slotShowTrackModel(QAbstractItemModel* model) { diff --git a/src/library/library.h b/src/library/library.h index 0dbf013cfe..afe8457a5f 100644 --- a/src/library/library.h +++ b/src/library/library.h @@ -88,7 +88,7 @@ public: void searchStarting(); // emit this signal to enable/disable the cover art widget void enableCoverArtDisplay(bool); - void loadCoverArt(CoverInfo info, bool cachedOnly); + void trackSelected(TrackPointer pTrack); private: ConfigObject<ConfigValue>* m_pConfig; diff --git a/src/library/libraryfeature.h b/src/library/libraryfeature.h index ce36382076..b353cc3b5e 100644 --- a/src/library/libraryfeature.h +++ b/src/library/libraryfeature.h @@ -95,7 +95,7 @@ class LibraryFeature : public QObject { void featureSelect(LibraryFeature* pFeature, const QModelIndex& index); // emit this signal to enable/disable the cover art widget void enableCoverArtDisplay(bool); - void loadCoverArt(CoverInfo info, bool cachedOnly); + void trackSelected(TrackPointer pTrack); }; #endif /* LIBRARYFEATURE_H */ diff --git a/src/library/mixxxlibraryfeature.cpp b/src/library/mixxxlibraryfeature.cpp index acb8538811..99180b7c0d 100644 --- a/src/library/mixxxlibraryfeature.cpp +++ b/src/library/mixxxlibraryfeature.cpp @@ -127,15 +127,15 @@ void MixxxLibraryFeature::bindWidget(WLibrary* pLibrary, m_pConfig, m_pTrackCollection, pKeyboard); pLibrary->registerView(kHiddenTitle, m_pHiddenView); - connect(m_pHiddenView, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(m_pHiddenView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); m_pMissingView = new DlgMissing(pLibrary, m_pConfig, m_pTrackCollection, pKeyboard); pLibrary->registerView(kMissingTitle, m_pMissingView); - connect(m_pMissingView, SIGNAL(loadCoverArt(CoverInfo, bool)), - this, SIGNAL(loadCoverArt(CoverInfo, bool))); + connect(m_pMissingView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); } QVariant MixxxLibraryFeature::title() { diff --git a/src/skin/legacyskinparser.cpp b/src/skin/legacyskinparser.cpp index 17bd1a96c8..547dd00d1e 100644 --- a/src/skin/legacyskinparser.cpp +++ b/src/skin/legacyskinparser.cpp @@ -1013,20 +1013,32 @@ QWidget* LegacySkinParser::parseSearchBox(QDomElement node) { } QWidget* LegacySkinParser::parseCoverArt(QDomElement node) { - WCoverArt* pCoverArt = new WCoverArt(m_pParent, - m_pLibrary->getTrackCollection()); + QString channel = lookupNodeGroup(node); + BaseTrackPlayer* pPlayer = m_pPlayerManager->getPlayer(channel); + + WCoverArt* pCoverArt = new WCoverArt(m_pParent, channel); setupConnections(node, pCoverArt); setupBaseWidget(node, pCoverArt); setupWidget(node, pCoverArt); pCoverArt->setup(node, *m_pContext); - // Connect cover art signals to the library - connect(m_pLibrary, SIGNAL(switchToView(const QString&)), - pCoverArt, SLOT(slotReset())); - connect(m_pLibrary, SIGNAL(enableCoverArtDisplay(bool)), - pCoverArt, SLOT(slotEnable(bool))); - connect(m_pLibrary, SIGNAL(loadCoverArt(CoverInfo, bool)), - pCoverArt, SLOT(slotLoadCoverArt(CoverInfo, bool))); + // If no group was provided, hook the widget up to the Library. + if (channel.isEmpty()) { + // Connect cover art signals to the library + connect(m_pLibrary, SIGNAL(switchToView(const QString&)), + pCoverArt, SLOT(slotReset())); + connect(m_pLibrary, SIGNAL(enableCoverArtDisplay(bool)), + pCoverArt, SLOT(slotEnable(bool))); + connect(m_pLibrary, SIGNAL(trackSelected(TrackPointer)), + pCoverArt, SLOT(slotLoadTrack(TrackPointer))); + } else if (pPlayer != NULL) { + connect(pPlayer, SIGNAL(newTrackLoaded(TrackPointer)), + pCoverArt, SLOT(slotLoadTrack(TrackPointer))); + connect(pPlayer, SIGNAL(unloadingTrack(TrackPointer)), + pCoverArt, SLOT(slotReset())); + connect(pCoverArt, SIGNAL(trackDropped(QString, QString)), + m_pPlayerManager, SLOT(slotLoadToPlayer(QString, QString))); + } return pCoverArt; } @@ -1316,8 +1328,10 @@ QString LegacySkinParser::lookupNodeGroup(QDomElement node) { // will specify the channel as either 1 or 2. if (group.size() == 0) { int channel = m_pContext->selectInt(node, "Channel"); - // groupForDeck is 0-indexed - group = PlayerManager::groupForDeck(channel - 1); + if (channel > 0) { + // groupForDeck is 0-indexed + group = PlayerManager::groupForDeck(channel - 1); + } } return group; diff --git a/src/widget/wcoverart.cpp b/src/widget/wcoverart.cpp index 942ce56976..fd21390ca5 100644 --- a/src/widget/wcoverart.cpp +++ b/src/widget/wcoverart.cpp @@ -11,12 +11,12 @@ #include "library/coverartutils.h" WCoverArt::WCoverArt(QWidget* parent, - TrackCollection* pTrackCollection) + const QString& group) : QWidget(parent), WBaseWidget(this), + m_group(group), m_bEnable(true), m_pMenu(new WCoverArtMenu(this)), - m_trackDAO(pTrackCollection->getTrackDAO()), m_pDlgFullSize(new DlgCoverArtFullSize()) { CoverArtCache* pCache = CoverArtCache::instance(); if (pCache != NULL) { @@ -74,26 +74,36 @@ void WCoverArt::slotCoverLocationUpdated(const QString& newLoc, QPixmap newCover) { Q_UNUSED(oldLoc); Q_UNUSED(newCover); - TrackPointer pTrack = m_trackDAO.getTrack(m_lastRequestedCover.trackId); - if (pTrack) { - CoverArt art; - art.info.coverLocation = newLoc; - art.info.source = CoverInfo::USER_SELECTED; - art.info.type = CoverInfo::FILE; - pTrack->setCoverArt(art); + + if (m_loadedTrack.isNull()) { + return; } + + CoverArt art; + art.info.coverLocation = newLoc; + art.info.source = CoverInfo::USER_SELECTED; + art.info.type = CoverInfo::FILE; + // TODO(rryan): hash + m_loadedTrack->setCoverArt(art); } void WCoverArt::slotEnable(bool enable) { + bool wasDisabled = !m_bEnable && enable; m_bEnable = enable; int h = (float) parentWidget()->height() / 3; h = m_bEnable ? h : 0; setMinimumHeight(h); setMaximumHeight(h); + + if (wasDisabled) { + slotLoadTrack(m_loadedTrack); + } + update(); } void WCoverArt::slotReset() { + m_loadedTrack = TrackPointer(); m_lastRequestedCover = CoverInfo(); m_loadedCover = QPixmap(); m_loadedCoverScaled = QPixmap(); @@ -111,14 +121,26 @@ void WCoverArt::slotPixmapFound(int trackId, QPixmap pixmap) { } } -void WCoverArt::slotLoadCoverArt(CoverInfo info, bool cachedOnly) { +void WCoverArt::slotLoadTrack(TrackPointer pTrack) { + qDebug() << "WCoverArt::slotLoadTrack" << pTrack; + m_lastRequestedCover = CoverInfo(); + m_loadedCover = QPixmap(); + m_loadedCoverScaled = QPixmap(); + m_loadedTrack = pTrack; + if (!m_bEnable) { return; } - m_lastRequestedCover = info; - CoverArtCache* pCache = CoverArtCache::instance(); - if (pCache != NULL) { - pCache->requestCover(info, QSize(0,0), cachedOnly); + + if (m_loadedTrack) { + m_lastRequestedCover = m_loadedTrack->getCoverInfo(); + m_lastRequestedCover.trackId = m_loadedTrack->getId(); + m_lastRequestedCover.trackLocation = m_loadedTrack->getLocation(); + + CoverArtCache* pCache = CoverArtCache::instance(); + if (pCache != NULL) { + pCache->requestCover(m_lastRequestedCover, QSize(0,0), false); + } } } @@ -173,9 +195,9 @@ void WCoverArt::mousePressEvent(QMouseEvent* event) { return; } - if (event->button() == Qt::RightButton) { // show context-menu - TrackPointer pTrack = m_trackDAO.getTrack(m_lastRequestedCover.trackId); - m_pMenu->show(event->globalPos(), m_lastRequestedCover, pTrack); + + if (event->button() == Qt::RightButton && m_loadedTrack) { // show context-menu + m_pMenu->show(event->globalPos(), m_lastRequestedCover, m_loadedTrack); } else if (event->button() == Qt::LeftButton) { // init/close fullsize cover if (m_pDlgFullSize->isVisible()) { m_pDlgFullSize->close(); diff --git a/src/widget/wcoverart.h b/src/widget/wcoverart.h index 63bc09075c..9f57ec0ea6 100644 --- a/src/widget/wcoverart.h +++ b/src/widget/wcoverart.h @@ -9,7 +9,6 @@ #include "dlgcoverartfullsize.h" #include "trackinfoobject.h" #include "library/coverartcache.h" -#include "library/trackcollection.h" #include "skin/skincontext.h" #include "widget/wbasewidget.h" #include "widget/wcoverartmenu.h" @@ -17,15 +16,18 @@ class WCoverArt : public QWidget, public WBaseWidget { Q_OBJECT public: - WCoverArt(QWidget* parent, TrackCollection* pTrackCollection); + WCoverArt(QWidget* parent, const QString& group); virtual ~WCoverArt(); void setup(QDomNode node, const SkinContext& context); public slots: + void slotLoadTrack(TrackPointer); void slotReset(); void slotEnable(bool); - void slotLoadCoverArt(CoverInfo info, bool cachedOnly); + + signals: + void trackDropped(QString filename, QString group); private slots: void slotPixmapFound(int trackId, QPixmap pixmap); @@ -42,13 +44,14 @@ class WCoverArt : public QWidget, public WBaseWidget { private: QPixmap scaledCoverArt(const QPixmap& normal); + QString m_group; bool m_bEnable; WCoverArtMenu* m_pMenu; + TrackPointer m_loadedTrack; QPixmap m_loadedCover; QPixmap m_loadedCoverScaled; QPixmap m_defaultCover; QPixmap m_defaultCoverScaled; - TrackDAO& m_trackDAO; CoverInfo m_lastRequestedCover; DlgCoverArtFullSize* m_pDlgFullSize; }; diff --git a/src/widget/wlibrarytableview.h b/src/widget/wlibrarytableview.h index 1eef425014..66bb303b98 100644 --- a/src/widget/wlibrarytableview.h +++ b/src/widget/wlibrarytableview.h @@ -27,7 +27,7 @@ class WLibraryTableView : public QTableView, public virtual LibraryView { void loadTrack(TrackPointer pTrack); void loadTrackToPlayer(TrackPointer pTrack, QString group, bool play = false); - void loadCoverArt(CoverInfo info, bool cachedOnly); + void trackSelected(TrackPointer pTrack); void onlyCachedCoverArt(bool); void scrollValueChanged(int); diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 3414e9653d..8f2c13c384 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -159,10 +159,20 @@ void WTrackTableView::slotScrollValueChanged(int) { enableCachedOnly(); } -void WTrackTableView::selectionChanged(const QItemSelection &selected, - const QItemSelection &deselected) { +void WTrackTableView::selectionChanged(const QItemSelection& selected, + const QItemSelection& deselected) { enableCachedOnly(); - emitLoadCoverArt(true); + + const QModelIndexList indices = selectionModel()->selectedRows(); + if (indices.size() > 0 && indices.last().isValid()) { + TrackModel* trackModel = getTrackModel(); + if (trackModel) { + TrackPointer pTrack = trackModel->getTrack(indices.last()); + if (pTrack) { + emit(trackSelected(pTrack)); + } + } + } QTableView::selectionChanged(selected, deselected); } @@ -171,7 +181,6 @@ void WTrackTableView::slotGuiTickTime(double cpuTime) { // if the user is stopped in the same row for more than 0.1 s, // we load un-cached cover arts as well. if (m_loadCachedOnly && cpuTime >= m_lastSelection + 0.1) { - emitLoadCoverArt(false); // it will allows CoverCache to load and search covers normally emit(onlyCachedCoverArt(false)); m_loadCachedOnly = false; @@ -187,33 +196,6 @@ void WTrackTableView::slotGuiTickTime(double cpuTime) { } } -void WTrackTableView::emitLoadCoverArt(bool cachedOnly) { - if (m_iCoverSourceColumn < 0 || m_iCoverTypeColumn < 0 || - m_iCoverLocationColumn < 0 || m_iCoverHashColumn < 0) { - return; - } - - CoverInfo info; - const QModelIndexList indices = selectionModel()->selectedRows(); - if (indices.size() > 0 && indices.last().isValid()) { - TrackModel* trackModel = getTrackModel(); - if (trackModel) { - QModelIndex idx = indices.last(); - info.source = static_cast<CoverInfo::Source>( - idx.sibling(idx.row(), m_iCoverSourceColumn).data().toInt()); - info.type = static_cast<CoverInfo::Type>( - idx.sibling(idx.row(), m_iCoverTypeColumn).data().toInt()); - info.hash = idx.sibling(idx.row(), m_iCoverHashColumn).data().toString(); - info.trackId = trackModel->getTrackId(idx); - info.coverLocation = idx.sibling( - idx.row(), m_iCoverLocationColumn).data().toString(); - info.trackLocation = idx.sibling( - idx.row(), m_iTrackLocationColumn).data().toString(); - } - } - emit(loadCoverArt(info, cachedOnly)); -} - // slot void WTrackTableView::loadTrackModel(QAbstractItemModel *model) { //qDebug() << "WTrackTableView::loadTrackModel()" << model; diff --git a/src/widget/wtracktableview.h b/src/widget/wtracktableview.h index be2e130200..e293a8e2ae 100644 --- a/src/widget/wtracktableview.h +++ b/src/widget/wtracktableview.h @@ -82,7 +82,6 @@ class WTrackTableView : public WLibraryTableView { void dropEvent(QDropEvent * event); void lockBpm(bool lock); - void emitLoadCoverArt(bool cachedOnly); void enableCachedOnly(); void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); |