-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 FILE line to Cuefile to include file path for each track #13365
base: main
Are you sure you want to change the base?
Add FILE line to Cuefile to include file path for each track #13365
Conversation
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.
Thanks for the contribution, as @fwcd suggested, it would be great to make that an option. To do so, you could add a boolean to EngineRecord
(like m_bCueUsesFileAnnotation
), and initialise it in the EngineRecord::updateFromPreferences
, using m_pConfig->getValue()
.
You can use Qt Designer to edit src/preferences/dialog/dlgprefrecorddlg.ui
and add the logic in src/preferences/dialog/dlgprefrecord.cpp
to ahndle the preference edition. Happy to do that part if you would like me to.
Just a word on Qt Designer: that potentially rearranges the .ui files (for no reason) which produces a unreviewable diff. |
@ronso0 Thanks for the tip, I will pay attention to the .ui files order and will edit manually if need be |
@acolombier Quick question, I just read in the Developer Guidelines to prefer merging over rebasing as rebasing apparently causes problems. I did not know this, and can't remember if I rebased or not. Is there a way for me to check if I rebased? Sorry if this is a dumb question. Thanks! |
Welcome at Mixxx! |
@presentformyfriends Merging is preferred becasue rebasing rewrites the commit history and may detach review comments (which could mean a lot / everything hd to be reviewwd again) Though, for this minimal PR that's irrelevant IMO. |
Thanks @JoergAtGithub just signed it!
|
Got it, good to know!
|
Add boolean to EngineRecord and initialize it in updateFromPreferences Add checkbox to DlgPrefRecord to enable file annotation in CUE file Add logic to ensure checkbox is disabled by default, include tooltip
Pushed the rest, please let me know if it's ok or if I should change anything. FYI: I edited the .ui file with kDevelop, not Qt Designer. EDIT: Build failed at pre-commit hook, I made some formatting changes and pushed those again. |
Can anyone tell me why my commit keeps failing on clang-format? I ran pre-commit locally and everything passes. When I look at the diff it's formatting issues that I've already fixed? 🤷 |
Are you sure? The lines that clang-format on CI complains about missing linebreaks in Also keep in mind that pre-commit only looks at the most recent commit, so if you have not run pre-commit since starting the PR, you might need to do a |
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.
This is looking good, thanks for the PR!
Just some minor comments
@@ -249,6 +251,12 @@ void EngineRecord::writeCueLine() { | |||
.arg(m_pCurrentTrack->getArtist()) | |||
.toUtf8()); | |||
|
|||
if (m_bCueUsesFileAnnotation) { | |||
m_cueFile.write(QString(" FILE \"%1\"\n") |
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 believe you might be able to use a QStringLiteral
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.
For this one, fyi all the m_cueFile.write
lines are existing code and use QString, I just added the if statement on line 254. I assumed whoever wrote that code used QString for a reason but idk.
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.
QStringLiteral
is a QString
:) (doc)
The value of a QStringLiteral
is that it will create the QString
at compilte time, instead of instantiating at every function calls. This is a macro optimisation.
The TL;DR is: if you use a static string in your QString
(like here with " FILE \"%1\"\n"
), you can make it a QStringLiteral
.
You are correct that the one above could also be using QStringLiteral
tho! Feel free to update them.
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.
Thanks for the explanation, I will update mine and the ones above. Just pushed new commit that should take care of this.
CheckBoxRecordCueFile->setChecked(kDefaultCueEnabled); | ||
|
||
// Sets 'Enable File Annotation in CUE file' checkbox value | ||
CheckBoxUseCueFileAnnotation->setChecked(false); |
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.
Can you capture that default value in a kConstant
like for line 217?
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.
Sure, I did this originally and then scrapped it when I realized I could keep it as false
. This builds fine on my end. I was curious why kDefaultCueEnabled
was necessary in this case but I could not find it anywhere else in the code. So if you can explain why we capture the default in this way (as opposed to say getValueString
), I would greatly appreciate it!
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.
This helps with readability mainly - all defaults get listed at the top of the file, and this helps to understand why this false
is being set to CheckBoxUseCueFileAnnotation
.
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.
That makes sense, thanks! Just pushed new commit that should take care of this.
void DlgPrefRecord::slotToggleCueEnabled() { | ||
updateCueEnabled(); | ||
} |
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 think these two methods are redundant. I would suggest keeping slotToggleCueEnabled
and call it directly if you need to.
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.
True, I've made this change but I'll wait til we resolve the others to push again.
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.
Just pushed new commit for this.
I ran this command but it still fails on clang-format and lists the same files:
|
Co-authored-by: Antoine Colombier <[email protected]>
Co-authored-by: Antoine Colombier <[email protected]>
Did you |
Alternative is to apply this patch: |
No, just tried that and now I'm unable to even push or pull. git push attempt:
git pull attempt:
No idea what to make of this despite their "hints" EDIT: Is it ok to use 'git reset' in this case? I don't know git that well and don't want to screw up anyone else's code |
This reverts commit 5a07163.
Ok should be fixed now, just did a git revert on most recent commit and then pulled. Please let me know if there is anything else I need to do to complete the PR, and thanks to all for the help. |
@@ -249,6 +251,12 @@ void EngineRecord::writeCueLine() { | |||
.arg(m_pCurrentTrack->getArtist()) | |||
.toUtf8()); | |||
|
|||
if (m_bCueUsesFileAnnotation) { | |||
m_cueFile.write(QString(" FILE \"%1\"\n") |
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.
m_cueFile.write(QString(" FILE \"%1\"\n") | |
m_cueFile.write(QStringLiteral(" FILE \"%1\"\n") |
Feel free to also fix other occurrence
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.
Just pushed new commit that should take care of this. I updated the line you suggested as well as the ones above it. Thanks!
Resolve line length issues to pass clang-format hook in pre-commit. Change config key to snake_case. Remove redundant 'updateCueEnabled' function, call slotToggleCueEnabled directly instead.
This reverts commit 77cc748.
Resolve line length issues to pass clang-format hook in pre-commit. Change config key to snake_case. Remove redundant 'updateCueEnabled' function, call slotToggleCueEnabled directly instead.
Fixes #13321
This PR adds a FILE line to the Cuefile to show a filepath for each track (see issue for more information).