MCPcopy Create free account
hub / github.com/TurningWheel/Barony / openURLTryWithOverlay

Function openURLTryWithOverlay

src/interface/ui_general.cpp:681–728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

679}
680
681void openURLTryWithOverlay(const std::string& url, bool forceSystemBrowser)
682{
683 bool useSystemBrowser = false;
684 if ( !forceSystemBrowser )
685 {
686#ifdef STEAMWORKS
687 if ( SteamUtils()->IsOverlayEnabled() )
688 {
689 SteamFriends()->ActivateGameOverlayToWebPage(url.c_str());
690 }
691 else
692 {
693 useSystemBrowser = true;
694 }
695#else
696 useSystemBrowser = true;
697#endif
698 }
699 else
700 {
701 useSystemBrowser = true;
702 }
703
704 if ( useSystemBrowser )
705 {
706#ifdef WINDOWS
707#ifdef _UNICODE
708 const int len = MultiByteToWideChar(CP_ACP, 0, url.c_str(), url.size() + 1, 0, 0);
709 auto buf = new wchar_t[len];
710 MultiByteToWideChar(CP_ACP, 0, url.c_str(), url.size() + 1, buf, len);
711 ShellExecute(NULL, TEXT("open"), buf, NULL, NULL, 0);
712 delete[] buf;
713#else
714 ShellExecute(NULL, TEXT("open"), TEXT(url.c_str()), NULL, NULL, 0);
715#endif
716#endif // WINDOWS
717#ifdef APPLE
718 //TODO: Mac equivalent.
719 system(std::string("open " + url).c_str());
720#endif // APPLE
721#ifdef LINUX
722 system(std::string("xdg-open " + url).c_str());
723#endif // LINUX
724#ifdef NINTENDO
725 SDL_OpenURL(url.c_str());
726#endif // NINTENDO
727 }
728}
729
730void UIToastNotificationManager_t::createAchievementsDisabledNotification()
731{

Callers 2

viewPrivacyPolicyMethod · 0.85
handleMainMenuFunction · 0.85

Calls 2

c_strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected