-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Feature: Pattern import/export #5891
Conversation
🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩
Windows
Linux
macOS🤖{"platform_name_to_artifacts": {"Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://12628-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.75%2Bgff2ec42be-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12628?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://12629-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.75%2Bgff2ec42be-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12629?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/h28i03249qbosn1j/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/37953778"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/1g5o2oboqxetl3cr/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/37953778"}], "Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://12627-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.75%2Bgff2ec42-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12627?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://12626-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.75%2Bgff2ec42be-mac10.14.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12626?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "16852a8084f290e1b8bb9ec8191d6cab527a6b6f"} |
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.
Code looks good, this review mostly points some code style or formatting minor issues. There's also one suggestion on using bool
instead of int
as a return type of savePatternXML
. I think it makes more sense as a return type, even though what you have now is POSIX compliant 😄
@IanCaio thanks for the review, I've made the suggested changes.
I also got curious, why does the export requires a `!selectedFiles().first().isEmpty()` check and the import doesn't? Is it because the file mode is `ExistingFiles`, so it will only accept the dialog with an existing file name?
Yes it is.
However this question did make me look at that code again and noticed that `FileDialog::ExistingFiles` was used instead of `FileDialog::ExistingFile`; so also changed that.
|
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 quick response!
Code LGTM! I'm leaving a last change request: It's a minor thing, code works fine the way it's written but I think it's a better habit for us to use TimePos
instead of int
where it's expected, even though they can be interchangeable.
I'm approving the PR despite that last change suggestion. Nice work!
I think it's a better habit for us to use TimePos instead of int where it's expected, even though they can be interchangeable.
Agreed :-)
|
Looks good. Could you look into |
It works well to me. |
@PhysSong that's a cool class, adopted the code to use it.
@superpaik I get the issue; from what I've tested all other LMMS file dialogs have pre-defined paths (example: {LMMS_HOME}/projects or {LMMS_HOME}/samples).
Maybe create a default `pattern` directory and use that as default?
Also would it be nice to be able to drag and drop from the sidebar filebrowser into a `InstrumentTrack`?
|
Recent changes look good to me! I agree that it would be nice to have a pattern folder, maybe accessible from the sidebar, but could we leave this for a future enhancement? We're running a little bit against time to make the code base refactoring happen, so maybe we can keep the feature in its state, which is perfectly functional, and leave the improvements for after the refactor? |
…f custom code to read/write the pattern file.
Awesome :-)
Yeah leaving it for what it is sounds OK to me. Once it's merged I will create another PR for drag-drop from the sidebar.
On the default directory idea: I thought there was a issue on exporting automation tracks, now I can't find it :') But if that's the case it will probably better to use `{LMMS_HOME}/patterns/notes` so potential future (other) patterns can have their own sub-directories. But yeah.. that's future stuff then.
|
A remark on names: |
src/gui/editors/PianoRoll.cpp
Outdated
QString extFilter("XML Pattern (*.xpt *.xptz)"); | ||
FileDialog exportDialog(this, tr("Export pattern"), "", extFilter); |
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 are some minor inconsistencies between exportPattern()
and importPattern()
:
XML Pattern
vs.XML pattern file
. I'm not sure ifXML pattern
describe well what the file is.- This file extension filter in this function is not translatable while the one in
importPattern()
is. Also, only this function uses an explicit temporaryQString
.
@cyber-bridge Have you read my latest comment? |
Yes thanks for reminding me! Would "notes pattern" be more descriptive?
|
@PhysSong You think this PR is ready for merge after those latest changes? |
Yes. |
* Init * Suggested changes by @IanCaio, thanks! * Selecting one file to import is enough. * Explicit use of TimePos in favour of int where expected, as suggested. * Make pattern import/export future proof with using DataFile instead of custom code to read/write the pattern file. * Remove unused/duplicate imports * Make import/export dialogs file-ext filter consistent. Co-authored-by: CYBERDEViL <cyberdevil@notabug.org>
* Init * Suggested changes by @IanCaio, thanks! * Selecting one file to import is enough. * Explicit use of TimePos in favour of int where expected, as suggested. * Make pattern import/export future proof with using DataFile instead of custom code to read/write the pattern file. * Remove unused/duplicate imports * Make import/export dialogs file-ext filter consistent. Co-authored-by: CYBERDEViL <cyberdevil@notabug.org>
Continuation of #5197
This makes it possible to export and import patterns. They will be saved to a XML document. Currently with the file-extension
.xpt
and.xtpz
for compressed files.Closes #3393