diff --git a/CHANGES b/CHANGES index 19834384d..66339a6c7 100644 --- a/CHANGES +++ b/CHANGES @@ -119,6 +119,7 @@ Misc: - Qt: Discard additional frame draws if waiting fails - Qt: Unify monospace font usage - Qt: Add button to jump to log settings + - Qt: Use relative paths in portable mode when applicable (fixes mgba.io/i/838) - SDL: Fall back to sw blit if OpenGL init fails - Util: Reset vector size on deinit - VFS: Change semantics of VFile.sync on mapped files (fixes mgba.io/i/1730) diff --git a/src/platform/qt/SettingsView.cpp b/src/platform/qt/SettingsView.cpp index bf20829c4..c750efb4e 100644 --- a/src/platform/qt/SettingsView.cpp +++ b/src/platform/qt/SettingsView.cpp @@ -85,11 +85,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC } }); connect(m_ui.savegameBrowse, &QAbstractButton::pressed, [this] () { - QString path = GBAApp::app()->getOpenDirectoryName(this, "Select directory"); - if (!path.isNull()) { - m_ui.savegameSameDir->setChecked(false); - m_ui.savegamePath->setText(path); - } + selectPath(m_ui.savegamePath, m_ui.savegameSameDir); }); if (m_ui.savestatePath->text().isEmpty()) { @@ -101,11 +97,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC } }); connect(m_ui.savestateBrowse, &QAbstractButton::pressed, [this] () { - QString path = GBAApp::app()->getOpenDirectoryName(this, "Select directory"); - if (!path.isNull()) { - m_ui.savestateSameDir->setChecked(false); - m_ui.savestatePath->setText(path); - } + selectPath(m_ui.savestatePath, m_ui.savestateSameDir); }); if (m_ui.screenshotPath->text().isEmpty()) { @@ -117,11 +109,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC } }); connect(m_ui.screenshotBrowse, &QAbstractButton::pressed, [this] () { - QString path = GBAApp::app()->getOpenDirectoryName(this, "Select directory"); - if (!path.isNull()) { - m_ui.screenshotSameDir->setChecked(false); - m_ui.screenshotPath->setText(path); - } + selectPath(m_ui.screenshotPath, m_ui.screenshotSameDir); }); if (m_ui.patchPath->text().isEmpty()) { @@ -133,11 +121,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC } }); connect(m_ui.patchBrowse, &QAbstractButton::pressed, [this] () { - QString path = GBAApp::app()->getOpenDirectoryName(this, "Select directory"); - if (!path.isNull()) { - m_ui.patchSameDir->setChecked(false); - m_ui.patchPath->setText(path); - } + selectPath(m_ui.patchPath, m_ui.patchSameDir); }); if (m_ui.cheatsPath->text().isEmpty()) { @@ -149,11 +133,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC } }); connect(m_ui.cheatsBrowse, &QAbstractButton::pressed, [this] () { - QString path = GBAApp::app()->getOpenDirectoryName(this, "Select directory"); - if (!path.isNull()) { - m_ui.cheatsSameDir->setChecked(false); - m_ui.cheatsPath->setText(path); - } + selectPath(m_ui.cheatsPath, m_ui.cheatsSameDir); }); connect(m_ui.clearCache, &QAbstractButton::pressed, this, &SettingsView::libraryCleared); @@ -372,10 +352,29 @@ void SettingsView::selectPage(SettingsView::Page page) { m_ui.tabs->setCurrentRow(m_pageIndex[page]); } +QString SettingsView::makePortablePath(const QString& path) { + if (m_controller->isPortable()) { + QDir configDir(m_controller->configDir()); + QFileInfo pathInfo(path); + if (pathInfo.canonicalPath() == configDir.canonicalPath()) { + return configDir.relativeFilePath(pathInfo.canonicalFilePath()); + } + } + return path; +} + void SettingsView::selectBios(QLineEdit* bios) { QString filename = GBAApp::app()->getOpenFileName(this, tr("Select BIOS")); if (!filename.isEmpty()) { - bios->setText(filename); + bios->setText(makePortablePath(filename)); + } +} + +void SettingsView::selectPath(QLineEdit* field, QCheckBox* sameDir) { + QString path = GBAApp::app()->getOpenDirectoryName(this, tr("Select directory")); + if (!path.isNull()) { + sameDir->setChecked(false); + field->setText(makePortablePath(path)); } } diff --git a/src/platform/qt/SettingsView.h b/src/platform/qt/SettingsView.h index 40eddd844..880db5f14 100644 --- a/src/platform/qt/SettingsView.h +++ b/src/platform/qt/SettingsView.h @@ -66,6 +66,7 @@ public slots: private slots: void selectBios(QLineEdit*); + void selectPath(QLineEdit*, QCheckBox*); void updateConfig(); void reloadConfig(); @@ -84,6 +85,8 @@ private: QMap m_pageIndex; + QString makePortablePath(const QString& path); + void addPage(const QString& name, QWidget* view, Page index); void saveSetting(const char* key, const QAbstractButton*); diff --git a/src/platform/qt/ts/mgba-de.ts b/src/platform/qt/ts/mgba-de.ts index 7413048c5..930c01af7 100644 --- a/src/platform/qt/ts/mgba-de.ts +++ b/src/platform/qt/ts/mgba-de.ts @@ -3724,64 +3724,69 @@ Game Boy Advance ist ein eingetragenes Warenzeichen von Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia Qt Multimedia - + SDL SDL - + Software (Qt) Software (Qt) - + OpenGL OpenGL - + OpenGL (force version 1.x) OpenGL (erzwinge Version 1.x) - + None (Still Image) Keiner (Standbild) - + Keyboard Tastatur - + Controllers Gamepads - + Shortcuts Tastenkürzel - - + + Shaders Shader - + Select BIOS BIOS auswählen - + + Select directory + + + + (%1×%2) (%1×%2) diff --git a/src/platform/qt/ts/mgba-en.ts b/src/platform/qt/ts/mgba-en.ts index 8e25ad4d0..dc53acb0a 100644 --- a/src/platform/qt/ts/mgba-en.ts +++ b/src/platform/qt/ts/mgba-en.ts @@ -3723,64 +3723,69 @@ Game Boy Advance is a registered trademark of Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia - + SDL - + Software (Qt) - + OpenGL - + OpenGL (force version 1.x) - + None (Still Image) - + Keyboard - + Controllers - + Shortcuts - - + + Shaders - + Select BIOS - + + Select directory + + + + (%1×%2) diff --git a/src/platform/qt/ts/mgba-es.ts b/src/platform/qt/ts/mgba-es.ts index 54ab059f6..f28e12c20 100644 --- a/src/platform/qt/ts/mgba-es.ts +++ b/src/platform/qt/ts/mgba-es.ts @@ -3724,64 +3724,69 @@ Game Boy Advance es una marca registrada de Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia Qt Multimedia - + SDL SDL - + Software (Qt) Software (Qt) - + OpenGL OpenGL - + OpenGL (force version 1.x) OpenGL (forzar versión 1.x) - + None (Still Image) Nada (imagen estática) - + Keyboard Teclado - + Controllers Controladores - + Shortcuts Atajos de teclado - - + + Shaders Shaders - + Select BIOS Seleccionar BIOS - + + Select directory + + + + (%1×%2) diff --git a/src/platform/qt/ts/mgba-fr.ts b/src/platform/qt/ts/mgba-fr.ts index 530aae00e..bf6821b58 100644 --- a/src/platform/qt/ts/mgba-fr.ts +++ b/src/platform/qt/ts/mgba-fr.ts @@ -3743,64 +3743,69 @@ Game Boy Advance est une marque de fabrique enregistré par Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia Qt Multimédia - + SDL SDL - + Software (Qt) Software (Qt) - + OpenGL OpenGL - + OpenGL (force version 1.x) OpenGL (version forcée 1.x) - + None (Still Image) Aucun (Image fixe) - + Keyboard Clavier - + Controllers Contrôleurs - + Shortcuts Raccourcis - - + + Shaders Shaders - + Select BIOS Choisir le BIOS - + + Select directory + + + + (%1×%2) (%1×%2) diff --git a/src/platform/qt/ts/mgba-it.ts b/src/platform/qt/ts/mgba-it.ts index bf295b1f7..8284cb409 100644 --- a/src/platform/qt/ts/mgba-it.ts +++ b/src/platform/qt/ts/mgba-it.ts @@ -3724,64 +3724,69 @@ Game Boy Advance è un marchio registrato di Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia Qt Multimedia - + SDL SDL - + Software (Qt) Software (Qt) - + OpenGL OpenGL - + OpenGL (force version 1.x) OpenGL (forza la versione 1.x) - + None (Still Image) Niente (Immagine fissa) - + Keyboard Tastiera - + Controllers Controllers - + Shortcuts Scorciatoie - - + + Shaders Shader - + Select BIOS Seleziona BIOS - + + Select directory + + + + (%1×%2) (%1×%2) diff --git a/src/platform/qt/ts/mgba-ja.ts b/src/platform/qt/ts/mgba-ja.ts index 2f19c6897..897936a18 100644 --- a/src/platform/qt/ts/mgba-ja.ts +++ b/src/platform/qt/ts/mgba-ja.ts @@ -3724,64 +3724,69 @@ Game Boy Advance is a registered trademark of Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia Qt Multimedia - + SDL SDL - + Software (Qt) ソフト(Qt) - + OpenGL OpenGL - + OpenGL (force version 1.x) OpenGL(強制バージョン1.x) - + None (Still Image) なし(静止画) - + Keyboard キーボード - + Controllers コントローラー - + Shortcuts ショートカット - - + + Shaders シェーダー - + Select BIOS BIOSを選択 - + + Select directory + + + + (%1×%2) (%1×%2) diff --git a/src/platform/qt/ts/mgba-ko.ts b/src/platform/qt/ts/mgba-ko.ts index b0534cff6..684d9a4db 100644 --- a/src/platform/qt/ts/mgba-ko.ts +++ b/src/platform/qt/ts/mgba-ko.ts @@ -3724,64 +3724,69 @@ Game Boy Advance는 Nintendo Co., Ltd.의 등록 상표입니다. QGBA::SettingsView - - + + Qt Multimedia Qt 멀티미디어 - + SDL SDL - + Software (Qt) 소프트웨어 (Qt) - + OpenGL 오픈GL - + OpenGL (force version 1.x) 오픈GL (버전 1.x 강제) - + None (Still Image) 없음 (정지 이미지) - + Keyboard 키보드 - + Controllers 컨트롤러 - + Shortcuts 단축키 - - + + Shaders 쉐이더 - + Select BIOS 바이오스 선택 - + + Select directory + + + + (%1×%2) diff --git a/src/platform/qt/ts/mgba-nl.ts b/src/platform/qt/ts/mgba-nl.ts index f2b1a03f7..fd69523df 100644 --- a/src/platform/qt/ts/mgba-nl.ts +++ b/src/platform/qt/ts/mgba-nl.ts @@ -3723,64 +3723,69 @@ Game Boy Advance is a registered trademark of Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia - + SDL - + Software (Qt) - + OpenGL - + OpenGL (force version 1.x) - + None (Still Image) - + Keyboard - + Controllers - + Shortcuts - - + + Shaders - + Select BIOS - + + Select directory + + + + (%1×%2) diff --git a/src/platform/qt/ts/mgba-pt_BR.ts b/src/platform/qt/ts/mgba-pt_BR.ts index 0daf66eec..af881d2c3 100644 --- a/src/platform/qt/ts/mgba-pt_BR.ts +++ b/src/platform/qt/ts/mgba-pt_BR.ts @@ -3724,64 +3724,69 @@ Game Boy Advance é uma marca registrada da Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia Qt multimídia - + SDL SDL - + Software (Qt) Software (Qt) - + OpenGL OpenGL - + OpenGL (force version 1.x) OpenGL (forçar versão 1.x) - + None (Still Image) Nenhum (Still Image) - + Keyboard Teclado - + Controllers Controles - + Shortcuts Atalhos - - + + Shaders Shaders - + Select BIOS Selecionar BIOS - + + Select directory + + + + (%1×%2) (%1×%2) diff --git a/src/platform/qt/ts/mgba-ru.ts b/src/platform/qt/ts/mgba-ru.ts index fcf0855d7..b20b53633 100644 --- a/src/platform/qt/ts/mgba-ru.ts +++ b/src/platform/qt/ts/mgba-ru.ts @@ -3723,64 +3723,69 @@ Game Boy Advance is a registered trademark of Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia - + SDL - + Software (Qt) - + OpenGL - + OpenGL (force version 1.x) - + None (Still Image) - + Keyboard - + Controllers - + Shortcuts - - + + Shaders - + Select BIOS - + + Select directory + + + + (%1×%2) diff --git a/src/platform/qt/ts/mgba-template.ts b/src/platform/qt/ts/mgba-template.ts index 283bb522f..18acc6273 100644 --- a/src/platform/qt/ts/mgba-template.ts +++ b/src/platform/qt/ts/mgba-template.ts @@ -3723,64 +3723,69 @@ Game Boy Advance is a registered trademark of Nintendo Co., Ltd. QGBA::SettingsView - - + + Qt Multimedia - + SDL - + Software (Qt) - + OpenGL - + OpenGL (force version 1.x) - + None (Still Image) - + Keyboard - + Controllers - + Shortcuts - - + + Shaders - + Select BIOS - + + Select directory + + + + (%1×%2) diff --git a/src/platform/qt/ts/mgba-tr.ts b/src/platform/qt/ts/mgba-tr.ts index 88da98a2c..0647bed4b 100644 --- a/src/platform/qt/ts/mgba-tr.ts +++ b/src/platform/qt/ts/mgba-tr.ts @@ -3724,64 +3724,69 @@ Game Boy Advance, Nintendo Co., Ltd.'nin tescilli ticari markasıdır. QGBA::SettingsView - - + + Qt Multimedia - + SDL - + Software (Qt) Yazılım - + OpenGL - + OpenGL (force version 1.x) - + None (Still Image) - + Keyboard Klavye - + Controllers - + Shortcuts Kısayollar - - + + Shaders Gölgelendiricler - + Select BIOS BIOS seç - + + Select directory + + + + (%1×%2) diff --git a/src/platform/qt/ts/mgba-zh_CN.ts b/src/platform/qt/ts/mgba-zh_CN.ts index 1cb3f2bf5..51dfca93b 100644 --- a/src/platform/qt/ts/mgba-zh_CN.ts +++ b/src/platform/qt/ts/mgba-zh_CN.ts @@ -3724,64 +3724,69 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 QGBA::SettingsView - - + + Qt Multimedia Qt Multimedia - + SDL SDL - + Software (Qt) 软件渲染 (Qt) - + OpenGL OpenGL - + OpenGL (force version 1.x) OpenGL (强制版本 1.x) - + None (Still Image) 无 (静止图像) - + Keyboard 键盘 - + Controllers 控制器 - + Shortcuts 快捷键 - - + + Shaders 着色器 - + Select BIOS 选择 BIOS - + + Select directory + + + + (%1×%2) (%1×%2)