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