diff --git a/Client/core/CCommandFuncs.cpp b/Client/core/CCommandFuncs.cpp index 22e13e3d88..d8414931e3 100644 --- a/Client/core/CCommandFuncs.cpp +++ b/Client/core/CCommandFuncs.cpp @@ -318,6 +318,10 @@ void CCommandFuncs::Reconnect(const char* szParameters) // Start the connect if (CCore::GetSingleton().GetConnectManager()->Reconnect(strHost.c_str(), usPort, strPassword.c_str(), false)) { + if (CCore::GetSingleton().GetConnectManager()->WasQuickConnect()) + { + CCore::GetSingleton().GetConnectManager()->SetQuickConnect(false); + } CCore::GetSingleton().GetConsole()->Printf(_("reconnect: Reconnecting to %s:%u..."), strHost.c_str(), usPort); } else diff --git a/Client/core/CConnectManager.h b/Client/core/CConnectManager.h index 63f4de3965..906d61e37a 100644 --- a/Client/core/CConnectManager.h +++ b/Client/core/CConnectManager.h @@ -26,10 +26,14 @@ class CConnectManager bool Abort(); + bool WasQuickConnect() const noexcept { return m_quickConnect; } + void DoPulse(); void OnServerExists(); + void SetQuickConnect(bool quick) noexcept { m_quickConnect = quick; } + static void OpenServerFirewall(in_addr Address, ushort usHttpPort = 80, bool bHighPriority = false); static bool StaticProcessPacket(unsigned char ucPacketID, class NetBitStreamInterface& bitStream); @@ -59,4 +63,5 @@ class CConnectManager bool m_bNotifyServerBrowser; bool CheckNickProvided(const char* szNick); + bool m_quickConnect{false}; }; diff --git a/Client/core/CMainMenu.cpp b/Client/core/CMainMenu.cpp index 7848da2162..21b97fc63b 100644 --- a/Client/core/CMainMenu.cpp +++ b/Client/core/CMainMenu.cpp @@ -850,6 +850,9 @@ bool CMainMenu::OnMenuClick(CGUIMouseEventArgs Args) } break; + case MENU_ITEM_QUICK_CONNECT: + AskUserIfHeWantsToDisconnect(m_pHoveredItem->menuType); + return true; default: break; } @@ -914,7 +917,8 @@ bool CMainMenu::OnQuickConnectButtonClick(CGUIElement* pElement, bool left) ShowNetworkNotReadyWindow(); return true; } - + + g_pCore->GetConnectManager()->SetQuickConnect(true); g_pCore->GetCommands()->Execute("reconnect", ""); } else @@ -1262,6 +1266,9 @@ void CMainMenu::WantsToDisconnectCallBack(void* pData, uint uiButton) case MENU_ITEM_DISCONNECT: OnDisconnectButtonClick(); break; + case MENU_ITEM_QUICK_CONNECT: + OnQuickConnectButtonClick(nullptr, true); + break; default: break; }