mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-24 07:40:21 +01:00
qt: Add support for opening files directly on macOS. (#7304)
* Associate 3ds files with Citra in Info.plist * qt: Add support for opening files directly on macOS. --------- Co-authored-by: shinra-electric <50119606+shinra-electric@users.noreply.github.com>
This commit is contained in:
parent
9b147d3f9c
commit
36db566428
32
dist/apple/Info.plist.in
vendored
32
dist/apple/Info.plist.in
vendored
@ -26,6 +26,38 @@
|
|||||||
<!-- Fixed -->
|
<!-- Fixed -->
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.games</string>
|
<string>public.app-category.games</string>
|
||||||
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>3ds</string>
|
||||||
|
<string>3dsx</string>
|
||||||
|
<string>cci</string>
|
||||||
|
<string>cxi</string>
|
||||||
|
<string>cia</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Nintendo 3DS File</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Default</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>elf</string>
|
||||||
|
<string>axf</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Unix Executable and Linkable Format</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Alternate</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>This app requires camera access to emulate the 3DS's cameras.</string>
|
<string>This app requires camera access to emulate the 3DS's cameras.</string>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
|
@ -229,6 +229,7 @@ GMainWindow::GMainWindow(Core::System& system_)
|
|||||||
SetDefaultUIGeometry();
|
SetDefaultUIGeometry();
|
||||||
RestoreUIState();
|
RestoreUIState();
|
||||||
|
|
||||||
|
ConnectAppEvents();
|
||||||
ConnectMenuEvents();
|
ConnectMenuEvents();
|
||||||
ConnectWidgetEvents();
|
ConnectWidgetEvents();
|
||||||
|
|
||||||
@ -761,6 +762,21 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GApplicationEventFilter::eventFilter(QObject* object, QEvent* event) {
|
||||||
|
if (event->type() == QEvent::FileOpen) {
|
||||||
|
emit FileOpen(static_cast<QFileOpenEvent*>(event));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ConnectAppEvents() {
|
||||||
|
const auto filter = new GApplicationEventFilter();
|
||||||
|
QGuiApplication::instance()->installEventFilter(filter);
|
||||||
|
|
||||||
|
connect(filter, &GApplicationEventFilter::FileOpen, this, &GMainWindow::OnFileOpen);
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::ConnectWidgetEvents() {
|
void GMainWindow::ConnectWidgetEvents() {
|
||||||
connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile);
|
connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile);
|
||||||
connect(game_list, &GameList::OpenDirectory, this, &GMainWindow::OnGameListOpenDirectory);
|
connect(game_list, &GameList::OpenDirectory, this, &GMainWindow::OnGameListOpenDirectory);
|
||||||
@ -2752,6 +2768,10 @@ bool GMainWindow::DropAction(QDropEvent* event) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::OnFileOpen(const QFileOpenEvent* event) {
|
||||||
|
BootGame(event->file());
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::dropEvent(QDropEvent* event) {
|
void GMainWindow::dropEvent(QDropEvent* event) {
|
||||||
DropAction(event);
|
DropAction(event);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ class LoadingScreen;
|
|||||||
class MicroProfileDialog;
|
class MicroProfileDialog;
|
||||||
class MultiplayerState;
|
class MultiplayerState;
|
||||||
class ProfilerWidget;
|
class ProfilerWidget;
|
||||||
|
class QFileOpenEvent;
|
||||||
template <typename>
|
template <typename>
|
||||||
class QFutureWatcher;
|
class QFutureWatcher;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
@ -96,6 +97,8 @@ public:
|
|||||||
bool DropAction(QDropEvent* event);
|
bool DropAction(QDropEvent* event);
|
||||||
void AcceptDropEvent(QDropEvent* event);
|
void AcceptDropEvent(QDropEvent* event);
|
||||||
|
|
||||||
|
void OnFileOpen(const QFileOpenEvent* event);
|
||||||
|
|
||||||
void UninstallTitles(
|
void UninstallTitles(
|
||||||
const std::vector<std::tuple<Service::FS::MediaType, u64, QString>>& titles);
|
const std::vector<std::tuple<Service::FS::MediaType, u64, QString>>& titles);
|
||||||
|
|
||||||
@ -137,6 +140,7 @@ private:
|
|||||||
void SyncMenuUISettings();
|
void SyncMenuUISettings();
|
||||||
void RestoreUIState();
|
void RestoreUIState();
|
||||||
|
|
||||||
|
void ConnectAppEvents();
|
||||||
void ConnectWidgetEvents();
|
void ConnectWidgetEvents();
|
||||||
void ConnectMenuEvents();
|
void ConnectMenuEvents();
|
||||||
void UpdateMenuState();
|
void UpdateMenuState();
|
||||||
@ -382,5 +386,15 @@ protected:
|
|||||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class GApplicationEventFilter : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void FileOpen(const QFileOpenEvent* event);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject* object, QEvent* event) override;
|
||||||
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(std::size_t);
|
Q_DECLARE_METATYPE(std::size_t);
|
||||||
Q_DECLARE_METATYPE(Service::AM::InstallStatus);
|
Q_DECLARE_METATYPE(Service::AM::InstallStatus);
|
||||||
|
Loading…
Reference in New Issue
Block a user