23 #include "doomseekerconfig.h" 25 #include "configuration/queryspeed.h" 26 #include "gui/models/serverlistproxymodel.h" 28 #include "ini/inisection.h" 29 #include "ini/inivariable.h" 30 #include "ini/settingsproviderqt.h" 31 #include "pathfinder/filealias.h" 32 #include "pathfinder/filesearchpath.h" 33 #include "plugins/engineplugin.h" 34 #include "updater/updatechannel.h" 35 #include "wadseeker/wadseeker.h" 36 #include "datapaths.h" 37 #include "fileutils.h" 46 DoomseekerConfig::DoomseekerConfig()
48 this->dummySection =
new IniSection(NULL, QString());
51 DoomseekerConfig::~DoomseekerConfig()
53 delete this->dummySection;
77 if (pluginName.isEmpty())
79 gLog << QObject::tr(
"DoomseekerConfig.iniSectionForPlugin(): empty plugin name has been specified, returning dummy IniSection.");
83 if (!isValidPluginName(pluginName))
85 gLog << QObject::tr(
"DoomseekerConfig.iniSectionForPlugin(): plugin name is invalid: %1").arg(pluginName);
89 if (this->pIni == NULL)
94 QString sectionName = pluginName;
95 sectionName = sectionName.replace(
' ',
"");
96 return this->pIni->section(sectionName);
104 bool DoomseekerConfig::isValidPluginName(
const QString& pluginName)
const 106 QString invalids[] = {
"doomseeker",
"wadseeker",
"" };
108 for (
int i = 0; !invalids[i].isEmpty(); ++i)
110 if (pluginName.compare(invalids[i], Qt::CaseInsensitive) == 0)
126 IniSection sectionDoomseeker = pIni->section(doomseeker.SECTION_NAME);
127 doomseeker.load(sectionDoomseeker);
129 IniSection sectionServerFilter = pIni->section(serverFilter.SECTION_NAME);
130 serverFilter.load(sectionServerFilter);
132 IniSection sectionWadseeker = pIni->section(wadseeker.SECTION_NAME);
133 wadseeker.load(sectionWadseeker);
135 IniSection sectionAutoUpdates = pIni->section(autoUpdates.SECTION_NAME);
136 autoUpdates.load(sectionAutoUpdates);
157 IniSection sectionDoomseeker = pIni->section(doomseeker.SECTION_NAME);
158 doomseeker.save(sectionDoomseeker);
160 IniSection sectionServerFilter = pIni->section(serverFilter.SECTION_NAME);
161 serverFilter.save(sectionServerFilter);
163 IniSection sectionWadseeker = pIni->section(wadseeker.SECTION_NAME);
164 wadseeker.save(sectionWadseeker);
166 IniSection sectionAutoUpdates = pIni->section(autoUpdates.SECTION_NAME);
167 autoUpdates.save(sectionAutoUpdates);
170 if (this->settings->isWritable())
172 this->settings->sync();
182 this->settingsProvider.reset();
183 this->settings.reset();
185 gLog << QObject::tr(
"Setting INI file: %1").arg(filePath);
187 this->settings.reset(
new QSettings(filePath, QSettings::IniFormat));
189 this->pIni.reset(
new Ini(this->settingsProvider.data()));
194 section = this->pIni->section(doomseeker.SECTION_NAME);
195 doomseeker.
init(section);
197 section = this->pIni->section(serverFilter.SECTION_NAME);
198 serverFilter.init(section);
200 section = this->pIni->section(wadseeker.SECTION_NAME);
201 wadseeker.
init(section);
203 section = this->pIni->section(autoUpdates.SECTION_NAME);
204 autoUpdates.init(section);
209 QList<FileSearchPath> DoomseekerConfig::combinedWadseekPaths()
const 211 QList<FileSearchPath> paths = doomseeker.wadPaths;
212 paths << wadseeker.targetDirectory;
217 DClass<DoomseekerConfig::DoomseekerCfg>
226 const QString DoomseekerConfig::DoomseekerCfg::SECTION_NAME =
"Doomseeker";
228 DoomseekerConfig::DoomseekerCfg::DoomseekerCfg()
230 this->bBotsAreNotPlayers =
true;
231 this->bCloseToTrayIcon =
false;
232 this->bColorizeServerConsole =
true;
233 this->bDrawGridInServerTable =
false;
234 this->bHidePasswords =
false;
235 this->bGroupServersWithPlayersAtTheTopOfTheList =
true;
236 this->bIP2CountryAutoUpdate =
true;
237 this->bLookupHosts =
true;
238 this->bQueryAutoRefreshDontIfActive =
true;
239 this->bQueryAutoRefreshEnabled =
false;
240 this->bQueryBeforeLaunch =
true;
241 this->bQueryOnStartup =
true;
242 this->bRecordDemo =
false;
243 this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn =
true;
244 this->bUseTrayIcon =
false;
245 this->bMarkServersWithBuddies =
true;
246 this->buddyServersColor =
"#5ecf75";
247 this->customServersColor =
"#ffaa00";
248 this->lanServersColor =
"#92ebe5";
249 this->localization = QLocale::system().name();
250 this->mainWindowState =
"";
251 this->mainWindowGeometry =
"";
252 this->queryAutoRefreshEverySeconds = 180;
253 setQuerySpeed(QuerySpeed::aggressive());
254 this->previousCreateServerConfigDir =
"";
255 this->previousCreateServerExecDir =
"";
256 this->previousCreateServerWadDir =
"";
258 this->serverListSortIndex = -1;
259 this->serverListSortDirection = Qt::DescendingOrder;
260 this->wadPaths << gDefaultDataPaths->programsDataDirectoryPath();
261 this->wadPaths << gDefaultDataPaths->workingDirectory();
264 DoomseekerConfig::DoomseekerCfg::~DoomseekerCfg()
268 QList<ColumnSort> DoomseekerConfig::DoomseekerCfg::additionalSortColumns()
const 270 QList<ColumnSort> list;
271 QVariantList varList = d->section.value(
"AdditionalSortColumns").toList();
272 foreach (
const QVariant &var, varList)
274 list << ColumnSort::deserializeQVariant(var);
279 void DoomseekerConfig::DoomseekerCfg::setAdditionalSortColumns(
const QList<ColumnSort> &val)
281 QVariantList varList;
284 varList << elem.serializeQVariant();
286 d->section.setValue(
"AdditionalSortColumns", varList);
292 d->section = section;
294 section.
createSetting(
"BotsAreNotPlayers", this->bBotsAreNotPlayers);
295 section.
createSetting(
"CloseToTrayIcon", this->bCloseToTrayIcon);
296 section.
createSetting(
"ColorizeServerConsole", this->bColorizeServerConsole);
297 section.
createSetting(
"DrawGridInServerTable", this->bDrawGridInServerTable);
298 section.
createSetting(
"HidePasswords", this->bHidePasswords);
299 section.
createSetting(
"GroupServersWithPlayersAtTheTopOfTheList", this->bGroupServersWithPlayersAtTheTopOfTheList);
300 section.
createSetting(
"IP2CAutoUpdate", this->bIP2CountryAutoUpdate);
302 section.
createSetting(
"QueryAutoRefreshDontIfActive", this->bQueryAutoRefreshDontIfActive);
303 section.
createSetting(
"QueryAutoRefreshEnabled", this->bQueryAutoRefreshEnabled);
304 section.
createSetting(
"QueryOnStartup", this->bQueryOnStartup);
306 section.
createSetting(
"TellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn", this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn);
308 section.
createSetting(
"MarkServersWithBuddies", this->bMarkServersWithBuddies);
309 section.
createSetting(
"BuddyServersColor", this->buddyServersColor);
310 section.
createSetting(
"CustomServersColor", this->customServersColor);
311 section.
createSetting(
"LanServersColor", this->lanServersColor);
312 section.
createSetting(
"QueryAutoRefreshEverySeconds", this->queryAutoRefreshEverySeconds);
313 section.
createSetting(
"QueryServerInterval", this->querySpeed().intervalBetweenServers);
314 section.
createSetting(
"QueryServerTimeout", this->querySpeed().delayBetweenSingleServerAttempts);
315 section.
createSetting(
"QueryAttemptsPerServer", this->querySpeed().attemptsPerServer);
317 section.
createSetting(
"ServerListSortIndex", this->serverListSortIndex);
318 section.
createSetting(
"ServerListSortDirection", this->serverListSortDirection);
319 section.
createSetting(
"WadPaths", FileSearchPath::toVariantList(this->wadPaths));
324 void DoomseekerConfig::DoomseekerCfg::initWadAlias()
326 if (!d->section.hasSetting(
"WadAliases"))
332 void DoomseekerConfig::DoomseekerCfg::load(
IniSection& section)
334 this->localization = (
const QString&)section[
"Localization"];
335 this->bBotsAreNotPlayers = section[
"BotsAreNotPlayers"];
336 this->bCloseToTrayIcon = section[
"CloseToTrayIcon"];
337 this->bColorizeServerConsole = section[
"ColorizeServerConsole"];
338 this->bDrawGridInServerTable = section[
"DrawGridInServerTable"];
339 this->bHidePasswords = section[
"HidePasswords"];
340 this->bGroupServersWithPlayersAtTheTopOfTheList = section[
"GroupServersWithPlayersAtTheTopOfTheList"];
341 this->bIP2CountryAutoUpdate = section[
"IP2CAutoUpdate"];
342 this->bLookupHosts = section[
"LookupHosts"];
343 this->bQueryAutoRefreshDontIfActive = section[
"QueryAutoRefreshDontIfActive"];
344 this->bQueryAutoRefreshEnabled = section[
"QueryAutoRefreshEnabled"];
345 this->bQueryBeforeLaunch = section[
"QueryBeforeLaunch"];
346 this->bQueryOnStartup = section[
"QueryOnStartup"];
347 this->bRecordDemo = section[
"RecordDemo"];
348 this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn = section[
"TellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn"];
349 this->bUseTrayIcon = section[
"UseTrayIcon"];
350 this->bMarkServersWithBuddies = section[
"MarkServersWithBuddies"];
351 this->buddyServersColor = (
const QString &)section[
"BuddyServersColor"];
352 this->customServersColor = (
const QString &)section[
"CustomServersColor"];
353 this->lanServersColor = (
const QString &)section[
"LanServersColor"];
354 this->mainWindowState = (
const QString &)section[
"MainWindowState"];
355 this->mainWindowGeometry = section.
value(
"MainWindowGeometry",
"").toByteArray();
356 this->queryAutoRefreshEverySeconds = section[
"QueryAutoRefreshEverySeconds"];
357 d->querySpeed.intervalBetweenServers = section[
"QueryServerInterval"];
358 d->querySpeed.delayBetweenSingleServerAttempts = section[
"QueryServerTimeout"];
359 d->querySpeed.attemptsPerServer = section[
"QueryAttemptsPerServer"];
360 this->previousCreateServerConfigDir = (
const QString &)section[
"PreviousCreateServerConfigDir"];
361 this->previousCreateServerExecDir = (
const QString &)section[
"PreviousCreateServerExecDir"];
362 this->previousCreateServerWadDir = (
const QString &)section[
"PreviousCreateServerWadDir"];
363 this->serverListColumnState = (
const QString &)section[
"ServerListColumnState"];
364 this->serverListSortIndex = section[
"ServerListSortIndex"];
365 this->serverListSortDirection = section[
"ServerListSortDirection"];
366 this->slotStyle = section[
"SlotStyle"];
371 QList<CustomServerInfo> customServersList;
373 this->customServers = customServersList.toVector();
377 QVariant variantWadPaths = section[
"WadPaths"].
value();
378 if (variantWadPaths.isValid() && variantWadPaths.toList().isEmpty())
382 QStringList paths = variantWadPaths.toString().split(
";");
383 foreach (
const QString& path, paths)
391 wadPaths = FileSearchPath::fromVariantList(section[
"WadPaths"].value().toList());
396 QString buddiesConfigEntry = section[
"BuddiesList"];
397 BuddyInfo::readConfigEntry(buddiesConfigEntry, this->buddiesList);
400 void DoomseekerConfig::DoomseekerCfg::save(
IniSection& section)
402 section[
"Localization"] = this->localization;
403 section[
"BotsAreNotPlayers"] = this->bBotsAreNotPlayers;
404 section[
"CloseToTrayIcon"] = this->bCloseToTrayIcon;
405 section[
"ColorizeServerConsole"] = this->bColorizeServerConsole;
406 section[
"DrawGridInServerTable"] = this->bDrawGridInServerTable;
407 section[
"HidePasswords"] = this->bHidePasswords;
408 section[
"GroupServersWithPlayersAtTheTopOfTheList"] = this->bGroupServersWithPlayersAtTheTopOfTheList;
409 section[
"IP2CAutoUpdate"] = this->bIP2CountryAutoUpdate;
410 section[
"LookupHosts"] = this->bLookupHosts;
411 section[
"QueryAutoRefreshDontIfActive"] = this->bQueryAutoRefreshDontIfActive;
412 section[
"QueryAutoRefreshEnabled"] = this->bQueryAutoRefreshEnabled;
413 section[
"QueryBeforeLaunch"] = this->bQueryBeforeLaunch;
414 section[
"QueryOnStartup"] = this->bQueryOnStartup;
415 section[
"RecordDemo"] = this->bRecordDemo;
416 section[
"TellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn"] = this->bTellMeWhereAreTheWADsWhenIHoverCursorOverWADSColumn;
417 section[
"UseTrayIcon"] = this->bUseTrayIcon;
418 section[
"MarkServersWithBuddies"] = this->bMarkServersWithBuddies;
419 section[
"BuddyServersColor"] = this->buddyServersColor;
420 section[
"CustomServersColor"] = this->customServersColor;
421 section[
"LanServersColor"] = this->lanServersColor;
422 section[
"MainWindowState"] = this->mainWindowState;
423 section.
setValue(
"MainWindowGeometry", this->mainWindowGeometry);
424 section[
"QueryAutoRefreshEverySeconds"] = this->queryAutoRefreshEverySeconds;
425 section[
"QueryServerInterval"] = this->querySpeed().intervalBetweenServers;
426 section[
"QueryServerTimeout"] = this->querySpeed().delayBetweenSingleServerAttempts;
427 section[
"QueryAttemptsPerServer"] = this->querySpeed().attemptsPerServer;
428 section[
"PreviousCreateServerConfigDir"] = this->previousCreateServerConfigDir;
429 section[
"PreviousCreateServerExecDir"] = this->previousCreateServerExecDir;
430 section[
"PreviousCreateServerWadDir"] = this->previousCreateServerWadDir;
431 section[
"ServerListColumnState"] = this->serverListColumnState;
432 section[
"ServerListSortIndex"] = this->serverListSortIndex;
433 section[
"ServerListSortDirection"] = this->serverListSortDirection;
434 section[
"SlotStyle"] = this->slotStyle;
439 QStringList allCustomServers;
442 QString engineName = QUrl::toPercentEncoding(customServer.engine,
"",
"()");
443 QString address = QUrl::toPercentEncoding(customServer.host,
"",
"()");
445 QString customServerString = QString(
"(%1;%2;%3)")
446 .arg(engineName).arg(address)
447 .arg(customServer.port);
449 allCustomServers << customServerString;
451 section[
"CustomServers"] = allCustomServers.join(
";");
454 section[
"WadPaths"].
setValue(FileSearchPath::toVariantList(this->wadPaths));
457 QString buddiesList = BuddyInfo::createConfigEntry(this->buddiesList);
458 section[
"BuddiesList"] = buddiesList;
461 const QuerySpeed &DoomseekerConfig::DoomseekerCfg::querySpeed()
const 463 return d->querySpeed;
466 void DoomseekerConfig::DoomseekerCfg::setQuerySpeed(
const QuerySpeed &val)
471 QList<FileAlias> DoomseekerConfig::DoomseekerCfg::wadAliases()
const 473 QList<FileAlias> list;
474 QVariantList varList = d->section.value(
"WadAliases").toList();
475 foreach (
const QVariant &var, varList)
477 list << FileAlias::deserializeQVariant(var);
479 return FileAliasList::mergeDuplicates(list);
482 void DoomseekerConfig::DoomseekerCfg::setWadAliases(
const QList<FileAlias> &val)
484 QVariantList varList;
487 varList << elem.serializeQVariant();
489 d->section.setValue(
"WadAliases", varList);
492 void DoomseekerConfig::DoomseekerCfg::enableFreedoomInstallation(
const QString &dir)
496 wadPaths.prepend(dir);
498 QList<FileAlias> aliases = wadAliases();
499 aliases << FileAlias::freeDoom1Aliases();
500 aliases << FileAlias::freeDoom2Aliases();
501 aliases = FileAliasList::mergeDuplicates(aliases);
502 setWadAliases(aliases);
505 QStringList DoomseekerConfig::DoomseekerCfg::wadPathsOnly()
const 510 result << path.path();
515 const QString DoomseekerConfig::AutoUpdates::SECTION_NAME =
"Doomseeker_AutoUpdates";
517 void DoomseekerConfig::AutoUpdates::init(
IniSection& section)
521 section.
createSetting(
"LastKnownUpdateRevisions", QVariant());
525 void DoomseekerConfig::AutoUpdates::load(
IniSection& section)
527 updateChannelName = (
const QString &)section[
"UpdateChannelName"];
528 updateMode = (UpdateMode)section[
"UpdateMode"].value().toInt();
529 QVariantMap lastKnownUpdateRevisionsVariant = section[
"LastKnownUpdateRevisions"].
value().toMap();
530 lastKnownUpdateRevisions.clear();
531 foreach (
const QString& package, lastKnownUpdateRevisionsVariant.keys())
533 QVariant revisionVariant = lastKnownUpdateRevisionsVariant[package];
534 lastKnownUpdateRevisions.insert(package, revisionVariant.toString());
536 bPerformUpdateOnNextRun = section[
"bPerformUpdateOnNextRun"].
value().toBool();
539 void DoomseekerConfig::AutoUpdates::save(
IniSection& section)
541 section[
"UpdateChannelName"] = updateChannelName;
542 section[
"UpdateMode"] = updateMode;
543 QVariantMap revisionsVariantMap;
544 foreach (
const QString& package, lastKnownUpdateRevisions.keys())
546 revisionsVariantMap.insert(package, lastKnownUpdateRevisions[package]);
548 section[
"LastKnownUpdateRevisions"].
setValue(revisionsVariantMap);
549 section[
"bPerformUpdateOnNextRun"].
setValue(bPerformUpdateOnNextRun);
552 const QString DoomseekerConfig::ServerFilter::SECTION_NAME =
"ServerFilter";
554 void DoomseekerConfig::ServerFilter::init(
IniSection& section)
564 section.
createSetting(
"TestingServers", Doomseeker::Indifferent);
569 void DoomseekerConfig::ServerFilter::load(
IniSection& section)
571 info.bEnabled = section[
"bEnabled"];
572 info.bShowEmpty = section[
"bShowEmpty"];
573 info.bShowFull = section[
"bShowFull"];
574 info.bShowOnlyValid = section[
"bShowOnlyValid"];
575 info.gameModes = section[
"GameModes"].
value().toStringList();
576 info.gameModesExcluded = section[
"GameModesExcluded"].
value().toStringList();
577 info.maxPing = section[
"MaxPing"];
578 info.serverName = (
const QString &)section[
"ServerName"];
579 info.testingServers =
static_cast<Doomseeker::ShowMode
>(section.
value(
"TestingServers").toInt());
580 info.wads = section[
"WADs"].
value().toStringList();
581 info.wadsExcluded = section[
"WADsExcluded"].
value().toStringList();
584 void DoomseekerConfig::ServerFilter::save(
IniSection& section)
586 section[
"bEnabled"] = info.bEnabled;
587 section[
"bShowEmpty"] = info.bShowEmpty;
588 section[
"bShowFull"] = info.bShowFull;
589 section[
"bShowOnlyValid"] = info.bShowOnlyValid;
590 section[
"GameModes"].
setValue(info.gameModes);
591 section[
"GameModesExcluded"].
setValue(info.gameModesExcluded);
592 section[
"MaxPing"] = info.maxPing;
593 section[
"ServerName"] = info.serverName;
594 section[
"TestingServers"] = info.testingServers;
595 section[
"WADs"].
setValue(info.wads);
596 section[
"WADsExcluded"].
setValue(info.wadsExcluded);
599 const QString DoomseekerConfig::WadseekerCfg::SECTION_NAME =
"Wadseeker";
601 DoomseekerConfig::WadseekerCfg::WadseekerCfg()
603 this->bAlwaysUseDefaultSites =
true;
604 this->bSearchInIdgames =
true;
605 this->bSearchInWadArchive =
true;
606 this->colorMessageCriticalError =
"#ff0000";
607 this->colorMessageError =
"#ff0000";
608 this->colorMessageNotice =
"#000000";
609 this->connectTimeoutSeconds = WADSEEKER_CONNECT_TIMEOUT_SECONDS_DEFAULT;
610 this->downloadTimeoutSeconds = WADSEEKER_DOWNLOAD_TIMEOUT_SECONDS_DEFAULT;
611 this->idgamesURL = Wadseeker::defaultIdgamesUrl();
612 this->maxConcurrentSiteDownloads = 3;
613 this->maxConcurrentWadDownloads = 2;
614 this->targetDirectory = gDefaultDataPaths->programsDataDirectoryPath();
623 section.
createSetting(
"AlwaysUseDefaultSites", this->bAlwaysUseDefaultSites);
624 section.
createSetting(
"SearchInIdgames", this->bSearchInIdgames);
625 section.
createSetting(
"SearchInWadArchive", this->bSearchInWadArchive);
626 section.
createSetting(
"ColorMessageCriticalError", this->colorMessageCriticalError);
627 section.
createSetting(
"ColorMessageError", this->colorMessageError);
628 section.
createSetting(
"ColorMessageNotice", this->colorMessageNotice);
629 section.
createSetting(
"ConnectTimeoutSeconds", this->connectTimeoutSeconds);
630 section.
createSetting(
"DownloadTimeoutSeconds", this->downloadTimeoutSeconds);
632 section.
createSetting(
"MaxConcurrentSiteDownloads", this->maxConcurrentSiteDownloads);
633 section.
createSetting(
"MaxConcurrentWadDownloads", this->maxConcurrentWadDownloads);
634 section.
createSetting(
"SearchURLs", Wadseeker::defaultSitesListEncoded().join(
";"));
635 section.
createSetting(
"TargetDirectory", this->targetDirectory);
638 void DoomseekerConfig::WadseekerCfg::load(
IniSection& section)
640 this->bAlwaysUseDefaultSites = section[
"AlwaysUseDefaultSites"];
641 this->bSearchInIdgames = section[
"SearchInIdgames"];
642 this->bSearchInWadArchive = section[
"SearchInWadArchive"];
643 this->colorMessageCriticalError = (
const QString &)section[
"ColorMessageCriticalError"];
644 this->colorMessageError = (
const QString &)section[
"ColorMessageError"];
645 this->colorMessageNotice = (
const QString &)section[
"ColorMessageNotice"];
646 this->connectTimeoutSeconds = section[
"ConnectTimeoutSeconds"];
647 this->downloadTimeoutSeconds = section[
"DownloadTimeoutSeconds"];
648 this->idgamesURL = (
const QString &)section[
"IdgamesApiURL"];
649 this->maxConcurrentSiteDownloads = section[
"MaxConcurrentSiteDownloads"];
650 this->maxConcurrentWadDownloads = section[
"MaxConcurrentWadDownloads"];
651 this->targetDirectory = (
const QString &)section[
"TargetDirectory"];
654 this->searchURLs.clear();
655 QStringList urlList = section[
"SearchURLs"].valueString().split(
";", QString::SkipEmptyParts);
656 foreach (
const QString& url, urlList)
658 this->searchURLs << QUrl::fromPercentEncoding(url.toUtf8());
662 void DoomseekerConfig::WadseekerCfg::save(
IniSection& section)
664 section[
"AlwaysUseDefaultSites"] = this->bAlwaysUseDefaultSites;
665 section[
"SearchInIdgames"] = this->bSearchInIdgames;
666 section[
"SearchInWadArchive"] = this->bSearchInWadArchive;
667 section[
"ColorMessageCriticalError"] = this->colorMessageCriticalError;
668 section[
"ColorMessageError"] = this->colorMessageError;
669 section[
"ColorMessageNotice"] = this->colorMessageNotice;
670 section[
"ConnectTimeoutSeconds"] = this->connectTimeoutSeconds;
671 section[
"DownloadTimeoutSeconds"] = this->downloadTimeoutSeconds;
672 section[
"IdgamesApiURL"] = this->idgamesURL;
673 section[
"MaxConcurrentSiteDownloads"] = this->maxConcurrentSiteDownloads;
674 section[
"MaxConcurrentWadDownloads"] = this->maxConcurrentWadDownloads;
675 section[
"TargetDirectory"] = this->targetDirectory;
678 QStringList urlEncodedList;
679 foreach (
const QString& url, this->searchURLs)
681 urlEncodedList << QUrl::toPercentEncoding(url);
683 section[
"SearchURLs"] = urlEncodedList.join(
";");
IniVariable createSetting(const QString &name, const QVariant &data)
Inits specified variable with specified data.
void init(IniSection §ion)
Initializes values that are not present in the section yet.
bool saveToFile()
Saves current settings to ini file. This file must be previously set by setIniFile() method...
This Singleton holds entire Doomseeker configuration in memory.
static bool containsPath(const QStringList &candidates, const QString &path)
Uses QFileInfo::operator== to see if 'path' is on 'candidates' list.
QVariant value(const QString &key) const
Retrieves a variable directly; omits the IniVariable system.
IniSection iniSectionForPlugin(const QString &pluginName)
This will assume that the .ini file is initialized.
static QList< FileAlias > standardWadAliases()
Standard/default aliases for configuration init.
static void decodeConfigEntries(const QString &str, QList< CustomServerInfo > &outCustomServerInfoList)
void init(IniSection §ion)
Initializes values that are not present in the section yet.
bool readFromFile()
Reads settings from ini file. This file must be previously set by setIniFile() method.
static UpdateChannel mkStable()
Creates "stable" channel object.
static DoomseekerConfig & config()
Returns the Singleton.
void setValue(const QString &key, const QVariant &value)
Sets a variable directly. Omits the IniVariable system.
INI section representation.
bool setIniFile(const QString &filePath)
Initializes the Ini class instance to point to a file.
static void dispose()
Disposes of the Singleton.