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