-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add command for clearing waveform to track's context menu #1197
Changes from all commits
1c354e3
162a899
511b31f
3228d77
399d6c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,7 @@ WTrackTableView::~WTrackTableView() { | |
delete m_pPropertiesAct; | ||
delete m_pMenu; | ||
delete m_pPlaylistMenu; | ||
delete m_pCoverMenu; | ||
delete m_pCrateMenu; | ||
delete m_pBpmLockAction; | ||
delete m_pBpmUnlockAction; | ||
|
@@ -137,6 +138,8 @@ WTrackTableView::~WTrackTableView() { | |
delete m_pBpmFourThirdsAction; | ||
delete m_pBpmThreeHalvesAction; | ||
delete m_pBPMMenu; | ||
delete m_pClearBeatsAction; | ||
delete m_pClearWaveformAction; | ||
delete m_pReplayGainResetAction; | ||
delete m_pPurgeAct; | ||
delete m_pFileBrowserAct; | ||
|
@@ -455,6 +458,10 @@ void WTrackTableView::createActions() { | |
connect(m_pClearBeatsAction, SIGNAL(triggered()), | ||
this, SLOT(slotClearBeats())); | ||
|
||
m_pClearWaveformAction = new QAction(tr("Clear Waveform"), this); | ||
connect(m_pClearWaveformAction, SIGNAL(triggered()), | ||
this, SLOT(slotClearWaveform())); | ||
|
||
m_pReplayGainResetAction = new QAction(tr("Reset ReplayGain"), this); | ||
connect(m_pReplayGainResetAction, SIGNAL(triggered()), | ||
this, SLOT(slotReplayGainReset())); | ||
|
@@ -929,6 +936,8 @@ void WTrackTableView::contextMenuEvent(QContextMenuEvent* event) { | |
m_pBPMMenu->addAction(m_pClearBeatsAction); | ||
} | ||
|
||
m_pMenu->addAction(m_pClearWaveformAction); | ||
|
||
m_pMenu->addAction(m_pReplayGainResetAction); | ||
|
||
m_pMenu->addSeparator(); | ||
|
@@ -1606,6 +1615,25 @@ void WTrackTableView::slotClearBeats() { | |
} | ||
} | ||
|
||
void WTrackTableView::slotClearWaveform() { | ||
TrackModel* trackModel = getTrackModel(); | ||
if (trackModel == nullptr) { | ||
return; | ||
} | ||
|
||
AnalysisDao& analysisDao = m_pTrackCollection->getAnalysisDAO(); | ||
QModelIndexList indices = selectionModel()->selectedRows(); | ||
for (const QModelIndex& index : indices) { | ||
TrackPointer pTrack = trackModel->getTrack(index); | ||
if (!pTrack) { | ||
continue; | ||
} | ||
analysisDao.deleteAnalysesForTrack(pTrack->getId()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this delete the all analysis data? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uhm Well, by looking at the AnalysisDao code, AnalysisDao is used just for storing waveforms, so this indeed is only clearing track's waveforms. |
||
pTrack->setWaveform(WaveformPointer()); | ||
pTrack->setWaveformSummary(WaveformPointer()); | ||
} | ||
} | ||
|
||
void WTrackTableView::slotReplayGainReset() { | ||
QModelIndexList indices = selectionModel()->selectedRows(); | ||
TrackModel* trackModel = getTrackModel(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about disconnecting the signal? I think this means clearing a track also reloads the texture for all decks it was loaded in (even if a new track has replaced it).