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
DolphinQt: Add "File Path" column to Game Grid #8580
Conversation
|
Definitely make this a new column please. |
|
Ok, do you have any other feedback? |
|
Nothing else for the moment. I'll give it a proper try tomorrow and give you additional feedback then, it's 2am here! |
|
Looks good, but is it hidden by default? I imagine this is one of those columns you'd rather default to hidden and allow the user to show it later. |
|
I think it isn't shown by default, but I haven't verified it |
|
Please verify then. I'd also appreciate a screenshot as I'm curious how does this display. |
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.
|
The issue is that the path in Settings uses backslashes and the function to get the path uses forwardslashes. I'll work on a fix right now |
|
Hence my remark that you probably need to compare those as paths and not strings - it'd most likely save some headache with more edge cases and not just slashes. |
|
Thanks for the advice, will do that |
|
Is this implementation valid? It removes all symlinks/backslashes so the strings will be correctly formatted. Otherwise, how would I check if a directory is contained in another? I couldn't find a function for this in Your feedback is appreciated |
|
Sorry, I might have been mistaken. Looks like the function you need here is So IMO you could erase your last commit by undoing everything in it and just filtering paths with this function, then you should be able to compare everything as you did previously. As for erasing the commit, you could undo the changes, apply |
|
Done |
|
I gotta go to sleep now (1:30am here), thanks for all of the assistance so far @CookiePLMonster :) |
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.
|
Shouldn't it display back slashes instead of forward slashes on Windows? |
|
Not true, |
|
cleanPath will always output forwardslashes, I could either check the platform and replace all forwardslashes with backslashes, or find a different function. |
|
I think performing comparisons and slicing on "clean" paths is a good idea - but may want to use "native separators" path for solely for displaying it to the user. |
|
Maybe I could put the processed path back into |
|
No need - |
|
Awesome, will add that as soon as I can |
|
Hmm now that's interesting, did lint bot spot missing brackets or incorrect indentation? Could be both, depending on what you intended this code to do. |
|
Yeah, it was missing brackets... Oops |
|
One more nitpick - I see you have edited an example of how it is supposed to work (or it's been there and I am just blind), and it would seem like Game Folder path is not to be included in the shown path at all. Yet, if you see the screens I posted above for me Any idea what's up with that? |
|
That is a typo, the path shortening behaviour works as I intended it to |
|
@CookiePLMonster should I keep the current functionality or change it to reflect the old example? |
For me the way it works now is good - let's wait for somebody else (preferably those who can merge) to comment on it too. |
|
What else needs to be done to complete this PR? |
I would say it's finished. At this point just sit tight and wait until somebody who |
|
I've found a slight weird behavior: if one game folder is nested within another, then the way the path is shortened depends on which one comes first in the list. Listing like this: gives this: while listing like this: gives this: This probably doesn't matter too much, though, since I suspect most people with a nested setup will just have search subfolders on. (Also, the |
|
I did that because of simplicity, if it's a problem then I could try sort the paths by length before comparing so the most nested paths are checked first. |
| case COL_FILE_PATH: | ||
| if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole) | ||
| { | ||
| QString file_path = QDir::cleanPath(QString::fromStdString(game.GetFilePath())); |
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.
I'm a little concerned about the performance impact of the logic here when used with very large game lists. But, I guess if the column is hidden by default, it shouldn't get executed.
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.
How do you suggest I improve the performance impact?
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.
Would probably require caching the string in the game list struct. But again, since it's not enabled by default, I don't think it matters all that much.
|
Gave this a quick check. It's not enabled by default, and it all works as advertised! However, I'm puzzled by the fact that it only shows one tree above the file name. Doesn't that greatly reduce its usefulness? Here's an example, an issue that I've run into before that this PR could help with, but doesn't. These two games appear exactly the same under this PR. However, if we take a peek at the full paths... One is on my NAS, the other is local. This is something that this PR could genuinely help with over just showing file names. I use my NAS for storing my games, but I do a local mirror of any game I'm playing through at the moment, with both paths accessible to Dolphin at all times. File names won't help with this, and neither would anything else in the GUI. Only file paths could help. But because this PR only goes up one level, it can't show that difference. It's no more useful than file names here. Of course, I could rename the folder of my local mirror folder. But at that point, I could also just rename the local mirrored version of the iso's file name, which would work without this PR at all, so... IMO, I think this PR should just show the full file path. Yes it'll be long, but it's useful in handling edge cases like the one I just outlined where file names are not sufficient. There are also other cases, like having games on a bulk storage drive and an SSD mirror that would this would also apply to. Just showing one folder up from the file name doesn't offer much. As for the length, why not just show only the path and not the file name? Why have the file name present in the file path when there is a dedicated column for that? That would greatly cut down on the length of the file path column and uses can add the file name column if they want that information. |
|
Those are good points you make, I'll use the full file path instead. |
|
@MayImilae I've integrated the changes you have requested |
|
Not to be "that guy", but I guess that if you're to show a full path after all then |
|
@AlexApps99 Much better! And yea, the final slash might be nice for combination things like this. |
|
Using |
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.
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.
LGTM


















The path is generated by finding a file path that contains the filename, then removing the path to that path.
Example:
File paths:
/home/foo/games,/home/foo/Desktop/wiiGame path:
/home/foo/games/gcn/ntsc/fun game.gcnFile name listed:gcn/ntsc/fun game.gcnFile name listed:
games/gcn/ntsc/fun game.gcndir.lastIndexOfuses-2in the case that the file path ends with a trailing slash.Fixes https://bugs.dolphin-emu.org/issues/10567
This is my first PR to Dolphin, so a thorough review would be awesome,
and let me know if this would be better as its' own column instead of replacing "File name".