mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
Add wrapper function to disable hotkeys for QFileDialog
Previously, if you have "Hotkeys Require Window Focus" disabled, you could repeatedly use the "Open" hotkey, for example, to stack File Open windows over top of each other over and over. This commit allows the hotkey manager to disable/enable on QFileDialog creation and destruction.
This commit is contained in:
40
Source/Core/DolphinQt/QtUtils/DolphinFileDialog.h
Normal file
40
Source/Core/DolphinQt/QtUtils/DolphinFileDialog.h
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright 2021 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Core/HotkeyManager.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
namespace DolphinFileDialog
|
||||
{
|
||||
class HotkeyDisabler final
|
||||
{
|
||||
public:
|
||||
HotkeyDisabler() { HotkeyManagerEmu::Enable(false); }
|
||||
~HotkeyDisabler() { HotkeyManagerEmu::Enable(true); }
|
||||
};
|
||||
|
||||
QString getExistingDirectory(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
const QString& dir = QString(),
|
||||
QFileDialog::Options options = QFileDialog::ShowDirsOnly);
|
||||
|
||||
QString getOpenFileName(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
const QString& dir = QString(), const QString& filter = QString(),
|
||||
QString* selectedFilter = nullptr,
|
||||
QFileDialog::Options options = QFileDialog::Options());
|
||||
|
||||
QStringList getOpenFileNames(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
const QString& dir = QString(), const QString& filter = QString(),
|
||||
QString* selectedFilter = nullptr,
|
||||
QFileDialog::Options options = QFileDialog::Options());
|
||||
|
||||
QString getSaveFileName(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
const QString& dir = QString(), const QString& filter = QString(),
|
||||
QString* selectedFilter = nullptr,
|
||||
QFileDialog::Options options = QFileDialog::Options());
|
||||
|
||||
} // namespace DolphinFileDialog
|
Reference in New Issue
Block a user