Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.5' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Oct 9, 2024
2 parents e2abcf9 + fc19b47 commit b35739a
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/analyzer/analyzerebur128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ void AnalyzerEbur128::storeResults(TrackPointer pTrack) {
if (averageLufs == -HUGE_VAL ||
averageLufs == HUGE_VAL ||
// This catches 0 and abnormal values inf and -inf (that may have
// slipped through in libebur for some reason.
util_isnormal(averageLufs)) {
// slipped through in libebur128 for some reason.
!util_isnormal(averageLufs)) {
qWarning() << "AnalyzerEbur128::storeResults() averageLufs invalid:"
<< averageLufs;
return;
Expand Down
5 changes: 4 additions & 1 deletion src/effects/backends/builtin/metronomeeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ void MetronomeEffect::processChannel(
nextClickStart = bufferEnd - beatToBufferEnd;
}
} else {
// no transport, nothing to do.
// no transport, continue until the current click has been fully played
if (gs->m_framesSinceClickStart < clickSize) {
gs->m_framesSinceClickStart += engineParameters.framesPerBuffer();
}
return;
}
} else {
Expand Down
6 changes: 6 additions & 0 deletions src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,12 @@ AutoDJProcessor::AutoDJError AutoDJProcessor::toggleAutoDJ(bool enable) {
}
}

if (pLeftDeck->index > 1 || pRightDeck->index > 1) {
// Left and/or right deck is deck 3/4 which may not be visible.
// Make sure it is, if the current skin is a 4-deck skin.
ControlObject::set(ConfigKey("[Skin]", "show_4decks"), 1);
}

