File indexing completed on 2025-01-05 03:57:13

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2003-16-10
0007  * Description : application settings interface
0008  *
0009  * SPDX-FileCopyrightText: 2003-2004 by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2003-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2007      by Arnd Baecker <arnd dot baecker at web dot de>
0012  * SPDX-FileCopyrightText: 2014-2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
0013  * SPDX-FileCopyrightText: 2014      by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail dot com>
0014  * SPDX-FileCopyrightText: 2017      by Simon Frei <freisim93 at gmail dot com>
0015  *
0016  * SPDX-License-Identifier: GPL-2.0-or-later
0017  *
0018  * ============================================================ */
0019 
0020 #include "applicationsettings_p.h"
0021 
0022 namespace Digikam
0023 {
0024 
0025 class Q_DECL_HIDDEN ApplicationSettingsCreator
0026 {
0027 public:
0028 
0029     ApplicationSettings object;
0030 };
0031 
0032 Q_GLOBAL_STATIC(ApplicationSettingsCreator, creator)
0033 
0034 // -------------------------------------------------------------------------------------------------
0035 
0036 ApplicationSettings* ApplicationSettings::instance()
0037 {
0038     return &creator->object;
0039 }
0040 
0041 ApplicationSettings::ApplicationSettings()
0042     : QObject(),
0043       d      (new Private(this))
0044 {
0045     d->config = KSharedConfig::openConfig();
0046     d->init();
0047     readSettings();
0048 
0049     // Init Max Thumbnail Size at startup.
0050 
0051     ThumbnailSize::readSettings(generalConfigGroup());
0052 }
0053 
0054 ApplicationSettings::~ApplicationSettings()
0055 {
0056     delete d;
0057 }
0058 
0059 QString ApplicationSettings::generalConfigGroupName() const
0060 {
0061     return d->configGroupGeneral;
0062 }
0063 
0064 KConfigGroup ApplicationSettings::generalConfigGroup() const
0065 {
0066     return d->config->group(generalConfigGroupName());
0067 }
0068 
0069 void ApplicationSettings::emitSetupChanged()
0070 {
0071     Q_EMIT setupChanged();
0072 }
0073 
0074 void ApplicationSettings::applyBalooSettings()
0075 {
0076 
0077 #ifdef HAVE_KFILEMETADATA
0078 
0079     BalooWrap::instance()->setSyncToBaloo(d->syncToBaloo);
0080     BalooWrap::instance()->setSyncToDigikam(d->syncToDigikam);
0081 
0082 #endif
0083 
0084 }
0085 
0086 void ApplicationSettings::readSettings()
0087 {
0088     KSharedConfigPtr config    = d->config;
0089 
0090     // ---------------------------------------------------------------------
0091 
0092     KConfigGroup group         = config->group(d->configGroupDefault);
0093     QStringList collectionList = group.readEntry(d->configAlbumCollectionsEntry, QStringList());
0094 
0095     if (!collectionList.isEmpty())
0096     {
0097         collectionList.sort();
0098         d->albumCategoryNames = collectionList;
0099     }
0100 
0101     d->albumSortRole                     = (ApplicationSettings::AlbumSortRole)
0102                                                (group.readEntry(d->configAlbumSortRoleEntry,           (int)ApplicationSettings::ByFolder));
0103 
0104     d->imageSortOrder                    = group.readEntry(d->configImageSortOrderEntry,               (int)ItemSortSettings::SortByFileName);
0105     d->imageSorting                      = group.readEntry(d->configImageSortingEntry,                 (int)ItemSortSettings::AscendingOrder);
0106     d->imageSeparationMode               = group.readEntry(d->configImageSeparationModeEntry,          (int)ItemSortSettings::CategoryByAlbum);
0107     d->imageSeparationSortOrder          = group.readEntry(d->configImageSeparationSortOrderEntry,     (int)ItemSortSettings::AscendingOrder);
0108 
0109     d->itemLeftClickAction               = (ApplicationSettings::ItemLeftClickAction)
0110                                                (group.readEntry(d->configItemLeftClickActionEntry,     (int)ApplicationSettings::ShowPreview));
0111 
0112     d->thumbnailSize                     = group.readEntry(d->configDefaultIconSizeEntry,              (int)ThumbnailSize::Medium);
0113     d->treeThumbnailSize                 = group.readEntry(d->configDefaultTreeIconSizeEntry,          22);
0114     d->treeThumbFaceSize                 = group.readEntry(d->configDefaultTreeFaceSizeEntry,          48);
0115     d->treeviewFont                      = group.readEntry(d->configTreeViewFontEntry,                 QFontDatabase::systemFont(QFontDatabase::GeneralFont));
0116     d->currentTheme                      = group.readEntry(d->configThemeEntry,                        ThemeManager::instance()->defaultThemeName());
0117 
0118     d->updateType                        = group.readEntry(d->configUpdateType,                        0);
0119     d->sidebarTitleStyle                 = (DMultiTabBar::TextStyle)
0120                                                group.readEntry(d->configSidebarTitleStyleEntry,        (int)DMultiTabBar::AllIconsText);
0121 
0122     d->ratingFilterCond                  = group.readEntry(d->configRatingFilterConditionEntry,        (int)ItemFilterSettings::GreaterEqualCondition);
0123 
0124     d->albumMonitoring                   = group.readEntry(d->configAlbumMonitoringEntry,              false);
0125     d->recursiveAlbums                   = group.readEntry(d->configRecursiveAlbumsEntry,              false);
0126     d->recursiveTags                     = group.readEntry(d->configRecursiveTagsEntry,                true);
0127     d->allGroupsOpen                     = group.readEntry(d->configAllGroupsOpenEntry,                false);
0128 
0129     d->iconShowName                      = group.readEntry(d->configIconShowNameEntry,                 true);
0130     d->iconShowSize                      = group.readEntry(d->configIconShowSizeEntry,                 false);
0131     d->iconShowDate                      = group.readEntry(d->configIconShowDateEntry,                 true);
0132     d->iconShowModDate                   = group.readEntry(d->configIconShowModificationDateEntry,     false);
0133     d->iconShowTitle                     = group.readEntry(d->configIconShowTitleEntry,                true);
0134     d->iconShowComments                  = group.readEntry(d->configIconShowCommentsEntry,             true);
0135     d->iconShowResolution                = group.readEntry(d->configIconShowResolutionEntry,           false);
0136     d->iconShowAspectRatio               = group.readEntry(d->configIconShowAspectRatioEntry,          false);
0137     d->iconShowTags                      = group.readEntry(d->configIconShowTagsEntry,                 true);
0138     d->iconShowOverlays                  = group.readEntry(d->configIconShowOverlaysEntry,             true);
0139     d->iconShowFullscreen                = group.readEntry(d->configIconShowFullscreenEntry,           true);
0140     d->iconShowRating                    = group.readEntry(d->configIconShowRatingEntry,               true);
0141     d->iconShowPickLabel                 = group.readEntry(d->configIconShowPickLabelEntry,            true);
0142     d->iconShowColorLabel                = group.readEntry(d->configIconShowColorLabelEntry,           true);
0143     d->iconShowImageFormat               = group.readEntry(d->configIconShowImageFormatEntry,          true);
0144     d->iconShowCoordinates               = group.readEntry(d->configIconShowCoordinatesEntry,          true);
0145     d->iconviewFont                      = group.readEntry(d->configIconViewFontEntry,                 QFontDatabase::systemFont(QFontDatabase::GeneralFont));
0146 
0147     d->toolTipsFont                      = group.readEntry(d->configToolTipsFontEntry,                 QFontDatabase::systemFont(QFontDatabase::GeneralFont));
0148     d->showToolTips                      = group.readEntry(d->configShowToolTipsEntry,                 false);
0149     d->tooltipShowFileName               = group.readEntry(d->configToolTipsShowFileNameEntry,         true);
0150     d->tooltipShowFileDate               = group.readEntry(d->configToolTipsShowFileDateEntry,         false);
0151     d->tooltipShowFileSize               = group.readEntry(d->configToolTipsShowFileSizeEntry,         false);
0152     d->tooltipShowImageType              = group.readEntry(d->configToolTipsShowImageTypeEntry,        false);
0153     d->tooltipShowImageDim               = group.readEntry(d->configToolTipsShowImageDimEntry,         true);
0154     d->tooltipShowImageAR                = group.readEntry(d->configToolTipsShowImageAREntry,          true);
0155     d->tooltipShowPhotoMake              = group.readEntry(d->configToolTipsShowPhotoMakeEntry,        true);
0156     d->tooltipShowPhotoLens              = group.readEntry(d->configToolTipsShowPhotoLensEntry,        true);
0157     d->tooltipShowPhotoDate              = group.readEntry(d->configToolTipsShowPhotoDateEntry,        true);
0158     d->tooltipShowPhotoFocal             = group.readEntry(d->configToolTipsShowPhotoFocalEntry,       true);
0159     d->tooltipShowPhotoExpo              = group.readEntry(d->configToolTipsShowPhotoExpoEntry,        true);
0160     d->tooltipShowPhotoMode              = group.readEntry(d->configToolTipsShowPhotoModeEntry,        true);
0161     d->tooltipShowPhotoFlash             = group.readEntry(d->configToolTipsShowPhotoFlashEntry,       false);
0162     d->tooltipShowPhotoWb                = group.readEntry(d->configToolTipsShowPhotoWBEntry,          false);
0163     d->tooltipShowAlbumName              = group.readEntry(d->configToolTipsShowAlbumNameEntry,        false);
0164     d->tooltipShowTitles                 = group.readEntry(d->configToolTipsShowTitlesEntry,           true);
0165     d->tooltipShowComments               = group.readEntry(d->configToolTipsShowCommentsEntry,         true);
0166     d->tooltipShowTags                   = group.readEntry(d->configToolTipsShowTagsEntry,             true);
0167     d->tooltipShowLabelRating            = group.readEntry(d->configToolTipsShowLabelRatingEntry,      true);
0168 
0169     d->tooltipShowVideoAspectRatio       = group.readEntry(d->configToolTipsShowVideoAspectRatioEntry,      true);
0170     d->tooltipShowVideoAudioBitRate      = group.readEntry(d->configToolTipsShowVideoAudioBitRateEntry,     true);
0171     d->tooltipShowVideoAudioChannelType  = group.readEntry(d->configToolTipsShowVideoAudioChannelTypeEntry, true);
0172     d->tooltipShowVideoAudioCodec        = group.readEntry(d->configToolTipsShowVideoAudioCodecEntry,       true);
0173     d->tooltipShowVideoDuration          = group.readEntry(d->configToolTipsShowVideoDurationEntry,         true);
0174     d->tooltipShowVideoFrameRate         = group.readEntry(d->configToolTipsShowVideoFrameRateEntry,        true);
0175     d->tooltipShowVideoVideoCodec        = group.readEntry(d->configToolTipsShowVideoVideoCodecEntry,       true);
0176 
0177     d->showAlbumToolTips                 = group.readEntry(d->configShowAlbumToolTipsEntry,            false);
0178     d->tooltipShowAlbumTitle             = group.readEntry(d->configToolTipsShowAlbumTitleEntry,       true);
0179     d->tooltipShowAlbumDate              = group.readEntry(d->configToolTipsShowAlbumDateEntry,        true);
0180     d->tooltipShowAlbumCollection        = group.readEntry(d->configToolTipsShowAlbumCollectionEntry,  true);
0181     d->tooltipShowAlbumCategory          = group.readEntry(d->configToolTipsShowAlbumCategoryEntry,    true);
0182     d->tooltipShowAlbumCaption           = group.readEntry(d->configToolTipsShowAlbumCaptionEntry,     true);
0183     d->tooltipShowAlbumPreview           = group.readEntry(d->configToolTipsShowAlbumPreviewEntry,     false);
0184 
0185     if (group.readEntry(d->configPreviewLoadFullItemSizeEntry, true))
0186     {
0187         d->previewSettings.quality       = PreviewSettings::HighQualityPreview;
0188         d->previewSettings.rawLoading    = (PreviewSettings::RawLoading)
0189                                                group.readEntry(d->configPreviewRawUseLoadingDataEntry, (int)PreviewSettings::RawPreviewAutomatic);
0190     }
0191     else
0192     {
0193         d->previewSettings.quality       = PreviewSettings::FastPreview;
0194     }
0195 
0196     d->previewSettings.convertToEightBit = group.readEntry(d->configPreviewConvertToEightBitEntry,     false);
0197     d->scaleFitToWindow                  = group.readEntry(d->configPreviewScaleFitToWindowEntry,      false);
0198     d->previewShowIcons                  = group.readEntry(d->configPreviewShowIconsEntry,             true);
0199     d->showThumbbar                      = group.readEntry(d->configShowThumbbarEntry,                 true);
0200 
0201     d->showFolderTreeViewItemsCount      = group.readEntry(d->configShowFolderTreeViewItemsCountEntry, false);
0202 
0203     // ---------------------------------------------------------------------
0204 
0205     group                                = generalConfigGroup();
0206 
0207     d->showSplash                        = group.readEntry(d->configShowSplashEntry,                                  true);
0208     d->useTrash                          = group.readEntry(d->configUseTrashEntry,                                    true);
0209     d->showTrashDeleteDialog             = group.readEntry(d->configShowTrashDeleteDialogEntry,                       true);
0210     d->showPermanentDeleteDialog         = group.readEntry(d->configShowPermanentDeleteDialogEntry,                   true);
0211     d->sidebarApplyDirectly              = group.readEntry(d->configApplySidebarChangesDirectlyEntry,                 false);
0212 
0213 #ifdef Q_OS_MACOS
0214 
0215     d->useNativeFileDialog               = group.readEntry(d->configUseNativeFileDialogEntry,                         true);
0216 
0217 #else
0218 
0219     d->useNativeFileDialog               = group.readEntry(d->configUseNativeFileDialogEntry,                         false);
0220 
0221 #endif
0222 
0223     d->drawFramesToGrouped               = group.readEntry(d->configDrawFramesToGroupedEntry,                         true);
0224     d->expandNewCurrentItem              = group.readEntry(d->configExpandNewCurrentItemEntry,                        true);
0225     d->scrollItemToCenter                = group.readEntry(d->configScrollItemToCenterEntry,                          false);
0226     d->showOnlyPersonTagsInPeopleSidebar = group.readEntry(d->configShowOnlyPersonTagsInPeopleSidebarEntry,           true);
0227     d->detectFacesInNewImages            = group.readEntry(d->configDetectFacesInNewImagesEntry,                      false);
0228     d->stringComparisonType              = (StringComparisonType)
0229                                                group.readEntry(d->configStringComparisonTypeEntry,                    (int) Natural);
0230 
0231 #if defined Q_OS_WIN || defined Q_OS_MACOS
0232 
0233     QString defaultStyle                 = QLatin1String("Breeze");
0234 
0235 #else
0236 
0237     QString defaultStyle                 = qApp->style()->objectName();
0238 
0239 #endif
0240 
0241 #ifdef HAVE_APPSTYLE_SUPPORT
0242 
0243     QString style = group.readEntry(d->configApplicationStyleEntry, defaultStyle);
0244 
0245     if (style == QLatin1String("Macintosh"))        // See bug @475572
0246     {
0247         style = QLatin1String("Breeze");
0248     }
0249 
0250     setApplicationStyle(style);
0251 
0252 #else
0253 
0254     setApplicationStyle(QLatin1String("Breeze"));
0255 
0256 #endif
0257 
0258     d->applicationIcon                   = group.readEntry(d->configIconThemeEntry,                                   QString());
0259 
0260     setApplicationFont(group.readEntry(d->configApplicationFontEntry, QFontDatabase::systemFont(QFontDatabase::GeneralFont)));
0261 
0262     d->scanAtStart                       = group.readEntry(d->configScanAtStartEntry,                                 true);
0263     d->cleanAtStart                      = group.readEntry(d->configCleanAtStartEntry,                                false);
0264 
0265     // ---------------------------------------------------------------------
0266 
0267     d->databaseParams.readFromConfig();
0268 
0269 #ifdef HAVE_KFILEMETADATA
0270 
0271     group                                = config->group(d->configGroupBaloo);
0272 
0273     d->syncToDigikam                     = group.readEntry(d->configSyncBalootoDigikamEntry, false);
0274     d->syncToBaloo                       = group.readEntry(d->configSyncDigikamtoBalooEntry, false);
0275 
0276     Q_EMIT balooSettingsChanged();
0277 
0278 #endif // HAVE_KFILEMETADATA
0279 
0280     // ---------------------------------------------------------------------
0281 
0282     group = config->group(d->configGroupVersioning);
0283     d->versionSettings.readFromConfig(group);
0284 
0285     // ---------------------------------------------------------------------
0286 
0287     group                    = config->group(d->configGroupFaceDetection);
0288     d->faceDetectionAccuracy = group.readEntry(d->configFaceDetectionAccuracyEntry, double(0.7));
0289     d->faceDetectionYoloV3   = group.readEntry(d->configFaceDetectionYoloV3Entry,   false);
0290 
0291     // ---------------------------------------------------------------------
0292 
0293     group                                                = config->group(d->configGroupDuplicatesSearch);
0294 
0295     d->minimumSimilarityBound                            = group.readEntry(d->configMinimumSimilarityBound,               40);
0296     d->duplicatesSearchLastMinSimilarity                 = group.readEntry(d->configDuplicatesSearchLastMinSimilarity,    90);
0297     d->duplicatesSearchLastMaxSimilarity                 = group.readEntry(d->configDuplicatesSearchLastMaxSimilarity,    100);
0298     d->duplicatesSearchLastAlbumTagRelation              = group.readEntry(d->configDuplicatesSearchLastAlbumTagRelation, 0);
0299     d->duplicatesSearchLastRestrictions                  = group.readEntry(d->configDuplicatesSearchLastRestrictions,     0);
0300     int method                                           = group.readEntry(d->configDuplicatesSearchReferenceSelectionMethod,
0301                                                                            (int)HaarIface::RefImageSelMethod::OlderOrLarger);
0302     d->duplicatesSearchLastReferenceImageSelectionMethod = (HaarIface::RefImageSelMethod)method;
0303 
0304     // ---------------------------------------------------------------------
0305 
0306     group = config->group(d->configGroupGrouping);
0307 
0308     for (ApplicationSettings::OperationModes::key_iterator it = d->groupingOperateOnAll.keyBegin() ;
0309          it != d->groupingOperateOnAll.keyEnd() ; ++it)
0310     {
0311         d->groupingOperateOnAll.insert(*it, (ApplicationSettings::ApplyToEntireGroup)
0312                                                 group.readEntry(d->configGroupingOperateOnAll.value(*it),
0313                                                                 (int)ApplicationSettings::Ask));
0314     }
0315 
0316     Q_EMIT setupChanged();
0317     Q_EMIT recurseSettingsChanged();
0318     Q_EMIT balooSettingsChanged();
0319 }
0320 
0321 void ApplicationSettings::saveSettings()
0322 {
0323     KSharedConfigPtr config = d->config;
0324 
0325     // ---------------------------------------------------------------------
0326 
0327     KConfigGroup group = config->group(d->configGroupDefault);
0328 
0329     group.writeEntry(d->configAlbumCollectionsEntry,                    d->albumCategoryNames);
0330     group.writeEntry(d->configAlbumSortRoleEntry,                       (int)d->albumSortRole);
0331     group.writeEntry(d->configImageSortOrderEntry,                      (int)d->imageSortOrder);
0332     group.writeEntry(d->configImageSortingEntry,                        (int)d->imageSorting);
0333     group.writeEntry(d->configImageSeparationModeEntry,                 (int)d->imageSeparationMode);
0334     group.writeEntry(d->configImageSeparationSortOrderEntry,            (int)d->imageSeparationSortOrder);
0335 
0336     group.writeEntry(d->configItemLeftClickActionEntry,                 (int)d->itemLeftClickAction);
0337     group.writeEntry(d->configDefaultIconSizeEntry,                     (int)d->thumbnailSize);
0338     group.writeEntry(d->configDefaultTreeIconSizeEntry,                 (int)d->treeThumbnailSize);
0339     group.writeEntry(d->configDefaultTreeFaceSizeEntry,                 (int)d->treeThumbFaceSize);
0340     group.writeEntry(d->configTreeViewFontEntry,                        d->treeviewFont);
0341     group.writeEntry(d->configRatingFilterConditionEntry,               d->ratingFilterCond);
0342     group.writeEntry(d->configAlbumMonitoringEntry,                     d->albumMonitoring);
0343     group.writeEntry(d->configRecursiveAlbumsEntry,                     d->recursiveAlbums);
0344     group.writeEntry(d->configRecursiveTagsEntry,                       d->recursiveTags);
0345     group.writeEntry(d->configAllGroupsOpenEntry,                       d->allGroupsOpen);
0346     group.writeEntry(d->configThemeEntry,                               d->currentTheme);
0347     group.writeEntry(d->configUpdateType,                               d->updateType);
0348     group.writeEntry(d->configSidebarTitleStyleEntry,                   (int)d->sidebarTitleStyle);
0349 
0350     group.writeEntry(d->configIconShowNameEntry,                        d->iconShowName);
0351     group.writeEntry(d->configIconShowSizeEntry,                        d->iconShowSize);
0352     group.writeEntry(d->configIconShowDateEntry,                        d->iconShowDate);
0353     group.writeEntry(d->configIconShowModificationDateEntry,            d->iconShowModDate);
0354     group.writeEntry(d->configIconShowTitleEntry,                       d->iconShowTitle);
0355     group.writeEntry(d->configIconShowCommentsEntry,                    d->iconShowComments);
0356     group.writeEntry(d->configIconShowResolutionEntry,                  d->iconShowResolution);
0357     group.writeEntry(d->configIconShowAspectRatioEntry,                 d->iconShowAspectRatio);
0358     group.writeEntry(d->configIconShowTagsEntry,                        d->iconShowTags);
0359     group.writeEntry(d->configIconShowOverlaysEntry,                    d->iconShowOverlays);
0360     group.writeEntry(d->configIconShowFullscreenEntry,                  d->iconShowFullscreen);
0361     group.writeEntry(d->configIconShowRatingEntry,                      d->iconShowRating);
0362     group.writeEntry(d->configIconShowPickLabelEntry,                   d->iconShowPickLabel);
0363     group.writeEntry(d->configIconShowColorLabelEntry,                  d->iconShowColorLabel);
0364     group.writeEntry(d->configIconShowImageFormatEntry,                 d->iconShowImageFormat);
0365     group.writeEntry(d->configIconShowCoordinatesEntry,                 d->iconShowCoordinates);
0366     group.writeEntry(d->configIconViewFontEntry,                        d->iconviewFont);
0367 
0368     group.writeEntry(d->configToolTipsFontEntry,                        d->toolTipsFont);
0369     group.writeEntry(d->configShowToolTipsEntry,                        d->showToolTips);
0370     group.writeEntry(d->configToolTipsShowFileNameEntry,                d->tooltipShowFileName);
0371     group.writeEntry(d->configToolTipsShowFileDateEntry,                d->tooltipShowFileDate);
0372     group.writeEntry(d->configToolTipsShowFileSizeEntry,                d->tooltipShowFileSize);
0373     group.writeEntry(d->configToolTipsShowImageTypeEntry,               d->tooltipShowImageType);
0374     group.writeEntry(d->configToolTipsShowImageDimEntry,                d->tooltipShowImageDim);
0375     group.writeEntry(d->configToolTipsShowImageAREntry,                 d->tooltipShowImageAR);
0376     group.writeEntry(d->configToolTipsShowPhotoMakeEntry,               d->tooltipShowPhotoMake);
0377     group.writeEntry(d->configToolTipsShowPhotoLensEntry,               d->tooltipShowPhotoLens);
0378     group.writeEntry(d->configToolTipsShowPhotoDateEntry,               d->tooltipShowPhotoDate);
0379     group.writeEntry(d->configToolTipsShowPhotoFocalEntry,              d->tooltipShowPhotoFocal);
0380     group.writeEntry(d->configToolTipsShowPhotoExpoEntry,               d->tooltipShowPhotoExpo);
0381     group.writeEntry(d->configToolTipsShowPhotoModeEntry,               d->tooltipShowPhotoMode);
0382     group.writeEntry(d->configToolTipsShowPhotoFlashEntry,              d->tooltipShowPhotoFlash);
0383     group.writeEntry(d->configToolTipsShowPhotoWBEntry,                 d->tooltipShowPhotoWb);
0384     group.writeEntry(d->configToolTipsShowAlbumNameEntry,               d->tooltipShowAlbumName);
0385     group.writeEntry(d->configToolTipsShowTitlesEntry,                  d->tooltipShowTitles);
0386     group.writeEntry(d->configToolTipsShowCommentsEntry,                d->tooltipShowComments);
0387     group.writeEntry(d->configToolTipsShowTagsEntry,                    d->tooltipShowTags);
0388     group.writeEntry(d->configToolTipsShowLabelRatingEntry,             d->tooltipShowLabelRating);
0389 
0390     group.writeEntry(d->configToolTipsShowVideoAspectRatioEntry,        d->tooltipShowVideoAspectRatio);
0391     group.writeEntry(d->configToolTipsShowVideoAudioBitRateEntry,       d->tooltipShowVideoAudioBitRate);
0392     group.writeEntry(d->configToolTipsShowVideoAudioChannelTypeEntry,   d->tooltipShowVideoAudioChannelType);
0393     group.writeEntry(d->configToolTipsShowVideoAudioCodecEntry,         d->tooltipShowVideoAudioCodec);
0394     group.writeEntry(d->configToolTipsShowVideoDurationEntry,           d->tooltipShowVideoDuration);
0395     group.writeEntry(d->configToolTipsShowVideoFrameRateEntry,          d->tooltipShowVideoFrameRate);
0396     group.writeEntry(d->configToolTipsShowVideoVideoCodecEntry,         d->tooltipShowVideoVideoCodec);
0397 
0398     group.writeEntry(d->configShowAlbumToolTipsEntry,                   d->showAlbumToolTips);
0399     group.writeEntry(d->configToolTipsShowAlbumTitleEntry,              d->tooltipShowAlbumTitle);
0400     group.writeEntry(d->configToolTipsShowAlbumDateEntry,               d->tooltipShowAlbumDate);
0401     group.writeEntry(d->configToolTipsShowAlbumCollectionEntry,         d->tooltipShowAlbumCollection);
0402     group.writeEntry(d->configToolTipsShowAlbumCategoryEntry,           d->tooltipShowAlbumCategory);
0403     group.writeEntry(d->configToolTipsShowAlbumCaptionEntry,            d->tooltipShowAlbumCaption);
0404     group.writeEntry(d->configToolTipsShowAlbumPreviewEntry,            d->tooltipShowAlbumPreview);
0405 
0406     if (d->previewSettings.quality == PreviewSettings::HighQualityPreview)
0407     {
0408         group.writeEntry(d->configPreviewLoadFullItemSizeEntry,         true);
0409         group.writeEntry(d->configPreviewRawUseLoadingDataEntry,        (int)d->previewSettings.rawLoading);
0410     }
0411     else
0412     {
0413         group.writeEntry(d->configPreviewLoadFullItemSizeEntry,         false);
0414     }
0415 
0416     group.writeEntry(d->configPreviewConvertToEightBitEntry,            d->previewSettings.convertToEightBit);
0417     group.writeEntry(d->configPreviewScaleFitToWindowEntry,             d->scaleFitToWindow);
0418     group.writeEntry(d->configPreviewShowIconsEntry,                    d->previewShowIcons);
0419     group.writeEntry(d->configShowThumbbarEntry,                        d->showThumbbar);
0420     group.writeEntry(d->configShowFolderTreeViewItemsCountEntry,        d->showFolderTreeViewItemsCount);
0421 
0422     // ---------------------------------------------------------------------
0423 
0424     group = generalConfigGroup();
0425 
0426     group.writeEntry(d->configShowSplashEntry,                          d->showSplash);
0427     group.writeEntry(d->configUseTrashEntry,                            d->useTrash);
0428     group.writeEntry(d->configShowTrashDeleteDialogEntry,               d->showTrashDeleteDialog);
0429     group.writeEntry(d->configShowPermanentDeleteDialogEntry,           d->showPermanentDeleteDialog);
0430     group.writeEntry(d->configApplySidebarChangesDirectlyEntry,         d->sidebarApplyDirectly);
0431     group.writeEntry(d->configUseNativeFileDialogEntry,                 d->useNativeFileDialog);
0432     group.writeEntry(d->configDrawFramesToGroupedEntry,                 d->drawFramesToGrouped);
0433     group.writeEntry(d->configExpandNewCurrentItemEntry,                d->expandNewCurrentItem);
0434     group.writeEntry(d->configScrollItemToCenterEntry,                  d->scrollItemToCenter);
0435     group.writeEntry(d->configShowOnlyPersonTagsInPeopleSidebarEntry,   d->showOnlyPersonTagsInPeopleSidebar);
0436     group.writeEntry(d->configDetectFacesInNewImagesEntry,              d->detectFacesInNewImages);
0437     group.writeEntry(d->configStringComparisonTypeEntry,                (int) d->stringComparisonType);
0438 
0439 #ifdef HAVE_APPSTYLE_SUPPORT
0440 
0441     group.writeEntry(d->configApplicationStyleEntry,                    d->applicationStyle);
0442 
0443 #endif
0444 
0445     group.writeEntry(d->configIconThemeEntry,                           d->applicationIcon);
0446     group.writeEntry(d->configApplicationFontEntry,                     d->applicationFont);
0447 
0448     group.writeEntry(d->configScanAtStartEntry,                         d->scanAtStart);
0449     group.writeEntry(d->configCleanAtStartEntry,                        d->cleanAtStart);
0450 
0451     // ---------------------------------------------------------------------
0452 
0453     d->databaseParams.writeToConfig();
0454 
0455 #ifdef HAVE_KFILEMETADATA
0456 
0457     group = config->group(d->configGroupBaloo);
0458 
0459     group.writeEntry(d->configSyncBalootoDigikamEntry,                  d->syncToDigikam);
0460     group.writeEntry(d->configSyncDigikamtoBalooEntry,                  d->syncToBaloo);
0461 
0462 #endif // HAVE_KFILEMETADATA
0463 
0464     // ---------------------------------------------------------------------
0465 
0466     group = config->group(d->configGroupVersioning);
0467     d->versionSettings.writeToConfig(group);
0468 
0469     // ---------------------------------------------------------------------
0470 
0471     group = config->group(d->configGroupFaceDetection);
0472 
0473     group.writeEntry(d->configFaceDetectionAccuracyEntry,               d->faceDetectionAccuracy);
0474     group.writeEntry(d->configFaceDetectionYoloV3Entry,                 d->faceDetectionYoloV3);
0475 
0476     group = config->group(d->configGroupDuplicatesSearch);
0477 
0478     group.writeEntry(d->configMinimumSimilarityBound,                   d->minimumSimilarityBound);
0479     group.writeEntry(d->configDuplicatesSearchLastMinSimilarity,        d->duplicatesSearchLastMinSimilarity);
0480     group.writeEntry(d->configDuplicatesSearchLastMaxSimilarity,        d->duplicatesSearchLastMaxSimilarity);
0481     group.writeEntry(d->configDuplicatesSearchLastAlbumTagRelation,     d->duplicatesSearchLastAlbumTagRelation);
0482     group.writeEntry(d->configDuplicatesSearchLastRestrictions,         d->duplicatesSearchLastRestrictions);
0483     group.writeEntry(d->configDuplicatesSearchReferenceSelectionMethod, (int)d->duplicatesSearchLastReferenceImageSelectionMethod);
0484 
0485     group = config->group(d->configGroupGrouping);
0486 
0487     for (ApplicationSettings::OperationModes::key_iterator it = d->groupingOperateOnAll.keyBegin() ;
0488          it != d->groupingOperateOnAll.keyEnd() ; ++it)
0489     {
0490         group.writeEntry(d->configGroupingOperateOnAll.value(*it),
0491                          (int)d->groupingOperateOnAll.value(*it));
0492     }
0493 
0494     config->sync();
0495 }
0496 
0497 } // namespace Digikam
0498 
0499 #include "moc_applicationsettings.cpp"