diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt
index c96aec40a0..3fd3d99599 100644
--- a/Source/Core/DolphinQt/CMakeLists.txt
+++ b/Source/Core/DolphinQt/CMakeLists.txt
@@ -202,6 +202,8 @@ add_executable(dolphin-emu
QtUtils/DoubleClickEventFilter.h
QtUtils/ElidedButton.cpp
QtUtils/ElidedButton.h
+ QtUtils/FileOpenEventFilter.cpp
+ QtUtils/FileOpenEventFilter.h
QtUtils/FlowLayout.cpp
QtUtils/FlowLayout.h
QtUtils/ModalMessageBox.cpp
diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj b/Source/Core/DolphinQt/DolphinQt.vcxproj
index f5f1742c67..151c4032c7 100644
--- a/Source/Core/DolphinQt/DolphinQt.vcxproj
+++ b/Source/Core/DolphinQt/DolphinQt.vcxproj
@@ -156,6 +156,7 @@
+
@@ -193,6 +194,7 @@
+
@@ -379,6 +381,7 @@
+
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp
index 066812b66f..b7ce9d5206 100644
--- a/Source/Core/DolphinQt/MainWindow.cpp
+++ b/Source/Core/DolphinQt/MainWindow.cpp
@@ -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)
diff --git a/Source/Core/DolphinQt/QtUtils/FileOpenEventFilter.cpp b/Source/Core/DolphinQt/QtUtils/FileOpenEventFilter.cpp
new file mode 100644
index 0000000000..9c13795688
--- /dev/null
+++ b/Source/Core/DolphinQt/QtUtils/FileOpenEventFilter.cpp
@@ -0,0 +1,24 @@
+// Copyright 2019 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#include
+
+#include "DolphinQt/QtUtils/FileOpenEventFilter.h"
+
+FileOpenEventFilter::FileOpenEventFilter(QObject* event_source) : QObject(event_source)
+{
+ event_source->installEventFilter(this);
+}
+
+bool FileOpenEventFilter::eventFilter(QObject* object, QEvent* event)
+{
+ if (event->type() == QEvent::FileOpen)
+ {
+ auto* openEvent = static_cast(event);
+ emit fileOpened(openEvent->file());
+ return true;
+ }
+
+ return false;
+}
diff --git a/Source/Core/DolphinQt/QtUtils/FileOpenEventFilter.h b/Source/Core/DolphinQt/QtUtils/FileOpenEventFilter.h
new file mode 100644
index 0000000000..57aaa1cf3e
--- /dev/null
+++ b/Source/Core/DolphinQt/QtUtils/FileOpenEventFilter.h
@@ -0,0 +1,20 @@
+// Copyright 2019 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include
+
+class FileOpenEventFilter : public QObject
+{
+ Q_OBJECT
+public:
+ explicit FileOpenEventFilter(QObject* event_source);
+
+signals:
+ void fileOpened(const QString& file_name);
+
+private:
+ bool eventFilter(QObject* object, QEvent* event) override;
+};