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

Add FILE line to Cuefile to include file path for each track #13365

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

presentformyfriends
Copy link

Fixes #13321

This PR adds a FILE line to the Cuefile to show a filepath for each track (see issue for more information).

Copy link
Contributor

@acolombier acolombier left a 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.

@ronso0
Copy link
Member

ronso0 commented Jun 13, 2024

Just a word on Qt Designer: that potentially rearranges the .ui files (for no reason) which produces a unreviewable diff.
If that happens please resort to editing the ui file manually in a text editor.

@presentformyfriends
Copy link
Author

@ronso0 Thanks for the tip, I will pay attention to the .ui files order and will edit manually if need be

@presentformyfriends
Copy link
Author

@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!

@JoergAtGithub
Copy link
Member

Welcome at Mixxx!
As a first-time contributor we need you to sign the Mixxx Contributor Agreement and comment here when you have done so. It gives us permission to distribute your contribution under the GPL v2 or later license and the Apple Mac App Store. It is also helpful for us to have contact information for contributors in case we may need it in the future.

@ronso0
Copy link
Member

ronso0 commented Jun 13, 2024

@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.

@presentformyfriends
Copy link
Author

Thanks @JoergAtGithub just signed it!

Welcome at Mixxx! As a first-time contributor we need you to sign the

@presentformyfriends
Copy link
Author

Got it, good to know!

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.

presentformyfriends and others added 2 commits June 29, 2024 16:53
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
@presentformyfriends
Copy link
Author

presentformyfriends commented Jul 14, 2024

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.

@presentformyfriends
Copy link
Author

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? 🤷

@Swiftb0y
Copy link
Member

Swiftb0y commented Jul 15, 2024

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 enginerecord.cpp:128 for example.

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 pre-commit run --from-ref upstream/main --to-ref HEAD so it runs on the entire PR.

Copy link
Contributor

@acolombier acolombier left a 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

src/preferences/dialog/dlgprefrecord.cpp Outdated Show resolved Hide resolved
@@ -249,6 +251,12 @@ void EngineRecord::writeCueLine() {
.arg(m_pCurrentTrack->getArtist())
.toUtf8());

if (m_bCueUsesFileAnnotation) {
m_cueFile.write(QString(" FILE \"%1\"\n")
Copy link
Contributor

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

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.

Copy link
Contributor

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.

Copy link
Author

@presentformyfriends presentformyfriends Jul 23, 2024

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);
Copy link
Contributor

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?

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!

Copy link
Contributor

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.

Copy link
Author

@presentformyfriends presentformyfriends Jul 23, 2024

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.

src/preferences/dialog/dlgprefrecord.cpp Outdated Show resolved Hide resolved
Comment on lines 458 to 460
void DlgPrefRecord::slotToggleCueEnabled() {
updateCueEnabled();
}
Copy link
Contributor

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.

Copy link
Author

@presentformyfriends presentformyfriends Jul 17, 2024

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.

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.

@presentformyfriends
Copy link
Author

presentformyfriends commented Jul 17, 2024

you might need to do a pre-commit run --from-ref upstream/main --to-ref HEAD so it runs on the entire PR.

I ran this command but it still fails on clang-format and lists the same files:

fix utf-8 byte order marker..............................................Passed
check for case conflicts.................................................Passed
check json...........................................(no files to check)Skipped
check for merge conflicts................................................Passed
check xml............................................(no files to check)Skipped
check yaml...........................................(no files to check)Skipped
fix end of files.........................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
don't commit to branch...................................................Passed
codespell................................................................Passed
eslint...............................................(no files to check)Skipped
clang-format.............................................................Failed
- hook id: clang-format
- files were modified by this hook

[INFO] First pass: Reformatting added/changed lines...
[INFO] Reformatting src/engine/sidechain/enginerecord.cpp [21-22, 40-40, 254-259]...
[INFO] Reformatting src/engine/sidechain/enginerecord.h [88-88]...
[INFO] Reformatting src/preferences/dialog/dlgprefrecord.cpp [79-81, 125-129, 155-155, 187-187, 191-192, 215-216, 218-220, 322-331, 458-461, 467-471]...
[INFO] Reformatting src/preferences/dialog/dlgprefrecord.h [35-37, 50-51]...
[INFO] Second pass: Breaking long added/changed lines...
[INFO] Reformatting src/engine/sidechain/enginerecord.cpp [40-40]...
[INFO] Reformatting src/preferences/dialog/dlgprefrecord.cpp [322-322]...

black................................................(no files to check)Skipped
flake8...............................................(no files to check)Skipped
shellcheck...........................................(no files to check)Skipped
markdownlint-cli2....................................(no files to check)Skipped
Validate GitHub Workflows............................(no files to check)Skipped
prettier.............................................(no files to check)Skipped
reformat QML files...................................(no files to check)Skipped
qsscheck.............................................(no files to check)Skipped
changelog............................................(no files to check)Skipped
qmllint..............................................(no files to check)Skipped
metainfo.............................................(no files to check)Skipped 

@daschuer
Copy link
Member

I ran this command but it still fails on clang-format and lists the same files:

Did you
git commit -a after checking all files?

@daschuer
Copy link
Member

Alternative is to apply this patch:
https://github.com/mixxxdj/mixxx/actions/runs/9982325217/artifacts/1713542080

@presentformyfriends
Copy link
Author

presentformyfriends commented Jul 19, 2024

Did you git commit -a after checking all files?

No, just tried that and now I'm unable to even push or pull.

git push attempt:

To github.com:presentformyfriends/mixxx.git
 ! [rejected]              fixing_some_bug -> fixing_some_bug (fetch first)
error: failed to push some refs to 'github.com:presentformyfriends/mixxx.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

git pull attempt:

remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 12 (delta 5), reused 8 (delta 5), pack-reused 0
Unpacking objects: 100% (12/12), 11.50 KiB | 3.83 MiB/s, done.
From github.com:presentformyfriends/mixxx
   d6a42bb989..7ae6cb7bb7  fixing_some_bug -> origin/fixing_some_bug
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.

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

@presentformyfriends
Copy link
Author

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")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
m_cueFile.write(QString(" FILE \"%1\"\n")
m_cueFile.write(QStringLiteral(" FILE \"%1\"\n")

Feel free to also fix other occurrence

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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please add a FILE line to the Cue Sheet
6 participants