QtGui: Handle file open events

Handle file open events received by Dolphin. This allows Wii/GC files to be
opened when double-clicked or dropped on the Dolphin application on macOS.
This commit is contained in:
Vincent Duvert
2019-06-11 23:00:02 +02:00
parent c34388f75b
commit 2f63b71bde
5 changed files with 56 additions and 0 deletions

View File

@ -84,6 +84,7 @@
#include "DolphinQt/NetPlay/NetPlayBrowser.h"
#include "DolphinQt/NetPlay/NetPlayDialog.h"
#include "DolphinQt/NetPlay/NetPlaySetupDialog.h"
#include "DolphinQt/QtUtils/FileOpenEventFilter.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/QueueOnObject.h"
#include "DolphinQt/QtUtils/RunOnObject.h"
@ -336,6 +337,12 @@ void MainWindow::InitCoreCallbacks()
});
installEventFilter(this);
m_render_widget->installEventFilter(this);
// Handle file open events
auto* filter = new FileOpenEventFilter(QGuiApplication::instance());
connect(filter, &FileOpenEventFilter::fileOpened, this, [=](const QString& file_name) {
StartGame(BootParameters::GenerateFromFile(file_name.toStdString()));
});
}
static void InstallHotkeyFilter(QWidget* dialog)