diff options
author | Paul Rouget <me@paulrouget.com> | 2020-06-08 12:32:00 +0200 |
---|---|---|
committer | Paul Rouget <me@paulrouget.com> | 2020-06-11 07:54:57 +0200 |
commit | 805b79b32ca009d7c8afc45a02e155d3f925d86c (patch) | |
tree | 5fd9c72471832b685f3f75bbf554f064130c6086 /support/hololens/ServoApp/ServoControl/ServoControl.cpp | |
parent | 60ee588c71c6bba9871efaaf0ef68ae05e3e175f (diff) | |
download | servo-805b79b32ca009d7c8afc45a02e155d3f925d86c.tar.gz servo-805b79b32ca009d7c8afc45a02e155d3f925d86c.zip |
log and format for wstrings.
Diffstat (limited to 'support/hololens/ServoApp/ServoControl/ServoControl.cpp')
-rw-r--r-- | support/hololens/ServoApp/ServoControl/ServoControl.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/support/hololens/ServoApp/ServoControl/ServoControl.cpp b/support/hololens/ServoApp/ServoControl/ServoControl.cpp index cca58cce0ac..280e86778e0 100644 --- a/support/hololens/ServoApp/ServoControl/ServoControl.cpp +++ b/support/hololens/ServoApp/ServoControl/ServoControl.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "strutils.h" #include "ServoControl.h" #include "ServoControl.g.cpp" #include "Pref.g.cpp" @@ -277,16 +278,9 @@ hstring ServoControl::LoadURIOrSearch(hstring input) { // Doesn't look like a URI. Let's search for the string. auto escapedInput = Uri::EscapeComponent(input); - std::wstring searchUri = - unbox_value<hstring>(std::get<1>(Servo::GetPref(L"shell.searchpage"))) - .c_str(); - std::wstring keyword = L"%s"; - size_t start_pos = searchUri.find(keyword); - if (start_pos == std::string::npos) - searchUri = searchUri + escapedInput; - else - searchUri.replace(start_pos, keyword.length(), escapedInput); - hstring finalUri{searchUri}; + std::wstring searchUri = unbox_value<hstring>(std::get<1>(Servo::GetPref(L"shell.searchpage"))).c_str(); + std::wstring formated = format(searchUri, escapedInput.c_str()); + hstring finalUri{formated}; TryLoadUri(finalUri); return finalUri; } @@ -323,10 +317,10 @@ void ServoControl::RunOnGLThread(std::function<void()> task) { /**** GL THREAD LOOP ****/ void ServoControl::Loop() { - log("BrowserPage::Loop(). GL thread: %i", GetCurrentThreadId()); + log(L"BrowserPage::Loop(). GL thread: %i", GetCurrentThreadId()); if (mServo == nullptr) { - log("Entering loop"); + log(L"Entering loop"); ServoDelegate *sd = static_cast<ServoDelegate *>(this); EGLNativeWindowType win = GetNativeWindow(); mServo = std::make_unique<Servo>(mInitialURL, mArgs, mPanelWidth, @@ -367,7 +361,7 @@ void ServoControl::StartRenderLoop() { #endif } mLooping = true; - log("BrowserPage::StartRenderLoop(). UI thread: %i", GetCurrentThreadId()); + log(L"BrowserPage::StartRenderLoop(). UI thread: %i", GetCurrentThreadId()); auto task = Concurrency::create_task([=] { Loop(); }); mLoopTask = std::make_unique<Concurrency::task<void>>(task); } |