GUI: Add GUI option for Discord RPC

This commit is contained in:
Lothar Serra Mari 2021-08-31 21:39:17 +02:00
parent 82adcbeeb0
commit 7b0ce6282f
20 changed files with 76 additions and 5 deletions

View File

@ -37,7 +37,7 @@
#include "graphics/pixelformat.h"
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.50"
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.51"
class OSystem;

View File

@ -1921,6 +1921,9 @@ GlobalOptionsDialog::GlobalOptionsDialog(LauncherDialog *launcher)
_ttsCheckbox = nullptr;
_ttsVoiceSelectionPopUp = nullptr;
#endif
#ifdef USE_DISCORD
_discordRpcCheckbox = nullptr;
#endif
}
GlobalOptionsDialog::~GlobalOptionsDialog() {
@ -2287,6 +2290,15 @@ void GlobalOptionsDialog::addMiscControls(GuiObject *boss, const Common::String
_guiConfirmExit->setState(ConfMan.getBool("confirm_exit", _domain));
#ifdef USE_DISCORD
_discordRpcCheckbox = new CheckboxWidget(boss, prefix + "DiscordRpc",
_("Enable Discord integration"),
_("Show information about the games you are playing on Discord if the Discord client is running.")
);
_discordRpcCheckbox->setState(ConfMan.getBool("discord_rpc", _domain));
#endif
// TODO: joystick setting
#ifdef USE_TRANSLATION
@ -2692,6 +2704,11 @@ void GlobalOptionsDialog::apply() {
if (_guiConfirmExit) {
ConfMan.setBool("confirm_exit", _guiConfirmExit->getState(), _domain);
}
#ifdef USE_DISCORD
if (_discordRpcCheckbox) {
ConfMan.setBool("discord_rpc", _discordRpcCheckbox->getState(), _domain);
}
#endif // USE_DISCORD
GUI::ThemeEngine::GraphicsMode gfxMode = (GUI::ThemeEngine::GraphicsMode)_rendererPopUp->getSelectedTag();
Common::String oldGfxConfig = ConfMan.get("gui_renderer");

View File

@ -394,6 +394,10 @@ protected:
void addAccessibilityControls(GuiObject *boss, const Common::String &prefix);
#endif
#ifdef USE_DISCORD
bool _enableDiscordRpc;
CheckboxWidget *_discordRpcCheckbox;
#endif
};
} // End of namespace GUI

View File

@ -2040,6 +2040,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"type='Checkbox' "
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='6' align='center'>"
"<widget name='DiscordRpc' "
"type='Checkbox' "
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='10' align='center'>"
"<widget name='UpdatesPopupDesc' "
"type='OptionsLabel' "
@ -3897,6 +3902,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='6' align='center'>"
"<widget name='DiscordRpc' "
"type='Checkbox' "
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='6' align='center'>"
"<widget name='UpdatesPopupDesc' "
"width='80' "
"height='Globals.Line.Height' "

Binary file not shown.

View File

@ -1 +1 @@
[SCUMMVM_STX0.8.50:ResidualVM Modern Theme:No Author]
[SCUMMVM_STX0.8.51:ResidualVM Modern Theme:No Author]

View File

@ -692,6 +692,11 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'DiscordRpc'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'UpdatesPopupDesc'
type = 'OptionsLabel'

View File

@ -681,6 +681,11 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'DiscordRpc'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'UpdatesPopupDesc'
width = '80'

Binary file not shown.

View File

@ -1 +1 @@
[SCUMMVM_STX0.8.50:ScummVM Classic Theme:No Author]
[SCUMMVM_STX0.8.51:ScummVM Classic Theme:No Author]

View File

@ -678,6 +678,11 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'DiscordRpc'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'UpdatesPopupDesc'
type = 'OptionsLabel'

View File

@ -681,6 +681,11 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'DiscordRpc'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'UpdatesPopupDesc'
width = '80'

Binary file not shown.

View File

@ -1 +1 @@
[SCUMMVM_STX0.8.50:ScummVM Modern Theme:No Author]
[SCUMMVM_STX0.8.51:ScummVM Modern Theme:No Author]

View File

@ -692,6 +692,11 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'DiscordRpc'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'UpdatesPopupDesc'
type = 'OptionsLabel'

View File

@ -681,6 +681,11 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'DiscordRpc'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'UpdatesPopupDesc'
width = '80'

Binary file not shown.

View File

@ -1 +1 @@
[SCUMMVM_STX0.8.50:ScummVM Modern Theme Remastered:No Author]
[SCUMMVM_STX0.8.51:ScummVM Modern Theme Remastered:No Author]

View File

@ -694,6 +694,11 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'DiscordRpc'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'UpdatesPopupDesc'
type = 'OptionsLabel'

View File

@ -683,6 +683,11 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'DiscordRpc'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'UpdatesPopupDesc'
width = '80'