-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add "Open containing folder" (#5453) #5454
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 "Open containing folder" (#5453) #5454
Conversation
Add functionality to open the containing folder of a file that's selected in LMMS' file browser. Technical details ------------------ Add a new private method openContainingFolder to FileBrowser. Add a new action to the context menu of a selected file. This action in turn calls the added method. The current implementation of openContainingFolder delegates to QDesktopServices::openUrl with the directory of the selected file. Please note that this will only open the directory but not select the file as this is much more complicated due to different implementations that are needed for the different platforms (Linux/Windows/MacOS). Using QDesktopServices::openUrl seems to be the most simple cross platform way which uses functionality that's already available in Qt.
|
Implements #5453. I propose to merge it like this which for now only opens the directory of the file as this is already an improvement for the end use. In case someone wants to enhance it by also selecting the file in the opened file browser some hints on how to do this can be found here: https://stackoverflow.com/questions/3490336/how-to-reveal-in-finder-or-show-in-explorer-with-qt. |
🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩
Linux
Windows
macOS
🤖{"platform_name_to_artifacts": {"Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://5981-15778896-gh.circle-artifacts.com/0/lmms-1.2.1.633-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/5981?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://5979-15778896-gh.circle-artifacts.com/0/lmms-1.2.1.633-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/5979?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://5980-15778896-gh.circle-artifacts.com/0/lmms-1.2.1.633-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/5980?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/2kw303jei5jm5j6y/artifacts/build/lmms-1.2.1-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/32340834"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/mah67i54bk71jnbq/artifacts/build/lmms-1.2.1-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/32340834"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://5983-15778896-gh.circle-artifacts.com/0/lmms-1.2.1.633-mac10.13.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/5983?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "c37fdd005529f1fbc19d974c62d617fe89dfe988"} |
Move openContainingFolder to the end of the method block. Adjust FileBrowserTreeWidget::contextMenuEvent to the coding conventions and also make the code more readable by splitting up some conditions. Add comments to clarify as to why the member m_contextMenuItem is set to nullptr at the end of the execution of contextMenuEvent. Please note that this implementation is not exception safe and should be changed in the future, e.g. by passing the FileItem as a parameter of the slot.
Could you add a comment to the code itself as well, to make the intention clear? |
Add a comment which describes that only the folder is opened without selecting any file. Also explain why it is only done like this for now.
…gFolder Implements "Open containing folder" (LMMS#5453)
Add functionality to open the containing folder of a file that's selected
in LMMS' file browser.
Technical details
Add a new private method openContainingFolder to FileBrowser. Add a new
action to the context menu of a selected file. This action in turn calls
the added method.
The current implementation of openContainingFolder delegates to
QDesktopServices::openUrl with the directory of the selected file. Please
note that this will only open the directory but not select the file as
this is much more complicated due to different implementations that are
needed for the different platforms (Linux/Windows/MacOS).
Using QDesktopServices::openUrl seems to be the most simple cross
platform way which uses functionality that's already available in Qt.