mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-25 17:15:45 +08:00
Add possibility to retrieve compile-time wxWebView version
This is currently only implemented for GTK WebKit2 and CEF backends. Show both the compile- and run-time versions in the sample.
This commit is contained in:
@@ -551,15 +551,32 @@ WebFrame::WebFrame(const wxString& url, int flags, wxWebViewWindowFeatures* wind
|
||||
wxLog::SetActiveTarget(new wxLogTextCtrl(m_log_textCtrl));
|
||||
|
||||
// Log backend information
|
||||
const auto& version = wxWebView::GetBackendVersionInfo(backend);
|
||||
wxString description;
|
||||
if ( version.HasDescription() )
|
||||
description.Printf(" (%s)", version.GetDescription());
|
||||
|
||||
wxLogMessage("Backend: %s version=%s%s",
|
||||
const auto formatVersion = [](const char* context,
|
||||
const wxVersionInfo& version) {
|
||||
wxString str;
|
||||
|
||||
if ( version.IsOk() )
|
||||
{
|
||||
str.Printf(", %s version=%s",
|
||||
context, version.GetNumericVersionString());
|
||||
|
||||
if ( version.HasDescription() )
|
||||
str += wxString::Format(" (%s)", version.GetDescription());
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
|
||||
const auto versionRunTime = formatVersion("run-time", wxWebView::GetBackendVersionInfo(backend));
|
||||
const auto versionBuildTime = formatVersion("build-time", wxWebView::GetBackendVersionInfo(
|
||||
backend, wxVersionContext::BuildTime
|
||||
));
|
||||
|
||||
wxLogMessage("Backend: %s%s%s",
|
||||
m_browser->GetClassInfo()->GetClassName(),
|
||||
version.GetNumericVersionString(),
|
||||
description);
|
||||
versionRunTime,
|
||||
versionBuildTime);
|
||||
|
||||
// Chromium backend can't be used immediately after creation, so wait
|
||||
// until the browser is created before calling GetUserAgent(), but we
|
||||
|
||||
Reference in New Issue
Block a user