mirror of
https://github.com/PabloMK7/citra.git
synced 2024-12-29 11:06:12 +00:00
citra_qt: Improvements to hotkeys and ui state management (#6224)
This commit is contained in:
parent
9b49d94644
commit
f66d03dd48
|
@ -8,7 +8,6 @@
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include "citra_qt/configuration/config.h"
|
#include "citra_qt/configuration/config.h"
|
||||||
#include "citra_qt/uisettings.h"
|
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "core/frontend/mic.h"
|
#include "core/frontend/mic.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
@ -56,17 +55,17 @@ const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config:
|
||||||
// This must be in alphabetical order according to action name as it must have the same order as
|
// This must be in alphabetical order according to action name as it must have the same order as
|
||||||
// UISetting::values.shortcuts, which is alphabetically ordered.
|
// UISetting::values.shortcuts, which is alphabetically ordered.
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const std::array<UISettings::Shortcut, 24> default_hotkeys{
|
const std::array<UISettings::Shortcut, 24> Config::default_hotkeys {{
|
||||||
{{QStringLiteral("Advance Frame"), QStringLiteral("Main Window"), {QStringLiteral("\\"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Advance Frame"), QStringLiteral("Main Window"), {QStringLiteral(""), Qt::ApplicationShortcut}},
|
||||||
{QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::WidgetWithChildrenShortcut}},
|
||||||
{QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}},
|
{QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Decrease Speed Limit"), QStringLiteral("Main Window"), {QStringLiteral("-"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Decrease Speed Limit"), QStringLiteral("Main Window"), {QStringLiteral("-"), Qt::ApplicationShortcut}},
|
||||||
{QStringLiteral("Exit Citra"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+Q"), Qt::WindowShortcut}},
|
{QStringLiteral("Exit Citra"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+Q"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Exit Fullscreen"), QStringLiteral("Main Window"), {QStringLiteral("Esc"), Qt::WindowShortcut}},
|
{QStringLiteral("Exit Fullscreen"), QStringLiteral("Main Window"), {QStringLiteral("Esc"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Fullscreen"), QStringLiteral("Main Window"), {QStringLiteral("F11"), Qt::WindowShortcut}},
|
{QStringLiteral("Fullscreen"), QStringLiteral("Main Window"), {QStringLiteral("F11"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Increase Speed Limit"), QStringLiteral("Main Window"), {QStringLiteral("+"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Increase Speed Limit"), QStringLiteral("Main Window"), {QStringLiteral("+"), Qt::ApplicationShortcut}},
|
||||||
{QStringLiteral("Load Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F2"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Load Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F2"), Qt::WidgetWithChildrenShortcut}},
|
||||||
{QStringLiteral("Load File"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+O"), Qt::WindowShortcut}},
|
{QStringLiteral("Load File"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+O"), Qt::WidgetWithChildrenShortcut}},
|
||||||
{QStringLiteral("Load from Newest Slot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+V"), Qt::WindowShortcut}},
|
{QStringLiteral("Load from Newest Slot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+V"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Mute Audio"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+M"), Qt::WindowShortcut}},
|
{QStringLiteral("Mute Audio"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+M"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Remove Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F3"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Remove Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F3"), Qt::ApplicationShortcut}},
|
||||||
|
@ -75,12 +74,13 @@ const std::array<UISettings::Shortcut, 24> default_hotkeys{
|
||||||
{QStringLiteral("Save to Oldest Slot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+C"), Qt::WindowShortcut}},
|
{QStringLiteral("Save to Oldest Slot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+C"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}},
|
{QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Swap Screens"), QStringLiteral("Main Window"), {QStringLiteral("F9"), Qt::WindowShortcut}},
|
{QStringLiteral("Swap Screens"), QStringLiteral("Main Window"), {QStringLiteral("F9"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Toggle Alternate Speed"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+Z"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Toggle Per-Game Speed"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+Z"), Qt::ApplicationShortcut}},
|
||||||
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}},
|
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Toggle Frame Advancing"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+A"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Toggle Frame Advancing"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+A"), Qt::ApplicationShortcut}},
|
||||||
{QStringLiteral("Toggle Screen Layout"), QStringLiteral("Main Window"), {QStringLiteral("F10"), Qt::WindowShortcut}},
|
{QStringLiteral("Toggle Screen Layout"), QStringLiteral("Main Window"), {QStringLiteral("F10"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Toggle Status Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+S"), Qt::WindowShortcut}},
|
{QStringLiteral("Toggle Status Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+S"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Toggle Texture Dumping"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+D"), Qt::ApplicationShortcut}}}};
|
{QStringLiteral("Toggle Texture Dumping"), QStringLiteral("Main Window"), {QStringLiteral(""), Qt::ApplicationShortcut}},
|
||||||
|
}};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
void Config::Initialize(const std::string& config_name) {
|
void Config::Initialize(const std::string& config_name) {
|
||||||
|
@ -632,14 +632,16 @@ void Config::ReadShortcutValues() {
|
||||||
qt_config->beginGroup(QStringLiteral("Shortcuts"));
|
qt_config->beginGroup(QStringLiteral("Shortcuts"));
|
||||||
|
|
||||||
for (const auto& [name, group, shortcut] : default_hotkeys) {
|
for (const auto& [name, group, shortcut] : default_hotkeys) {
|
||||||
auto [keyseq, context] = shortcut;
|
|
||||||
qt_config->beginGroup(group);
|
qt_config->beginGroup(group);
|
||||||
qt_config->beginGroup(name);
|
qt_config->beginGroup(name);
|
||||||
|
// No longer using ReadSetting for shortcut.second as it innacurately returns a value of 1
|
||||||
|
// for WidgetWithChildrenShortcut which is a value of 3. Needed to fix shortcuts the open
|
||||||
|
// a file dialog in windowed mode
|
||||||
UISettings::values.shortcuts.push_back(
|
UISettings::values.shortcuts.push_back(
|
||||||
{name,
|
{name,
|
||||||
group,
|
group,
|
||||||
{ReadSetting(QStringLiteral("KeySeq"), keyseq).toString(),
|
{ReadSetting(QStringLiteral("KeySeq"), shortcut.keyseq).toString(),
|
||||||
ReadSetting(QStringLiteral("Context"), context).toInt()}});
|
shortcut.context}});
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
}
|
||||||
|
@ -1110,12 +1112,13 @@ void Config::SaveShortcutValues() {
|
||||||
// Lengths of UISettings::values.shortcuts & default_hotkeys are same.
|
// Lengths of UISettings::values.shortcuts & default_hotkeys are same.
|
||||||
// However, their ordering must also be the same.
|
// However, their ordering must also be the same.
|
||||||
for (std::size_t i = 0; i < default_hotkeys.size(); i++) {
|
for (std::size_t i = 0; i < default_hotkeys.size(); i++) {
|
||||||
auto [name, group, shortcut] = UISettings::values.shortcuts[i];
|
const auto& [name, group, shortcut] = UISettings::values.shortcuts[i];
|
||||||
|
const auto& default_hotkey = default_hotkeys[i].shortcut;
|
||||||
|
|
||||||
qt_config->beginGroup(group);
|
qt_config->beginGroup(group);
|
||||||
qt_config->beginGroup(name);
|
qt_config->beginGroup(name);
|
||||||
WriteSetting(QStringLiteral("KeySeq"), shortcut.first, default_hotkeys[i].shortcut.first);
|
WriteSetting(QStringLiteral("KeySeq"), shortcut.keyseq, default_hotkey.keyseq);
|
||||||
WriteSetting(QStringLiteral("Context"), shortcut.second,
|
WriteSetting(QStringLiteral("Context"), shortcut.context, default_hotkey.context);
|
||||||
default_hotkeys[i].shortcut.second);
|
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include "citra_qt/uisettings.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
@ -25,6 +26,7 @@ public:
|
||||||
|
|
||||||
static const std::array<int, Settings::NativeButton::NumButtons> default_buttons;
|
static const std::array<int, Settings::NativeButton::NumButtons> default_buttons;
|
||||||
static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs;
|
static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs;
|
||||||
|
static const std::array<UISettings::Shortcut, 24> default_hotkeys;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Initialize(const std::string& config_name);
|
void Initialize(const std::string& config_name);
|
||||||
|
|
|
@ -2,31 +2,40 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
#include "citra_qt/configuration/config.h"
|
||||||
#include "citra_qt/configuration/configure_hotkeys.h"
|
#include "citra_qt/configuration/configure_hotkeys.h"
|
||||||
#include "citra_qt/hotkeys.h"
|
#include "citra_qt/hotkeys.h"
|
||||||
#include "citra_qt/util/sequence_dialog/sequence_dialog.h"
|
#include "citra_qt/util/sequence_dialog/sequence_dialog.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "ui_configure_hotkeys.h"
|
#include "ui_configure_hotkeys.h"
|
||||||
|
|
||||||
|
constexpr int name_column = 0;
|
||||||
|
constexpr int hotkey_column = 1;
|
||||||
|
|
||||||
ConfigureHotkeys::ConfigureHotkeys(QWidget* parent)
|
ConfigureHotkeys::ConfigureHotkeys(QWidget* parent)
|
||||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigureHotkeys>()) {
|
: QWidget(parent), ui(std::make_unique<Ui::ConfigureHotkeys>()) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setFocusPolicy(Qt::ClickFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
|
|
||||||
model = new QStandardItemModel(this);
|
model = new QStandardItemModel(this);
|
||||||
model->setColumnCount(3);
|
model->setColumnCount(2);
|
||||||
model->setHorizontalHeaderLabels({tr("Action"), tr("Hotkey"), tr("Context")});
|
model->setHorizontalHeaderLabels({tr("Action"), tr("Hotkey")});
|
||||||
|
|
||||||
connect(ui->hotkey_list, &QTreeView::doubleClicked, this, &ConfigureHotkeys::Configure);
|
connect(ui->hotkey_list, &QTreeView::doubleClicked, this, &ConfigureHotkeys::Configure);
|
||||||
|
connect(ui->hotkey_list, &QTreeView::customContextMenuRequested, this,
|
||||||
|
&ConfigureHotkeys::PopupContextMenu);
|
||||||
|
ui->hotkey_list->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
ui->hotkey_list->setModel(model);
|
ui->hotkey_list->setModel(model);
|
||||||
|
|
||||||
// TODO(Kloen): Make context configurable as well (hiding the column for now)
|
ui->hotkey_list->setColumnWidth(0, 250);
|
||||||
ui->hotkey_list->hideColumn(2);
|
ui->hotkey_list->resizeColumnToContents(hotkey_column);
|
||||||
|
|
||||||
ui->hotkey_list->setColumnWidth(0, 200);
|
connect(ui->button_restore_defaults, &QPushButton::clicked, this,
|
||||||
ui->hotkey_list->resizeColumnToContents(1);
|
&ConfigureHotkeys::RestoreDefaults);
|
||||||
|
connect(ui->button_clear_all, &QPushButton::clicked, this, &ConfigureHotkeys::ClearAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureHotkeys::~ConfigureHotkeys() = default;
|
ConfigureHotkeys::~ConfigureHotkeys() = default;
|
||||||
|
@ -55,9 +64,11 @@ void ConfigureHotkeys::Populate(const HotkeyRegistry& registry) {
|
||||||
QStandardItem* action = new QStandardItem(hotkey.first);
|
QStandardItem* action = new QStandardItem(hotkey.first);
|
||||||
QStandardItem* keyseq =
|
QStandardItem* keyseq =
|
||||||
new QStandardItem(hotkey.second.keyseq.toString(QKeySequence::NativeText));
|
new QStandardItem(hotkey.second.keyseq.toString(QKeySequence::NativeText));
|
||||||
|
QStandardItem* controller_keyseq = new QStandardItem(hotkey.second.controller_keyseq);
|
||||||
action->setEditable(false);
|
action->setEditable(false);
|
||||||
keyseq->setEditable(false);
|
keyseq->setEditable(false);
|
||||||
parent_item->appendRow({action, keyseq});
|
controller_keyseq->setEditable(false);
|
||||||
|
parent_item->appendRow({action, keyseq, controller_keyseq});
|
||||||
}
|
}
|
||||||
model->appendRow(parent_item);
|
model->appendRow(parent_item);
|
||||||
}
|
}
|
||||||
|
@ -74,8 +85,9 @@ void ConfigureHotkeys::Configure(QModelIndex index) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = index.sibling(index.row(), 1);
|
// Swap to the hotkey column
|
||||||
auto* const model = ui->hotkey_list->model();
|
index = index.sibling(index.row(), hotkey_column);
|
||||||
|
|
||||||
const auto previous_key = model->data(index);
|
const auto previous_key = model->data(index);
|
||||||
|
|
||||||
SequenceDialog hotkey_dialog{this};
|
SequenceDialog hotkey_dialog{this};
|
||||||
|
@ -85,26 +97,50 @@ void ConfigureHotkeys::Configure(QModelIndex index) {
|
||||||
if (return_code == QDialog::Rejected || key_sequence.isEmpty()) {
|
if (return_code == QDialog::Rejected || key_sequence.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const auto [key_sequence_used, used_action] = IsUsedKey(key_sequence);
|
||||||
|
|
||||||
if (IsUsedKey(key_sequence) && key_sequence != QKeySequence(previous_key.toString())) {
|
if (key_sequence_used && key_sequence != QKeySequence(previous_key.toString())) {
|
||||||
QMessageBox::warning(this, tr("Conflicting Key Sequence"),
|
QMessageBox::warning(
|
||||||
tr("The entered key sequence is already assigned to another hotkey."));
|
this, tr("Conflicting Key Sequence"),
|
||||||
|
tr("The entered key sequence is already assigned to: %1").arg(used_action));
|
||||||
} else {
|
} else {
|
||||||
model->setData(index, key_sequence.toString(QKeySequence::NativeText));
|
model->setData(index, key_sequence.toString(QKeySequence::NativeText));
|
||||||
EmitHotkeysChanged();
|
EmitHotkeysChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const {
|
std::pair<bool, QString> ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const {
|
||||||
return input_keys_list.contains(key_sequence) || GetUsedKeyList().contains(key_sequence);
|
if (key_sequence == QKeySequence::fromString(QStringLiteral(""), QKeySequence::NativeText)) {
|
||||||
|
return std::make_pair(false, QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input_keys_list.contains(key_sequence)) {
|
||||||
|
return std::make_pair(true, tr("A 3ds button"));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int r = 0; r < model->rowCount(); ++r) {
|
||||||
|
const QStandardItem* const parent = model->item(r, 0);
|
||||||
|
|
||||||
|
for (int r2 = 0; r2 < parent->rowCount(); ++r2) {
|
||||||
|
const QStandardItem* const key_seq_item = parent->child(r2, hotkey_column);
|
||||||
|
const auto key_seq_str = key_seq_item->text();
|
||||||
|
const auto key_seq = QKeySequence::fromString(key_seq_str, QKeySequence::NativeText);
|
||||||
|
|
||||||
|
if (key_sequence == key_seq) {
|
||||||
|
return std::make_pair(true, parent->child(r2, 0)->text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::make_pair(false, QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureHotkeys::ApplyConfiguration(HotkeyRegistry& registry) {
|
void ConfigureHotkeys::ApplyConfiguration(HotkeyRegistry& registry) {
|
||||||
for (int key_id = 0; key_id < model->rowCount(); key_id++) {
|
for (int key_id = 0; key_id < model->rowCount(); key_id++) {
|
||||||
QStandardItem* parent = model->item(key_id, 0);
|
QStandardItem* parent = model->item(key_id, 0);
|
||||||
for (int key_column_id = 0; key_column_id < parent->rowCount(); key_column_id++) {
|
for (int key_column_id = 0; key_column_id < parent->rowCount(); key_column_id++) {
|
||||||
QStandardItem* action = parent->child(key_column_id, 0);
|
const QStandardItem* action = parent->child(key_column_id, name_column);
|
||||||
QStandardItem* keyseq = parent->child(key_column_id, 1);
|
const QStandardItem* keyseq = parent->child(key_column_id, hotkey_column);
|
||||||
for (auto& [group, sub_actions] : registry.hotkey_groups) {
|
for (auto& [group, sub_actions] : registry.hotkey_groups) {
|
||||||
if (group != parent->text())
|
if (group != parent->text())
|
||||||
continue;
|
continue;
|
||||||
|
@ -120,6 +156,61 @@ void ConfigureHotkeys::ApplyConfiguration(HotkeyRegistry& registry) {
|
||||||
registry.SaveHotkeys();
|
registry.SaveHotkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigureHotkeys::RestoreDefaults() {
|
||||||
|
for (int r = 0; r < model->rowCount(); ++r) {
|
||||||
|
const QStandardItem* parent = model->item(r, 0);
|
||||||
|
|
||||||
|
for (int r2 = 0; r2 < parent->rowCount(); ++r2) {
|
||||||
|
model->item(r, 0)
|
||||||
|
->child(r2, hotkey_column)
|
||||||
|
->setText(Config::default_hotkeys[r2].shortcut.keyseq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureHotkeys::ClearAll() {
|
||||||
|
for (int r = 0; r < model->rowCount(); ++r) {
|
||||||
|
const QStandardItem* parent = model->item(r, 0);
|
||||||
|
|
||||||
|
for (int r2 = 0; r2 < parent->rowCount(); ++r2) {
|
||||||
|
model->item(r, 0)->child(r2, hotkey_column)->setText(QString{});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureHotkeys::PopupContextMenu(const QPoint& menu_location) {
|
||||||
|
const auto index = ui->hotkey_list->indexAt(menu_location);
|
||||||
|
if (!index.parent().isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu context_menu;
|
||||||
|
QAction* restore_default = context_menu.addAction(tr("Restore Default"));
|
||||||
|
QAction* clear = context_menu.addAction(tr("Clear"));
|
||||||
|
|
||||||
|
const auto hotkey_index = index.sibling(index.row(), hotkey_column);
|
||||||
|
connect(restore_default, &QAction::triggered,
|
||||||
|
[this, hotkey_index] { RestoreHotkey(hotkey_index); });
|
||||||
|
connect(clear, &QAction::triggered,
|
||||||
|
[this, hotkey_index] { model->setData(hotkey_index, QString{}); });
|
||||||
|
|
||||||
|
context_menu.exec(ui->hotkey_list->viewport()->mapToGlobal(menu_location));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureHotkeys::RestoreHotkey(QModelIndex index) {
|
||||||
|
const QKeySequence& default_key_sequence = QKeySequence::fromString(
|
||||||
|
Config::default_hotkeys[index.row()].shortcut.keyseq, QKeySequence::NativeText);
|
||||||
|
const auto [key_sequence_used, used_action] = IsUsedKey(default_key_sequence);
|
||||||
|
|
||||||
|
if (key_sequence_used && default_key_sequence != QKeySequence(model->data(index).toString())) {
|
||||||
|
QMessageBox::warning(
|
||||||
|
this, tr("Conflicting Key Sequence"),
|
||||||
|
tr("The default key sequence is already assigned to: %1").arg(used_action));
|
||||||
|
} else {
|
||||||
|
model->setData(index, default_key_sequence.toString(QKeySequence::NativeText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigureHotkeys::RetranslateUI() {
|
void ConfigureHotkeys::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class ConfigureHotkeys : public QWidget {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConfigureHotkeys(QWidget* parent = nullptr);
|
explicit ConfigureHotkeys(QWidget* parent = nullptr);
|
||||||
~ConfigureHotkeys();
|
~ConfigureHotkeys() override;
|
||||||
|
|
||||||
void ApplyConfiguration(HotkeyRegistry& registry);
|
void ApplyConfiguration(HotkeyRegistry& registry);
|
||||||
void RetranslateUI();
|
void RetranslateUI();
|
||||||
|
@ -41,10 +41,13 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Configure(QModelIndex index);
|
void Configure(QModelIndex index);
|
||||||
bool IsUsedKey(QKeySequence key_sequence) const;
|
std::pair<bool, QString> IsUsedKey(QKeySequence key_sequence) const;
|
||||||
QList<QKeySequence> GetUsedKeyList() const;
|
QList<QKeySequence> GetUsedKeyList() const;
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureHotkeys> ui;
|
void RestoreDefaults();
|
||||||
|
void ClearAll();
|
||||||
|
void PopupContextMenu(const QPoint& menu_location);
|
||||||
|
void RestoreHotkey(QModelIndex index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of keyboard keys currently registered to any of the 3DS inputs.
|
* List of keyboard keys currently registered to any of the 3DS inputs.
|
||||||
|
@ -53,5 +56,7 @@ private:
|
||||||
*/
|
*/
|
||||||
QList<QKeySequence> input_keys_list;
|
QList<QKeySequence> input_keys_list;
|
||||||
|
|
||||||
|
std::unique_ptr<Ui::ConfigureHotkeys> ui;
|
||||||
|
|
||||||
QStandardItemModel* model;
|
QStandardItemModel* model;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -23,6 +23,37 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_clear_all">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear All</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_restore_defaults">
|
||||||
|
<property name="text">
|
||||||
|
<string>Restore Defaults</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeView" name="hotkey_list">
|
<widget class="QTreeView" name="hotkey_list">
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
|
|
|
@ -395,9 +395,6 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
LoadConfiguration();
|
LoadConfiguration();
|
||||||
|
|
||||||
// TODO(wwylele): enable this when we actually emulate it
|
|
||||||
ui->buttonHome->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureInput::~ConfigureInput() = default;
|
ConfigureInput::~ConfigureInput() = default;
|
||||||
|
|
|
@ -17,8 +17,8 @@ void HotkeyRegistry::SaveHotkeys() {
|
||||||
for (const auto& hotkey : group.second) {
|
for (const auto& hotkey : group.second) {
|
||||||
UISettings::values.shortcuts.push_back(
|
UISettings::values.shortcuts.push_back(
|
||||||
{hotkey.first, group.first,
|
{hotkey.first, group.first,
|
||||||
UISettings::ContextualShortcut(hotkey.second.keyseq.toString(),
|
UISettings::ContextualShortcut(
|
||||||
hotkey.second.context)});
|
{hotkey.second.keyseq.toString(), hotkey.second.context})});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,10 @@ void HotkeyRegistry::LoadHotkeys() {
|
||||||
// beginGroup()
|
// beginGroup()
|
||||||
for (auto shortcut : UISettings::values.shortcuts) {
|
for (auto shortcut : UISettings::values.shortcuts) {
|
||||||
Hotkey& hk = hotkey_groups[shortcut.group][shortcut.name];
|
Hotkey& hk = hotkey_groups[shortcut.group][shortcut.name];
|
||||||
if (!shortcut.shortcut.first.isEmpty()) {
|
if (!shortcut.shortcut.keyseq.isEmpty()) {
|
||||||
hk.keyseq = QKeySequence::fromString(shortcut.shortcut.first, QKeySequence::NativeText);
|
hk.keyseq =
|
||||||
hk.context = static_cast<Qt::ShortcutContext>(shortcut.shortcut.second);
|
QKeySequence::fromString(shortcut.shortcut.keyseq, QKeySequence::NativeText);
|
||||||
|
hk.context = static_cast<Qt::ShortcutContext>(shortcut.shortcut.context);
|
||||||
}
|
}
|
||||||
if (hk.shortcut) {
|
if (hk.shortcut) {
|
||||||
hk.shortcut->disconnect();
|
hk.shortcut->disconnect();
|
||||||
|
@ -42,8 +43,9 @@ void HotkeyRegistry::LoadHotkeys() {
|
||||||
QShortcut* HotkeyRegistry::GetHotkey(const QString& group, const QString& action, QWidget* widget) {
|
QShortcut* HotkeyRegistry::GetHotkey(const QString& group, const QString& action, QWidget* widget) {
|
||||||
Hotkey& hk = hotkey_groups[group][action];
|
Hotkey& hk = hotkey_groups[group][action];
|
||||||
|
|
||||||
if (!hk.shortcut)
|
if (!hk.shortcut) {
|
||||||
hk.shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context);
|
hk.shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context);
|
||||||
|
}
|
||||||
|
|
||||||
return hk.shortcut;
|
return hk.shortcut;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ public:
|
||||||
private:
|
private:
|
||||||
struct Hotkey {
|
struct Hotkey {
|
||||||
QKeySequence keyseq;
|
QKeySequence keyseq;
|
||||||
|
QString controller_keyseq;
|
||||||
QShortcut* shortcut = nullptr;
|
QShortcut* shortcut = nullptr;
|
||||||
Qt::ShortcutContext context = Qt::WindowShortcut;
|
Qt::ShortcutContext context = Qt::WindowShortcut;
|
||||||
};
|
};
|
||||||
|
|
|
@ -473,62 +473,37 @@ void GMainWindow::InitializeHotkeys() {
|
||||||
hotkey_registry.LoadHotkeys();
|
hotkey_registry.LoadHotkeys();
|
||||||
|
|
||||||
const QString main_window = QStringLiteral("Main Window");
|
const QString main_window = QStringLiteral("Main Window");
|
||||||
const QString load_file = QStringLiteral("Load File");
|
|
||||||
const QString exit_citra = QStringLiteral("Exit Citra");
|
|
||||||
const QString stop_emulation = QStringLiteral("Stop Emulation");
|
|
||||||
const QString toggle_filter_bar = QStringLiteral("Toggle Filter Bar");
|
|
||||||
const QString toggle_status_bar = QStringLiteral("Toggle Status Bar");
|
|
||||||
const QString fullscreen = QStringLiteral("Fullscreen");
|
const QString fullscreen = QStringLiteral("Fullscreen");
|
||||||
const QString toggle_screen_layout = QStringLiteral("Toggle Screen Layout");
|
const QString toggle_screen_layout = QStringLiteral("Toggle Screen Layout");
|
||||||
const QString swap_screens = QStringLiteral("Swap Screens");
|
const QString swap_screens = QStringLiteral("Swap Screens");
|
||||||
const QString rotate_screens = QStringLiteral("Rotate Screens Upright");
|
const QString rotate_screens = QStringLiteral("Rotate Screens Upright");
|
||||||
|
|
||||||
ui->action_Show_Filter_Bar->setShortcut(
|
const auto link_action_shortcut = [&](QAction* action, const QString& action_name) {
|
||||||
hotkey_registry.GetKeySequence(main_window, toggle_filter_bar));
|
static const QString main_window = QStringLiteral("Main Window");
|
||||||
ui->action_Show_Filter_Bar->setShortcutContext(
|
action->setShortcut(hotkey_registry.GetKeySequence(main_window, action_name));
|
||||||
hotkey_registry.GetShortcutContext(main_window, toggle_filter_bar));
|
action->setShortcutContext(hotkey_registry.GetShortcutContext(main_window, action_name));
|
||||||
|
action->setAutoRepeat(false);
|
||||||
|
this->addAction(action);
|
||||||
|
};
|
||||||
|
|
||||||
ui->action_Show_Status_Bar->setShortcut(
|
link_action_shortcut(ui->action_Load_File, QStringLiteral("Load File"));
|
||||||
hotkey_registry.GetKeySequence(main_window, toggle_status_bar));
|
link_action_shortcut(ui->action_Load_Amiibo, QStringLiteral("Load Amiibo"));
|
||||||
ui->action_Show_Status_Bar->setShortcutContext(
|
link_action_shortcut(ui->action_Remove_Amiibo, QStringLiteral("Remove Amiibo"));
|
||||||
hotkey_registry.GetShortcutContext(main_window, toggle_status_bar));
|
link_action_shortcut(ui->action_Exit, QStringLiteral("Exit Citra"));
|
||||||
|
link_action_shortcut(ui->action_Restart, QStringLiteral("Restart Emulation"));
|
||||||
connect(hotkey_registry.GetHotkey(main_window, load_file, this), &QShortcut::activated,
|
link_action_shortcut(ui->action_Pause, QStringLiteral("Continue/Pause Emulation"));
|
||||||
ui->action_Load_File, &QAction::trigger);
|
link_action_shortcut(ui->action_Stop, QStringLiteral("Stop Emulation"));
|
||||||
|
link_action_shortcut(ui->action_Show_Filter_Bar, QStringLiteral("Toggle Filter Bar"));
|
||||||
connect(hotkey_registry.GetHotkey(main_window, stop_emulation, this), &QShortcut::activated,
|
link_action_shortcut(ui->action_Show_Status_Bar, QStringLiteral("Toggle Status Bar"));
|
||||||
ui->action_Stop, &QAction::trigger);
|
link_action_shortcut(ui->action_Fullscreen, fullscreen);
|
||||||
|
link_action_shortcut(ui->action_Capture_Screenshot, QStringLiteral("Capture Screenshot"));
|
||||||
connect(hotkey_registry.GetHotkey(main_window, exit_citra, this), &QShortcut::activated,
|
link_action_shortcut(ui->action_Screen_Layout_Swap_Screens, swap_screens);
|
||||||
ui->action_Exit, &QAction::trigger);
|
link_action_shortcut(ui->action_Screen_Layout_Upright_Screens, rotate_screens);
|
||||||
|
link_action_shortcut(ui->action_Enable_Frame_Advancing,
|
||||||
connect(
|
QStringLiteral("Toggle Frame Advancing"));
|
||||||
hotkey_registry.GetHotkey(main_window, QStringLiteral("Continue/Pause Emulation"), this),
|
link_action_shortcut(ui->action_Advance_Frame, QStringLiteral("Advance Frame"));
|
||||||
&QShortcut::activated, this, [&] {
|
link_action_shortcut(ui->action_Load_from_Newest_Slot, QStringLiteral("Load from Newest Slot"));
|
||||||
if (emulation_running) {
|
link_action_shortcut(ui->action_Save_to_Oldest_Slot, QStringLiteral("Save to Oldest Slot"));
|
||||||
if (emu_thread->IsRunning()) {
|
|
||||||
OnPauseGame();
|
|
||||||
} else {
|
|
||||||
OnStartGame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this),
|
|
||||||
&QShortcut::activated, this, [this] {
|
|
||||||
if (!Core::System::GetInstance().IsPoweredOn())
|
|
||||||
return;
|
|
||||||
BootGame(QString(game_path));
|
|
||||||
});
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, swap_screens, render_window),
|
|
||||||
&QShortcut::activated, ui->action_Screen_Layout_Swap_Screens, &QAction::trigger);
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, rotate_screens, render_window),
|
|
||||||
&QShortcut::activated, ui->action_Screen_Layout_Upright_Screens, &QAction::trigger);
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, toggle_screen_layout, render_window),
|
|
||||||
&QShortcut::activated, this, &GMainWindow::ToggleScreenLayout);
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window),
|
|
||||||
&QShortcut::activated, ui->action_Fullscreen, &QAction::trigger);
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window),
|
|
||||||
&QShortcut::activatedAmbiguously, ui->action_Fullscreen, &QAction::trigger);
|
|
||||||
|
|
||||||
const auto add_secondary_window_hotkey = [this](QKeySequence hotkey, const char* slot) {
|
const auto add_secondary_window_hotkey = [this](QKeySequence hotkey, const char* slot) {
|
||||||
// This action will fire specifically when secondary_window is in focus
|
// This action will fire specifically when secondary_window is in focus
|
||||||
|
@ -553,26 +528,30 @@ void GMainWindow::InitializeHotkeys() {
|
||||||
const auto rotate_screen_hotkey = hotkey_registry.GetKeySequence(main_window, rotate_screens);
|
const auto rotate_screen_hotkey = hotkey_registry.GetKeySequence(main_window, rotate_screens);
|
||||||
add_secondary_window_hotkey(rotate_screen_hotkey, SLOT(TriggerRotateScreens()));
|
add_secondary_window_hotkey(rotate_screen_hotkey, SLOT(TriggerRotateScreens()));
|
||||||
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Exit Fullscreen"), this),
|
const auto connect_shortcut = [&](const QString& action_name, const auto& function) {
|
||||||
&QShortcut::activated, this, [&] {
|
const auto* hotkey = hotkey_registry.GetHotkey(main_window, action_name, this);
|
||||||
|
connect(hotkey, &QShortcut::activated, this, function);
|
||||||
|
};
|
||||||
|
|
||||||
|
connect(hotkey_registry.GetHotkey(main_window, toggle_screen_layout, render_window),
|
||||||
|
&QShortcut::activated, this, &GMainWindow::ToggleScreenLayout);
|
||||||
|
|
||||||
|
connect_shortcut(QStringLiteral("Exit Fullscreen"), [&] {
|
||||||
if (emulation_running) {
|
if (emulation_running) {
|
||||||
ui->action_Fullscreen->setChecked(false);
|
ui->action_Fullscreen->setChecked(false);
|
||||||
ToggleFullscreen();
|
ToggleFullscreen();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Alternate Speed"), this),
|
connect_shortcut(QStringLiteral("Toggle Per-Game Speed"), [&] {
|
||||||
&QShortcut::activated, this, [&] {
|
|
||||||
Settings::values.frame_limit.SetGlobal(!Settings::values.frame_limit.UsingGlobal());
|
Settings::values.frame_limit.SetGlobal(!Settings::values.frame_limit.UsingGlobal());
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
});
|
});
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Texture Dumping"), this),
|
connect_shortcut(QStringLiteral("Toggle Texture Dumping"),
|
||||||
&QShortcut::activated, this,
|
|
||||||
[&] { Settings::values.dump_textures = !Settings::values.dump_textures; });
|
[&] { Settings::values.dump_textures = !Settings::values.dump_textures; });
|
||||||
// We use "static" here in order to avoid capturing by lambda due to a MSVC bug, which makes
|
// We use "static" here in order to avoid capturing by lambda due to a MSVC bug, which makes
|
||||||
// the variable hold a garbage value after this function exits
|
// the variable hold a garbage value after this function exits
|
||||||
static constexpr u16 SPEED_LIMIT_STEP = 5;
|
static constexpr u16 SPEED_LIMIT_STEP = 5;
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Increase Speed Limit"), this),
|
connect_shortcut(QStringLiteral("Increase Speed Limit"), [&] {
|
||||||
&QShortcut::activated, this, [&] {
|
|
||||||
if (Settings::values.frame_limit.GetValue() == 0) {
|
if (Settings::values.frame_limit.GetValue() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -584,8 +563,7 @@ void GMainWindow::InitializeHotkeys() {
|
||||||
}
|
}
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
});
|
});
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Decrease Speed Limit"), this),
|
connect_shortcut(QStringLiteral("Decrease Speed Limit"), [&] {
|
||||||
&QShortcut::activated, this, [&] {
|
|
||||||
if (Settings::values.frame_limit.GetValue() == 0) {
|
if (Settings::values.frame_limit.GetValue() == 0) {
|
||||||
Settings::values.frame_limit = 995;
|
Settings::values.frame_limit = 995;
|
||||||
} else if (Settings::values.frame_limit.GetValue() > SPEED_LIMIT_STEP) {
|
} else if (Settings::values.frame_limit.GetValue() > SPEED_LIMIT_STEP) {
|
||||||
|
@ -595,34 +573,7 @@ void GMainWindow::InitializeHotkeys() {
|
||||||
}
|
}
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
});
|
});
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Frame Advancing"), this),
|
connect_shortcut(QStringLiteral("Mute Audio"),
|
||||||
&QShortcut::activated, ui->action_Enable_Frame_Advancing, &QAction::trigger);
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Advance Frame"), this),
|
|
||||||
&QShortcut::activated, ui->action_Advance_Frame, &QAction::trigger);
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load Amiibo"), this),
|
|
||||||
&QShortcut::activated, this, [&] {
|
|
||||||
if (ui->action_Load_Amiibo->isEnabled()) {
|
|
||||||
OnLoadAmiibo();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Remove Amiibo"), this),
|
|
||||||
&QShortcut::activated, this, [&] {
|
|
||||||
if (ui->action_Remove_Amiibo->isEnabled()) {
|
|
||||||
OnRemoveAmiibo();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Capture Screenshot"), this),
|
|
||||||
&QShortcut::activated, this, [&] {
|
|
||||||
if (ui->action_Capture_Screenshot->isEnabled()) {
|
|
||||||
OnCaptureScreenshot();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load from Newest Slot"), this),
|
|
||||||
&QShortcut::activated, ui->action_Load_from_Newest_Slot, &QAction::trigger);
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Save to Oldest Slot"), this),
|
|
||||||
&QShortcut::activated, ui->action_Save_to_Oldest_Slot, &QAction::trigger);
|
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this),
|
|
||||||
&QShortcut::activated, this,
|
|
||||||
[] { Settings::values.audio_muted = !Settings::values.audio_muted; });
|
[] { Settings::values.audio_muted = !Settings::values.audio_muted; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,7 +637,8 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
|
||||||
(state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
|
(state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
|
||||||
auto_paused = true;
|
auto_paused = true;
|
||||||
OnPauseGame();
|
OnPauseGame();
|
||||||
} else if (ui->action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
|
} else if (emulation_running && !emu_thread->IsRunning() && auto_paused &&
|
||||||
|
state == Qt::ApplicationActive) {
|
||||||
auto_paused = false;
|
auto_paused = false;
|
||||||
OnStartGame();
|
OnStartGame();
|
||||||
}
|
}
|
||||||
|
@ -728,32 +680,34 @@ void GMainWindow::ConnectWidgetEvents() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::ConnectMenuEvents() {
|
void GMainWindow::ConnectMenuEvents() {
|
||||||
|
const auto connect_menu = [&](QAction* action, const auto& event_fn) {
|
||||||
|
connect(action, &QAction::triggered, this, event_fn);
|
||||||
|
// Add actions to this window so that hiding menus in fullscreen won't disable them
|
||||||
|
addAction(action);
|
||||||
|
// Add actions to the render window so that they work outside of single window mode
|
||||||
|
render_window->addAction(action);
|
||||||
|
};
|
||||||
|
|
||||||
// File
|
// File
|
||||||
connect(ui->action_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile);
|
connect_menu(ui->action_Load_File, &GMainWindow::OnMenuLoadFile);
|
||||||
connect(ui->action_Install_CIA, &QAction::triggered, this, &GMainWindow::OnMenuInstallCIA);
|
connect_menu(ui->action_Install_CIA, &GMainWindow::OnMenuInstallCIA);
|
||||||
connect(ui->action_Exit, &QAction::triggered, this, &QMainWindow::close);
|
connect_menu(ui->action_Exit, &QMainWindow::close);
|
||||||
connect(ui->action_Load_Amiibo, &QAction::triggered, this, &GMainWindow::OnLoadAmiibo);
|
connect_menu(ui->action_Load_Amiibo, &GMainWindow::OnLoadAmiibo);
|
||||||
connect(ui->action_Remove_Amiibo, &QAction::triggered, this, &GMainWindow::OnRemoveAmiibo);
|
connect_menu(ui->action_Remove_Amiibo, &GMainWindow::OnRemoveAmiibo);
|
||||||
|
|
||||||
// Emulation
|
// Emulation
|
||||||
connect(ui->action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame);
|
connect_menu(ui->action_Pause, &GMainWindow::OnPauseContinueGame);
|
||||||
connect(ui->action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame);
|
connect_menu(ui->action_Stop, &GMainWindow::OnStopGame);
|
||||||
connect(ui->action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame);
|
connect_menu(ui->action_Restart, [this] { BootGame(QString(game_path)); });
|
||||||
connect(ui->action_Restart, &QAction::triggered, this,
|
connect_menu(ui->action_Report_Compatibility, &GMainWindow::OnMenuReportCompatibility);
|
||||||
[this] { BootGame(QString(game_path)); });
|
connect_menu(ui->action_Configure, &GMainWindow::OnConfigure);
|
||||||
connect(ui->action_Report_Compatibility, &QAction::triggered, this,
|
connect_menu(ui->action_Configure_Current_Game, &GMainWindow::OnConfigurePerGame);
|
||||||
&GMainWindow::OnMenuReportCompatibility);
|
connect_menu(ui->action_Cheats, &GMainWindow::OnCheats);
|
||||||
connect(ui->action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure);
|
|
||||||
connect(ui->action_Configure_Current_Game, &QAction::triggered, this,
|
|
||||||
&GMainWindow::OnConfigurePerGame);
|
|
||||||
connect(ui->action_Cheats, &QAction::triggered, this, &GMainWindow::OnCheats);
|
|
||||||
|
|
||||||
// View
|
// View
|
||||||
connect(ui->action_Single_Window_Mode, &QAction::triggered, this,
|
connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode);
|
||||||
&GMainWindow::ToggleWindowMode);
|
connect_menu(ui->action_Display_Dock_Widget_Headers, &GMainWindow::OnDisplayTitleBars);
|
||||||
connect(ui->action_Display_Dock_Widget_Headers, &QAction::triggered, this,
|
connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar);
|
||||||
&GMainWindow::OnDisplayTitleBars);
|
|
||||||
connect(ui->action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
|
|
||||||
connect(ui->action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
|
connect(ui->action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
|
||||||
|
|
||||||
// Multiplayer
|
// Multiplayer
|
||||||
|
@ -768,64 +722,41 @@ void GMainWindow::ConnectMenuEvents() {
|
||||||
connect(ui->action_Show_Room, &QAction::triggered, multiplayer_state,
|
connect(ui->action_Show_Room, &QAction::triggered, multiplayer_state,
|
||||||
&MultiplayerState::OnOpenNetworkRoom);
|
&MultiplayerState::OnOpenNetworkRoom);
|
||||||
|
|
||||||
ui->action_Fullscreen->setShortcut(
|
connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen);
|
||||||
hotkey_registry
|
connect_menu(ui->action_Screen_Layout_Default, &GMainWindow::ChangeScreenLayout);
|
||||||
.GetHotkey(QStringLiteral("Main Window"), QStringLiteral("Fullscreen"), this)
|
connect_menu(ui->action_Screen_Layout_Single_Screen, &GMainWindow::ChangeScreenLayout);
|
||||||
->key());
|
connect_menu(ui->action_Screen_Layout_Large_Screen, &GMainWindow::ChangeScreenLayout);
|
||||||
ui->action_Screen_Layout_Swap_Screens->setShortcut(
|
connect_menu(ui->action_Screen_Layout_Side_by_Side, &GMainWindow::ChangeScreenLayout);
|
||||||
hotkey_registry
|
connect_menu(ui->action_Screen_Layout_Separate_Windows, &GMainWindow::ChangeScreenLayout);
|
||||||
.GetHotkey(QStringLiteral("Main Window"), QStringLiteral("Swap Screens"), this)
|
connect_menu(ui->action_Screen_Layout_Swap_Screens, &GMainWindow::OnSwapScreens);
|
||||||
->key());
|
connect_menu(ui->action_Screen_Layout_Upright_Screens, &GMainWindow::OnRotateScreens);
|
||||||
ui->action_Screen_Layout_Swap_Screens->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
|
||||||
ui->action_Screen_Layout_Upright_Screens->setShortcut(
|
|
||||||
hotkey_registry
|
|
||||||
.GetHotkey(QStringLiteral("Main Window"), QStringLiteral("Rotate Screens Upright"),
|
|
||||||
this)
|
|
||||||
->key());
|
|
||||||
ui->action_Screen_Layout_Upright_Screens->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
|
||||||
connect(ui->action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
|
|
||||||
connect(ui->action_Screen_Layout_Default, &QAction::triggered, this,
|
|
||||||
&GMainWindow::ChangeScreenLayout);
|
|
||||||
connect(ui->action_Screen_Layout_Single_Screen, &QAction::triggered, this,
|
|
||||||
&GMainWindow::ChangeScreenLayout);
|
|
||||||
connect(ui->action_Screen_Layout_Large_Screen, &QAction::triggered, this,
|
|
||||||
&GMainWindow::ChangeScreenLayout);
|
|
||||||
connect(ui->action_Screen_Layout_Side_by_Side, &QAction::triggered, this,
|
|
||||||
&GMainWindow::ChangeScreenLayout);
|
|
||||||
connect(ui->action_Screen_Layout_Separate_Windows, &QAction::triggered, this,
|
|
||||||
&GMainWindow::ChangeScreenLayout);
|
|
||||||
connect(ui->action_Screen_Layout_Swap_Screens, &QAction::triggered, this,
|
|
||||||
&GMainWindow::OnSwapScreens);
|
|
||||||
connect(ui->action_Screen_Layout_Upright_Screens, &QAction::triggered, this,
|
|
||||||
&GMainWindow::OnRotateScreens);
|
|
||||||
|
|
||||||
// Movie
|
// Movie
|
||||||
connect(ui->action_Record_Movie, &QAction::triggered, this, &GMainWindow::OnRecordMovie);
|
connect_menu(ui->action_Record_Movie, &GMainWindow::OnRecordMovie);
|
||||||
connect(ui->action_Play_Movie, &QAction::triggered, this, &GMainWindow::OnPlayMovie);
|
connect_menu(ui->action_Play_Movie, &GMainWindow::OnPlayMovie);
|
||||||
connect(ui->action_Close_Movie, &QAction::triggered, this, &GMainWindow::OnCloseMovie);
|
connect_menu(ui->action_Close_Movie, &GMainWindow::OnCloseMovie);
|
||||||
connect(ui->action_Save_Movie, &QAction::triggered, this, &GMainWindow::OnSaveMovie);
|
connect_menu(ui->action_Save_Movie, &GMainWindow::OnSaveMovie);
|
||||||
connect(ui->action_Movie_Read_Only_Mode, &QAction::toggled, this,
|
connect_menu(ui->action_Movie_Read_Only_Mode,
|
||||||
[](bool checked) { Core::Movie::GetInstance().SetReadOnly(checked); });
|
[](bool checked) { Core::Movie::GetInstance().SetReadOnly(checked); });
|
||||||
connect(ui->action_Enable_Frame_Advancing, &QAction::triggered, this, [this] {
|
connect_menu(ui->action_Enable_Frame_Advancing, [this] {
|
||||||
if (emulation_running) {
|
if (emulation_running) {
|
||||||
Core::System::GetInstance().frame_limiter.SetFrameAdvancing(
|
Core::System::GetInstance().frame_limiter.SetFrameAdvancing(
|
||||||
ui->action_Enable_Frame_Advancing->isChecked());
|
ui->action_Enable_Frame_Advancing->isChecked());
|
||||||
ui->action_Advance_Frame->setEnabled(ui->action_Enable_Frame_Advancing->isChecked());
|
ui->action_Advance_Frame->setEnabled(ui->action_Enable_Frame_Advancing->isChecked());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(ui->action_Advance_Frame, &QAction::triggered, this, [this] {
|
connect_menu(ui->action_Advance_Frame, [this] {
|
||||||
if (emulation_running) {
|
auto& system = Core::System::GetInstance();
|
||||||
|
if (emulation_running && system.frame_limiter.IsFrameAdvancing()) {
|
||||||
ui->action_Enable_Frame_Advancing->setChecked(true);
|
ui->action_Enable_Frame_Advancing->setChecked(true);
|
||||||
ui->action_Advance_Frame->setEnabled(true);
|
ui->action_Advance_Frame->setEnabled(true);
|
||||||
Core::System::GetInstance().frame_limiter.SetFrameAdvancing(true);
|
system.frame_limiter.AdvanceFrame();
|
||||||
Core::System::GetInstance().frame_limiter.AdvanceFrame();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(ui->action_Capture_Screenshot, &QAction::triggered, this,
|
connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot);
|
||||||
&GMainWindow::OnCaptureScreenshot);
|
|
||||||
|
|
||||||
#ifdef ENABLE_FFMPEG_VIDEO_DUMPER
|
#ifdef ENABLE_FFMPEG_VIDEO_DUMPER
|
||||||
connect(ui->action_Dump_Video, &QAction::triggered, [this] {
|
connect_menu(ui->action_Dump_Video, [this] {
|
||||||
if (ui->action_Dump_Video->isChecked()) {
|
if (ui->action_Dump_Video->isChecked()) {
|
||||||
OnStartVideoDumping();
|
OnStartVideoDumping();
|
||||||
} else {
|
} else {
|
||||||
|
@ -837,16 +768,41 @@ void GMainWindow::ConnectMenuEvents() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Help
|
// Help
|
||||||
connect(ui->action_Open_Citra_Folder, &QAction::triggered, this,
|
connect_menu(ui->action_Open_Citra_Folder, &GMainWindow::OnOpenCitraFolder);
|
||||||
&GMainWindow::OnOpenCitraFolder);
|
connect_menu(ui->action_FAQ, []() {
|
||||||
connect(ui->action_FAQ, &QAction::triggered, []() {
|
|
||||||
QDesktopServices::openUrl(QUrl(QStringLiteral("https://citra-emu.org/wiki/faq/")));
|
QDesktopServices::openUrl(QUrl(QStringLiteral("https://citra-emu.org/wiki/faq/")));
|
||||||
});
|
});
|
||||||
connect(ui->action_About, &QAction::triggered, this, &GMainWindow::OnMenuAboutCitra);
|
connect_menu(ui->action_About, &GMainWindow::OnMenuAboutCitra);
|
||||||
connect(ui->action_Check_For_Updates, &QAction::triggered, this,
|
connect_menu(ui->action_Check_For_Updates, &GMainWindow::OnCheckForUpdates);
|
||||||
&GMainWindow::OnCheckForUpdates);
|
connect_menu(ui->action_Open_Maintenance_Tool, &GMainWindow::OnOpenUpdater);
|
||||||
connect(ui->action_Open_Maintenance_Tool, &QAction::triggered, this,
|
}
|
||||||
&GMainWindow::OnOpenUpdater);
|
|
||||||
|
void GMainWindow::UpdateMenuState() {
|
||||||
|
const bool is_paused = emu_thread == nullptr || !emu_thread->IsRunning();
|
||||||
|
|
||||||
|
const std::array running_actions{
|
||||||
|
ui->action_Stop,
|
||||||
|
ui->action_Restart,
|
||||||
|
ui->action_Configure_Current_Game,
|
||||||
|
ui->action_Report_Compatibility,
|
||||||
|
ui->action_Load_Amiibo,
|
||||||
|
ui->action_Remove_Amiibo,
|
||||||
|
ui->action_Pause,
|
||||||
|
ui->action_Cheats,
|
||||||
|
ui->action_Advance_Frame,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (QAction* action : running_actions) {
|
||||||
|
action->setEnabled(emulation_running);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->action_Capture_Screenshot->setEnabled(emulation_running && !is_paused);
|
||||||
|
|
||||||
|
if (emulation_running && is_paused) {
|
||||||
|
ui->action_Pause->setText(tr("&Continue"));
|
||||||
|
} else {
|
||||||
|
ui->action_Pause->setText(tr("&Pause"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnDisplayTitleBars(bool show) {
|
void GMainWindow::OnDisplayTitleBars(bool show) {
|
||||||
|
@ -1247,27 +1203,16 @@ void GMainWindow::ShutdownGame() {
|
||||||
disconnect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
|
disconnect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
|
||||||
disconnect(secondary_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
|
disconnect(secondary_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
|
||||||
|
|
||||||
// Update the GUI
|
|
||||||
ui->action_Start->setEnabled(false);
|
|
||||||
ui->action_Start->setText(tr("Start"));
|
|
||||||
ui->action_Pause->setEnabled(false);
|
|
||||||
ui->action_Stop->setEnabled(false);
|
|
||||||
ui->action_Restart->setEnabled(false);
|
|
||||||
ui->action_Cheats->setEnabled(false);
|
|
||||||
ui->action_Configure_Current_Game->setEnabled(false);
|
|
||||||
ui->action_Load_Amiibo->setEnabled(false);
|
|
||||||
ui->action_Remove_Amiibo->setEnabled(false);
|
|
||||||
ui->action_Report_Compatibility->setEnabled(false);
|
|
||||||
ui->action_Advance_Frame->setEnabled(false);
|
|
||||||
ui->action_Capture_Screenshot->setEnabled(false);
|
|
||||||
render_window->hide();
|
render_window->hide();
|
||||||
secondary_window->hide();
|
secondary_window->hide();
|
||||||
loading_screen->hide();
|
loading_screen->hide();
|
||||||
loading_screen->Clear();
|
loading_screen->Clear();
|
||||||
if (game_list->IsEmpty())
|
|
||||||
|
if (game_list->IsEmpty()) {
|
||||||
game_list_placeholder->show();
|
game_list_placeholder->show();
|
||||||
else
|
} else {
|
||||||
game_list->show();
|
game_list->show();
|
||||||
|
}
|
||||||
game_list->SetFilterFocus();
|
game_list->SetFilterFocus();
|
||||||
|
|
||||||
setMouseTracking(false);
|
setMouseTracking(false);
|
||||||
|
@ -1293,6 +1238,9 @@ void GMainWindow::ShutdownGame() {
|
||||||
|
|
||||||
game_path.clear();
|
game_path.clear();
|
||||||
|
|
||||||
|
// Update the GUI
|
||||||
|
UpdateMenuState();
|
||||||
|
|
||||||
// When closing the game, destroy the GLWindow to clear the context after the game is closed
|
// When closing the game, destroy the GLWindow to clear the context after the game is closed
|
||||||
render_window->ReleaseRenderTarget();
|
render_window->ReleaseRenderTarget();
|
||||||
secondary_window->ReleaseRenderTarget();
|
secondary_window->ReleaseRenderTarget();
|
||||||
|
@ -1595,9 +1543,12 @@ void GMainWindow::OnMenuInstallCIA() {
|
||||||
QStringList filepaths = QFileDialog::getOpenFileNames(
|
QStringList filepaths = QFileDialog::getOpenFileNames(
|
||||||
this, tr("Load Files"), UISettings::values.roms_path,
|
this, tr("Load Files"), UISettings::values.roms_path,
|
||||||
tr("3DS Installation File (*.CIA*)") + QStringLiteral(";;") + tr("All Files (*.*)"));
|
tr("3DS Installation File (*.CIA*)") + QStringLiteral(";;") + tr("All Files (*.*)"));
|
||||||
if (filepaths.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
if (filepaths.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UISettings::values.roms_path = QFileInfo(filepaths[0]).path();
|
||||||
InstallCIA(filepaths);
|
InstallCIA(filepaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1692,34 +1643,40 @@ void GMainWindow::OnStartGame() {
|
||||||
qRegisterMetaType<std::string>("std::string");
|
qRegisterMetaType<std::string>("std::string");
|
||||||
connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError);
|
connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError);
|
||||||
|
|
||||||
ui->action_Start->setEnabled(false);
|
UpdateMenuState();
|
||||||
ui->action_Start->setText(tr("Continue"));
|
|
||||||
|
|
||||||
ui->action_Pause->setEnabled(true);
|
|
||||||
ui->action_Stop->setEnabled(true);
|
|
||||||
ui->action_Restart->setEnabled(true);
|
|
||||||
ui->action_Cheats->setEnabled(true);
|
|
||||||
ui->action_Configure_Current_Game->setEnabled(true);
|
|
||||||
ui->action_Load_Amiibo->setEnabled(true);
|
|
||||||
ui->action_Report_Compatibility->setEnabled(true);
|
|
||||||
ui->action_Capture_Screenshot->setEnabled(true);
|
|
||||||
|
|
||||||
discord_rpc->Update();
|
discord_rpc->Update();
|
||||||
|
|
||||||
UpdateSaveStates();
|
UpdateSaveStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::OnRestartGame() {
|
||||||
|
Core::System& system = Core::System::GetInstance();
|
||||||
|
if (!system.IsPoweredOn()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Make a copy since BootGame edits game_path
|
||||||
|
BootGame(QString(game_path));
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnPauseGame() {
|
void GMainWindow::OnPauseGame() {
|
||||||
emu_thread->SetRunning(false);
|
emu_thread->SetRunning(false);
|
||||||
Camera::QtMultimediaCameraHandler::StopCameras();
|
Camera::QtMultimediaCameraHandler::StopCameras();
|
||||||
ui->action_Start->setEnabled(true);
|
|
||||||
ui->action_Pause->setEnabled(false);
|
|
||||||
ui->action_Stop->setEnabled(true);
|
|
||||||
ui->action_Capture_Screenshot->setEnabled(false);
|
|
||||||
|
|
||||||
|
UpdateMenuState();
|
||||||
AllowOSSleep();
|
AllowOSSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::OnPauseContinueGame() {
|
||||||
|
if (emulation_running) {
|
||||||
|
if (emu_thread->IsRunning()) {
|
||||||
|
OnPauseGame();
|
||||||
|
} else {
|
||||||
|
OnStartGame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnStopGame() {
|
void GMainWindow::OnStopGame() {
|
||||||
ShutdownGame();
|
ShutdownGame();
|
||||||
Settings::RestoreGlobalState(false);
|
Settings::RestoreGlobalState(false);
|
||||||
|
@ -1951,6 +1908,10 @@ void GMainWindow::OnConfigure() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnLoadAmiibo() {
|
void GMainWindow::OnLoadAmiibo() {
|
||||||
|
if (emu_thread == nullptr || !emu_thread->IsRunning()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QString extensions{QStringLiteral("*.bin")};
|
const QString extensions{QStringLiteral("*.bin")};
|
||||||
const QString file_filter = tr("Amiibo File (%1);; All Files (*.*)").arg(extensions);
|
const QString file_filter = tr("Amiibo File (%1);; All Files (*.*)").arg(extensions);
|
||||||
const QString filename = QFileDialog::getOpenFileName(this, tr("Load Amiibo"), {}, file_filter);
|
const QString filename = QFileDialog::getOpenFileName(this, tr("Load Amiibo"), {}, file_filter);
|
||||||
|
@ -2105,6 +2066,10 @@ void GMainWindow::OnSaveMovie() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnCaptureScreenshot() {
|
void GMainWindow::OnCaptureScreenshot() {
|
||||||
|
if (emu_thread == nullptr || !emu_thread->IsRunning()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
OnPauseGame();
|
OnPauseGame();
|
||||||
std::string path = UISettings::values.screenshot_path.GetValue();
|
std::string path = UISettings::values.screenshot_path.GetValue();
|
||||||
if (!FileUtil::IsDirectory(path)) {
|
if (!FileUtil::IsDirectory(path)) {
|
||||||
|
@ -2509,9 +2474,6 @@ void GMainWindow::OnLanguageChanged(const QString& locale) {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
RetranslateStatusBar();
|
RetranslateStatusBar();
|
||||||
UpdateWindowTitle();
|
UpdateWindowTitle();
|
||||||
|
|
||||||
if (emulation_running)
|
|
||||||
ui->action_Start->setText(tr("Continue"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnConfigurePerGame() {
|
void GMainWindow::OnConfigurePerGame() {
|
||||||
|
|
|
@ -119,6 +119,7 @@ private:
|
||||||
|
|
||||||
void ConnectWidgetEvents();
|
void ConnectWidgetEvents();
|
||||||
void ConnectMenuEvents();
|
void ConnectMenuEvents();
|
||||||
|
void UpdateMenuState();
|
||||||
|
|
||||||
void PreventOSSleep();
|
void PreventOSSleep();
|
||||||
void AllowOSSleep();
|
void AllowOSSleep();
|
||||||
|
@ -169,7 +170,9 @@ private:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void OnStartGame();
|
void OnStartGame();
|
||||||
|
void OnRestartGame();
|
||||||
void OnPauseGame();
|
void OnPauseGame();
|
||||||
|
void OnPauseContinueGame();
|
||||||
void OnStopGame();
|
void OnStopGame();
|
||||||
void OnSaveState();
|
void OnSaveState();
|
||||||
void OnLoadState();
|
void OnLoadState();
|
||||||
|
|
|
@ -93,7 +93,6 @@
|
||||||
<addaction name="action_Load_from_Newest_Slot"/>
|
<addaction name="action_Load_from_Newest_Slot"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="action_Start"/>
|
|
||||||
<addaction name="action_Pause"/>
|
<addaction name="action_Pause"/>
|
||||||
<addaction name="action_Stop"/>
|
<addaction name="action_Stop"/>
|
||||||
<addaction name="action_Restart"/>
|
<addaction name="action_Restart"/>
|
||||||
|
@ -215,14 +214,6 @@
|
||||||
<string>E&xit</string>
|
<string>E&xit</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_Start">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Start</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="action_Pause">
|
<action name="action_Pause">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|
|
@ -17,7 +17,10 @@
|
||||||
|
|
||||||
namespace UISettings {
|
namespace UISettings {
|
||||||
|
|
||||||
using ContextualShortcut = std::pair<QString, int>;
|
struct ContextualShortcut {
|
||||||
|
QString keyseq;
|
||||||
|
int context;
|
||||||
|
};
|
||||||
|
|
||||||
struct Shortcut {
|
struct Shortcut {
|
||||||
QString name;
|
QString name;
|
||||||
|
|
Loading…
Reference in a new issue