Skip to content

Commit

Permalink
Avoid redundant messages for failed track load
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Sep 12, 2022
1 parent bfa9c4d commit 4eb384a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/mixer/basetrackplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent,
m_pConfig(pConfig),
m_pEngineMaster(pMixingEngine),
m_pLoadedTrack(),
m_pPrevFailedTrack(),
m_replaygainPending(false),
m_pChannelToCloneFrom(nullptr) {
ChannelHandleAndGroup channelGroup =
Expand Down Expand Up @@ -415,8 +416,16 @@ void BaseTrackPlayerImpl::slotLoadFailed(TrackPointer pTrack, const QString& rea
qDebug() << "Failed to load track (NULL track object)" << reason;
}
m_pChannelToCloneFrom = nullptr;

// Alert user.
// Show only one message for this track at a time
if (pTrack && m_pPrevFailedTrack == pTrack) {
return;
} else if (pTrack) {
m_pPrevFailedTrack = pTrack;
}
QMessageBox::warning(nullptr, tr("Couldn't load track."), reason);
m_pPrevFailedTrack = nullptr;
}

void BaseTrackPlayerImpl::slotTrackLoaded(TrackPointer pNewTrack,
Expand Down
1 change: 1 addition & 0 deletions src/mixer/basetrackplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer {
UserSettingsPointer m_pConfig;
EngineMaster* m_pEngineMaster;
TrackPointer m_pLoadedTrack;
TrackPointer m_pPrevFailedTrack;
EngineDeck* m_pChannel;
bool m_replaygainPending;
EngineChannel* m_pChannelToCloneFrom;
Expand Down

0 comments on commit 4eb384a

Please sign in to comment.