refactor: use Settings::value().toString().isEmpty() to check for empty setting values. This is because QVariant::isNull() no longer returns the internal types isNull() method. As a results "" is a non Null QVariant
This commit is contained in:
parent
c45d586bbf
commit
b25f083433
3 changed files with 6 additions and 6 deletions
|
|
@ -82,7 +82,7 @@ I18N::I18N(QObject *parent) : QObject{parent}
|
||||||
|
|
||||||
static const auto s_prefix = QStringLiteral("_");
|
static const auto s_prefix = QStringLiteral("_");
|
||||||
|
|
||||||
if (Settings::value(Settings::Core::Language).isNull()) {
|
if (Settings::value(Settings::Core::Language).toString().isEmpty()) {
|
||||||
auto appTranslator = new QTranslator(this);
|
auto appTranslator = new QTranslator(this);
|
||||||
if (appTranslator->load(QLocale(), kAppId, s_prefix, m_appTrPath)) {
|
if (appTranslator->load(QLocale(), kAppId, s_prefix, m_appTrPath)) {
|
||||||
m_currentTranslations.append(appTranslator);
|
m_currentTranslations.append(appTranslator);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ void Settings::cleanStateSettings()
|
||||||
|
|
||||||
void Settings::setupScreenName()
|
void Settings::setupScreenName()
|
||||||
{
|
{
|
||||||
if (m_settings->value(Settings::Core::ScreenName).isNull())
|
if (m_settings->value(Settings::Core::ScreenName).toString().isEmpty())
|
||||||
m_settings->setValue(Settings::Core::ScreenName, cleanScreenName(QSysInfo::machineHostName()));
|
m_settings->setValue(Settings::Core::ScreenName, cleanScreenName(QSysInfo::machineHostName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -429,7 +429,7 @@ void MainWindow::coreProcessError(CoreProcess::Error error)
|
||||||
void MainWindow::startCore()
|
void MainWindow::startCore()
|
||||||
{
|
{
|
||||||
// Save current IP state when server starts
|
// Save current IP state when server starts
|
||||||
if (m_coreProcess.mode() == CoreMode::Server && Settings::value(Settings::Core::Interface).isNull()) {
|
if (m_coreProcess.mode() == CoreMode::Server && Settings::value(Settings::Core::Interface).toString().isEmpty()) {
|
||||||
m_serverStartIPs = m_networkMonitor->getAvailableIPv4Addresses();
|
m_serverStartIPs = m_networkMonitor->getAvailableIPv4Addresses();
|
||||||
m_serverStartSuggestedIP = m_serverStartIPs.isEmpty() ? "" : m_serverStartIPs.first();
|
m_serverStartSuggestedIP = m_serverStartIPs.isEmpty() ? "" : m_serverStartIPs.first();
|
||||||
}
|
}
|
||||||
|
|
@ -702,8 +702,8 @@ void MainWindow::setupTrayIcon()
|
||||||
|
|
||||||
void MainWindow::applyConfig()
|
void MainWindow::applyConfig()
|
||||||
{
|
{
|
||||||
if (!Settings::value(Settings::Client::RemoteHost).isNull())
|
if (const auto host = Settings::value(Settings::Client::RemoteHost).toString(); !host.isEmpty())
|
||||||
ui->lineHostname->setText(Settings::value(Settings::Client::RemoteHost).toString());
|
ui->lineHostname->setText(host);
|
||||||
updateLocalFingerprint();
|
updateLocalFingerprint();
|
||||||
setTrayIcon();
|
setTrayIcon();
|
||||||
|
|
||||||
|
|
@ -1255,7 +1255,7 @@ void MainWindow::updateIpLabel(const QStringList &addresses)
|
||||||
|
|
||||||
static const auto colorText = QStringLiteral(R"(<span style="color:%1;">%2</span>)");
|
static const auto colorText = QStringLiteral(R"(<span style="color:%1;">%2</span>)");
|
||||||
const bool serverStarted = m_coreProcess.isStarted();
|
const bool serverStarted = m_coreProcess.isStarted();
|
||||||
const bool fixedIP = !Settings::value(Settings::Core::Interface).isNull();
|
const bool fixedIP = !Settings::value(Settings::Core::Interface).toString().isEmpty();
|
||||||
|
|
||||||
if (!fixedIP && addresses.isEmpty() && !serverStarted || (serverStarted && m_serverStartSuggestedIP.isEmpty())) {
|
if (!fixedIP && addresses.isEmpty() && !serverStarted || (serverStarted && m_serverStartSuggestedIP.isEmpty())) {
|
||||||
ui->lblIpAddresses->setText(colorText.arg(palette().linkVisited().color().name(), tr("No IP Detected")));
|
ui->lblIpAddresses->setText(colorText.arg(palette().linkVisited().color().name(), tr("No IP Detected")));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue