dolphin/Source/Core/DolphinQt/QtUtils/DolphinFileDialog.h
sowens99 839b04014e 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.
2021-10-09 22:43:56 -04:00

41 lines
1.6 KiB
C++

// 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