Fix naming of static variables

This commit is contained in:
Ilya Fedin 2020-06-01 14:20:51 +04:00 committed by John Preston
parent 1fc2b19c94
commit c83b8d4043
3 changed files with 35 additions and 35 deletions

View File

@ -239,7 +239,7 @@ QIcon TrayIconGen(int counter, bool muted) {
bool IsIndicatorApplication() { bool IsIndicatorApplication() {
// Hack for indicator-application, which doesn't handle icons sent across D-Bus: // Hack for indicator-application, which doesn't handle icons sent across D-Bus:
// save the icon to a temp file and set the icon name to that filename. // save the icon to a temp file and set the icon name to that filename.
static const auto IndicatorApplication = [] { static const auto Result = [] {
const auto interface = QDBusConnection::sessionBus().interface(); const auto interface = QDBusConnection::sessionBus().interface();
if (!interface) { if (!interface) {
@ -255,7 +255,7 @@ bool IsIndicatorApplication() {
return ubuntuIndicator || ayatanaIndicator; return ubuntuIndicator || ayatanaIndicator;
}(); }();
return IndicatorApplication; return Result;
} }
std::unique_ptr<QTemporaryFile> TrayIconFile( std::unique_ptr<QTemporaryFile> TrayIconFile(
@ -298,11 +298,11 @@ std::unique_ptr<QTemporaryFile> TrayIconFile(
} }
bool UseUnityCounter() { bool UseUnityCounter() {
static const auto UnityCounter = QDBusInterface( static const auto Result = QDBusInterface(
"com.canonical.Unity", "com.canonical.Unity",
"/").isValid(); "/").isValid();
return UnityCounter; return Result;
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION

View File

@ -105,8 +105,8 @@ std::vector<QString> ComputeServerInformation() {
} }
std::vector<QString> GetServerInformation() { std::vector<QString> GetServerInformation() {
static const auto ServerInformation = ComputeServerInformation(); static const auto Result = ComputeServerInformation();
return ServerInformation; return Result;
} }
QStringList ComputeCapabilities() { QStringList ComputeCapabilities() {
@ -129,8 +129,8 @@ QStringList ComputeCapabilities() {
} }
QStringList GetCapabilities() { QStringList GetCapabilities() {
static const auto Capabilities = ComputeCapabilities(); static const auto Result = ComputeCapabilities();
return Capabilities; return Result;
} }
bool Inhibited() { bool Inhibited() {

View File

@ -241,18 +241,18 @@ void SetApplicationIcon(const QIcon &icon) {
} }
bool InFlatpak() { bool InFlatpak() {
static const auto Flatpak = QFileInfo::exists(qsl("/.flatpak-info")); static const auto Result = QFileInfo::exists(qsl("/.flatpak-info"));
return Flatpak; return Result;
} }
bool InSnap() { bool InSnap() {
static const auto Snap = qEnvironmentVariableIsSet("SNAP"); static const auto Result = qEnvironmentVariableIsSet("SNAP");
return Snap; return Result;
} }
bool InAppImage() { bool InAppImage() {
static const auto AppImage = qEnvironmentVariableIsSet("APPIMAGE"); static const auto Result = qEnvironmentVariableIsSet("APPIMAGE");
return AppImage; return Result;
} }
bool IsStaticBinary() { bool IsStaticBinary() {
@ -265,13 +265,13 @@ bool IsStaticBinary() {
bool IsGtkIntegrationForced() { bool IsGtkIntegrationForced() {
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION #ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
static const auto GtkIntegration = [&] { static const auto Result = [&] {
const auto platformThemes = QString::fromUtf8(qgetenv("QT_QPA_PLATFORMTHEME")).split(':'); const auto platformThemes = QString::fromUtf8(qgetenv("QT_QPA_PLATFORMTHEME")).split(':');
return platformThemes.contains(qstr("gtk3"), Qt::CaseInsensitive) return platformThemes.contains(qstr("gtk3"), Qt::CaseInsensitive)
|| platformThemes.contains(qstr("gtk2"), Qt::CaseInsensitive); || platformThemes.contains(qstr("gtk2"), Qt::CaseInsensitive);
}(); }();
return GtkIntegration; return Result;
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION #endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
return false; return false;
@ -294,19 +294,19 @@ bool IsQtPluginsBundled() {
} }
bool IsXDGDesktopPortalPresent() { bool IsXDGDesktopPortalPresent() {
#ifdef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
static const auto XDGDesktopPortalPresent = false; static const auto Result = QDBusInterface(
#else // TDESKTOP_DISABLE_DBUS_INTEGRATION
static const auto XDGDesktopPortalPresent = QDBusInterface(
"org.freedesktop.portal.Desktop", "org.freedesktop.portal.Desktop",
"/org/freedesktop/portal/desktop").isValid(); "/org/freedesktop/portal/desktop").isValid();
return Result;
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
return XDGDesktopPortalPresent; return false;
} }
bool UseXDGDesktopPortal() { bool UseXDGDesktopPortal() {
static const auto UsePortal = [&] { static const auto Result = [&] {
const auto envVar = qEnvironmentVariableIsSet("TDESKTOP_USE_PORTAL"); const auto envVar = qEnvironmentVariableIsSet("TDESKTOP_USE_PORTAL");
const auto portalPresent = IsXDGDesktopPortalPresent(); const auto portalPresent = IsXDGDesktopPortalPresent();
@ -317,7 +317,7 @@ bool UseXDGDesktopPortal() {
) && portalPresent; ) && portalPresent;
}(); }();
return UsePortal; return Result;
} }
QString ProcessNameByPID(const QString &pid) { QString ProcessNameByPID(const QString &pid) {
@ -367,7 +367,7 @@ QString CurrentExecutablePath(int argc, char *argv[]) {
} }
QString AppRuntimeDirectory() { QString AppRuntimeDirectory() {
static const auto RuntimeDirectory = [&] { static const auto Result = [&] {
auto runtimeDir = QStandardPaths::writableLocation( auto runtimeDir = QStandardPaths::writableLocation(
QStandardPaths::RuntimeLocation); QStandardPaths::RuntimeLocation);
@ -399,7 +399,7 @@ QString AppRuntimeDirectory() {
return runtimeDir; return runtimeDir;
}(); }();
return RuntimeDirectory; return Result;
} }
QString SingleInstanceLocalServerName(const QString &hash) { QString SingleInstanceLocalServerName(const QString &hash) {
@ -411,7 +411,7 @@ QString SingleInstanceLocalServerName(const QString &hash) {
} }
QString GetLauncherBasename() { QString GetLauncherBasename() {
static const auto LauncherBasename = [&] { static const auto Result = [&] {
if (InSnap()) { if (InSnap()) {
const auto snapNameKey = const auto snapNameKey =
qEnvironmentVariableIsSet("SNAP_INSTANCE_NAME") qEnvironmentVariableIsSet("SNAP_INSTANCE_NAME")
@ -453,20 +453,20 @@ QString GetLauncherBasename() {
return possibleBasenames[0]; return possibleBasenames[0];
}(); }();
return LauncherBasename; return Result;
} }
QString GetLauncherFilename() { QString GetLauncherFilename() {
static const auto LauncherFilename = GetLauncherBasename() static const auto Result = GetLauncherBasename()
+ qsl(".desktop"); + qsl(".desktop");
return LauncherFilename; return Result;
} }
QString GetIconName() { QString GetIconName() {
static const auto IconName = InFlatpak() static const auto Result = InFlatpak()
? GetLauncherBasename() ? GetLauncherBasename()
: kIconName.utf16(); : kIconName.utf16();
return IconName; return Result;
} }
std::optional<crl::time> LastUserInputTime() { std::optional<crl::time> LastUserInputTime() {
@ -479,14 +479,14 @@ std::optional<crl::time> LastUserInputTime() {
return std::nullopt; return std::nullopt;
} }
static const auto message = QDBusMessage::createMethodCall( static const auto Message = QDBusMessage::createMethodCall(
qsl("org.freedesktop.ScreenSaver"), qsl("org.freedesktop.ScreenSaver"),
qsl("/org/freedesktop/ScreenSaver"), qsl("/org/freedesktop/ScreenSaver"),
qsl("org.freedesktop.ScreenSaver"), qsl("org.freedesktop.ScreenSaver"),
qsl("GetSessionIdleTime")); qsl("GetSessionIdleTime"));
const QDBusReply<uint> reply = QDBusConnection::sessionBus().call( const QDBusReply<uint> reply = QDBusConnection::sessionBus().call(
message); Message);
const auto notSupportedErrors = { const auto notSupportedErrors = {
QDBusError::ServiceUnknown, QDBusError::ServiceUnknown,
@ -695,11 +695,11 @@ void RegisterCustomScheme(bool force) {
if (home.isEmpty() || cExeName().isEmpty()) if (home.isEmpty() || cExeName().isEmpty())
return; return;
static const auto disabledByEnv = qEnvironmentVariableIsSet( static const auto DisabledByEnv = qEnvironmentVariableIsSet(
"TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION"); "TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION");
// don't update desktop file for alpha version or if updater is disabled // don't update desktop file for alpha version or if updater is disabled
if ((cAlphaVersion() || Core::UpdaterDisabled() || disabledByEnv) if ((cAlphaVersion() || Core::UpdaterDisabled() || DisabledByEnv)
&& !force) && !force)
return; return;