Skip to content

Commit

Permalink
stop deck, eject track after confirmation, before deleting the file
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Dec 9, 2021
1 parent 7fc4b9e commit 6a9aeda
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions src/widget/wtrackmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,10 +1732,19 @@ void WTrackMenu::slotRemoveFromDisk() {
delListWidget->addItems(locations);
mixxx::widgethelper::growListWidget(*delListWidget, *this);
// Warning text
QString delWarningText;
if (m_pTrackModel) {
delWarningText = tr("Permanently delete these files from disk?") +
QString("<br><br><b>") +
tr("This can not be undone!") + QString("</b>");
} else {
delWarningText =
tr("Stop the deck and permanently delete this track file from disk?") +
QString("<br><br><b>") +
tr("This can not be undone!") + QString("</b>");
}
QLabel* delWarning = new QLabel();
delWarning->setText(tr("Permanently delete these files from disk?") +
QString("<br><br><b>") +
tr("This can not be undone!") + QString("</b>"));
delWarning->setText(delWarningText);
delWarning->setTextFormat(Qt::RichText);
delWarning->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,
QSizePolicy::Minimum));
Expand Down Expand Up @@ -1769,6 +1778,17 @@ void WTrackMenu::slotRemoveFromDisk() {
}
}

// If the operation was initiated from a deck's track menu
// we'll first stop the deck and eject the track.
if (m_pTrack) {
ControlProxy* stopDeckProxy = new ControlProxy(
m_deckGroup, "stop", this);
stopDeckProxy->set(1.0);
ControlProxy* ejectTrackProxy = new ControlProxy(
m_deckGroup, "eject", this);
ejectTrackProxy->set(1.0);
}

// Set up and initiate the track batch operation
const auto progressLabelText =
tr("Removing %1 track file(s) from disk...",
Expand Down Expand Up @@ -1801,11 +1821,6 @@ void WTrackMenu::slotRemoveFromDisk() {
tr("Note: if you are in Browse or Recording you need to "
"click the current view again to see changes.");
} else {
// Eject track from deck
ControlProxy* ejectTrackProxy = new ControlProxy(
m_deckGroup, "eject", this);
ejectTrackProxy->set(1.0);

msgTitle = tr("Track File Deleted");
msgText = tr(
"Track file was deleted from disk and purged "
Expand Down

0 comments on commit 6a9aeda

Please sign in to comment.