// Never load the same track if it is already playing
if (leftDeckPlaying) {
removeLoadedTrackFromTopOfQueue(*pLeftDeck);
Expand Down
17 changes: 9 additions & 8 deletions src/library/dlgtagfetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,30 +246,31 @@ void DlgTagFetcher::slotPrev() {
}

void DlgTagFetcher::loadTrack(const TrackPointer& pTrack) {
tags->clear();
m_data = Data();
if (m_pTrack) {
tags->clear();
disconnect(m_pTrack.get(),
&Track::changed,
this,
&DlgTagFetcher::slotTrackChanged);
m_data = Data();
}
tags->clear();

m_pWFetchedCoverArtLabel->setCoverArt(CoverInfo{}, QPixmap{});

m_coverCache.clear();

m_pTrack = pTrack;
if (!m_pTrack) {
return;
}

btnRetry->setDisabled(true);
btnApply->setDisabled(true);
checkBoxTags->setDisabled(true);
checkBoxCover->setDisabled(true);
statusMessage->setVisible(false);

m_pTrack = pTrack;
if (!m_pTrack) {
loadingProgressBar->setVisible(false);
return;
}

loadingProgressBar->setVisible(true);
loadingProgressBar->setValue(kMinimumValueOfQProgressBar);
loadingProgressBar->setToolTip(QString());
Expand Down
2 changes: 2 additions & 0 deletions src/library/dlgtrackinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ void DlgTrackInfo::saveTrack() {
void DlgTrackInfo::clear() {
const QSignalBlocker signalBlocker(this);

setWindowTitle(QString());

if (m_pLoadedTrack) {
disconnect(m_pLoadedTrack.get(),
&Track::changed,
Expand Down
62 changes: 44 additions & 18 deletions src/widget/wtrackmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ void WTrackMenu::createMenus() {
m_pSearchRelatedMenu->clear();
const auto pTrack = getFirstTrackPointer();
if (pTrack) {
// Ensure it's enabled, else we can't add actions.
VERIFY_OR_DEBUG_ASSERT(m_pSearchRelatedMenu->isEnabled()) {
m_pSearchRelatedMenu->setEnabled(true);
}
m_pSearchRelatedMenu->addActionsForTrack(*pTrack);
}
m_pSearchRelatedMenu->setEnabled(
Expand Down Expand Up @@ -759,11 +763,9 @@ std::pair<bool, bool> WTrackMenu::getTrackBpmLockStates() const {
break;
}
}
} else {
if (m_pTrack) {
anyBpmLocked = m_pTrack->isBpmLocked();
anyBpmNotLocked = !anyBpmLocked;
}
} else if (m_pTrack) {
anyBpmLocked = m_pTrack->isBpmLocked();
anyBpmNotLocked = !anyBpmLocked;
}
return std::pair<bool, bool>(anyBpmLocked, anyBpmNotLocked);
}
Expand Down Expand Up @@ -885,8 +887,11 @@ CoverInfo WTrackMenu::getCoverInfoOfLastTrack() const {
.data()
.toString();
return coverInfo;
} else {
} else if (m_pTrack) {
return m_pTrack->getCoverInfoWithLocation();
} else {
// No track, no track model
return CoverInfo();
}
}

Expand All @@ -898,10 +903,25 @@ void WTrackMenu::updateMenus() {
// Gray out some stuff if multiple songs were selected.
const bool singleTrackSelected = getTrackCount() == 1;

if (featureIsEnabled(Feature::SearchRelated)) {
// Enable only if we have one valid track pointer.
// this prevents the cursor getting stuck on this menu in case it gets
// disabled when encountering a track nullptr in lambda function
// connected to aboutToShow() signal (see createMenus()).
// Note: track nullptr can happen when TrackDAO returns nullptr because
// the selected track references a file referenced by another cached track.
DEBUG_ASSERT(m_pSearchRelatedMenu);
const auto pTrack = getFirstTrackPointer();
m_pSearchRelatedMenu->setEnabled(pTrack != nullptr);
// TODO Only enable for single track?
}

if (featureIsEnabled(Feature::LoadTo)) {
// Enable menus only for single track
int iNumDecks = static_cast<int>(m_pNumDecks.get());
m_pDeckMenu->clear();
if (iNumDecks > 0) {
m_pDeckMenu->setEnabled(singleTrackSelected);
if (singleTrackSelected && iNumDecks > 0) {
for (int i = 1; i <= iNumDecks; ++i) {
// PlayerManager::groupForDeck is 0-indexed.
QString deckGroup = PlayerManager::groupForDeck(i - 1);
Expand Down Expand Up @@ -936,8 +956,9 @@ void WTrackMenu::updateMenus() {

int iNumSamplers = static_cast<int>(m_pNumSamplers.get());
const int maxSamplersPerMenu = 16;
if (iNumSamplers > 0) {
m_pSamplerMenu->clear();
m_pSamplerMenu->clear();
m_pSamplerMenu->setEnabled(singleTrackSelected);
if (singleTrackSelected && iNumSamplers > 0) {
QMenu* pMenu = m_pSamplerMenu;
int samplersInMenu = 0;
for (int i = 1; i <= iNumSamplers; ++i) {
Expand Down Expand Up @@ -1039,13 +1060,15 @@ void WTrackMenu::updateMenus() {
} else if (m_pTrack) {
pTrack = m_pTrack;
}
const double bpm = pTrack->getBpm();
appendBpmPreviewtoBpmAction(m_pBpmDoubleAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmHalveAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmTwoThirdsAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmThreeFourthsAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmFourThirdsAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmThreeHalvesAction, bpm);
if (pTrack) {
const double bpm = pTrack->getBpm();
appendBpmPreviewtoBpmAction(m_pBpmDoubleAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmHalveAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmTwoThirdsAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmThreeFourthsAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmFourThirdsAction, bpm);
appendBpmPreviewtoBpmAction(m_pBpmThreeHalvesAction, bpm);
}
}
}
}
Expand Down Expand Up @@ -2536,8 +2559,11 @@ void WTrackMenu::slotShowDlgTrackInfo() {
m_pDlgTrackInfo.release()->deleteLater();
}
});
// Method getFirstTrackPointer() is not applicable here, the dialog
// needs an index reference for the Next/Prev navigation.
// Method getFirstTrackPointer() is not applicable here!
// DlgTrackInfo relies on a track model for certain operations,
// for example show/hide the Next/Prev buttons.
// It can be loaded with either an index (must have a model),
// or a TrackPointer (must NOT have a model then).
if (m_pTrackModel) {
m_pDlgTrackInfo->loadTrack(m_trackIndexList.at(0));
} else {
Expand Down
6 changes: 6 additions & 0 deletions src/widget/wtracktableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,12 @@ void WTrackTableView::keyPressEvent(QKeyEvent* event) {
if (event->modifiers().testFlag(Qt::NoModifier)) {
slotMouseDoubleClicked(currentIndex());
} else if ((event->modifiers() & kPropertiesShortcutModifier)) {
TrackModel* pTrackModel = getTrackModel();
if (!pTrackModel ||
!pTrackModel->hasCapabilities(
TrackModel::Capability::EditMetadata)) {
return;
}
const QModelIndexList indices = getSelectedRows();
if (indices.isEmpty()) {
return;
Expand Down

0 comments on commit b35739a

Please sign in to comment.