23 #include "doomseekerconfig.h"
25 #include "configuration/queryspeed.h"
26 #include "datapaths.h"
27 #include "fileutils.h"
28 #include "gui/models/serverlistproxymodel.h"
30 #include "ini/inisection.h"
31 #include "ini/inivariable.h"
32 #include "ini/settingsproviderqt.h"
33 #include "localizationinfo.h"
35 #include "pathfinder/filealias.h"
36 #include "pathfinder/filesearchpath.h"
37 #include "plugins/engineplugin.h"
39 #include "strings.hpp"
40 #include "updater/updatechannel.h"
42 #include "wadseeker/wadseeker.h"
48 static PatternList readPre1Point2BuddiesList(
const QString &configEntry)
52 Scanner listReader(configEntry.toUtf8().constData(), configEntry.length());
54 while (listReader.tokensLeft())
56 if (!listReader.checkToken(TK_Identifier))
59 Pattern::Syntax syntax;
60 if (listReader->str().compare(
"basic") == 0)
61 syntax = Pattern::Wildcard;
63 syntax = Pattern::RegExp;
65 if (!listReader.checkToken(TK_StringConst))
68 Pattern pattern(listReader->str(), QRegularExpression::CaseInsensitiveOption, syntax);
69 if (pattern.isValid())
72 if (!listReader.checkToken(
';'))
80 DoomseekerConfig::DoomseekerConfig()
82 this->dummySection =
new IniSection(
nullptr, QString());
85 DoomseekerConfig::~DoomseekerConfig()
87 delete this->dummySection;
92 if (instance ==
nullptr)
100 if (instance !=
nullptr)
109 if (pluginName.isEmpty())
111 gLog << QObject::tr(
"DoomseekerConfig.iniSectionForPlugin(): empty plugin name has been specified, returning dummy IniSection.");
112 return *dummySection;
115 if (!isValidPluginName(pluginName))
117 gLog << QObject::tr(
"DoomseekerConfig.iniSectionForPlugin(): plugin name is invalid: %1").arg(pluginName);
118 return *dummySection;
121 if (this->pIni ==
nullptr)
124 QString sectionName = pluginName;
125 sectionName = sectionName.replace(
' ',
"");
126 return this->pIni->section(sectionName);
134 bool DoomseekerConfig::isValidPluginName(
const QString &pluginName)
const
136 QString invalids[] = {
"doomseeker",
"wadseeker",
"" };
138 for (
int i = 0; !invalids[i].isEmpty(); ++i)
140 if (pluginName.compare(invalids[i], Qt::CaseInsensitive) == 0)
152 IniSection sectionDoomseeker = pIni->section(doomseeker.SECTION_NAME);
153 doomseeker.load(sectionDoomseeker);
155 IniSection sectionServerFilter = pIni->section(serverFilter.SECTION_NAME);
156 serverFilter.load(sectionServerFilter);
158 IniSection sectionWadseeker = pIni->section(wadseeker.SECTION_NAME);
159 wadseeker.load(sectionWadseeker);
161 IniSection sectionAutoUpdates = pIni->section(autoUpdates.SECTION_NAME);
162 autoUpdates.load(sectionAutoUpdates);
182 IniSection sectionDoomseeker = pIni->section(doomseeker.SECTION_NAME);
183 doomseeker.save(sectionDoomseeker);
185 IniSection sectionServerFilter = pIni->section(serverFilter.SECTION_NAME);
186 serverFilter.save(sectionServerFilter);
188 IniSection sectionWadseeker = pIni->section(wadseeker.SECTION_NAME);
189 wadseeker.save(sectionWadseeker);
191 IniSection sectionAutoUpdates = pIni->section(autoUpdates.SECTION_NAME);
192 autoUpdates.save(sectionAutoUpdates);
195 if (this->settings->isWritable())
197 this->settings->sync();
207 this->settingsProvider.reset();
208 this->settings.reset();
210 gLog << QObject::tr(
"Setting INI file: %1").arg(filePath);
212 this->settings.reset(
new QSettings(filePath, QSettings::IniFormat));
214 this->pIni.reset(
new Ini(this->settingsProvider.data()));
219 section = this->pIni->section(doomseeker.SECTION_NAME);
220 doomseeker.
init(section);
222 section = this->pIni->section(serverFilter.SECTION_NAME);
223 serverFilter.init(section);
225 section = this->pIni->section(wadseeker.SECTION_NAME);
226 wadseeker.
init(section);
228 section = this->pIni->section(autoUpdates.SECTION_NAME);
229 autoUpdates.init(section);
234 QList<FileSearchPath> DoomseekerConfig::combinedWadseekPaths()
const
236 QList<FileSearchPath> paths = doomseeker.wadPaths;
237 paths << wadseeker.targetDirectory;
242 DClass<DoomseekerConfig::DoomseekerCfg>
248 QString slotStyle()
const
253 const int NUM_SLOTSTYLES = 2;
254 const char *indexedSlotStyles[NUM_SLOTSTYLES] = {
"marines",
"blocks" };
256 int numeric = section[
"SlotStyle"].
value().toInt(&isInt);
257 if (isInt && numeric >= 0 && numeric < NUM_SLOTSTYLES)
258 return indexedSlotStyles[numeric];
260 return section[
"SlotStyle"].valueString();
270 this->bBotsAreNotPlayers =
true;
271 this->bCloseToTrayIcon =
false;
272 this->bColorizeServerConsole =
true;
273 this->bDrawGridInServerTable =
false;
274 this->bHidePasswords =
false;
275 this->bHonorServerCountries =
true;
276 this->bGroupServersWithPlayersAtTheTopOfTheList =
true;
277 this->bIP2CountryAutoUpdate =
true;
278 this->bLogCreatedServer =
false;
279 this->bLookupHosts =
true;
280 this->bQueryAutoRefreshDontIfActive =
true;
281 this->bQueryAutoRefreshEnabled =
false;
282 this->bQueryBeforeLaunch =
true;
283 this->bQueryOnStartup =
true;
284 this->bRecordDemo =
false;
285 this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn =
true;
286 this->bCheckTheIntegrityOfWads =
true;
287 this->bUseTrayIcon =
false;
288 this->bMarkServersWithBuddies =
true;
289 this->buddyServersColor =
"#5ecf75";
290 this->customServersColor =
"#ffaa00";
291 this->lanServersColor =
"#92ebe5";
293 this->mainWindowState =
"";
294 this->mainWindowGeometry =
"";
295 this->queryAutoRefreshEverySeconds = 180;
296 setQuerySpeed(QuerySpeed::aggressive());
297 this->previousCreateServerConfigDir =
"";
298 this->previousCreateServerExecDir =
"";
299 this->previousCreateServerLogDir =
"";
300 this->previousCreateServerWadDir =
"";
301 this->slotStyle =
"blocks";
302 this->serverListSortIndex = -1;
303 this->serverListSortDirection = Qt::DescendingOrder;
304 this->wadPaths = FileSearchPath::fromStringList(gDefaultDataPaths->defaultWadPaths());
307 DoomseekerConfig::DoomseekerCfg::~DoomseekerCfg()
311 QList<ColumnSort> DoomseekerConfig::DoomseekerCfg::additionalSortColumns()
const
313 QList<ColumnSort> list;
314 QVariantList varList = d->section.value(
"AdditionalSortColumns").toList();
315 for (
const QVariant &var : varList)
317 list << ColumnSort::deserializeQVariant(var);
322 void DoomseekerConfig::DoomseekerCfg::setAdditionalSortColumns(
const QList<ColumnSort> &val)
324 QVariantList varList;
327 varList << elem.serializeQVariant();
329 d->section.setValue(
"AdditionalSortColumns", varList);
335 d->section = section;
337 section.
createSetting(
"BotsAreNotPlayers", this->bBotsAreNotPlayers);
338 section.
createSetting(
"CloseToTrayIcon", this->bCloseToTrayIcon);
339 section.
createSetting(
"ColorizeServerConsole", this->bColorizeServerConsole);
340 section.
createSetting(
"DrawGridInServerTable", this->bDrawGridInServerTable);
341 section.
createSetting(
"HidePasswords", this->bHidePasswords);
342 section.
createSetting(
"HonorServerCountries", this->bHonorServerCountries);
343 section.
createSetting(
"GroupServersWithPlayersAtTheTopOfTheList", this->bGroupServersWithPlayersAtTheTopOfTheList);
344 section.
createSetting(
"IP2CAutoUpdate", this->bIP2CountryAutoUpdate);
345 section.
createSetting(
"LogCreatedServers", this->bLogCreatedServer);
347 section.
createSetting(
"QueryAutoRefreshDontIfActive", this->bQueryAutoRefreshDontIfActive);
348 section.
createSetting(
"QueryAutoRefreshEnabled", this->bQueryAutoRefreshEnabled);
349 section.
createSetting(
"QueryOnStartup", this->bQueryOnStartup);
351 section.
createSetting(
"TellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn", this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn);
352 section.
createSetting(
"CheckTheIntegrityOfWads", this->bCheckTheIntegrityOfWads);
354 section.
createSetting(
"MarkServersWithBuddies", this->bMarkServersWithBuddies);
355 section.
createSetting(
"BuddyServersColor", this->buddyServersColor);
356 section.
createSetting(
"CustomServersColor", this->customServersColor);
357 section.
createSetting(
"LanServersColor", this->lanServersColor);
358 section.
createSetting(
"QueryAutoRefreshEverySeconds", this->queryAutoRefreshEverySeconds);
359 section.
createSetting(
"QueryServerInterval", this->querySpeed().intervalBetweenServers);
360 section.
createSetting(
"QueryServerTimeout", this->querySpeed().delayBetweenSingleServerAttempts);
361 section.
createSetting(
"QueryAttemptsPerServer", this->querySpeed().attemptsPerServer);
363 section.
createSetting(
"ServerListSortIndex", this->serverListSortIndex);
364 section.
createSetting(
"ServerListSortDirection", this->serverListSortDirection);
365 section.
createSetting(
"WadPaths", FileSearchPath::toVariantList(this->wadPaths));
370 void DoomseekerConfig::DoomseekerCfg::initWadAlias()
372 if (!d->section.hasSetting(
"WadAliases"))
376 void DoomseekerConfig::DoomseekerCfg::load(
IniSection §ion)
378 this->localization = (
const QString &)section[
"Localization"];
379 this->bBotsAreNotPlayers = section[
"BotsAreNotPlayers"];
380 this->bCloseToTrayIcon = section[
"CloseToTrayIcon"];
381 this->bColorizeServerConsole = section[
"ColorizeServerConsole"];
382 this->bDrawGridInServerTable = section[
"DrawGridInServerTable"];
383 this->bHidePasswords = section[
"HidePasswords"];
384 this->bHonorServerCountries = section[
"HonorServerCountries"];
385 this->bGroupServersWithPlayersAtTheTopOfTheList = section[
"GroupServersWithPlayersAtTheTopOfTheList"];
386 this->bIP2CountryAutoUpdate = section[
"IP2CAutoUpdate"];
387 this->bLogCreatedServer = section[
"LogCreatedServers"];
388 this->bLookupHosts = section[
"LookupHosts"];
389 this->bQueryAutoRefreshDontIfActive = section[
"QueryAutoRefreshDontIfActive"];
390 this->bQueryAutoRefreshEnabled = section[
"QueryAutoRefreshEnabled"];
391 this->bQueryBeforeLaunch = section[
"QueryBeforeLaunch"];
392 this->bQueryOnStartup = section[
"QueryOnStartup"];
393 this->bRecordDemo = section[
"RecordDemo"];
394 this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn = section[
"TellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn"];
395 this->bCheckTheIntegrityOfWads = section[
"CheckTheIntegrityOfWads"];
396 this->bUseTrayIcon = section[
"UseTrayIcon"];
397 this->bMarkServersWithBuddies = section[
"MarkServersWithBuddies"];
398 this->buddyServersColor = (
const QString &)section[
"BuddyServersColor"];
399 this->customServersColor = (
const QString &)section[
"CustomServersColor"];
400 this->lanServersColor = (
const QString &)section[
"LanServersColor"];
401 this->mainWindowState = (
const QString &)section[
"MainWindowState"];
402 this->mainWindowGeometry = section.
value(
"MainWindowGeometry",
"").toByteArray();
403 this->queryAutoRefreshEverySeconds = section[
"QueryAutoRefreshEverySeconds"];
404 d->querySpeed.intervalBetweenServers = section[
"QueryServerInterval"];
405 d->querySpeed.delayBetweenSingleServerAttempts = section[
"QueryServerTimeout"];
406 d->querySpeed.attemptsPerServer = section[
"QueryAttemptsPerServer"];
407 this->previousCreateServerConfigDir = (
const QString &)section[
"PreviousCreateServerConfigDir"];
408 this->previousCreateServerExecDir = (
const QString &)section[
"PreviousCreateServerExecDir"];
409 this->previousCreateServerLogDir = (
const QString &)section[
"PreviousCreateServerLogDir"];
410 this->previousCreateServerWadDir = (
const QString &)section[
"PreviousCreateServerWadDir"];
411 this->serverListColumnState = (
const QString &)section[
"ServerListColumnState"];
412 this->serverListSortIndex = section[
"ServerListSortIndex"];
413 this->serverListSortDirection = section[
"ServerListSortDirection"];
414 this->slotStyle = d->slotStyle();
424 QList<CustomServerInfo> customServersList;
426 QList<CustomServerInfo> backwardCompatibleServers;
428 for (
const CustomServerInfo &backwardCompatibleServer : backwardCompatibleServers)
433 if (knownServer.isSameServer(backwardCompatibleServer))
440 customServersList << backwardCompatibleServer;
442 this->customServers = customServersList.toVector();
446 QVariant variantWadPaths = section[
"WadPaths"].
value();
447 if (variantWadPaths.isValid() && variantWadPaths.toList().isEmpty())
451 QStringList paths = variantWadPaths.toString().split(
";");
452 for (
const QString &path : paths)
460 wadPaths = FileSearchPath::fromVariantList(section[
"WadPaths"].value().toList());
466 this->buddies = PatternList::deserializeQVariant(section.
value(
"Buddies"));
470 this->buddies = readPre1Point2BuddiesList(section[
"BuddiesList"]);
474 void DoomseekerConfig::DoomseekerCfg::save(
IniSection §ion)
476 section[
"Localization"] = this->localization;
477 section[
"BotsAreNotPlayers"] = this->bBotsAreNotPlayers;
478 section[
"CloseToTrayIcon"] = this->bCloseToTrayIcon;
479 section[
"ColorizeServerConsole"] = this->bColorizeServerConsole;
480 section[
"DrawGridInServerTable"] = this->bDrawGridInServerTable;
481 section[
"HidePasswords"] = this->bHidePasswords;
482 section[
"HonorServerCountries"] = this->bHonorServerCountries;
483 section[
"GroupServersWithPlayersAtTheTopOfTheList"] = this->bGroupServersWithPlayersAtTheTopOfTheList;
484 section[
"IP2CAutoUpdate"] = this->bIP2CountryAutoUpdate;
485 section[
"LogCreatedServers"] = this->bLogCreatedServer;
486 section[
"LookupHosts"] = this->bLookupHosts;
487 section[
"QueryAutoRefreshDontIfActive"] = this->bQueryAutoRefreshDontIfActive;
488 section[
"QueryAutoRefreshEnabled"] = this->bQueryAutoRefreshEnabled;
489 section[
"QueryBeforeLaunch"] = this->bQueryBeforeLaunch;
490 section[
"QueryOnStartup"] = this->bQueryOnStartup;
491 section[
"RecordDemo"] = this->bRecordDemo;
492 section[
"TellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn"] = this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn;
493 section[
"CheckTheIntegrityOfWads"] = this->bCheckTheIntegrityOfWads;
494 section[
"UseTrayIcon"] = this->bUseTrayIcon;
495 section[
"MarkServersWithBuddies"] = this->bMarkServersWithBuddies;
496 section[
"BuddyServersColor"] = this->buddyServersColor;
497 section[
"CustomServersColor"] = this->customServersColor;
498 section[
"LanServersColor"] = this->lanServersColor;
499 section[
"MainWindowState"] = this->mainWindowState;
500 section.
setValue(
"MainWindowGeometry", this->mainWindowGeometry);
501 section[
"QueryAutoRefreshEverySeconds"] = this->queryAutoRefreshEverySeconds;
502 section[
"QueryServerInterval"] = this->querySpeed().intervalBetweenServers;
503 section[
"QueryServerTimeout"] = this->querySpeed().delayBetweenSingleServerAttempts;
504 section[
"QueryAttemptsPerServer"] = this->querySpeed().attemptsPerServer;
505 section[
"PreviousCreateServerConfigDir"] = this->previousCreateServerConfigDir;
506 section[
"PreviousCreateServerExecDir"] = this->previousCreateServerExecDir;
507 section[
"PreviousCreateServerLogDir"] = this->previousCreateServerLogDir;
508 section[
"PreviousCreateServerWadDir"] = this->previousCreateServerWadDir;
509 section[
"ServerListColumnState"] = this->serverListColumnState;
510 section[
"ServerListSortIndex"] = this->serverListSortIndex;
511 section[
"ServerListSortDirection"] = this->serverListSortDirection;
512 section[
"SlotStyle"] = this->slotStyle;
517 QStringList allCustomServers;
518 QStringList allCustomServers2;
521 QString engineName = QUrl::toPercentEncoding(customServer.engine,
"",
"()");
522 QString address = QUrl::toPercentEncoding(customServer.host,
"",
"()");
524 QString customServerStringPrefix = QString(
"(%1;%2;%3")
525 .arg(engineName).arg(address)
526 .arg(customServer.port);
527 QString customServerString2 = QString(
"%1;%2)")
528 .arg(customServerStringPrefix)
529 .arg(customServer.enabled ? 1 : 0);
531 allCustomServers << customServerStringPrefix +
")";
532 allCustomServers2 << customServerString2;
534 section[
"CustomServers"] = allCustomServers.join(
";");
535 section[
"CustomServers2"] = allCustomServers2.join(
";");
537 section[
"WadPaths"].
setValue(FileSearchPath::toVariantList(this->wadPaths));
538 section[
"Buddies"].
setValue(this->buddies.serializeQVariant());
541 const QuerySpeed &DoomseekerConfig::DoomseekerCfg::querySpeed()
const
543 return d->querySpeed;
546 void DoomseekerConfig::DoomseekerCfg::setQuerySpeed(
const QuerySpeed &val)
551 QList<FileAlias> DoomseekerConfig::DoomseekerCfg::wadAliases()
const
553 QList<FileAlias> list;
554 QVariantList varList = d->section.value(
"WadAliases").toList();
555 for (
const QVariant &var : varList)
557 list << FileAlias::deserializeQVariant(var);
559 return FileAliasList::mergeDuplicates(list);
562 void DoomseekerConfig::DoomseekerCfg::setWadAliases(
const QList<FileAlias> &val)
564 QVariantList varList;
567 varList << elem.serializeQVariant();
569 d->section.setValue(
"WadAliases", varList);
572 void DoomseekerConfig::DoomseekerCfg::enableFreedoomInstallation(
const QString &dir)
575 wadPaths.prepend(dir);
576 QList<FileAlias> aliases = wadAliases();
577 aliases << FileAlias::freeDoom1Aliases();
578 aliases << FileAlias::freeDoom2Aliases();
579 aliases = FileAliasList::mergeDuplicates(aliases);
580 setWadAliases(aliases);
583 QStringList DoomseekerConfig::DoomseekerCfg::wadPathsOnly()
const
588 result << path.path();
593 const QString DoomseekerConfig::AutoUpdates::SECTION_NAME =
"Doomseeker_AutoUpdates";
595 void DoomseekerConfig::AutoUpdates::init(
IniSection §ion)
599 section.
createSetting(
"LastKnownUpdateRevisions", QVariant());
603 void DoomseekerConfig::AutoUpdates::load(
IniSection §ion)
605 updateChannelName = (
const QString &)section[
"UpdateChannelName"];
606 updateMode = (UpdateMode)section[
"UpdateMode"].value().toInt();
607 QVariantMap lastKnownUpdateRevisionsVariant = section[
"LastKnownUpdateRevisions"].
value().toMap();
608 lastKnownUpdateRevisions.clear();
609 for (
const QString &package : lastKnownUpdateRevisionsVariant.keys())
611 QVariant revisionVariant = lastKnownUpdateRevisionsVariant[package];
612 lastKnownUpdateRevisions.insert(package, revisionVariant.toString());
614 bPerformUpdateOnNextRun = section[
"bPerformUpdateOnNextRun"].
value().toBool();
617 void DoomseekerConfig::AutoUpdates::save(
IniSection §ion)
619 section[
"UpdateChannelName"] = updateChannelName;
620 section[
"UpdateMode"] = updateMode;
621 QVariantMap revisionsVariantMap;
622 for (
const QString &package : lastKnownUpdateRevisions.keys())
624 revisionsVariantMap.insert(package, lastKnownUpdateRevisions[package]);
626 section[
"LastKnownUpdateRevisions"].
setValue(revisionsVariantMap);
627 section[
"bPerformUpdateOnNextRun"].
setValue(bPerformUpdateOnNextRun);
630 const QString DoomseekerConfig::ServerFilter::SECTION_NAME =
"ServerFilter";
632 void DoomseekerConfig::ServerFilter::init(
IniSection §ion)
642 section.
createSetting(
"TestingServers", Doomseeker::Indifferent);
647 void DoomseekerConfig::ServerFilter::load(
IniSection §ion)
649 info.bEnabled = section[
"bEnabled"];
650 info.bShowEmpty = section[
"bShowEmpty"];
651 info.bShowFull = section[
"bShowFull"];
652 info.bShowOnlyValid = section[
"bShowOnlyValid"];
654 info.gameModesExcluded = section[
"GameModesExcluded"].
value().toStringList();
655 info.maxPing = section[
"MaxPing"];
656 info.serverName = (
const QString &)section[
"ServerName"];
657 info.testingServers =
static_cast<Doomseeker::ShowMode
>(section.
value(
"TestingServers").toInt());
658 info.wads = section[
"WADs"].
value().toStringList();
659 info.wadsExcluded = section[
"WADsExcluded"].
value().toStringList();
662 void DoomseekerConfig::ServerFilter::save(
IniSection §ion)
664 section[
"bEnabled"] = info.bEnabled;
665 section[
"bShowEmpty"] = info.bShowEmpty;
666 section[
"bShowFull"] = info.bShowFull;
667 section[
"bShowOnlyValid"] = info.bShowOnlyValid;
669 section[
"GameModesExcluded"].
setValue(info.gameModesExcluded);
670 section[
"MaxPing"] = info.maxPing;
671 section[
"ServerName"] = info.serverName;
672 section[
"TestingServers"] = info.testingServers;
673 section[
"WADs"].
setValue(info.wads);
674 section[
"WADsExcluded"].
setValue(info.wadsExcluded);
677 const QString DoomseekerConfig::WadseekerCfg::SECTION_NAME =
"Wadseeker";
679 DoomseekerConfig::WadseekerCfg::WadseekerCfg()
681 this->bAlwaysUseDefaultSites =
true;
682 this->bSearchInIdgames =
true;
683 this->bSearchInWadArchive =
true;
684 this->colorMessageCriticalError =
"#ff0000";
685 this->colorMessageError =
"#ff0000";
686 this->colorMessageNotice =
"#000000";
688 this->idgamesURL = Wadseeker::defaultIdgamesUrl();
689 this->maxConcurrentSiteDownloads = 3;
690 this->maxConcurrentWadDownloads = 2;
691 this->targetDirectory = gDefaultDataPaths->programsDataDirectoryPath();
700 section.
createSetting(
"AlwaysUseDefaultSites", this->bAlwaysUseDefaultSites);
701 section.
createSetting(
"SearchInIdgames", this->bSearchInIdgames);
702 section.
createSetting(
"SearchInWadArchive", this->bSearchInWadArchive);
703 section.
createSetting(
"ColorMessageCriticalError", this->colorMessageCriticalError);
704 section.
createSetting(
"ColorMessageError", this->colorMessageError);
705 section.
createSetting(
"ColorMessageNotice", this->colorMessageNotice);
707 section.
createSetting(
"MaxConcurrentSiteDownloads", this->maxConcurrentSiteDownloads);
708 section.
createSetting(
"MaxConcurrentWadDownloads", this->maxConcurrentWadDownloads);
709 section.
createSetting(
"SearchURLs", Wadseeker::defaultSitesListEncoded().join(
";"));
710 section.
createSetting(
"TargetDirectory", this->targetDirectory);
713 void DoomseekerConfig::WadseekerCfg::load(
IniSection §ion)
715 this->bAlwaysUseDefaultSites = section[
"AlwaysUseDefaultSites"];
716 this->bSearchInIdgames = section[
"SearchInIdgames"];
717 this->bSearchInWadArchive = section[
"SearchInWadArchive"];
718 this->colorMessageCriticalError = (
const QString &)section[
"ColorMessageCriticalError"];
719 this->colorMessageError = (
const QString &)section[
"ColorMessageError"];
720 this->colorMessageNotice = (
const QString &)section[
"ColorMessageNotice"];
721 this->idgamesURL = (
const QString &)section[
"IdgamesApiURL"];
722 this->maxConcurrentSiteDownloads = section[
"MaxConcurrentSiteDownloads"];
723 this->maxConcurrentWadDownloads = section[
"MaxConcurrentWadDownloads"];
724 this->targetDirectory = (
const QString &)section[
"TargetDirectory"];
727 this->searchURLs.clear();
728 QStringList urlList = section[
"SearchURLs"].valueString().split(
";", Qt::SkipEmptyParts);
729 for (
const QString &url : urlList)
731 this->searchURLs << QUrl::fromPercentEncoding(url.toUtf8());
735 void DoomseekerConfig::WadseekerCfg::save(
IniSection §ion)
737 section[
"AlwaysUseDefaultSites"] = this->bAlwaysUseDefaultSites;
738 section[
"SearchInIdgames"] = this->bSearchInIdgames;
739 section[
"SearchInWadArchive"] = this->bSearchInWadArchive;
740 section[
"ColorMessageCriticalError"] = this->colorMessageCriticalError;
741 section[
"ColorMessageError"] = this->colorMessageError;
742 section[
"ColorMessageNotice"] = this->colorMessageNotice;
743 section[
"IdgamesApiURL"] = this->idgamesURL;
744 section[
"MaxConcurrentSiteDownloads"] = this->maxConcurrentSiteDownloads;
745 section[
"MaxConcurrentWadDownloads"] = this->maxConcurrentWadDownloads;
746 section[
"TargetDirectory"] = this->targetDirectory;
749 QStringList urlEncodedList;
750 for (
const QString &url : this->searchURLs)
752 urlEncodedList << QUrl::toPercentEncoding(url);
754 section[
"SearchURLs"] = urlEncodedList.join(
";");