1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2003-16-10
7  * Description : application settings interface
8  *
9  * Copyright (C) 2003-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C  2015      by Mohamed_Anwer <m_dot_anwer at gmx dot com>
11  * Copyright (C) 2017      by Simon Frei <freisim93 at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_APPLICATION_SETTINGS_PRIVATE_H
27 #define DIGIKAM_APPLICATION_SETTINGS_PRIVATE_H
28 
29 #include "applicationsettings.h"
30 
31 // C++ includes
32 
33 #include <stdexcept>
34 
35 // Qt includes
36 
37 #include <QApplication>
38 #include <QFontDatabase>
39 #include <QString>
40 #include <QStringList>
41 #include <QFont>
42 #include <QCheckBox>
43 #include <QPointer>
44 #include <QMessageBox>
45 
46 // KDE includes
47 
48 #include <klocalizedstring.h>
49 #include <ksharedconfig.h>
50 #include <kconfiggroup.h>
51 
52 #ifdef HAVE_KFILEMETADATA
53 #   include "baloowrap.h"
54 #endif
55 
56 // Local includes
57 
58 #include "previewsettings.h"
59 #include "dbengineparameters.h"
60 #include "versionmanager.h"
61 #include "itemfiltersettings.h"
62 #include "itemsortsettings.h"
63 #include "mimefilter.h"
64 #include "thumbnailsize.h"
65 #include "thememanager.h"
66 #include "digikam_debug.h"
67 #include "drawdecoder.h"
68 #include "coredbaccess.h"
69 #include "coredb.h"
70 
71 namespace Digikam
72 {
73 
74 class ApplicationSettings;
75 
76 class Q_DECL_HIDDEN ApplicationSettings::Private
77 {
78 public:
79 
80     explicit Private(ApplicationSettings* const qq);
81     ~Private();
82 
83     void init();
84 
85 public:
86 
87     static const QString configGroupDefault;
88     static const QString configGroupExif;
89     static const QString configGroupMetadata;
90     static const QString configGroupBaloo;
91     static const QString configGroupGeneral;
92     static const QString configGroupVersioning;
93     static const QString configGroupFaceDetection;
94     static const QString configGroupDuplicatesSearch;
95     static const QString configGroupGrouping;
96     static const QString configAlbumCollectionsEntry;
97     static const QString configAlbumMonitoringEntry;
98     static const QString configAlbumSortRoleEntry;
99     static const QString configImageSortOrderEntry;
100     static const QString configImageSortingEntry;
101     static const QString configImageSeparationModeEntry;
102     static const QString configImageSeparationSortOrderEntry;
103     static const QString configItemLeftClickActionEntry;
104     static const QString configDefaultIconSizeEntry;
105     static const QString configDefaultTreeIconSizeEntry;
106     static const QString configDefaultTreeFaceSizeEntry;
107     static const QString configTreeViewFontEntry;
108     static const QString configThemeEntry;
109     static const QString configUpdateType;
110     static const QString configUpdateWithDebug;
111     static const QString configSidebarTitleStyleEntry;
112     static const QString configUseNativeFileDialogEntry;
113     static const QString configDrawFramesToGroupedEntry;
114     static const QString configExpandNewCurrentItemEntry;
115     static const QString configScrollItemToCenterEntry;
116     static const QString configShowOnlyPersonTagsInPeopleSidebarEntry;
117     static const QString configRatingFilterConditionEntry;
118     static const QString configRecursiveAlbumsEntry;
119     static const QString configRecursiveTagsEntry;
120     static const QString configAllGroupsOpenEntry;
121     static const QString configIconShowNameEntry;
122     static const QString configIconShowResolutionEntry;
123     static const QString configIconShowSizeEntry;
124     static const QString configIconShowDateEntry;
125     static const QString configIconShowModificationDateEntry;
126     static const QString configIconShowTitleEntry;
127     static const QString configIconShowCommentsEntry;
128     static const QString configIconShowTagsEntry;
129     static const QString configIconShowOverlaysEntry;
130     static const QString configIconShowFullscreenEntry;
131     static const QString configIconShowRatingEntry;
132     static const QString configIconShowImageFormatEntry;
133     static const QString configIconShowCoordinatesEntry;
134     static const QString configIconShowAspectRatioEntry;
135     static const QString configIconViewFontEntry;
136     static const QString configToolTipsFontEntry;
137     static const QString configShowToolTipsEntry;
138     static const QString configToolTipsShowFileNameEntry;
139     static const QString configToolTipsShowFileDateEntry;
140     static const QString configToolTipsShowFileSizeEntry;
141     static const QString configToolTipsShowImageTypeEntry;
142     static const QString configToolTipsShowImageDimEntry;
143     static const QString configToolTipsShowImageAREntry;
144     static const QString configToolTipsShowPhotoMakeEntry;
145     static const QString configToolTipsShowPhotoLensEntry;
146     static const QString configToolTipsShowPhotoDateEntry;
147     static const QString configToolTipsShowPhotoFocalEntry;
148     static const QString configToolTipsShowPhotoExpoEntry;
149     static const QString configToolTipsShowPhotoModeEntry;
150     static const QString configToolTipsShowPhotoFlashEntry;
151     static const QString configToolTipsShowPhotoWBEntry;
152     static const QString configToolTipsShowVideoAspectRatioEntry;
153     static const QString configToolTipsShowVideoAudioBitRateEntry;
154     static const QString configToolTipsShowVideoAudioChannelTypeEntry;
155     static const QString configToolTipsShowVideoAudioCodecEntry;
156     static const QString configToolTipsShowVideoDurationEntry;
157     static const QString configToolTipsShowVideoFrameRateEntry;
158     static const QString configToolTipsShowVideoVideoCodecEntry;
159     static const QString configToolTipsShowAlbumNameEntry;
160     static const QString configToolTipsShowTitlesEntry;
161     static const QString configToolTipsShowCommentsEntry;
162     static const QString configToolTipsShowTagsEntry;
163     static const QString configToolTipsShowLabelRatingEntry;
164     static const QString configShowAlbumToolTipsEntry;
165     static const QString configToolTipsShowAlbumTitleEntry;
166     static const QString configToolTipsShowAlbumDateEntry;
167     static const QString configToolTipsShowAlbumCollectionEntry;
168     static const QString configToolTipsShowAlbumCategoryEntry;
169     static const QString configToolTipsShowAlbumCaptionEntry;
170     static const QString configToolTipsShowAlbumPreviewEntry;
171     static const QString configPreviewLoadFullItemSizeEntry;
172     static const QString configPreviewRawUseEmbeddedPreview;
173     static const QString configPreviewRawUseHalfSizeData;
174     static const QString configPreviewConvertToEightBitEntry;
175     static const QString configPreviewShowIconsEntry;
176     static const QString configShowThumbbarEntry;
177     static const QString configShowFolderTreeViewItemsCountEntry;
178     static const QString configShowSplashEntry;
179     static const QString configUseTrashEntry;
180     static const QString configShowTrashDeleteDialogEntry;
181     static const QString configShowPermanentDeleteDialogEntry;
182     static const QString configApplySidebarChangesDirectlyEntry;
183     static const QString configScanAtStartEntry;
184     static const QString configCleanAtStartEntry;
185     static const QString configSyncBalootoDigikamEntry;
186     static const QString configSyncDigikamtoBalooEntry;
187     static const QString configStringComparisonTypeEntry;
188     static const QString configFaceDetectionAccuracyEntry;
189     static const QString configFaceDetectionYoloV3Entry;
190     static const QString configApplicationStyleEntry;
191     static const QString configIconThemeEntry;
192     static const QString configApplicationFontEntry;
193     static const QString configMinimumSimilarityBound;
194     static const QString configDuplicatesSearchLastMinSimilarity;
195     static const QString configDuplicatesSearchLastMaxSimilarity;
196     static const QString configDuplicatesSearchLastAlbumTagRelation;
197     static const QString configDuplicatesSearchLastRestrictions;
198     static const ApplicationSettings::OperationStrings configGroupingOperateOnAll;
199 
200     /// start up setting
201     bool                                         showSplash;
202     /// file ops settings
203     bool                                         useTrash;
204     bool                                         showTrashDeleteDialog;
205     bool                                         showPermanentDeleteDialog;
206     /// metadata setting
207     bool                                         sidebarApplyDirectly;
208     /// file dialog setting
209     bool                                         useNativeFileDialog;
210     /// grouped item draw setting
211     bool                                         drawFramesToGrouped;
212     /// expand item setting
213     bool                                         expandNewCurrentItem;
214     /// item center setting
215     bool                                         scrollItemToCenter;
216     /// tag filter setting
217     bool                                         showOnlyPersonTagsInPeopleSidebar;
218 
219     /// icon view settings
220     bool                                         iconShowName;
221     bool                                         iconShowSize;
222     bool                                         iconShowDate;
223     bool                                         iconShowModDate;
224     bool                                         iconShowTitle;
225     bool                                         iconShowComments;
226     bool                                         iconShowResolution;
227     bool                                         iconShowTags;
228     bool                                         iconShowOverlays;
229     bool                                         iconShowFullscreen;
230     bool                                         iconShowRating;
231     bool                                         iconShowImageFormat;
232     bool                                         iconShowCoordinates;
233     bool                                         iconShowAspectRatio;
234     QFont                                        iconviewFont;
235 
236     /// Icon-view tooltip settings
237     bool                                         showToolTips;
238     bool                                         tooltipShowFileName;
239     bool                                         tooltipShowFileDate;
240     bool                                         tooltipShowFileSize;
241     bool                                         tooltipShowImageType;
242     bool                                         tooltipShowImageDim;
243     bool                                         tooltipShowImageAR;
244     bool                                         tooltipShowPhotoMake;
245     bool                                         tooltipShowPhotoLens;
246     bool                                         tooltipShowPhotoDate;
247     bool                                         tooltipShowPhotoFocal;
248     bool                                         tooltipShowPhotoExpo;
249     bool                                         tooltipShowPhotoMode;
250     bool                                         tooltipShowPhotoFlash;
251     bool                                         tooltipShowPhotoWb;
252     bool                                         tooltipShowAlbumName;
253     bool                                         tooltipShowTitles;
254     bool                                         tooltipShowComments;
255     bool                                         tooltipShowTags;
256     bool                                         tooltipShowLabelRating;
257     bool                                         tooltipShowVideoAspectRatio;
258     bool                                         tooltipShowVideoAudioBitRate;
259     bool                                         tooltipShowVideoAudioChannelType;
260     bool                                         tooltipShowVideoAudioCodec;
261     bool                                         tooltipShowVideoDuration;
262     bool                                         tooltipShowVideoFrameRate;
263     bool                                         tooltipShowVideoVideoCodec;
264 
265     QFont                                        toolTipsFont;
266 
267     /// Folder-view tooltip settings
268     bool                                         showAlbumToolTips;
269     bool                                         tooltipShowAlbumTitle;
270     bool                                         tooltipShowAlbumDate;
271     bool                                         tooltipShowAlbumCollection;
272     bool                                         tooltipShowAlbumCategory;
273     bool                                         tooltipShowAlbumCaption;
274     bool                                         tooltipShowAlbumPreview;
275 
276     /// preview settings
277     PreviewSettings                              previewSettings;
278     bool                                         previewShowIcons;
279     bool                                         showThumbbar;
280 
281     bool                                         showFolderTreeViewItemsCount;
282 
283     /// tree-view settings
284     int                                          treeThumbnailSize;
285     int                                          treeThumbFaceSize;
286     QFont                                        treeviewFont;
287 
288     /// icon view settings
289     int                                          thumbnailSize;
290     int                                          ratingFilterCond;
291     bool                                         recursiveAlbums;
292     bool                                         recursiveTags;
293     bool                                         allGroupsOpen;
294 
295     /// theme settings
296     QString                                      currentTheme;
297 
298     /// database settings
299     DbEngineParameters                           databaseParams;
300     bool                                         scanAtStart;
301     bool                                         cleanAtStart;
302     bool                                         databaseDirSetAtCmd;
303 
304     /// album settings
305     bool                                         albumMonitoring;
306 
307     QStringList                                  albumCategoryNames;
308 
309     KSharedConfigPtr                             config;
310 
311     int                                          updateType;
312     bool                                         updateWithDebug;
313     DMultiTabBar::TextStyle                      sidebarTitleStyle;
314 
315     /// album view settings
316     ApplicationSettings::AlbumSortRole           albumSortRole;
317     bool                                         albumSortChanged;
318 
319     /// icon view settings
320     int                                          imageSortOrder;
321     int                                          imageSorting;
322     int                                          imageSeparationMode;
323     int                                          imageSeparationSortOrder;
324     int                                          itemLeftClickAction;
325 
326     /// Baloo settings
327     bool                                         syncToDigikam;
328     bool                                         syncToBaloo;
329 
330     /// versioning settings
331 
332     VersionManagerSettings                       versionSettings;
333 
334     /// face detection settings
335     double                                       faceDetectionAccuracy;
336     bool                                         faceDetectionYoloV3;
337 
338     /// misc
339     ApplicationSettings::StringComparisonType    stringComparisonType;
340     QString                                      applicationStyle;
341     QString                                      applicationIcon;
342     QFont                                        applicationFont;
343 
344     int                                          minimumSimilarityBound;
345     int                                          duplicatesSearchLastMinSimilarity;
346     int                                          duplicatesSearchLastMaxSimilarity;
347     int                                          duplicatesSearchLastAlbumTagRelation;
348     int                                          duplicatesSearchLastRestrictions;
349 
350     /// Grouping operation settings
351     ApplicationSettings::OperationModes          groupingOperateOnAll;
352 
353 private:
354 
355     ApplicationSettings*                         q;
356 
357 private:
358 
359     // cppcheck-suppress unusedPrivateFunction
360     static ApplicationSettings::OperationStrings createConfigGroupingOperateOnAll();
361 };
362 
363 } // namespace Digikam
364 
365 #endif // DIGIKAM_APPLICATION_SETTINGS_PRIVATE_H
366