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 QRegExp::PatternSyntax syntax;
60 if (listReader->str().compare(
"basic") == 0)
61 syntax = QRegExp::Wildcard;
63 syntax = QRegExp::RegExp;
65 if (!listReader.checkToken(TK_StringConst))
68 QRegExp pattern(listReader->str(), Qt::CaseInsensitive, 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->bGroupServersWithPlayersAtTheTopOfTheList =
true;
276 this->bIP2CountryAutoUpdate =
true;
277 this->bLogCreatedServer =
false;
278 this->bLookupHosts =
true;
279 this->bQueryAutoRefreshDontIfActive =
true;
280 this->bQueryAutoRefreshEnabled =
false;
281 this->bQueryBeforeLaunch =
true;
282 this->bQueryOnStartup =
true;
283 this->bRecordDemo =
false;
284 this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn =
true;
285 this->bCheckTheIntegrityOfWads =
true;
286 this->bUseTrayIcon =
false;
287 this->bMarkServersWithBuddies =
true;
288 this->buddyServersColor =
"#5ecf75";
289 this->customServersColor =
"#ffaa00";
290 this->lanServersColor =
"#92ebe5";
292 this->mainWindowState =
"";
293 this->mainWindowGeometry =
"";
294 this->queryAutoRefreshEverySeconds = 180;
295 setQuerySpeed(QuerySpeed::aggressive());
296 this->previousCreateServerConfigDir =
"";
297 this->previousCreateServerExecDir =
"";
298 this->previousCreateServerLogDir =
"";
299 this->previousCreateServerWadDir =
"";
301 this->serverListSortIndex = -1;
302 this->serverListSortDirection = Qt::DescendingOrder;
303 this->wadPaths = FileSearchPath::fromStringList(gDefaultDataPaths->defaultWadPaths());
306 DoomseekerConfig::DoomseekerCfg::~DoomseekerCfg()
310 QList<ColumnSort> DoomseekerConfig::DoomseekerCfg::additionalSortColumns()
const
312 QList<ColumnSort> list;
313 QVariantList varList = d->section.value(
"AdditionalSortColumns").toList();
314 for (
const QVariant &var : varList)
316 list << ColumnSort::deserializeQVariant(var);
321 void DoomseekerConfig::DoomseekerCfg::setAdditionalSortColumns(
const QList<ColumnSort> &val)
323 QVariantList varList;
326 varList << elem.serializeQVariant();
328 d->section.setValue(
"AdditionalSortColumns", varList);
334 d->section = section;
336 section.
createSetting(
"BotsAreNotPlayers", this->bBotsAreNotPlayers);
337 section.
createSetting(
"CloseToTrayIcon", this->bCloseToTrayIcon);
338 section.
createSetting(
"ColorizeServerConsole", this->bColorizeServerConsole);
339 section.
createSetting(
"DrawGridInServerTable", this->bDrawGridInServerTable);
340 section.
createSetting(
"HidePasswords", this->bHidePasswords);
341 section.
createSetting(
"GroupServersWithPlayersAtTheTopOfTheList", this->bGroupServersWithPlayersAtTheTopOfTheList);
342 section.
createSetting(
"IP2CAutoUpdate", this->bIP2CountryAutoUpdate);
343 section.
createSetting(
"LogCreatedServers", this->bLogCreatedServer);
345 section.
createSetting(
"QueryAutoRefreshDontIfActive", this->bQueryAutoRefreshDontIfActive);
346 section.
createSetting(
"QueryAutoRefreshEnabled", this->bQueryAutoRefreshEnabled);
347 section.
createSetting(
"QueryOnStartup", this->bQueryOnStartup);
349 section.
createSetting(
"TellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn", this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn);
350 section.
createSetting(
"CheckTheIntegrityOfWads", this->bCheckTheIntegrityOfWads);
352 section.
createSetting(
"MarkServersWithBuddies", this->bMarkServersWithBuddies);
353 section.
createSetting(
"BuddyServersColor", this->buddyServersColor);
354 section.
createSetting(
"CustomServersColor", this->customServersColor);
355 section.
createSetting(
"LanServersColor", this->lanServersColor);
356 section.
createSetting(
"QueryAutoRefreshEverySeconds", this->queryAutoRefreshEverySeconds);
357 section.
createSetting(
"QueryServerInterval", this->querySpeed().intervalBetweenServers);
358 section.
createSetting(
"QueryServerTimeout", this->querySpeed().delayBetweenSingleServerAttempts);
359 section.
createSetting(
"QueryAttemptsPerServer", this->querySpeed().attemptsPerServer);
361 section.
createSetting(
"ServerListSortIndex", this->serverListSortIndex);
362 section.
createSetting(
"ServerListSortDirection", this->serverListSortDirection);
363 section.
createSetting(
"WadPaths", FileSearchPath::toVariantList(this->wadPaths));
368 void DoomseekerConfig::DoomseekerCfg::initWadAlias()
370 if (!d->section.hasSetting(
"WadAliases"))
374 void DoomseekerConfig::DoomseekerCfg::load(
IniSection §ion)
376 this->localization = (
const QString &)section[
"Localization"];
377 this->bBotsAreNotPlayers = section[
"BotsAreNotPlayers"];
378 this->bCloseToTrayIcon = section[
"CloseToTrayIcon"];
379 this->bColorizeServerConsole = section[
"ColorizeServerConsole"];
380 this->bDrawGridInServerTable = section[
"DrawGridInServerTable"];
381 this->bHidePasswords = section[
"HidePasswords"];
382 this->bGroupServersWithPlayersAtTheTopOfTheList = section[
"GroupServersWithPlayersAtTheTopOfTheList"];
383 this->bIP2CountryAutoUpdate = section[
"IP2CAutoUpdate"];
384 this->bLogCreatedServer = section[
"LogCreatedServers"];
385 this->bLookupHosts = section[
"LookupHosts"];
386 this->bQueryAutoRefreshDontIfActive = section[
"QueryAutoRefreshDontIfActive"];
387 this->bQueryAutoRefreshEnabled = section[
"QueryAutoRefreshEnabled"];
388 this->bQueryBeforeLaunch = section[
"QueryBeforeLaunch"];
389 this->bQueryOnStartup = section[
"QueryOnStartup"];
390 this->bRecordDemo = section[
"RecordDemo"];
391 this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn = section[
"TellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn"];
392 this->bCheckTheIntegrityOfWads = section[
"CheckTheIntegrityOfWads"];
393 this->bUseTrayIcon = section[
"UseTrayIcon"];
394 this->bMarkServersWithBuddies = section[
"MarkServersWithBuddies"];
395 this->buddyServersColor = (
const QString &)section[
"BuddyServersColor"];
396 this->customServersColor = (
const QString &)section[
"CustomServersColor"];
397 this->lanServersColor = (
const QString &)section[
"LanServersColor"];
398 this->mainWindowState = (
const QString &)section[
"MainWindowState"];
399 this->mainWindowGeometry = section.
value(
"MainWindowGeometry",
"").toByteArray();
400 this->queryAutoRefreshEverySeconds = section[
"QueryAutoRefreshEverySeconds"];
401 d->querySpeed.intervalBetweenServers = section[
"QueryServerInterval"];
402 d->querySpeed.delayBetweenSingleServerAttempts = section[
"QueryServerTimeout"];
403 d->querySpeed.attemptsPerServer = section[
"QueryAttemptsPerServer"];
404 this->previousCreateServerConfigDir = (
const QString &)section[
"PreviousCreateServerConfigDir"];
405 this->previousCreateServerExecDir = (
const QString &)section[
"PreviousCreateServerExecDir"];
406 this->previousCreateServerLogDir = (
const QString &)section[
"PreviousCreateServerLogDir"];
407 this->previousCreateServerWadDir = (
const QString &)section[
"PreviousCreateServerWadDir"];
408 this->serverListColumnState = (
const QString &)section[
"ServerListColumnState"];
409 this->serverListSortIndex = section[
"ServerListSortIndex"];
410 this->serverListSortDirection = section[
"ServerListSortDirection"];
411 this->slotStyle = d->slotStyle();
421 QList<CustomServerInfo> customServersList;
423 QList<CustomServerInfo> backwardCompatibleServers;
425 for (
const CustomServerInfo &backwardCompatibleServer : backwardCompatibleServers)
430 if (knownServer.isSameServer(backwardCompatibleServer))
437 customServersList << backwardCompatibleServer;
439 this->customServers = customServersList.toVector();
443 QVariant variantWadPaths = section[
"WadPaths"].
value();
444 if (variantWadPaths.isValid() && variantWadPaths.toList().isEmpty())
448 QStringList paths = variantWadPaths.toString().split(
";");
449 for (
const QString &path : paths)
457 wadPaths = FileSearchPath::fromVariantList(section[
"WadPaths"].value().toList());
463 this->buddies = PatternList::deserializeQVariant(section.
value(
"Buddies"));
467 this->buddies = readPre1Point2BuddiesList(section[
"BuddiesList"]);
471 void DoomseekerConfig::DoomseekerCfg::save(
IniSection §ion)
473 section[
"Localization"] = this->localization;
474 section[
"BotsAreNotPlayers"] = this->bBotsAreNotPlayers;
475 section[
"CloseToTrayIcon"] = this->bCloseToTrayIcon;
476 section[
"ColorizeServerConsole"] = this->bColorizeServerConsole;
477 section[
"DrawGridInServerTable"] = this->bDrawGridInServerTable;
478 section[
"HidePasswords"] = this->bHidePasswords;
479 section[
"GroupServersWithPlayersAtTheTopOfTheList"] = this->bGroupServersWithPlayersAtTheTopOfTheList;
480 section[
"IP2CAutoUpdate"] = this->bIP2CountryAutoUpdate;
481 section[
"LogCreatedServers"] = this->bLogCreatedServer;
482 section[
"LookupHosts"] = this->bLookupHosts;
483 section[
"QueryAutoRefreshDontIfActive"] = this->bQueryAutoRefreshDontIfActive;
484 section[
"QueryAutoRefreshEnabled"] = this->bQueryAutoRefreshEnabled;
485 section[
"QueryBeforeLaunch"] = this->bQueryBeforeLaunch;
486 section[
"QueryOnStartup"] = this->bQueryOnStartup;
487 section[
"RecordDemo"] = this->bRecordDemo;
488 section[
"TellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn"] = this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn;
489 section[
"CheckTheIntegrityOfWads"] = this->bCheckTheIntegrityOfWads;
490 section[
"UseTrayIcon"] = this->bUseTrayIcon;
491 section[
"MarkServersWithBuddies"] = this->bMarkServersWithBuddies;
492 section[
"BuddyServersColor"] = this->buddyServersColor;
493 section[
"CustomServersColor"] = this->customServersColor;
494 section[
"LanServersColor"] = this->lanServersColor;
495 section[
"MainWindowState"] = this->mainWindowState;
496 section.
setValue(
"MainWindowGeometry", this->mainWindowGeometry);
497 section[
"QueryAutoRefreshEverySeconds"] = this->queryAutoRefreshEverySeconds;
498 section[
"QueryServerInterval"] = this->querySpeed().intervalBetweenServers;
499 section[
"QueryServerTimeout"] = this->querySpeed().delayBetweenSingleServerAttempts;
500 section[
"QueryAttemptsPerServer"] = this->querySpeed().attemptsPerServer;
501 section[
"PreviousCreateServerConfigDir"] = this->previousCreateServerConfigDir;
502 section[
"PreviousCreateServerExecDir"] = this->previousCreateServerExecDir;
503 section[
"PreviousCreateServerLogDir"] = this->previousCreateServerLogDir;
504 section[
"PreviousCreateServerWadDir"] = this->previousCreateServerWadDir;
505 section[
"ServerListColumnState"] = this->serverListColumnState;
506 section[
"ServerListSortIndex"] = this->serverListSortIndex;
507 section[
"ServerListSortDirection"] = this->serverListSortDirection;
508 section[
"SlotStyle"] = this->slotStyle;
513 QStringList allCustomServers;
514 QStringList allCustomServers2;
517 QString engineName = QUrl::toPercentEncoding(customServer.engine,
"",
"()");
518 QString address = QUrl::toPercentEncoding(customServer.host,
"",
"()");
520 QString customServerStringPrefix = QString(
"(%1;%2;%3")
521 .arg(engineName).arg(address)
522 .arg(customServer.port);
523 QString customServerString2 = QString(
"%1;%2)")
524 .arg(customServerStringPrefix)
525 .arg(customServer.enabled ? 1 : 0);
527 allCustomServers << customServerStringPrefix +
")";
528 allCustomServers2 << customServerString2;
530 section[
"CustomServers"] = allCustomServers.join(
";");
531 section[
"CustomServers2"] = allCustomServers2.join(
";");
533 section[
"WadPaths"].
setValue(FileSearchPath::toVariantList(this->wadPaths));
534 section[
"Buddies"].
setValue(this->buddies.serializeQVariant());
537 const QuerySpeed &DoomseekerConfig::DoomseekerCfg::querySpeed()
const
539 return d->querySpeed;
542 void DoomseekerConfig::DoomseekerCfg::setQuerySpeed(
const QuerySpeed &val)
547 QList<FileAlias> DoomseekerConfig::DoomseekerCfg::wadAliases()
const
549 QList<FileAlias> list;
550 QVariantList varList = d->section.value(
"WadAliases").toList();
551 for (
const QVariant &var : varList)
553 list << FileAlias::deserializeQVariant(var);
555 return FileAliasList::mergeDuplicates(list);
558 void DoomseekerConfig::DoomseekerCfg::setWadAliases(
const QList<FileAlias> &val)
560 QVariantList varList;
563 varList << elem.serializeQVariant();
565 d->section.setValue(
"WadAliases", varList);
568 void DoomseekerConfig::DoomseekerCfg::enableFreedoomInstallation(
const QString &dir)
571 wadPaths.prepend(dir);
572 QList<FileAlias> aliases = wadAliases();
573 aliases << FileAlias::freeDoom1Aliases();
574 aliases << FileAlias::freeDoom2Aliases();
575 aliases = FileAliasList::mergeDuplicates(aliases);
576 setWadAliases(aliases);
579 QStringList DoomseekerConfig::DoomseekerCfg::wadPathsOnly()
const
584 result << path.path();
589 const QString DoomseekerConfig::AutoUpdates::SECTION_NAME =
"Doomseeker_AutoUpdates";
591 void DoomseekerConfig::AutoUpdates::init(
IniSection §ion)
595 section.
createSetting(
"LastKnownUpdateRevisions", QVariant());
599 void DoomseekerConfig::AutoUpdates::load(
IniSection §ion)
601 updateChannelName = (
const QString &)section[
"UpdateChannelName"];
602 updateMode = (UpdateMode)section[
"UpdateMode"].value().toInt();
603 QVariantMap lastKnownUpdateRevisionsVariant = section[
"LastKnownUpdateRevisions"].
value().toMap();
604 lastKnownUpdateRevisions.clear();
605 for (
const QString &package : lastKnownUpdateRevisionsVariant.keys())
607 QVariant revisionVariant = lastKnownUpdateRevisionsVariant[package];
608 lastKnownUpdateRevisions.insert(package, revisionVariant.toString());
610 bPerformUpdateOnNextRun = section[
"bPerformUpdateOnNextRun"].
value().toBool();
613 void DoomseekerConfig::AutoUpdates::save(
IniSection §ion)
615 section[
"UpdateChannelName"] = updateChannelName;
616 section[
"UpdateMode"] = updateMode;
617 QVariantMap revisionsVariantMap;
618 for (
const QString &package : lastKnownUpdateRevisions.keys())
620 revisionsVariantMap.insert(package, lastKnownUpdateRevisions[package]);
622 section[
"LastKnownUpdateRevisions"].
setValue(revisionsVariantMap);
623 section[
"bPerformUpdateOnNextRun"].
setValue(bPerformUpdateOnNextRun);
626 const QString DoomseekerConfig::ServerFilter::SECTION_NAME =
"ServerFilter";
628 void DoomseekerConfig::ServerFilter::init(
IniSection §ion)
638 section.
createSetting(
"TestingServers", Doomseeker::Indifferent);
643 void DoomseekerConfig::ServerFilter::load(
IniSection §ion)
645 info.bEnabled = section[
"bEnabled"];
646 info.bShowEmpty = section[
"bShowEmpty"];
647 info.bShowFull = section[
"bShowFull"];
648 info.bShowOnlyValid = section[
"bShowOnlyValid"];
650 info.gameModesExcluded = section[
"GameModesExcluded"].
value().toStringList();
651 info.maxPing = section[
"MaxPing"];
652 info.serverName = (
const QString &)section[
"ServerName"];
653 info.testingServers =
static_cast<Doomseeker::ShowMode
>(section.
value(
"TestingServers").toInt());
654 info.wads = section[
"WADs"].
value().toStringList();
655 info.wadsExcluded = section[
"WADsExcluded"].
value().toStringList();
658 void DoomseekerConfig::ServerFilter::save(
IniSection §ion)
660 section[
"bEnabled"] = info.bEnabled;
661 section[
"bShowEmpty"] = info.bShowEmpty;
662 section[
"bShowFull"] = info.bShowFull;
663 section[
"bShowOnlyValid"] = info.bShowOnlyValid;
665 section[
"GameModesExcluded"].
setValue(info.gameModesExcluded);
666 section[
"MaxPing"] = info.maxPing;
667 section[
"ServerName"] = info.serverName;
668 section[
"TestingServers"] = info.testingServers;
669 section[
"WADs"].
setValue(info.wads);
670 section[
"WADsExcluded"].
setValue(info.wadsExcluded);
673 const QString DoomseekerConfig::WadseekerCfg::SECTION_NAME =
"Wadseeker";
675 DoomseekerConfig::WadseekerCfg::WadseekerCfg()
677 this->bAlwaysUseDefaultSites =
true;
678 this->bSearchInIdgames =
true;
679 this->bSearchInWadArchive =
true;
680 this->colorMessageCriticalError =
"#ff0000";
681 this->colorMessageError =
"#ff0000";
682 this->colorMessageNotice =
"#000000";
683 this->connectTimeoutSeconds = WADSEEKER_CONNECT_TIMEOUT_SECONDS_DEFAULT;
684 this->downloadTimeoutSeconds = WADSEEKER_DOWNLOAD_TIMEOUT_SECONDS_DEFAULT;
685 this->idgamesURL = Wadseeker::defaultIdgamesUrl();
686 this->maxConcurrentSiteDownloads = 3;
687 this->maxConcurrentWadDownloads = 2;
688 this->targetDirectory = gDefaultDataPaths->programsDataDirectoryPath();
697 section.
createSetting(
"AlwaysUseDefaultSites", this->bAlwaysUseDefaultSites);
698 section.
createSetting(
"SearchInIdgames", this->bSearchInIdgames);
699 section.
createSetting(
"SearchInWadArchive", this->bSearchInWadArchive);
700 section.
createSetting(
"ColorMessageCriticalError", this->colorMessageCriticalError);
701 section.
createSetting(
"ColorMessageError", this->colorMessageError);
702 section.
createSetting(
"ColorMessageNotice", this->colorMessageNotice);
703 section.
createSetting(
"ConnectTimeoutSeconds", this->connectTimeoutSeconds);
704 section.
createSetting(
"DownloadTimeoutSeconds", this->downloadTimeoutSeconds);
706 section.
createSetting(
"MaxConcurrentSiteDownloads", this->maxConcurrentSiteDownloads);
707 section.
createSetting(
"MaxConcurrentWadDownloads", this->maxConcurrentWadDownloads);
708 section.
createSetting(
"SearchURLs", Wadseeker::defaultSitesListEncoded().join(
";"));
709 section.
createSetting(
"TargetDirectory", this->targetDirectory);
712 void DoomseekerConfig::WadseekerCfg::load(
IniSection §ion)
714 this->bAlwaysUseDefaultSites = section[
"AlwaysUseDefaultSites"];
715 this->bSearchInIdgames = section[
"SearchInIdgames"];
716 this->bSearchInWadArchive = section[
"SearchInWadArchive"];
717 this->colorMessageCriticalError = (
const QString &)section[
"ColorMessageCriticalError"];
718 this->colorMessageError = (
const QString &)section[
"ColorMessageError"];
719 this->colorMessageNotice = (
const QString &)section[
"ColorMessageNotice"];
720 this->connectTimeoutSeconds = section[
"ConnectTimeoutSeconds"];
721 this->downloadTimeoutSeconds = section[
"DownloadTimeoutSeconds"];
722 this->idgamesURL = (
const QString &)section[
"IdgamesApiURL"];
723 this->maxConcurrentSiteDownloads = section[
"MaxConcurrentSiteDownloads"];
724 this->maxConcurrentWadDownloads = section[
"MaxConcurrentWadDownloads"];
725 this->targetDirectory = (
const QString &)section[
"TargetDirectory"];
728 this->searchURLs.clear();
729 QStringList urlList = section[
"SearchURLs"].valueString().split(
";", QString::SkipEmptyParts);
730 for (
const QString &url : urlList)
732 this->searchURLs << QUrl::fromPercentEncoding(url.toUtf8());
736 void DoomseekerConfig::WadseekerCfg::save(
IniSection §ion)
738 section[
"AlwaysUseDefaultSites"] = this->bAlwaysUseDefaultSites;
739 section[
"SearchInIdgames"] = this->bSearchInIdgames;
740 section[
"SearchInWadArchive"] = this->bSearchInWadArchive;
741 section[
"ColorMessageCriticalError"] = this->colorMessageCriticalError;
742 section[
"ColorMessageError"] = this->colorMessageError;
743 section[
"ColorMessageNotice"] = this->colorMessageNotice;
744 section[
"ConnectTimeoutSeconds"] = this->connectTimeoutSeconds;
745 section[
"DownloadTimeoutSeconds"] = this->downloadTimeoutSeconds;
746 section[
"IdgamesApiURL"] = this->idgamesURL;
747 section[
"MaxConcurrentSiteDownloads"] = this->maxConcurrentSiteDownloads;
748 section[
"MaxConcurrentWadDownloads"] = this->maxConcurrentWadDownloads;
749 section[
"TargetDirectory"] = this->targetDirectory;
752 QStringList urlEncodedList;
753 for (
const QString &url : this->searchURLs)
755 urlEncodedList << QUrl::toPercentEncoding(url);
757 section[
"SearchURLs"] = urlEncodedList.join(
";");