refactor: use QVariant().toBool() in place of StringUtils::StrToBool, remove StringUtils
This commit is contained in:
parent
da5f3c0be1
commit
07219ed431
5 changed files with 4 additions and 33 deletions
|
|
@ -22,7 +22,6 @@
|
||||||
#include "common/UrlConstants.h"
|
#include "common/UrlConstants.h"
|
||||||
#include "gui/Logger.h"
|
#include "gui/Logger.h"
|
||||||
#include "gui/Messages.h"
|
#include "gui/Messages.h"
|
||||||
#include "gui/StringUtils.h"
|
|
||||||
#include "gui/Styles.h"
|
#include "gui/Styles.h"
|
||||||
#include "gui/core/CoreProcess.h"
|
#include "gui/core/CoreProcess.h"
|
||||||
#include "gui/ipc/DaemonIpcClient.h"
|
#include "gui/ipc/DaemonIpcClient.h"
|
||||||
|
|
@ -677,7 +676,7 @@ void MainWindow::createMenuBar()
|
||||||
menuBar->addMenu(menuEdit);
|
menuBar->addMenu(menuEdit);
|
||||||
menuBar->addMenu(menuHelp);
|
menuBar->addMenu(menuHelp);
|
||||||
|
|
||||||
const auto enableTestMenu = strToTrue(qEnvironmentVariable("DESKFLOW_TEST_MENU"));
|
const auto enableTestMenu = QVariant(qEnvironmentVariable("DESKFLOW_TEST_MENU")).toBool();
|
||||||
if (enableTestMenu || kDebugBuild) {
|
if (enableTestMenu || kDebugBuild) {
|
||||||
auto testMenu = new QMenu(tr("Test"));
|
auto testMenu = new QMenu(tr("Test"));
|
||||||
menuBar->addMenu(testMenu);
|
menuBar->addMenu(testMenu);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
#include "gui/DotEnv.h"
|
#include "gui/DotEnv.h"
|
||||||
#include "gui/Logger.h"
|
#include "gui/Logger.h"
|
||||||
#include "gui/Messages.h"
|
#include "gui/Messages.h"
|
||||||
#include "gui/StringUtils.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -135,7 +134,7 @@ int main(int argc, char *argv[])
|
||||||
// --no-reset
|
// --no-reset
|
||||||
QStringList arguments = QCoreApplication::arguments();
|
QStringList arguments = QCoreApplication::arguments();
|
||||||
const auto noReset = hasArg("--no-reset", arguments);
|
const auto noReset = hasArg("--no-reset", arguments);
|
||||||
const auto resetEnvVar = strToTrue(qEnvironmentVariable("DESKFLOW_RESET_ALL"));
|
const auto resetEnvVar = QVariant(qEnvironmentVariable("DESKFLOW_RESET_ALL")).toBool();
|
||||||
if (resetEnvVar && !noReset) {
|
if (resetEnvVar && !noReset) {
|
||||||
diagnostic::clearSettings(false);
|
diagnostic::clearSettings(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ add_library(${target} STATIC
|
||||||
Logger.h
|
Logger.h
|
||||||
Messages.cpp
|
Messages.cpp
|
||||||
Messages.h
|
Messages.h
|
||||||
StringUtils.h
|
|
||||||
Styles.h
|
Styles.h
|
||||||
config/IServerConfig.h
|
config/IServerConfig.h
|
||||||
config/Screen.cpp
|
config/Screen.cpp
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
#include "StringUtils.h"
|
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
@ -59,15 +57,8 @@ QString printLine(FILE *out, const QString &type, const QString &message, const
|
||||||
|
|
||||||
void Logger::loadEnvVars()
|
void Logger::loadEnvVars()
|
||||||
{
|
{
|
||||||
const auto debugEnvVar = qEnvironmentVariable("DESKFLOW_GUI_DEBUG");
|
m_debug = QVariant(qEnvironmentVariable("DESKFLOW_GUI_DEBUG")).toBool();
|
||||||
if (!debugEnvVar.isEmpty()) {
|
m_verbose = QVariant(qEnvironmentVariable("DESKFLOW_GUI_VERBOSE")).toBool();
|
||||||
m_debug = strToTrue(debugEnvVar);
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto verboseEnvVar = qEnvironmentVariable("DESKFLOW_GUI_VERBOSE");
|
|
||||||
if (!verboseEnvVar.isEmpty()) {
|
|
||||||
m_verbose = strToTrue(verboseEnvVar);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::logVerbose(const QString &message) const
|
void Logger::logVerbose(const QString &message) const
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* Deskflow -- mouse and keyboard sharing utility
|
|
||||||
* SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
|
|
||||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Useful for environment variables that have string boolean values.
|
|
||||||
*/
|
|
||||||
inline bool strToTrue(const QString &str)
|
|
||||||
{
|
|
||||||
return str.toLower() == "true" || str == "1";
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue