-
-
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
playlist export: add missing file extension #4531
Conversation
66a1695
to
a18d321
Compare
@uklotzde Refactored to use regexp in util/string.h |
eb06a87
to
62d59c5
Compare
for anyone testing this without reading the code:
so for example |
62d59c5
to
aa72e10
Compare
ping, this is ready. |
aa72e10
to
22d2a47
Compare
@ronso0, I took the liberty and pushed my changes directly to your branch so my changes don't get detached from the PR. |
7a6241b
to
f07b964
Compare
Perfecto, thanks! |
src/library/crate/cratefeature.cpp
Outdated
const ConfigKey kConfigKeyLastImportExportCrateDirectoryKey( | ||
"[Library]", "last_import_export_crate_directory"); | ||
|
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.
@uklotzde I'd like to hear your opinion on this. Instead of defining kConfigKeyLastImportExportCrateDirectoryKey
in a bunch of cpp files all at once, put it in a header file under the mixxx
namespace and then #include
it where its needed. Does that make sense, what do you need to specify for it to work? something like inline const ConfigKey ...
?
nevermind, its not defined in more than one translation unit. Don't know how I got that idea.
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, though I'm not sure if I'm allowed to merge since this PR does contain commits I made.
cc15cce
to
371c925
Compare
sqashed, rebased, tested if all commits build. |
I think it doesn't make a difference if your review proposals are implemented or if you implment them yourself. |
371c925
to
4ead4ac
Compare
pushed again because I squashing wiped your co-authorship @Swiftb0y |
The last two commits contain the experimental workaround for the QFileDialog suffix bug (with the Qt dialog). |
src/util/file.cpp
Outdated
return fileLocation; | ||
} | ||
|
||
QString checkedFilePathWithSelectedExtension(const QString& caption, |
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 function name sounds as if it will just do the check. It also pops up a dialog.
This should be expressed by the name.
Something like:
SaveFileDialogWithVerifiedExtension() or such
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.
yes, thank you. consider this WIP and the name will be adjusted.
What I care about here is whether this approach works for everyone, or not.
if this get's sufficient 👍 I'll implement it in other places, too, and change the name.
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.
considering the return value I'd name it filePathWithVerifiedExtensionFromFileDialog
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.
Thank you.
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.
Try to name functions starting with an imperative verb if possible. Like good commit messages ;)
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.
getFilePathWithVerifiedExtensionFromFileDialog ;)
I have tested this and it works quite good. Since the roundtrip happens only in an exceptional case, it is a good solution. I have noticed if you, misspell the extension, the correctly spelled extension is appended. I think we can merge it after the function name has been adjusted. |
@uklotzde Are all your review findings solved. |
I'll address @Swiftb0y's recent comments after implementing the new dialog. |
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 naming could be improved, but I don't have concerns regarding the code. Merge when ready.
src/util/file.cpp
Outdated
return fileLocation; | ||
} | ||
|
||
QString checkedFilePathWithSelectedExtension(const QString& caption, |
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.
Try to name functions starting with an imperative verb if possible. Like good commit messages ;)
Okay then, thanks for reviewing! |
c14ccfd
to
02705f6
Compare
Done. Every commit builds and works as intended. |
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, Thank you for all these bug fixes of this type. That makes really a difference.
m_pConfig->set(ConfigKey("[Library]", "LastImportExportPlaylistDirectory"), | ||
ConfigValue(fileName.dir().absolutePath())); | ||
QString fileDirectory(playlistFile); | ||
fileDirectory.truncate(playlistFile.lastIndexOf(QDir::separator())); |
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 suspect this always truncates at position 0, see https://bugs.launchpad.net/bugs/1964508
Native separator is \
on Windows and maybe Qt has already converted the path to use /
? In that case lastIndexOf("\")
would return -1 which is equivalent to passing 0 to truncate
https://doc.qt.io/qt-5/qstring.html#truncate
It is not recommended to use QDir::separator() for constructing paths, but appearantly it also creates issues when computing paths
https://doc.qt.io/qt-5/qdir.html#separator
original bug https://bugs.launchpad.net/mixxx/+bug/1197302
follow-up https://bugs.launchpad.net/mixxx/+bug/1889352
the fix from #430 got lost somehow.
related pending bug:
"extension is not autocompleted in dialog"
https://bugs.launchpad.net/mixxx/+bug/1455749