LeechCraft
0.6.70-19424-g027e980fd1
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
lcserviceoverride.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#include "
lcserviceoverride.h
"
10
11
namespace
LC::Util
12
{
13
namespace
14
{
15
QString GetHost (
const
ServiceInfo
& info)
16
{
17
const
auto
& env = qEnvironmentVariable ((info.EnvPrefix_ +
"_SERVER_HOST"
).constData ());
18
if
(!env.isEmpty ())
19
return
env;
20
21
return
info.DefaultHost_;
22
}
23
24
int
GetPort (
const
ServiceInfo
& info)
25
{
26
bool
ok =
false
;
27
const
auto
port = qEnvironmentVariableIntValue ((info.EnvPrefix_ +
"_SERVER_PORT"
).constData (), &ok);
28
return
ok ? port : info.DefaultPort_;
29
}
30
31
QString GetProto (
const
ServiceInfo
& info)
32
{
33
return
qEnvironmentVariableIsEmpty ((info.EnvPrefix_ +
"_NO_HTTPS"
).constData ()) && info.UseSslByDefault_ ?
34
QStringLiteral (
"https"
) :
35
QStringLiteral (
"http"
);
36
}
37
}
38
39
QString
GetServiceUrl
(
const
ServiceInfo
& info,
const
QString& path)
40
{
41
return
QStringLiteral (
"%1://%2:%3/%4"
)
42
.arg (GetProto (info),
43
GetHost (info))
44
.arg (GetPort (info))
45
.arg (path);
46
}
47
}
lcserviceoverride.h
LC::Util
Definition
icoreproxy.h:34
LC::Util::GetServiceUrl
QString GetServiceUrl(const ServiceInfo &info, const QString &path)
Definition
lcserviceoverride.cpp:39
LC::Util::ServiceInfo
Definition
lcserviceoverride.h:17
src
util
network
lcserviceoverride.cpp
Generated by
1.18.0