diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index a81222d031f0..dad99f50a9d5 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -403,7 +403,7 @@ void WTrackMenu::updateMenus() { const auto trackPointers = getTrackPointers(); // Gray out some stuff if multiple songs were selected. - bool oneSongSelected = trackPointers.size() == 1; + const bool singleTrackSelected = trackPointers.size() == 1; if (featureIsEnabled(Feature::LoadTo)) { int iNumDecks = m_pNumDecks->get(); @@ -416,7 +416,7 @@ void WTrackMenu::updateMenus() { ConfigKey(deckGroup, "play")) > 0.0; bool loadTrackIntoPlayingDeck = m_pConfig->getValue( ConfigKey("[Controls]", "AllowTrackLoadToPlayingDeck")); - bool deckEnabled = (!deckPlaying || loadTrackIntoPlayingDeck) && oneSongSelected; + bool deckEnabled = (!deckPlaying || loadTrackIntoPlayingDeck) && singleTrackSelected; QAction* pAction = new QAction(tr("Deck %1").arg(i), this); pAction->setEnabled(deckEnabled); m_pDeckMenu->addAction(pAction); @@ -432,7 +432,7 @@ void WTrackMenu::updateMenus() { QString samplerGroup = PlayerManager::groupForSampler(i - 1); bool samplerPlaying = ControlObject::get( ConfigKey(samplerGroup, "play")) > 0.0; - bool samplerEnabled = !samplerPlaying && oneSongSelected; + bool samplerEnabled = !samplerPlaying && singleTrackSelected; QAction* pAction = new QAction(tr("Sampler %1").arg(i), m_pSamplerMenu); pAction->setEnabled(samplerEnabled); m_pSamplerMenu->addAction(pAction); @@ -467,18 +467,14 @@ void WTrackMenu::updateMenus() { } if (featureIsEnabled(Feature::Metadata)) { - m_pImportMetadataFromMusicBrainzAct->setEnabled(oneSongSelected); + m_pImportMetadataFromMusicBrainzAct->setEnabled(singleTrackSelected); // We load a single track to get the necessary context for the cover (we use // last to be consistent with selectionChanged above). - TrackPointer last = trackPointers.last(); - CoverInfo info; - info.source = last->getCoverInfo().source; - info.type = last->getCoverInfo().type; - info.hash = last->getCoverHash(); - info.trackLocation = last->getCoverInfoWithLocation().trackLocation; - info.coverLocation = last->getCoverInfoWithLocation().coverLocation; - m_pCoverMenu->setCoverArt(info); + TrackPointer pTrack = trackPointers.last(); + + m_pCoverMenu->setCoverArt( + pTrack->getCoverInfoWithLocation()); } if (featureIsEnabled(Feature::Reset)) { @@ -558,7 +554,7 @@ void WTrackMenu::updateMenus() { } if (featureIsEnabled(Feature::Properties)) { - m_pPropertiesAct->setEnabled(oneSongSelected); + m_pPropertiesAct->setEnabled(singleTrackSelected); } } diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 90fded6833c9..a4fce2e8ec16 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -156,12 +156,6 @@ void WTrackTableView::loadTrackModel(QAbstractItemModel *model) { //using address of track model as key } - // The "coverLocation" and "hash" column numbers are required very often - // by slotLoadCoverArt(). As this value will not change when the model - // still the same, we must avoid doing hundreds of "fieldIndex" calls - // when it is completely unnecessary... - - setVisible(false); // Save the previous track model's header state