summaryrefslogtreecommitdiff
path: root/src/yuzu/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r--src/yuzu/main.cpp39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index ef92c25bc..0ba7c07cc 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -850,6 +850,16 @@ void GMainWindow::InitializeHotkeys() {
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this),
&QShortcut::activated, this,
[] { Settings::values.audio_muted = !Settings::values.audio_muted; });
+
+ connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Mouse Panning"), this),
+ &QShortcut::activated, this, [&] {
+ Settings::values.mouse_panning = !Settings::values.mouse_panning;
+ if (UISettings::values.hide_mouse || Settings::values.mouse_panning) {
+ mouse_hide_timer.start();
+ render_window->installEventFilter(render_window);
+ render_window->setAttribute(Qt::WA_Hover, true);
+ }
+ });
}
void GMainWindow::SetDefaultUIGeometry() {
@@ -1197,7 +1207,7 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index) {
multicore_status_button->setDisabled(true);
renderer_status_button->setDisabled(true);
- if (UISettings::values.hide_mouse) {
+ if (UISettings::values.hide_mouse || Settings::values.mouse_panning) {
mouse_hide_timer.start();
render_window->installEventFilter(render_window);
render_window->setAttribute(Qt::WA_Hover, true);
@@ -2359,7 +2369,7 @@ void GMainWindow::OnConfigure() {
config->Save();
- if (UISettings::values.hide_mouse && emulation_running) {
+ if ((UISettings::values.hide_mouse || Settings::values.mouse_panning) && emulation_running) {
render_window->installEventFilter(render_window);
render_window->setAttribute(Qt::WA_Hover, true);
mouse_hide_timer.start();
@@ -2480,6 +2490,11 @@ void GMainWindow::OnCaptureScreenshot() {
.arg(title_id, 16, 16, QLatin1Char{'0'})
.arg(date);
+ if (!Common::FS::CreateDir(screenshot_path.toStdString())) {
+ OnStartGame();
+ return;
+ }
+
#ifdef _WIN32
if (UISettings::values.enable_screenshot_save_as) {
filename = QFileDialog::getSaveFileName(this, tr("Capture Screenshot"), filename,
@@ -2600,7 +2615,8 @@ void GMainWindow::UpdateUISettings() {
}
void GMainWindow::HideMouseCursor() {
- if (emu_thread == nullptr || UISettings::values.hide_mouse == false) {
+ if (emu_thread == nullptr ||
+ (!UISettings::values.hide_mouse && !Settings::values.mouse_panning)) {
mouse_hide_timer.stop();
ShowMouseCursor();
return;
@@ -2610,13 +2626,16 @@ void GMainWindow::HideMouseCursor() {
void GMainWindow::ShowMouseCursor() {
render_window->unsetCursor();
- if (emu_thread != nullptr && UISettings::values.hide_mouse) {
+ if (emu_thread != nullptr &&
+ (UISettings::values.hide_mouse || Settings::values.mouse_panning)) {
mouse_hide_timer.start();
}
}
void GMainWindow::OnMouseActivity() {
- ShowMouseCursor();
+ if (!Settings::values.mouse_panning) {
+ ShowMouseCursor();
+ }
}
void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
@@ -2751,7 +2770,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
.arg(errors));
}
- QProgressDialog prog;
+ QProgressDialog prog(this);
prog.setRange(0, 0);
prog.setLabelText(tr("Deriving keys...\nThis may take up to a minute depending \non your "
"system's performance."));
@@ -2933,7 +2952,7 @@ void GMainWindow::filterBarSetChecked(bool state) {
}
void GMainWindow::UpdateUITheme() {
- const QString default_icons = QStringLiteral(":/icons/default");
+ const QString default_icons = QStringLiteral("default");
const QString& current_theme = UISettings::values.theme;
const bool is_default_theme = current_theme == QString::fromUtf8(UISettings::themes[0].second);
QStringList theme_paths(default_theme_paths);
@@ -2949,7 +2968,6 @@ void GMainWindow::UpdateUITheme() {
qApp->setStyleSheet({});
setStyleSheet({});
}
- theme_paths.append(default_icons);
QIcon::setThemeName(default_icons);
} else {
const QString theme_uri(QLatin1Char{':'} + current_theme + QStringLiteral("/style.qss"));
@@ -2961,10 +2979,7 @@ void GMainWindow::UpdateUITheme() {
} else {
LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
}
-
- const QString theme_name = QStringLiteral(":/icons/") + current_theme;
- theme_paths.append({default_icons, theme_name});
- QIcon::setThemeName(theme_name);
+ QIcon::setThemeName(current_theme);
}
QIcon::setThemeSearchPaths(theme_paths);