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:
@ -82,7 +82,7 @@ I18N::I18N(QObject *parent) : QObject{parent}
|
||||
|
||||
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);
|
||||
if (appTranslator->load(QLocale(), kAppId, s_prefix, m_appTrPath)) {
|
||||
m_currentTranslations.append(appTranslator);
|
||||
|
||||
@ -110,7 +110,7 @@ void Settings::cleanStateSettings()
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
|
||||
@ -429,7 +429,7 @@ void MainWindow::coreProcessError(CoreProcess::Error error)
|
||||
void MainWindow::startCore()
|
||||
{
|
||||
// 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_serverStartSuggestedIP = m_serverStartIPs.isEmpty() ? "" : m_serverStartIPs.first();
|
||||
}
|
||||
@ -702,8 +702,8 @@ void MainWindow::setupTrayIcon()
|
||||
|
||||
void MainWindow::applyConfig()
|
||||
{
|
||||
if (!Settings::value(Settings::Client::RemoteHost).isNull())
|
||||
ui->lineHostname->setText(Settings::value(Settings::Client::RemoteHost).toString());
|
||||
if (const auto host = Settings::value(Settings::Client::RemoteHost).toString(); !host.isEmpty())
|
||||
ui->lineHostname->setText(host);
|
||||
updateLocalFingerprint();
|
||||
setTrayIcon();
|
||||
|
||||
@ -1255,7 +1255,7 @@ void MainWindow::updateIpLabel(const QStringList &addresses)
|
||||
|
||||
static const auto colorText = QStringLiteral(R"(<span style="color:%1;">%2</span>)");
|
||||
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())) {
|
||||
ui->lblIpAddresses->setText(colorText.arg(palette().linkVisited().color().name(), tr("No IP Detected")));
|
||||
|
||||
Reference in New Issue
Block a user