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())
120 error = tr(
"No path specified.");
122 if (error.isEmpty() && !targetDirectory.exists())
123 error = tr(
"This path doesn't exist.");
125 if (error.isEmpty() && !targetDirectory.isDir())
126 error = tr(
"This is not a directory.");
128 if (error.isEmpty() && !targetDirectory.isWritable())
129 error = tr(
"This directory cannot be written to.");
131 d->lblDirectoryWarning->setVisible(!error.isEmpty());
132 d->lblDirectoryWarning->setText(error);