-
-
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
Fix opening of project files on macOS #3219
Conversation
It looks like you are trying to load the project before the engine is initialized. If
You should use a separate file for the class. |
That makes sense.
I'm not sure the second part of that statement, but it appears we could be missing quite a bit of logic here. Shouldn't this be decoupled from Lines 714 to 899 in 1f39474
Sure but even if it's a single function only used in |
OK I think I get this... We have two separate use-cases.
If I can detect which use-cases is happening... The ladder simply needs to set a member variable in main.cpp instructing which file to load, right? |
.. or would it be simpler to just loop and wait for the Engine to be non-NULL and hit two birds? |
It is about organization. When you see Regarding the implementation:
|
Won't that require dynamic casting back in main.cpp since app is a QApplication, not a EventApp?
Fair enough but the code is riddled with nested classes, I assume you wanna keep'm separated moving forward? I just can't bare to add two new files for such a small change, but if that's the way to do it, that's just fine. |
Static casting will do since you are running the GUI case.
Outer classes in a file with a different name are a problem. Nested classes are fine.
I understand how you feel, though I would add those files. On the other hand, LMMS is not that big yet. If you decide to keep |
You mean the header contents? That's how I had it originally but it was god awful ugly. I'll split it out, it may come in handy for other Mac events or perhaps non-Mac events down the road. |
Done.
Done.
Done.
Done, in a slightly different way. If the event file is not empty, we use it. This is ready for another review. Tested on already running instances as well as newly fired instances. Thanks for the pointers. |
If there are no objections, I will merge this in 2 days. |
- Double-click mmpz file in finder will now open properly on macOS - Adds new MainApplication class for listening to QEvent::FileOpenEvent - Queues open events until the application is ready to recieve them - Closes LMMS#665
case QEvent::FileOpen: | ||
{ | ||
QFileOpenEvent * fileEvent = static_cast<QFileOpenEvent *>(event); | ||
if(event) |
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 condition will always be true.
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 please explain? Also, why drop the non-obvious fall-through comment?
Never mind, explained here. #3440. Thanks!
- Double-click mmpz file in finder will now open properly on macOS - Adds new MainApplication class for listening to QEvent::FileOpenEvent - Queues open events until the application is ready to recieve them - Closes LMMS#665
This is intended to fix the problem where LMMS won't open a project that has been double-clicked on macOS.
Closes #665
Although this fix is Mac-specific, it should have no negative impact on Windows or Linux.