Skip to content
Snippets Groups Projects
Commit 81165af5 authored by Sergey Linev's avatar Sergey Linev
Browse files

[webgui] improve support of custom browsers

Firefox and Chrome are "native" brwosers for ROOT and fully supported.
Custom browser can be specified when starting root like: 
   root --web=opera
Now it should be possible properly use such browser to open RWebWindow
or just to show webpage with URL
parent 8dd7dcc2
No related branches found
No related tags found
No related merge requests found
...@@ -113,14 +113,9 @@ public: ...@@ -113,14 +113,9 @@ public:
int GetHeight() const { return fHeight; } int GetHeight() const { return fHeight; }
/// set custom executable to start web browser /// set custom executable to start web browser
void SetCustomExec(const std::string &exec) void SetCustomExec(const std::string &exec);
{
SetBrowserKind(kCustom);
fExec = exec;
}
/// returns custom executable to start web browser /// returns custom executable to start web browser
std::string GetCustomExec() const { return GetBrowserKind() == kCustom ? fExec : ""; } std::string GetCustomExec() const;
/// set http server instance, used for window display /// set http server instance, used for window display
void SetHttpServer(THttpServer *serv) { fServer = serv; } void SetHttpServer(THttpServer *serv) { fServer = serv; }
......
...@@ -144,3 +144,22 @@ std::string ROOT::Experimental::RWebDisplayArgs::GetFullUrl() const ...@@ -144,3 +144,22 @@ std::string ROOT::Experimental::RWebDisplayArgs::GetFullUrl() const
return url; return url;
} }
///////////////////////////////////////////////////////////////////////////////////////////
/// Configure custom web browser
/// Either just name of browser which can be used like "opera"
/// or full execution string which must includes $url like "/usr/bin/opera $url"
void ROOT::Experimental::RWebDisplayArgs::SetCustomExec(const std::string &exec)
{
SetBrowserKind(kCustom);
fExec = exec;
}
///////////////////////////////////////////////////////////////////////////////////////////
/// returns custom executable to start web browser
std::string ROOT::Experimental::RWebDisplayArgs::GetCustomExec() const
{
return GetBrowserKind() == kCustom ? fExec : "";
}
...@@ -139,7 +139,19 @@ ROOT::Experimental::RWebDisplayHandle::BrowserCreator::BrowserCreator(bool custo ...@@ -139,7 +139,19 @@ ROOT::Experimental::RWebDisplayHandle::BrowserCreator::BrowserCreator(bool custo
if (custom) return; if (custom) return;
if (!exec.empty()) { if (!exec.empty()) {
fExec = exec; if (exec.find("$url") == std::string::npos) {
fProg = exec;
#ifdef _MSC_VER
fExec = exec + " $url";
#else
fExec = exec + " $url &";
#endif
} else {
fExec = exec;
auto pos = exec.find(" ");
if (pos != std::string::npos)
fProg = exec.substr(0, pos);
}
} else if (gSystem->InheritsFrom("TMacOSXSystem")) { } else if (gSystem->InheritsFrom("TMacOSXSystem")) {
fExec = "open \'$url\'"; fExec = "open \'$url\'";
} else if (gSystem->InheritsFrom("TWinNTSystem")) { } else if (gSystem->InheritsFrom("TWinNTSystem")) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment