logic: file associations for Mac and opening project files via Mac OS
* hide start screen when opening with project file * added project icon file to bundle and file type association to plist * listen for file open events from double click or drag and drop * fixed crashes in window handling
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "qt/QtApplication.h"
|
||||
|
||||
#include <QFileOpenEvent>
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
|
||||
QtApplication::QtApplication(int& argc, char** argv)
|
||||
: QApplication(argc, argv)
|
||||
{
|
||||
}
|
||||
|
||||
// responds to FileOpenEvent specific for Mac
|
||||
bool QtApplication::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::FileOpen)
|
||||
{
|
||||
QFileOpenEvent* fileEvent = dynamic_cast<QFileOpenEvent*>(event);
|
||||
|
||||
FilePath path(fileEvent->file().toStdString());
|
||||
|
||||
if (path.exists() && path.extension() == ".coatiproject")
|
||||
{
|
||||
MessageLoadProject(path.str(), false).dispatch();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return QApplication::event(event);
|
||||
}
|
||||
Reference in New Issue
Block a user