237{
239
240
241
242
243 {
244 scrollAreaWidgetContents->setAutoFillBackground(false);
245 scrollAreaWidgetContents->parentWidget()->setAutoFillBackground(false);
246 }
247
248
249
250
251
253 << i18n("No Cursor")
254 << i18n("Tool Icon")
255 << i18n("Arrow")
256 << i18n("Small Circle")
257 << i18n("Crosshair")
258 << i18n("Triangle Righthanded")
259 << i18n("Triangle Lefthanded")
260 << i18n("Black Pixel")
261 << i18n("White Pixel");
262
264 << i18nc("Display options label to not DISPLAY brush outline", "No Outline")
265 << i18n("Circle Outline")
266 << i18n("Preview Outline")
267 << i18n("Tilt Outline");
268
269
270
271 m_cmbCursorShape->addItems(cursorItems);
272
273 m_cmbCursorShape->setCurrentIndex(cfg.newCursorStyle());
274
275 m_cmbOutlineShape->addItems(outlineItems);
276
277 m_cmbOutlineShape->setCurrentIndex(cfg.newOutlineStyle());
278
279 m_showOutlinePainting->setChecked(cfg.showOutlineWhilePainting());
280 m_changeBrushOutline->setChecked(!cfg.forceAlwaysFullSizedOutline());
281
283 cursorColor.fromQColor(cfg.getCursorMainColor());
284 cursorColorButton->setColor(cursorColor);
285
286
287
288 m_chkSeparateEraserCursor->setChecked(cfg.separateEraserCursor());
289
290 m_cmbEraserCursorShape->addItems(cursorItems);
291 m_cmbEraserCursorShape->addItem(i18n("Eraser"));
292
293 m_cmbEraserCursorShape->setCurrentIndex(cfg.eraserCursorStyle());
294
295 m_cmbEraserOutlineShape->addItems(outlineItems);
296
297 m_cmbEraserOutlineShape->setCurrentIndex(cfg.eraserOutlineStyle());
298
299 m_showEraserOutlinePainting->setChecked(cfg.showEraserOutlineWhilePainting());
300 m_changeEraserBrushOutline->setChecked(!cfg.forceAlwaysFullSizedEraserOutline());
301
303 eraserCursorColor.fromQColor(cfg.getEraserCursorMainColor());
304 eraserCursorColorButton->setColor(eraserCursorColor);
305
306
307
310 connect(m_cmbColorSamplerPreviewStyle,
311 QOverload<int>::of(&QComboBox::currentIndexChanged),
312 this,
315
316 m_nmbColorSamplerPreviewSize->setRange(1, 400);
317 m_nmbColorSamplerPreviewSize->setValue(cfg.colorSamplerPreviewCircleDiameter());
318 m_lblColorSamplerPreviewSizePreview->setDiameter(cfg.colorSamplerPreviewCircleDiameter());
320
321 m_ssbColorSamplerPreviewThickness->setRange(1, 50);
322 m_ssbColorSamplerPreviewThickness->setValue(cfg.colorSamplerPreviewCircleThickness());
323 m_lblColorSamplerPreviewSizePreview->setThickness(cfg.colorSamplerPreviewCircleThickness()/100.0);
325
326 m_chkColorSamplerPreviewOutlineEnabled->setChecked(cfg.colorSamplerPreviewCircleOutlineEnabled());
327 m_lblColorSamplerPreviewSizePreview->setOutlineEnabled(cfg.colorSamplerPreviewCircleOutlineEnabled());
329
330 m_chkColorSamplerPreviewExtraCircles->setChecked(cfg.colorSamplerPreviewCircleExtraCirclesEnabled());
331
332
334
335
336
337
338
339
340
341
342
343
344
345 chkUseCustomFont->setChecked(cfg.readEntry<bool>("use_custom_system_font", false));
346 cmbCustomFont->findChild <QComboBox*>("stylesComboBox")->setVisible(false);
347
348 QString fontName = cfg.readEntry<QString>("custom_system_font", "");
349 if (fontName.isEmpty()) {
350 cmbCustomFont->setCurrentFont(qApp->font());
351
352 }
353 else {
354 int pointSize = qApp->font().pointSize();
355 cmbCustomFont->setCurrentFont(QFont(fontName, pointSize));
356 }
357 int fontSize = cfg.readEntry<int>("custom_font_size", -1);
358 if (fontSize < 0) {
359 intFontSize->setValue(qApp->font().pointSize());
360 }
361 else {
362 intFontSize->setValue(fontSize);
363 }
364
365 m_cmbMDIType->setCurrentIndex(cfg.readEntry<int>("mdi_viewmode", (int)QMdiArea::TabbedView));
368
369 m_backgroundimage->setText(cfg.getMDIBackgroundImage());
372
373 QString xml = cfg.getMDIBackgroundColor();
375 m_mdiColor->setColor(mdiColor);
376
377 m_chkRubberBand->setChecked(cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
378
379 m_chkCanvasMessages->setChecked(cfg.showCanvasMessages());
380
381 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
382 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
383 m_chkHiDPI->setChecked(kritarc.value("EnableHiDPI", true).toBool());
384#if defined(Q_OS_WIN) && defined(HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY)
385 m_chkHiDPIFractionalScaling->setChecked(kritarc.value("EnableHiDPIFractionalScaling", false).toBool());
386#else
387 m_wdgHiDPIFractionalScaling->setEnabled(false);
388#endif
389 chkUsageLogging->setChecked(kritarc.value("LogUsage", true).toBool());
390
391
392
393
394
395 m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker());
396 cmbFlowMode->setCurrentIndex((int)!cfg.readEntry<bool>("useCreamyAlphaDarken", true));
397 cmbCmykBlendingMode->setCurrentIndex((int)!cfg.readEntry<bool>("useSubtractiveBlendingForCmykColorSpaces", true));
398 m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt());
399 cmbTouchPainting->addItem(
401 : i18nc("touch painting", "Auto (Enabled)"));
402 cmbTouchPainting->addItem(i18nc("touch painting", "Enabled"));
403 cmbTouchPainting->addItem(i18nc("touch painting", "Disabled"));
404 cmbTouchPainting->setCurrentIndex(int(cfg.touchPainting()));
405 chkTouchPressureSensitivity->setChecked(cfg.readEntry("useTouchPressureSensitivity", true));
406 connect(cmbTouchPainting, SIGNAL(currentIndexChanged(int)),
409
410 chkEnableTransformToolAfterPaste->setChecked(cfg.activateTransformToolAfterPaste());
411 chkZoomHorizontally->setChecked(cfg.zoomHorizontal());
412
413 chkEnableLongPress->setChecked(cfg.longPressEnabled());
414
415 m_groupBoxKineticScrollingSettings->setChecked(cfg.kineticScrollingEnabled());
416
417 m_cmbKineticScrollingGesture->addItem(i18n("On Touch Drag"));
418 m_cmbKineticScrollingGesture->addItem(i18n("On Click Drag"));
419 m_cmbKineticScrollingGesture->addItem(i18n("On Middle-Click Drag"));
420
421
422 spnZoomSteps->setValue(cfg.zoomSteps());
423
424
425 m_cmbKineticScrollingGesture->setCurrentIndex(cfg.kineticScrollingGesture());
426 m_kineticScrollingSensitivitySlider->setRange(0, 100);
427 m_kineticScrollingSensitivitySlider->setValue(cfg.kineticScrollingSensitivity());
428 m_chkKineticScrollingHideScrollbars->setChecked(cfg.kineticScrollingHiddenScrollbars());
429
430 intZoomMarginSize->setValue(cfg.zoomMarginSize());
431
432 bool sapEnabled = cfg.selectionActionBar();
433
434 chkEnableSelectionActionBar->setChecked(sapEnabled);
435
436
437
438
439 int autosaveInterval = cfg.autoSaveInterval();
440
441 m_autosaveSpinBox->setValue(autosaveInterval / 60);
442 m_autosaveCheckBox->setChecked(autosaveInterval > 0);
443 chkHideAutosaveFiles->setChecked(cfg.readEntry<bool>("autosavefileshidden", true));
444
445 m_chkCompressKra->setChecked(cfg.compressKra());
446 chkZip64->setChecked(cfg.useZip64());
447 m_chkTrimKra->setChecked(cfg.trimKra());
448 m_chkTrimFramesImport->setChecked(cfg.trimFramesImport());
449
450 m_backupFileCheckBox->setChecked(cfg.backupFile());
451 cmbBackupFileLocation->setCurrentIndex(cfg.readEntry<int>("backupfilelocation", 0));
452 txtBackupFileSuffix->setText(cfg.readEntry<QString>("backupfilesuffix", "~"));
454 txtBackupFileSuffix->setValidator(validator);
455 intNumBackupFiles->setValue(cfg.readEntry<int>("numberofbackupfiles", 1));
456
457 cmbDefaultExportFileType->clear();
459
460 QMap<QString, QString> mimeTypeMap;
461
462 foreach (const QString &mimeType, mimeFilter) {
464 mimeTypeMap.insert(description, mimeType);
465 }
466
467
468 QStringList sortedDescriptions = mimeTypeMap.keys();
469 sortedDescriptions.sort(Qt::CaseInsensitive);
470
471 cmbDefaultExportFileType->addItem(i18n("All Supported Files"), "all/mime");
472 foreach (const QString &description, sortedDescriptions) {
473 const QString &mimeType = mimeTypeMap.value(description);
474 cmbDefaultExportFileType->addItem(description, mimeType);
475 }
476
477 const QString mimeTypeToFind = cfg.exportMimeType(false).toUtf8();
478 const int index = cmbDefaultExportFileType->findData(mimeTypeToFind);
479
480 if (index >= 0) {
481 cmbDefaultExportFileType->setCurrentIndex(index);
482 } else {
483
484 const QString defaultMimeType = "image/png";
485 const int defaultIndex = cmbDefaultExportFileType->findData(defaultMimeType);
486 if (defaultIndex >= 0) {
487 cmbDefaultExportFileType->setCurrentIndex(defaultIndex);
488 } else {
489
490 qDebug() << "Default mime type not found in the combo box.";
491 }
492 }
493
494 QString selectedMimeType = cmbDefaultExportFileType->currentData().toString();
495
496
497
498
499 m_chkAutoPin->setChecked(cfg.autoPinLayersToTimeline());
500 m_chkAdaptivePlaybackRange->setChecked(cfg.adaptivePlaybackRange());
501 m_chkAutoZoom->setChecked(cfg.autoZoomTimelineToPlaybackRange());
502
503
504
505
506 cmbStartupSession->addItem(i18n("Open default window"));
507 cmbStartupSession->addItem(i18n("Load previous session"));
508 cmbStartupSession->addItem(i18n("Show session manager"));
509 cmbStartupSession->setCurrentIndex(cfg.sessionOnStartup());
510
511 chkSaveSessionOnQuit->setChecked(cfg.saveSessionOnQuit(false));
512
513 m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport());
514
515 m_undoStackSize->setValue(cfg.undoStackLimit());
516 chkCumulativeUndo->setChecked(cfg.useCumulativeUndoRedo());
517 connect(chkCumulativeUndo, SIGNAL(toggled(bool)), btnAdvancedCumulativeUndo, SLOT(setEnabled(bool)));
518 btnAdvancedCumulativeUndo->setEnabled(chkCumulativeUndo->isChecked());
521
522 chkShowRootLayer->setChecked(cfg.showRootLayer());
523
525 chkRenamePastedLayers->setChecked(cfg.renamePastedLayers());
527
528 KConfigGroup group = KSharedConfig::openConfig()->group("File Dialogs");
529 bool dontUseNative = true;
530#ifdef Q_OS_ANDROID
531 dontUseNative = false;
532#endif
533#ifdef Q_OS_UNIX
534 if (qgetenv("XDG_CURRENT_DESKTOP") == "KDE") {
535 dontUseNative = false;
536 }
537#endif
538#ifdef Q_OS_MACOS
539 dontUseNative = false;
540#endif
541#ifdef Q_OS_WIN
542 dontUseNative = false;
543#endif
544 m_chkNativeFileDialog->setChecked(!group.readEntry("DontUseNativeFileDialog", dontUseNative));
545
546 if (!qEnvironmentVariable("APPIMAGE").isEmpty()) {
547
548
549 m_chkNativeFileDialog->setChecked(false);
550 m_chkNativeFileDialog->setEnabled(false);
551 }
552
554 chkIgnoreHighFunctionKeys->setChecked(cfg.ignoreHighFunctionKeys());
555#ifndef Q_OS_WIN
556
557
558 chkIgnoreHighFunctionKeys->setVisible(false);
559#endif
560
561
562
563
565 m_urlResourceFolder->setConfigurationName("resource_directory");
567 if (QFileInfo(resourceLocation).isWritable()) {
568 m_urlResourceFolder->setFileName(resourceLocation);
569 }
570 else {
571 m_urlResourceFolder->setFileName(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
572 }
574 m_urlResourceFolder->setValidator(writableValidator);
575 connect(m_urlResourceFolder, SIGNAL(textChanged(QString)), SLOT(
checkResourcePath()));
577
578 grpRestartMessage->setPixmap(
579 grpRestartMessage->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(32, 32)));
580 grpRestartMessage->setText(i18n("You will need to Restart Krita for the changes to take an effect."));
581
582 grpAndroidWarningMessage->setVisible(false);
583 grpAndroidWarningMessage->setPixmap(
584 grpAndroidWarningMessage->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(32, 32)));
585 grpAndroidWarningMessage->setText(
586 i18n("Saving at a Location picked from the File Picker may slow down the startup!"));
587
588#ifdef Q_OS_ANDROID
589 m_urlResourceFolder->setVisible(false);
590
591 m_resourceFolderSelector->setVisible(true);
593
596
599 const QStringList locations = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
600 Q_FOREACH(const QString &location, locations) {
601 if (!filteredLocations.contains(location)) {
602 filteredLocations.append(location);
603 }
604 }
605 return filteredLocations;
606 }();
607
608 bool isFirst = true;
609
610 Q_FOREACH (QString location, locations) {
611 QString text;
612 QFileInfo fileLocation(location);
613
614 if (isFirst) {
615 text = i18n("Default");
616 isFirst = false;
617 } else if (location.startsWith("/data")) {
618 text = i18n("Internal Storage");
619 } else {
620 text = i18n("SD-Card");
621 }
622 if (fileLocation.isWritable()) {
623 writableLocationsAndText.append({text, location});
624 }
625 }
626 return writableLocationsAndText;
627 }();
628
629 for (auto it = writableLocations.constBegin(); it != writableLocations.constEnd(); ++it) {
630 m_resourceFolderSelector->addItem(it->first + " - " + it->second);
631
632 m_resourceFolderSelector->setItemData(m_resourceFolderSelector->count() - 1, it->second, Qt::UserRole);
633 }
634
635
636 if (resourceLocation.startsWith("content://")) {
637 m_resourceFolderSelector->addItem(resourceLocation);
638 int index = m_resourceFolderSelector->count() - 1;
639 m_resourceFolderSelector->setItemData(index, resourceLocation, Qt::UserRole);
640 m_resourceFolderSelector->setCurrentIndex(index);
641 grpAndroidWarningMessage->setVisible(true);
642 } else {
643
644 auto iterator = std::find_if(writableLocations.constBegin(),
645 writableLocations.constEnd(),
646 [&resourceLocation](QPair<QString, QString> location) {
647 return location.second == resourceLocation;
648 });
649
650 if (iterator != writableLocations.constEnd()) {
651 int index = writableLocations.indexOf(*iterator);
653 m_resourceFolderSelector->setCurrentIndex(index);
654 }
655 }
656
657
658 m_resourceFolderSelector->addItem(i18n("Choose Manually"));
659
660 connect(m_resourceFolderSelector, qOverload<int>(&QComboBox::activated), [this](int index) {
661 const int previousIndex = m_resourceFolderSelector->currentIndex();
662
663
664 if (m_resourceFolderSelector->count() - 1 == index) {
665 KoFileDialog dialog(this, KoFileDialog::OpenDirectory, "Select Directory");
666 const QString selectedDirectory = dialog.filename();
667
668 if (!selectedDirectory.isEmpty()) {
669
670
671 if (m_resourceFolderSelector->itemData(index - 1, Qt::DisplayRole)
672 .value<QString>()
673 .startsWith("content://")) {
674 m_resourceFolderSelector->setItemText(index - 1, selectedDirectory);
675 m_resourceFolderSelector->setItemData(index - 1, selectedDirectory, Qt::UserRole);
676 m_resourceFolderSelector->setCurrentIndex(index - 1);
677 } else {
678
679 m_resourceFolderSelector->insertItem(index, selectedDirectory);
680 m_resourceFolderSelector->setItemData(index, selectedDirectory, Qt::UserRole);
681 m_resourceFolderSelector->setCurrentIndex(index);
682 }
683
684 grpAndroidWarningMessage->setVisible(true);
685 } else {
686 m_resourceFolderSelector->setCurrentIndex(previousIndex);
687 }
688 }
689
690
691 grpAndroidWarningMessage->setVisible(
692 m_resourceFolderSelector->currentData(Qt::UserRole).value<QString>().startsWith("content://"));
693 });
694
695#else
696 m_resourceFolderSelector->setVisible(false);
697#endif
698
699 grpWindowsAppData->setVisible(false);
700#ifdef Q_OS_WIN
701 QString folderInStandardAppData;
702 QString folderInPrivateAppData;
704
705 if (!folderInPrivateAppData.isEmpty()) {
706 const auto pathToDisplay = [](const QString &path) {
707
708
709
710
711
712
713
714 return QDir::toNativeSeparators(path).replace(QChar(
'\\'), QStringLiteral(
u"\\\u200B"));
715 };
716
717 const QDir privateResourceDir(folderInPrivateAppData);
718 const QDir appDataDir(folderInStandardAppData);
719 grpWindowsAppData->setPixmap(
720 grpWindowsAppData->style()->standardIcon(QStyle::SP_MessageBoxInformation).pixmap(QSize(32, 32)));
721
722 grpWindowsAppData->setText(i18nc("@info resource folder",
723 "<p>You are using the Microsoft Store package version of Krita. "
724 "Even though Krita can be configured to place resources under the "
725 "user AppData location, Windows may actually store the files "
726 "inside a private app location.</p>\n"
727 "<p>You should check both locations to determine where "
728 "the files are located.</p>\n"
729 "<p><b>User AppData</b> (<a href=\"copyuser\">Copy</a>):<br/>\n"
730 "%1</p>\n"
731 "<p><b>Private app location</b> (<a href=\"copyprivate\">Copy</a>):<br/>\n"
732 "%2</p>",
733 pathToDisplay(appDataDir.absolutePath()),
734 pathToDisplay(privateResourceDir.absolutePath())));
735 grpWindowsAppData->setVisible(true);
736
737 connect(grpWindowsAppData,
739 [userPath = appDataDir.absolutePath(),
740 privatePath = privateResourceDir.absolutePath()](const QString &link) {
741 if (link == QStringLiteral("copyuser")) {
742 qApp->clipboard()->setText(QDir::toNativeSeparators(userPath));
743 } else if (link == QStringLiteral("copyprivate")) {
744 qApp->clipboard()->
setText(QDir::toNativeSeparators(privatePath));
745 } else {
746 qWarning() << "Unexpected link activated in lblWindowsAppDataNote:" << link;
747 }
748 });
749 }
750#endif
751
752
753 const int forcedFontDPI = cfg.readEntry("forcedDpiForQtFontBugWorkaround", -1);
754 chkForcedFontDPI->setChecked(forcedFontDPI > 0);
755 intForcedFontDPI->setValue(forcedFontDPI > 0 ? forcedFontDPI :
qt_defaultDpi());
756 intForcedFontDPI->setEnabled(forcedFontDPI > 0);
757 connect(chkForcedFontDPI, SIGNAL(toggled(bool)), intForcedFontDPI, SLOT(setEnabled(bool)));
758
763
765
767
770 }
771}
QList< QString > QStringList
Q_GUI_EXPORT int qt_defaultDpi()
bool renameDuplicatedLayers()
void showAdvancedCumulativeUndoSettings()
void colorSamplePreviewThicknessChanged(qreal value)
void colorSamplePreviewOutlineEnabledChanged(int value)
void clearBackgroundImage()
void colorSamplePreviewStyleChanged(int index)
QButtonGroup m_pasteFormatGroup
void getBackgroundImage()
void colorSamplePreviewSizeChanged(int value)
KisCumulativeUndoData m_cumulativeUndoData
void updateTouchPressureSensitivityEnabled(int)
static void setColorSamplerPreviewStyleItems(QComboBox *cmb)
bool renameMergedLayers()
static void setColorSamplerPreviewStyleIndexByValue(QComboBox *cmb, KisConfig::ColorSamplerPreviewStyle style)
void enableSubWindowOptions(int)
static QStringList supportedMimeTypes(Direction direction)
static QString descriptionForMimeType(const QString &mimeType)
Find the user-readable description for the given mimetype.
static KoColor fromXML(const QDomElement &elt, const QString &channelDepthId)
static bool tabletInputReceived()
static void getAllUserResourceFoldersLocationsForWindowsStore(QString &standardLocation, QString &privateLocation)
getAllAppDataLocationsForWindowsStore Use this to get both private and general appdata folders which ...
static QString getAppDataLocation()
WdgGeneralSettings(QWidget *parent, const char *name)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
QString button(const QWheelEvent &ev)
void setText(QSpinBox *spinBox, const QStringView textTemplate)
void linkActivated(const QString &link)
static KoColorSpaceRegistry * instance()