MCPcopy Create free account
hub / github.com/QNapi/qnapi / writeConfig

Method writeConfig

gui/src/forms/frmoptions.cpp:325–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325void 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())

Callers 1

showSettingsMethod · 0.45

Calls 15

setDownloadPolicyMethod · 0.80
setSearchPolicyMethod · 0.80
setQuietBatchMethod · 0.80
setNoBackupMethod · 0.80
setBackupLanguageMethod · 0.80
setTmpPathMethod · 0.80
setP7zipPathMethod · 0.80
setUiLanguageMethod · 0.80
generalConfigMethod · 0.80
listFormatNamesMethod · 0.80

Tested by

no test coverage detected