mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 17:44:18 +00:00
Add DDNet settings button to unregister protocol and file extensions
Add a button to the Miscellaneous DDNet settings to manually unregister the protocol and file extension handlers.
This commit is contained in:
parent
db3d1f19a9
commit
a61eec8f1e
|
@ -283,6 +283,7 @@ public:
|
|||
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
virtual void ShellRegister() = 0;
|
||||
virtual void ShellUnregister() = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -4928,4 +4928,17 @@ void CClient::ShellRegister()
|
|||
if(Updated)
|
||||
shell_update();
|
||||
}
|
||||
|
||||
void CClient::ShellUnregister()
|
||||
{
|
||||
bool Updated = false;
|
||||
if(!shell_unregister("ddnet", &Updated))
|
||||
dbg_msg("client", "Failed to unregister ddnet protocol");
|
||||
if(!shell_unregister(GAME_NAME ".map", &Updated))
|
||||
dbg_msg("client", "Failed to unregister .map file extension");
|
||||
if(!shell_unregister(GAME_NAME ".demo", &Updated))
|
||||
dbg_msg("client", "Failed to unregister .demo file extension");
|
||||
if(Updated)
|
||||
shell_update();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -549,6 +549,7 @@ public:
|
|||
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
void ShellRegister() override;
|
||||
void ShellUnregister() override;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -3433,6 +3433,17 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
|||
SUIExEditBoxProperties EditProps;
|
||||
EditProps.m_pEmptyText = Localize("Chat command (e.g. showall 1)");
|
||||
UI()->DoEditBox(g_Config.m_ClRunOnJoin, &Button, g_Config.m_ClRunOnJoin, sizeof(g_Config.m_ClRunOnJoin), 14.0f, &s_RunOnJoin, false, IGraphics::CORNER_ALL, EditProps);
|
||||
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
static CButtonContainer s_ButtonUnregisterShell;
|
||||
Right.HSplitTop(10.0f, nullptr, &Right);
|
||||
Right.HSplitTop(20.0f, &Button, &Right);
|
||||
if(DoButton_Menu(&s_ButtonUnregisterShell, Localize("Unregister protocol and file extensions"), 0, &Button))
|
||||
{
|
||||
Client()->ShellUnregister();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Updater
|
||||
#if defined(CONF_AUTOUPDATE)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue