ENH: More UserLogin Log

JIRA: none
Change-Id: I9f9b8c86ab470f224138f3e6d91b9a454515b02e
This commit is contained in:
zorro.zhang 2025-04-27 11:03:17 +08:00 committed by lane.wei
parent 1d9819174d
commit 7e26594631
2 changed files with 13 additions and 1 deletions

View File

@ -18,6 +18,7 @@
#include <boost/cast.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <nlohmann/json.hpp>
#include "MainFrame.hpp"
@ -201,6 +202,7 @@ void ZUserLogin::OnIdle(wxIdleEvent &WXUNUSED(evt))
void ZUserLogin::OnNavigationRequest(wxWebViewEvent &evt)
{
//wxLogMessage("%s", "Navigation request to '" + evt.GetURL() + "'(target='" + evt.GetTarget() + "')");
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetURL().ToUTF8().data();
UpdateState();
}
@ -211,6 +213,8 @@ void ZUserLogin::OnNavigationRequest(wxWebViewEvent &evt)
void ZUserLogin::OnNavigationComplete(wxWebViewEvent &evt)
{
// wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'");
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetURL().ToUTF8().data();
m_browser->Show();
Layout();
UpdateState();
@ -221,6 +225,8 @@ void ZUserLogin::OnNavigationComplete(wxWebViewEvent &evt)
*/
void ZUserLogin::OnDocumentLoaded(wxWebViewEvent &evt)
{
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetURL().ToUTF8().data();
// Only notify if the document is the main frame, not a subframe
wxString tmpUrl = evt.GetURL();
NetworkAgent* agent = wxGetApp().getAgent();
@ -239,6 +245,8 @@ void ZUserLogin::OnDocumentLoaded(wxWebViewEvent &evt)
*/
void ZUserLogin::OnNewWindow(wxWebViewEvent &evt)
{
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetURL().ToUTF8().data();
wxString flag = " (other)";
if (evt.GetNavigationAction() == wxWEBVIEW_NAV_ACTION_USER) { flag = " (user)"; }
@ -380,6 +388,7 @@ void ZUserLogin::OnError(wxWebViewEvent &evt)
ShowErrorPage();
}
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetURL().ToUTF8().data();
// wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" +
// category + " (" + evt.GetString() + ")'");
@ -413,6 +422,7 @@ bool ZUserLogin::ShowErrorPage()
std::string ZUserLogin::GetStudioLanguage()
{
std::string strLanguage = wxGetApp().app_config->get("language");
boost::trim(strLanguage);
if (strLanguage.empty()) strLanguage = "en";
return strLanguage;

View File

@ -13,6 +13,7 @@
#include <boost/property_tree/json_parser.hpp>
#include <boost/chrono.hpp>
#include <boost/beast/core/detail/base64.hpp>
#include <boost/algorithm/string.hpp>
#include <wx/sizer.h>
#include <wx/toolbar.h>
@ -1931,7 +1932,8 @@ void WebViewPanel::SetWebviewShow(wxString name, bool show)
std::string WebViewPanel::GetStudioLanguage()
{
std::string strLanguage=wxGetApp().app_config->get("language");
std::string strLanguage = wxGetApp().app_config->get("language");
boost::trim(strLanguage);
if (strLanguage.empty()) strLanguage = "en";
return strLanguage;