23 #include "cfgwadseekergeneral.h" 24 #include "ui_cfgwadseekergeneral.h" 26 #include "configuration/doomseekerconfig.h" 27 #include "pathfinder/filesearchpath.h" 31 #include <QMessageBox> 33 DClass<CFGWadseekerGeneral> :
public Ui::CFGWadseekerGeneral
38 QString targetDirectory()
const 40 return cbTargetDirectory->currentText().trimmed();
50 d->completerActive =
false;
53 d->widgetTimeouts->setVisible(
false);
54 d->lblDirectoryWarning->setPixmap(QPixmap(
":/icons/exclamation_16.png"));
55 d->lblDirectoryWarning->hide();
56 d->lblDirectoryWarning->setWordWrap(
true);
58 this->connect(d->cbTargetDirectory, SIGNAL(editTextChanged(QString)),
59 SIGNAL(validationRequested()));
62 CFGWadseekerGeneral::~CFGWadseekerGeneral()
66 void CFGWadseekerGeneral::activateCompleter()
75 if (!d->completerActive)
77 d->cbTargetDirectory->setCompleter(
new QCompleter(
new QDirModel()));
78 d->completerActive =
true;
82 void CFGWadseekerGeneral::fillTargetDirectoryComboBox()
84 d->cbTargetDirectory->clear();
85 d->cbTargetDirectory->addItems(gConfig.doomseeker.wadPathsOnly());
90 fillTargetDirectoryComboBox();
92 d->cbTargetDirectory->setEditText(gConfig.wadseeker.targetDirectory);
93 d->spinConnectTimeout->setValue(gConfig.wadseeker.connectTimeoutSeconds);
94 d->spinDownloadTimeout->setValue(gConfig.wadseeker.downloadTimeoutSeconds);
95 d->spinMaxConcurrentSiteSeeks->setValue(gConfig.wadseeker.maxConcurrentSiteDownloads);
96 d->spinMaxConcurrentWadDownloads->setValue(gConfig.wadseeker.maxConcurrentWadDownloads);
101 gConfig.wadseeker.targetDirectory = d->targetDirectory();
102 gConfig.wadseeker.connectTimeoutSeconds = d->spinConnectTimeout->value();
103 gConfig.wadseeker.downloadTimeoutSeconds = d->spinDownloadTimeout->value();
104 gConfig.wadseeker.maxConcurrentSiteDownloads = d->spinMaxConcurrentSiteSeeks->value();
105 gConfig.wadseeker.maxConcurrentWadDownloads = d->spinMaxConcurrentWadDownloads->value();
108 void CFGWadseekerGeneral::showEvent(QShowEvent *event)
111 ConfigPage::showEvent(event);
118 QFileInfo targetDirectory = d->targetDirectory();
119 if (error.isEmpty() && d->targetDirectory().isEmpty())
121 error = tr(
"No path specified.");
124 if (error.isEmpty() && !targetDirectory.exists())
126 error = tr(
"This path doesn't exist.");
129 if (error.isEmpty() && !targetDirectory.isDir())
131 error = tr(
"This is not a directory.");
134 if (error.isEmpty() && !targetDirectory.isWritable())
136 error = tr(
"This directory cannot be written to.");
143 bool pathOnList =
false;
149 QFileInfo possiblePathFileInfo(possiblePath.path());
151 if (possiblePathFileInfo == targetDirectory)
161 "The specified target directory for Wadseeker could not be found on the file (WAD) paths list.\n\n" 162 "Doomseeker will automatically add this path to the file search paths.");
166 d->lblDirectoryWarning->setVisible(!error.isEmpty());
167 d->lblDirectoryWarning->setText(error);
Validation
Result of validate()
void saveSettings()
Reimplement this to write settings to config from widgets.
Validation detected no problems.
Validation validate()
Validate settings on this page.
void readSettings()
Reimplement this to read settings from config into widgets.
Validation detected at least one problem.
Base class for configuration pages.