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 drag & drop functionality for opening files (in macOS) #69

Merged
merged 4 commits into from
Sep 27, 2024

Conversation

agetroortega
Copy link
Contributor

@agetroortega agetroortega commented Sep 27, 2024

Summary

This allows the user to drag and drop files from the file system onto the app to be opened, a pop up window will prompt the user for confirmation.

NOTE: For Dev Days I only have macOS setup for building, so this PR only addresses that OS. I believe the functionality needs to be implemented for each platform.

Change List

  • Added general functionality to accept dropped files in the main app (app.cpp)
  • Added validation for:
    • Single dropped file: Only accepting a single file, but this case easily be expanded in the future when multiple timelines are allowed.
    • File type: Validates that the given file is valid and has the .otio extension
  • Modal pop up to get user confirmation before opening the file
  • Enabled file drop callback for macOS (only macOS in this PR, see note above)

Testing

I tested the following with a file currently loaded and with an empty session.

  • Drop multiple files: Aborts loading and warns the user.
  • Drop directory: Aborts and warns user about invalid file.
  • Drop invalid file (i.e.: .cpp file): Aborts and warns user about invalid file.
  • Drop valid .otio file:
    • Click "No" in prompt: Closes prompt, aborts loading and nothing changes in the session.
    • Click "Yes" in prompt: Closes prompt and loads dropped file.

Examples

Open a valid file

open_otio_file.mov

Invalid files and user clicking "No"

validation_and_abort.mov

Fixes #57

Copy link

linux-foundation-easycla bot commented Sep 27, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@agetroortega agetroortega changed the title Add drag & drop functionality for opening files Add drag & drop functionality for opening files (in macOS) Sep 27, 2024
app.cpp Show resolved Hide resolved
app.cpp Show resolved Hide resolved
Copy link
Member

@jminor jminor left a comment

Choose a reason for hiding this comment

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

This looks great!
I think the only remaining step is to take care of the DCO requirement. You can see instructions on how to do that here: https://github.com/OpenTimelineIO/raven/pull/69/checks?check_run_id=30779161433

Signed-off-by: Fernando Ortega <[email protected]>
Signed-off-by: Fernando Ortega <[email protected]>
Signed-off-by: Fernando Ortega <[email protected]>
@agetroortega
Copy link
Contributor Author

@jminor Thank you! I just updated my commits with the sign off.

@agetroortega
Copy link
Contributor Author

@jminor by the way, I mentioned in the description this just fixes it for macOS, there's a bit of work left to do for windows/linux. Would you prefer to have that as a separate issue? (I'm happy to give it a go later on)

@jminor
Copy link
Member

jminor commented Sep 27, 2024

Yep, I saw that. We can update #57 to clarify that there is work needed to bring this feature to the other platforms.

@jminor jminor merged commit d551b35 into OpenTimelineIO:main Sep 27, 2024
6 checks passed
@jminor
Copy link
Member

jminor commented Sep 27, 2024

Thanks for the contribution @agetroortega !

@agetroortega
Copy link
Contributor Author

Thanks a lot! It was a fun one!

@timlehr
Copy link
Collaborator

timlehr commented Sep 28, 2024

Super nice, thank you for your work! :)

jspada200 pushed a commit to jspada200/raven that referenced this pull request Oct 1, 2024
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.

Add drag & drop support for opening files on Linux
3 participants