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