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