Fix opening of project files on macOS (#3219)

- 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 #665
This commit is contained in:
Tres Finocchiaro
2017-03-17 21:53:36 -04:00
committed by GitHub
parent 29f832034a
commit 3dfd9794db
4 changed files with 120 additions and 1 deletions

View File

@@ -56,6 +56,7 @@
#include <signal.h>
#include "MainApplication.h"
#include "MemoryManager.h"
#include "ConfigManager.h"
#include "NotePlayHandle.h"
@@ -255,7 +256,7 @@ int main( int argc, char * * argv )
QCoreApplication * app = coreOnly ?
new QCoreApplication( argc, argv ) :
new QApplication( argc, argv ) ;
new MainApplication( argc, argv );
Mixer::qualitySettings qs( Mixer::qualitySettings::Mode_HighQuality );
ProjectRenderer::OutputSettings os( 44100, false, 160,
@@ -834,6 +835,12 @@ int main( int argc, char * * argv )
gui->mainWindow()->showMaximized();
}
// Handle macOS-style FileOpen QEvents
QString queuedFile = static_cast<MainApplication *>( app )->queuedFile();
if ( !queuedFile.isEmpty() ) {
fileToLoad = queuedFile;
}
if( !fileToLoad.isEmpty() )
{
if( fileToLoad == recoveryFile )