Skip to content

Commit 67093ae

Browse files
committed
Disable "Resolve peer countries" by default in new installations
The country of a connected peer is interesting, however it is not a crucial information that needs to be present for out-of-the box user experience. This also avoids contacting the GeoDB on the first qbt start up which acts like a ping signal for each qbt instance. Note that this change only affects new/fresh qbt installations. Existing instances are not affected.
1 parent 39f2da5 commit 67093ae

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/app/upgrade.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,22 @@ namespace
546546
settingsStorage->removeValue(oldKey);
547547
}
548548
}
549+
550+
void setResolvePeerCountriesSetting()
551+
{
552+
// User may not have touched this setting so it will stay at the default and its value is empty.
553+
// Set it to the previous default value so existing installations are not affected by the new default
554+
555+
auto *settingsStorage = SettingsStorage::instance();
556+
const QString key = u"Preferences/Connection/ResolvePeerCountries"_s;
557+
if (!settingsStorage->hasKey(key))
558+
SettingsStorage::instance()->storeValue(key, true);
559+
}
549560
}
550561

551562
bool upgrade()
552563
{
553-
CachedSettingValue<int> version {MIGRATION_VERSION_KEY, 0};
554-
555-
if (version != MIGRATION_VERSION)
564+
if (CachedSettingValue<int> version {MIGRATION_VERSION_KEY, 0}; version != MIGRATION_VERSION)
556565
{
557566
if (version < 1)
558567
{
@@ -597,6 +606,7 @@ bool upgrade()
597606
{
598607
upgradeTrayIconStyleSettings2();
599608
migrateSMTPEncryptionSetting();
609+
setResolvePeerCountriesSetting();
600610
}
601611

602612
version = MIGRATION_VERSION;

src/base/preferences.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ void Preferences::recheckTorrentsOnCompletion(const bool recheck)
13761376

13771377
bool Preferences::resolvePeerCountries() const
13781378
{
1379-
return value(u"Preferences/Connection/ResolvePeerCountries"_s, true);
1379+
return value(u"Preferences/Connection/ResolvePeerCountries"_s, false);
13801380
}
13811381

13821382
void Preferences::resolvePeerCountries(const bool resolve)

0 commit comments

Comments
 (0)