forked from qt-creator/qt-creator
Various: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*
And instead of qgetenv. Takes Qt Creator's setting at "Environment > System > Environment" into account, which makes it easier on some platforms to set them (e.g. macOS), can be configured differently in different settings paths, and potentially can be changed at runtime (depending on usage). Change-Id: I724eecc040e33e249a88243f27e8a9e72e54f24b Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -291,14 +292,14 @@ static Utils::optional<HelpViewerFactory> backendForId(const QByteArray &id)
|
||||
|
||||
HelpViewerFactory LocalHelpManager::defaultViewerBackend()
|
||||
{
|
||||
const QByteArray backend = qgetenv("QTC_HELPVIEWER_BACKEND");
|
||||
const QString backend = Utils::qtcEnvironmentVariable("QTC_HELPVIEWER_BACKEND");
|
||||
if (!backend.isEmpty()) {
|
||||
const Utils::optional<HelpViewerFactory> factory = backendForId(backend);
|
||||
const Utils::optional<HelpViewerFactory> factory = backendForId(backend.toLatin1());
|
||||
if (factory)
|
||||
return *factory;
|
||||
}
|
||||
if (!backend.isEmpty())
|
||||
qWarning("Help viewer backend \"%s\" not found, using default.", backend.constData());
|
||||
qWarning("Help viewer backend \"%s\" not found, using default.", qPrintable(backend));
|
||||
const QVector<HelpViewerFactory> backends = viewerBackends();
|
||||
return backends.isEmpty() ? HelpViewerFactory() : backends.first();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user