| 323 | } |
| 324 | |
| 325 | void frmOptions::writeConfig() { |
| 326 | #ifdef Q_OS_MAC |
| 327 | InfoPlistDockIcon::setShowDockIcon(ui.cbShowDockIcon->isChecked()); |
| 328 | #endif |
| 329 | |
| 330 | const QNapiConfig config = LibQNapi::loadConfig(); |
| 331 | |
| 332 | QString permissions = QString("%1%2%3") |
| 333 | .arg(ui.sbUPerm->value()) |
| 334 | .arg(ui.sbGPerm->value()) |
| 335 | .arg(ui.sbOPerm->value()); |
| 336 | |
| 337 | auto updatedGeneralConfig = |
| 338 | config.generalConfig() |
| 339 | .setUiLanguage( |
| 340 | ui.cbUiLanguage->itemData(ui.cbUiLanguage->currentIndex()) |
| 341 | .toString()) |
| 342 | .setP7zipPath(ui.le7zPath->text()) |
| 343 | .setTmpPath(ui.leTmpPath->text()) |
| 344 | .setLanguage( |
| 345 | ui.cbLang->itemData(ui.cbLang->currentIndex()).toString()) |
| 346 | .setBackupLanguage( |
| 347 | ui.cbLangBackup->itemData(ui.cbLangBackup->currentIndex()) |
| 348 | .toString()) |
| 349 | .setNoBackup(ui.cbNoBackup->isChecked()) |
| 350 | .setQuietBatch(ui.cbQuietBatch->isChecked()) |
| 351 | .setSearchPolicy( |
| 352 | static_cast<SearchPolicy>(ui.cbSearchPolicy->currentIndex())) |
| 353 | .setDownloadPolicy( |
| 354 | static_cast<DownloadPolicy>(ui.cbDownloadPolicy->currentIndex())) |
| 355 | .setChangePermissionsEnabled(ui.cbChangePermissions->isChecked()) |
| 356 | .setChangePermissionsTo(permissions); |
| 357 | |
| 358 | QList<QPair<QString, bool> > updatedEnabledEngines; |
| 359 | for (int i = 0; i < ui.twEngines->rowCount(); ++i) { |
| 360 | updatedEnabledEngines << qMakePair( |
| 361 | ui.twEngines->item(i, 0)->text(), |
| 362 | ui.twEngines->item(i, 0)->checkState() == Qt::Checked); |
| 363 | } |
| 364 | |
| 365 | QString targetSubFormat = ui.cbSubFormat->currentIndex() == 0 |
| 366 | ? "" |
| 367 | : subtitleFormatsRegistry->listFormatNames().at( |
| 368 | ui.cbSubFormat->currentIndex() - 1); |
| 369 | QString targetSubExt = ui.cbSubExtension->currentIndex() == 0 |
| 370 | ? "" |
| 371 | : ui.cbSubExtension->currentText(); |
| 372 | |
| 373 | auto updatedPostProcessingConfig = |
| 374 | config.postProcessingConfig() |
| 375 | .setEnabled(ui.gbPpEnable->isChecked()) |
| 376 | .setEncodingChangeMethod(static_cast<EncodingChangeMethod>( |
| 377 | ui.cbEncodingMethod->currentIndex())) |
| 378 | .setEncodingAutoDetectFrom(ui.cbAutoDetectEncoding->isChecked()) |
| 379 | .setEncodingFrom(ui.cbEncFrom->currentText()) |
| 380 | .setEncodingTo(ui.cbEncTo->currentText()) |
| 381 | .setShowAllEncodings(ui.cbShowAllEncodings->isChecked()) |
| 382 | .setRemoveWordsEnabled(ui.cbRemoveLines->isChecked()) |
no test coverage detected