Interface: Static Game Window Title option

This commit is contained in:
Pikterra32 2024-10-16 16:16:40 +02:00
parent 904ac5592d
commit cd12197d4a
5 changed files with 30 additions and 1 deletions

View File

@ -398,6 +398,7 @@ const Info<ShowCursor> MAIN_SHOW_CURSOR{{System::Main, "Interface", "CursorVisib
ShowCursor::OnMovement};
const Info<bool> MAIN_LOCK_CURSOR{{System::Main, "Interface", "LockCursor"}, false};
const Info<std::string> MAIN_INTERFACE_LANGUAGE{{System::Main, "Interface", "LanguageCode"}, ""};
const Info<bool> MAIN_STATIC_TITLE{{System::Main, "Interface", "StaticTitle"}, false};
const Info<bool> MAIN_SHOW_ACTIVE_TITLE{{System::Main, "Interface", "ShowActiveTitle"}, true};
const Info<bool> MAIN_USE_BUILT_IN_TITLE_DATABASE{
{System::Main, "Interface", "UseBuiltinTitleDatabase"}, true};

View File

@ -245,6 +245,7 @@ extern const Info<ShowCursor> MAIN_SHOW_CURSOR;
extern const Info<bool> MAIN_LOCK_CURSOR;
extern const Info<std::string> MAIN_INTERFACE_LANGUAGE;
extern const Info<bool> MAIN_STATIC_TITLE;
extern const Info<bool> MAIN_SHOW_ACTIVE_TITLE;
extern const Info<bool> MAIN_USE_BUILT_IN_TITLE_DATABASE;
extern const Info<std::string> MAIN_THEME_NAME;

View File

@ -913,7 +913,12 @@ void UpdateTitle(Core::System& system)
g_video_backend->GetDisplayName(), Config::Get(Config::MAIN_DSP_HLE) ? "HLE" : "LLE");
std::string message = fmt::format("{} | {}", Common::GetScmRevStr(), SSettings);
if (Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE))
if (Config::Get(Config::MAIN_STATIC_TITLE))
{
message = Common::GetStringT("Dolphin Render Window");
}
else if (Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE))
{
const std::string& title = SConfig::GetInstance().GetTitleDescription();
if (!title.empty())

View File

@ -189,6 +189,7 @@ void InterfacePane::CreateInGame()
new ConfigBool(tr("Use Panic Handlers"), Config::MAIN_USE_PANIC_HANDLERS);
m_checkbox_enable_osd =
new ConfigBool(tr("Show On-Screen Display Messages"), Config::MAIN_OSD_MESSAGES);
m_checkbox_static_title = new ConfigBool(tr("Static Window Title"), Config::MAIN_STATIC_TITLE);
m_checkbox_show_active_title =
new ConfigBool(tr("Show Active Title in Window Title"), Config::MAIN_SHOW_ACTIVE_TITLE);
m_checkbox_pause_on_focus_lost =
@ -219,6 +220,7 @@ void InterfacePane::CreateInGame()
groupbox_layout->addWidget(m_checkbox_confirm_on_stop);
groupbox_layout->addWidget(m_checkbox_use_panic_handlers);
groupbox_layout->addWidget(m_checkbox_enable_osd);
groupbox_layout->addWidget(m_checkbox_static_title);
groupbox_layout->addWidget(m_checkbox_show_active_title);
groupbox_layout->addWidget(m_checkbox_pause_on_focus_lost);
groupbox_layout->addWidget(mouse_groupbox);
@ -227,6 +229,7 @@ void InterfacePane::CreateInGame()
#else
m_checkbox_lock_mouse->hide();
#endif
UpdateShowActiveTitleEnabled();
}
void InterfacePane::ConnectLayout()
@ -253,6 +256,8 @@ void InterfacePane::ConnectLayout()
&Settings::CursorVisibilityChanged);
connect(m_checkbox_lock_mouse, &QCheckBox::toggled, &Settings::Instance(),
&Settings::LockCursorChanged);
connect(m_checkbox_static_title, &QCheckBox::stateChanged,
[this](int) { UpdateShowActiveTitleEnabled(); });
}
void InterfacePane::UpdateShowDebuggingCheckbox()
@ -353,6 +358,9 @@ void InterfacePane::AddDescriptions()
QT_TR_NOOP("Shows on-screen display messages over the render window. These messages "
"disappear after several seconds."
"<br><br><dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>");
static constexpr char TR_STATIC_WINDOW_TITLE[] =
QT_TR_NOOP("The render window's title will always be \"Dolphin Render Window\"."
"<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
static constexpr char TR_SHOW_ACTIVE_TITLE_DESCRIPTION[] =
QT_TR_NOOP("Shows the active game title in the render window's title bar."
"<br><br><dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>");
@ -400,6 +408,8 @@ void InterfacePane::AddDescriptions()
m_checkbox_enable_osd->SetDescription(tr(TR_ENABLE_OSD_DESCRIPTION));
m_checkbox_static_title->SetDescription(tr(TR_STATIC_WINDOW_TITLE));
m_checkbox_show_active_title->SetDescription(tr(TR_SHOW_ACTIVE_TITLE_DESCRIPTION));
m_checkbox_pause_on_focus_lost->SetDescription(tr(TR_PAUSE_ON_FOCUS_LOST_DESCRIPTION));
@ -415,3 +425,13 @@ void InterfacePane::AddDescriptions()
m_combobox_userstyle->SetTitle(tr("Style"));
m_combobox_userstyle->SetDescription(tr(TR_USER_STYLE_DESCRIPTION));
}
void InterfacePane::UpdateShowActiveTitleEnabled()
{
const bool enabled = m_checkbox_static_title->isChecked();
if (enabled)
m_checkbox_show_active_title->setChecked(false);
m_checkbox_show_active_title->setEnabled(!enabled);
}

View File

@ -29,6 +29,7 @@ private:
void LoadUserStyle();
void OnUserStyleChanged();
void OnLanguageChanged();
void UpdateShowActiveTitleEnabled();
QVBoxLayout* m_main_layout;
ConfigStringChoice* m_combobox_language;
@ -46,6 +47,7 @@ private:
ConfigBool* m_checkbox_confirm_on_stop;
ConfigBool* m_checkbox_use_panic_handlers;
ConfigBool* m_checkbox_enable_osd;
ConfigBool* m_checkbox_static_title;
ConfigBool* m_checkbox_show_active_title;
ConfigBool* m_checkbox_pause_on_focus_lost;
ConfigRadioInt* m_radio_cursor_visible_movement;