Skip to content
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

Remove from disk menu item #1737

Closed
wants to merge 5 commits into from
Closed

Remove from disk menu item #1737

wants to merge 5 commits into from

Conversation

WaylonR
Copy link
Contributor

@WaylonR WaylonR commented Jul 3, 2018

Method to remove a track from disk, and optionally hides it from the library, moving it to 'hidden' tracks. Will go to 'missing' after a rescan.

@daschuer
Copy link
Member

daschuer commented Jul 3, 2018

Thank you for the PR.
This is a modal message Box stopping the rest of Mixxx, right?
This should be replaced with one that is non-modal. Maybe you could reuse this.

ErrorDialogProperties* props = ErrorDialogHandler::instance()->newDialogProperties();

@@ -448,6 +448,10 @@ void WTrackTableView::createActions() {
connect(m_pFileBrowserAct, SIGNAL(triggered()),
this, SLOT(slotOpenInFileBrowser()));

m_pFileRemoveFromDiskAct = new QAction(tr("Remove from Disk"),this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Remove word is already used. The file does not necessary stored on a disk.
How about "Delete from file system"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

why not just 'Delete File'?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an action the users should do only when it is REALY intended.
So we should make it as clear as possible. I am not sure if "File" is clear for all non technic nerds and after it is translated to various languages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer "Delete file". I'm more concerned about users not understanding what a "file system" or "disk" is than a "file".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like "Delete File" or "Move To Trash"

@daschuer
Copy link
Member

daschuer commented Jul 3, 2018

A "Also hide track in library" is hard to understand.
...

This gives the chance to optimize the feature for the underlying use cases.
Mine are these:

  • I have a duplicated track an I like to keep the better one
  • I like to delete the track because I hate it.
  • I like to delete the track, because it is broken, but I like to replace it later.

What are you use cases? Can we reflect that in the dialog?

@daschuer
Copy link
Member

daschuer commented Jul 3, 2018

The message Box should show also the path from the file to delete.

@WaylonR
Copy link
Contributor Author

WaylonR commented Jul 3, 2018

I am unsure how to make "Also hide track" checkbox, easier to understand. Please, feel free to write me a message.

@WaylonR
Copy link
Contributor Author

WaylonR commented Jul 3, 2018

The 'remove from disk' can remove multiple files at a time.. so, each file should be in a list that gets displayed in the message?

@daschuer
Copy link
Member

daschuer commented Jul 3, 2018

Yes.

@daschuer
Copy link
Member

daschuer commented Jul 3, 2018

First we have to clarify the use cases.
Is my list complete?

@WaylonR
Copy link
Contributor Author

WaylonR commented Jul 3, 2018

Yes, I think you've got a complete list.

@WaylonR
Copy link
Contributor Author

WaylonR commented Jul 3, 2018

As for model, it does not stop mixxx. It prevents access to the UI, yes, but mixxx itself does not stop. Nor the UI, or the music. The only thing that the model dialog does, is prevents a mouse/keyboard event inside mixxx. And to be fair, it is asking an important question.

@ronso0
Copy link
Member

ronso0 commented Jul 3, 2018

Thanks for picking this up!
@daschuer I think your list is complete.

The message Box should show also the path from the file to delete.

Please show the complete file name & path so users can be sure to remove the track from the right subfolder (.../music/AlbumXY-copy/...) and catch the file extension as well as individual appendixes like 'supertrack_preview.mp3'

}
QString filenameWithPath = trackModel->getTrackLocation(index);
QFile file (filenameWithPath);
file.remove();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's handle failure to remove -- keep a list of filenames that we couldn't remove and let the user know somehow...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, two lists, a to do list with the dialog, and a dialog that shows any error, with a list of files which did not get deleted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we find out the reason deletion failed?
File doesn't exist? no write access/rights?

The 'Success/Error' window could show either "OK" or a list:

  • inexistant files
  • failed deletions (try again?)

I realize it might be a not-so-common use case and hard to accomplish, but in case of deletion fails (partly) and the error window was closed, could the track view select the 'failed' tracks?


QModelIndexList indices = selectionModel()->selectedRows();

for (const QModelIndex& index : indices) {
Copy link
Member

@rryan rryan Jul 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list could contain duplicate paths -- let's de-dupe first.

}
if( alsoHide.checkState() == Qt::Checked )
{
trackModel->hideTracks(indices);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be a purge? if the file is gone we should probably permanently remove the metadata too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That depends on the desired use case.
I will try to propose texts to distinguish it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to purge using trackModel->purgeTracks but.. it didn't work. not sure why. Even did hideTracks then purgeTracks. They stayed in hidden. So.. kinda stumped.

@rryan
Copy link
Member

rryan commented Jul 3, 2018

It'd be nice to add some unit tests for this feature, since it's quite dangerous, though WTrackTableView is difficult to test.

@daschuer
Copy link
Member

daschuer commented Jul 3, 2018

Something like this:

[ ] Delete and replace crates and playlist entried with a successor track.
[ ] Purge, emove Track from Playlist crates and History.
[ ] Delete track and mark as missing.
[ ] Delete track and keep metadat as hidden track in history.

Not perfect, but an idea.

@WaylonR
Copy link
Contributor Author

WaylonR commented Jul 3, 2018

[ ] Delete and replace crates and playlist entried with a successor track.
What would this need to do?

[ ] Delete track and mark as missing.
is it possible for code to set a track as missing, via trackModel?

@daschuer
Copy link
Member

daschuer commented Jul 4, 2018

We have "hide" this is original for hiding podcasts or other non music tracks. The track is moved to hidden tracks. This prevents the track from appearing again after library scan.

Than we have Purge, which removes the track from library as if it was never there.

The problematic thing here is the history.
The history should not be altered because of a changed library.

Looking at the wall of possible option, it can be anoying if a user just want to delete a bad track that was just added.

We can think about reverting the logic.
We may check if the track is member of any playlist and crate. And if not, we can delete the file and Purge the metadata, whithout asking anything else then a simple confirm.

If this is not the case we reject the delete:
"The track is used in .... "

@daschuer
Copy link
Member

daschuer commented Jul 4, 2018

Alternative, for the case crate an playlist entried are found:

[ ] Just delete track file and keep references for a successor track.
[ ] Purge, remove Track from Playlist crates and History.
[ ] Hide, remove Track from Playlist crates and keep it in History.

@Be-ing Be-ing added this to the 2.3.0 milestone Jul 6, 2018
if (!trackModel) {
return;
}
QMessageBox msgBox (QMessageBox::Information, QObject::tr("Remove From Disk"), QObject::tr("Really delete the files from disk? (Permanent Deletion)"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a simple and explicit question, no frills. The text is too complicated for confirming an irreversible action.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about: "Are you sure you want to permanently delete this file?"/"Are you sure you want to permanently delete these files?" It would be nice if the code could distinguish between having a single file selected and multiple files selected to show the appropriate string. Also, I'd like to see the paths of files before deleting them.

Copy link

@nwautier nwautier Apr 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "This will move one or more files to the Recycle Bin, are you sure you want to continue?"

I feel that some of the less computer literate think of the Recycle Bin as a keyword almost.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a permanent deletion, from the disk. It doesn't go to the recycle bin, it's simply unlinked? @uklotzde , do you have a suggestion as to wording? This is a pretty scary action.

@@ -1061,6 +1099,7 @@ void WTrackTableView::contextMenuEvent(QContextMenuEvent* event) {
m_pMenu->addAction(m_pPurgeAct);
}
m_pMenu->addAction(m_pFileBrowserAct);
m_pMenu->addAction(m_pFileRemoveFromDiskAct);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this action is not used very often and at least not while performing. It doesn't deserve enlarging and cluttering the top level layer of the context menu.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about a Hide / Delete submenu?
Could this hold items that distinguish between Hide, Delete but keep in history, Delete & Purge etc. or is it better to decide that per file in the dialog window?

Copy link

@nwautier nwautier Apr 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too worried about cluttering context menu... How often do you really right-click while performing? I do most of my file selection with a hardware controller and never touch a mouse anyways. I would not want another dialog box for each file... If I selected a range, then hit purge, the software purge everything I selected...

if (QMessageBox::Yes == msgBox.exec())
{


Copy link
Contributor

@Be-ing Be-ing Dec 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nitpicks:

  • Delete extra blank lines.
  • Put brackets on same line as if/else statements:
if (condition == true) {
    foo();
} else {
    bar();
}

@Be-ing
Copy link
Contributor

Be-ing commented Dec 26, 2018

There is now a merge conflict with master.

@ronso0
Copy link
Member

ronso0 commented Jan 22, 2019

This works well, thank you!

Any special cases that deserve further testing?

@Be-ing Be-ing modified the milestones: 2.3.0, 2.4.0 Feb 7, 2019
@ronso0
Copy link
Member

ronso0 commented Feb 14, 2019

Is it really to late to merge this into 2.3?
It's improving the preparation workflow A LOT!

@uklotzde
Copy link
Contributor

The requested changes have not been resolved, yet. This action performs a destructive task that must be save to use.

@uklotzde
Copy link
Contributor

It is still unclear if the corresponding track of a deleted file should be purged from the library.

@ronso0
Copy link
Member

ronso0 commented May 5, 2019

What defines a recording? how easy is it to identify one?

I'm not necessarily referring to Mixxx recordings. There might also be external files from a mobile recorder or another app, also files might be quite small like aborted Mixxx recordings, or field recording snippets.
When removing anyAudioFile.mp3/wav/... just look if there's an associated anyAudioFile.cue in the same folder and propose to delete it as well.

Conflicts resolved:
src/widget/wtracktableview.cpp
@ronso0
Copy link
Member

ronso0 commented Nov 19, 2019

merge conflicts are resolved here https://github.com/WaylonR/mixxx/pull/2

@ronso0
Copy link
Member

ronso0 commented Apr 25, 2020

@WaylonR would you mind merging https://github.com/WaylonR/mixxx/pull/2 ?
After that, do you think you can also take care of the merge conflicts with master?
Recently the track menu was separated in #2612 and is now also available as right-click menu on track property labels in decks.

@nwautier
Copy link

Sorry if this isn't the way you like to hear it, but BUMP. This is a killer feature I'd love to have yesterday. I'm not really comfortable diving into the code on a project of this scale, but if you want to bounce UI ideas or test cases off of me, feel free.

@Be-ing
Copy link
Contributor

Be-ing commented Apr 29, 2020

It's not so intimidating to get into such a big project once you have an IDE set up to navigate the code easily. I felt intimidated for a while until I got KDevelop setup. Now that we are using CMake on the master branch, most C++ IDEs are easy to set up.

Remove from disk: merge master, fix conflicts
@WaylonR
Copy link
Contributor Author

WaylonR commented Apr 29, 2020

Looking to resolve this, I can't find the Hide action anymore? Only the Purge action.

@ronso0 ronso0 marked this pull request as draft April 30, 2020 22:10
@ronso0
Copy link
Member

ronso0 commented Apr 30, 2020

Converted to Draft as there are a few open UI issues before we can implement it.

@ronso0
Copy link
Member

ronso0 commented Apr 30, 2020

I'll pick this up soonish because I miss it in my personal builds. I'll only try to restore the current state, not sure if I find the time to add the dialogs we talked about.

@ronso0
Copy link
Member

ronso0 commented Sep 18, 2020

I've ported this to 2.3 https://github.com/ronso0/mixxx/tree/remove-from-disk-2.3 to have it available in my 2.3 builds I use live. Shouldn't be too hard to apply it to master.
Respective PR to my 2.3 branch is ronso0#11
I added a simple file list to the message box:
image

@Holzhaus
Copy link
Member

There are merge conflicts now.

@ronso0
Copy link
Member

ronso0 commented Oct 23, 2020

@WaylonR
If you're still around, please spin back before merging b979bbe which is unrelated to this branch.

@ronso0
Copy link
Member

ronso0 commented Oct 23, 2020

@WaylonR
If you're still around, please spin back before merging b979bbe which is unrelated to this branch.

Sorry fo rthe noise, I was confused by commit hover preview that links to #2 instead of my repo...

@ronso0
Copy link
Member

ronso0 commented Oct 23, 2020

I'll take care of the conflicts. (seems I screwed it up earlier)

@ronso0
Copy link
Member

ronso0 commented Oct 23, 2020

Looking closer I think it's way easier to start over. I recommend to close this.
The trackmenu was moved out the library to wtrackmenu, so let's add the Remove action there.

@Be-ing Be-ing changed the base branch from master to main October 23, 2020 23:32
@Be-ing Be-ing closed this Oct 23, 2020
@WaylonR
Copy link
Contributor Author

WaylonR commented Oct 24, 2020

please @notify me when this is picked up in another PR. might get around to doing it again, myself. I've been using a artifact from an old main branch compile, and been missing the feature.

@ronso0
Copy link
Member

ronso0 commented Oct 24, 2020

I just spent my time after dinner to rebuild this onto mas.. main.
wasn't too hard, works well in Tracks & Crates.
dirty branch is https://github.com/ronso0/mixxx/tree/remove-from-disk

I'll open a draft PR during the weekend and we can discuss where else it is needed, and how to tweak the user dialog.

@ronso0
Copy link
Member

ronso0 commented Oct 24, 2020

I just spent my time after dinner to rebuild this onto mas.. main.

...because I missed it a lot since having rebuil my Live branch onto main.
Essential feature for my 'clean up the audio inbox' workflow!

@ronso0
Copy link
Member

ronso0 commented Oct 24, 2020

@WaylonR Here you go #3212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants