digiKam
applicationsettings.h
Go to the documentation of this file.
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-2004 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2003-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2007 by Arnd Baecker <arnd dot baecker at web dot de>
12  * Copyright (C) 2014-2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
13  * Copyright (C) 2017 by Simon Frei <freisim93 at gmail dot com>
14  *
15  * This program is free software; you can redistribute it
16  * and/or modify it under the terms of the GNU General
17  * Public License as published by the Free Software Foundation;
18  * either version 2, or (at your option)
19  * any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * ============================================================ */
27 
28 #ifndef DIGIKAM_APPLICATION_SETTINGS_H
29 #define DIGIKAM_APPLICATION_SETTINGS_H
30 
31 // Qt includes
32 
33 #include <QFont>
34 #include <QHash>
35 #include <QObject>
36 #include <QString>
37 #include <QStringList>
38 
39 // Local includes
40 
41 #include "digikam_config.h"
42 #include "sidebar.h"
43 #include "dbengineparameters.h"
44 #include "versionmanager.h"
45 #include "digikam_export.h"
46 
47 class KConfigGroup;
48 
49 namespace Digikam
50 {
51 
52 class DbEngineParameters;
53 class VersionManagerSettings;
54 class PreviewSettings;
55 
56 class DIGIKAM_GUI_EXPORT ApplicationSettings : public QObject
57 {
58  Q_OBJECT
59 
60 public:
61 
63  {
64  ByFolder = 0,
66  ByDate
67  };
68 
70  {
71  ShowPreview = 0,
75  };
76 
81  {
85  Natural = 0,
86 
90  Normal
91  };
92 
99  {
100  Metadata = 0,
107  Unspecified
108  };
109 
111  {
112  No = 0,
114  Ask
115  };
116 
117  typedef QHash<ApplicationSettings::OperationType, QString> OperationStrings;
118  typedef QHash<ApplicationSettings::OperationType, ApplicationSettings::ApplyToEntireGroup> OperationModes;
119 
120 Q_SIGNALS:
121 
122  void setupChanged();
125 
126 public:
127 
128  static ApplicationSettings* instance();
129 
130  void readSettings();
131  void saveSettings();
132  void emitSetupChanged();
133 
134  QString generalConfigGroupName() const;
135 
136  // -- MessageBox Notification ---------------------------------------------------
137 
142  bool readMsgBoxShouldBeShown(const QString& dontShowAgainName);
143 
149  void saveMsgBoxShouldBeShown(const QString& dontShowAgainName);
150 
151  // -- Database Settings ---------------------------------------------------------
152 
153  DbEngineParameters getDbEngineParameters() const;
154  void setDbEngineParameters(const DbEngineParameters& params);
155 
156  void setSyncBalooToDigikam(bool val);
157  bool getSyncBalooToDigikam() const;
158 
159  void setSyncDigikamToBaloo(bool val);
160  bool getSyncDigikamToBaloo() const;
161 
162  // -- Albums Settings -------------------------------------------------------
163 
164  void setTreeViewIconSize(int val);
165  int getTreeViewIconSize() const;
166 
167  void setTreeViewFaceSize(int val);
168  int getTreeViewFaceSize() const;
169 
170  void setTreeViewFont(const QFont& font);
171  QFont getTreeViewFont() const;
172 
173  void setAlbumSortRole(const AlbumSortRole role);
174  AlbumSortRole getAlbumSortRole() const;
175 
176  void setAlbumSortChanged(bool val);
177  bool getAlbumSortChanged() const;
178 
179  void setShowFolderTreeViewItemsCount(bool val);
180  bool getShowFolderTreeViewItemsCount() const;
181 
182  void setAlbumMonitoring(bool val);
183  bool getAlbumMonitoring() const;
184 
185  void setRecurseAlbums(bool val);
186  bool getRecurseAlbums() const;
187 
188  void setRecurseTags(bool val);
189  bool getRecurseTags() const;
190 
191  void setAllGroupsOpen(bool val);
192  bool getAllGroupsOpen() const;
193 
194  void setAlbumCategoryNames(const QStringList& list);
195  QStringList getAlbumCategoryNames() const;
196 
197  bool addAlbumCategoryName(const QString& name) const;
198  bool delAlbumCategoryName(const QString& name) const;
199 
200  // -- Icon-View Settings -------------------------------------------------------
201 
202  void setDefaultIconSize(int val);
203  int getDefaultIconSize() const;
204 
205  void setIconViewFont(const QFont& font);
206  QFont getIconViewFont() const;
207 
208  void setImageSortOrder(int order);
209  int getImageSortOrder() const;
210 
214  void setImageSorting(int sorting);
215  int getImageSorting() const;
216 
217  void setImageSeparationMode(int mode);
218  int getImageSeparationMode() const;
219 
220  void setImageSeparationSortOrder(int order);
221  int getImageSeparationSortOrder() const;
222 
223  void setItemLeftClickAction(int action);
224  int getItemLeftClickAction() const;
225 
226  void setIconShowName(bool val);
227  bool getIconShowName() const;
228 
229  void setIconShowSize(bool val);
230  bool getIconShowSize() const;
231 
232  void setIconShowTitle(bool val);
233  bool getIconShowTitle() const;
234 
235  void setIconShowComments(bool val);
236  bool getIconShowComments() const;
237 
238  void setIconShowResolution(bool val);
239  bool getIconShowResolution() const;
240 
241  void setIconShowAspectRatio(bool val);
242  bool getIconShowAspectRatio() const;
243 
244  void setIconShowTags(bool val);
245  bool getIconShowTags() const;
246 
247  void setIconShowDate(bool val);
248  bool getIconShowDate() const;
249 
250  void setIconShowModDate(bool val);
251  bool getIconShowModDate() const;
252 
253  void setIconShowRating(bool val);
254  bool getIconShowRating() const;
255 
256  void setIconShowImageFormat(bool val);
257  bool getIconShowImageFormat() const;
258 
259  void setIconShowCoordinates(bool val);
260  bool getIconShowCoordinates() const;
261 
265  void setIconShowOverlays(bool val);
266 
270  bool getIconShowOverlays() const;
271 
272  void setIconShowFullscreen(bool val);
273  bool getIconShowFullscreen() const;
274 
275  void setPreviewSettings(const PreviewSettings& settings);
276  PreviewSettings getPreviewSettings() const;
277 
278  void setPreviewShowIcons(bool val);
279  bool getPreviewShowIcons() const;
280 
281  // -- Mime-Types Settings -------------------------------------------------------
282 
283  QString getImageFileFilter() const;
284  QString getMovieFileFilter() const;
285  QString getAudioFileFilter() const;
286  QString getRawFileFilter() const;
287  QString getAllFileFilter() const;
288 
289  void addToImageFileFilter(const QString& extensions);
290 
291  // -- Tool-Tips Settings -------------------------------------------------------
292 
293  bool showToolTipsIsValid() const;
294  bool showAlbumToolTipsIsValid() const;
295 
296  void setToolTipsFont(const QFont& font);
297  QFont getToolTipsFont() const;
298 
299  void setShowToolTips(bool val);
300  bool getShowToolTips() const;
301 
302  void setToolTipsShowFileName(bool val);
303  bool getToolTipsShowFileName() const;
304 
305  void setToolTipsShowFileDate(bool val);
306  bool getToolTipsShowFileDate() const;
307 
308  void setToolTipsShowFileSize(bool val);
309  bool getToolTipsShowFileSize() const;
310 
311  void setToolTipsShowImageType(bool val);
312  bool getToolTipsShowImageType() const;
313 
314  void setToolTipsShowImageDim(bool val);
315  bool getToolTipsShowImageDim() const;
316 
317  void setToolTipsShowImageAR(bool val);
318  bool getToolTipsShowImageAR() const;
319 
320  void setToolTipsShowPhotoMake(bool val);
321  bool getToolTipsShowPhotoMake() const;
322 
323  void setToolTipsShowPhotoLens(bool val);
324  bool getToolTipsShowPhotoLens() const;
325 
326  void setToolTipsShowPhotoDate(bool val);
327  bool getToolTipsShowPhotoDate() const;
328 
329  void setToolTipsShowPhotoFocal(bool val);
330  bool getToolTipsShowPhotoFocal() const;
331 
332  void setToolTipsShowPhotoExpo(bool val);
333  bool getToolTipsShowPhotoExpo() const;
334 
335  void setToolTipsShowPhotoMode(bool val);
336  bool getToolTipsShowPhotoMode() const;
337 
338  void setToolTipsShowPhotoFlash(bool val);
339  bool getToolTipsShowPhotoFlash() const;
340 
341  void setToolTipsShowPhotoWB(bool val);
342  bool getToolTipsShowPhotoWB() const;
343 
344  void setToolTipsShowAlbumName(bool val);
345  bool getToolTipsShowAlbumName() const;
346 
347  void setToolTipsShowTitles(bool val);
348  bool getToolTipsShowTitles() const;
349 
350  void setToolTipsShowComments(bool val);
351  bool getToolTipsShowComments() const;
352 
353  void setToolTipsShowTags(bool val);
354  bool getToolTipsShowTags() const;
355 
356  void setToolTipsShowLabelRating(bool val);
357  bool getToolTipsShowLabelRating() const;
358 
359  void setShowAlbumToolTips(bool val);
360  bool getShowAlbumToolTips() const;
361 
362  void setToolTipsShowAlbumTitle(bool val);
363  bool getToolTipsShowAlbumTitle() const;
364 
365  void setToolTipsShowAlbumDate(bool val);
366  bool getToolTipsShowAlbumDate() const;
367 
368  void setToolTipsShowAlbumCollection(bool val);
369  bool getToolTipsShowAlbumCollection() const;
370 
371  void setToolTipsShowAlbumCategory(bool val);
372  bool getToolTipsShowAlbumCategory() const;
373 
374  void setToolTipsShowAlbumCaption(bool val);
375  bool getToolTipsShowAlbumCaption() const;
376 
377  void setToolTipsShowAlbumPreview(bool val);
378  bool getToolTipsShowAlbumPreview() const;
379 
380  void setToolTipsShowVideoAspectRatio(bool val);
381  bool getToolTipsShowVideoAspectRatio() const;
382 
383  void setToolTipsShowVideoAudioBitRate(bool val);
384  bool getToolTipsShowVideoAudioBitRate() const;
385 
386  void setToolTipsShowVideoAudioChannelType(bool val);
387  bool getToolTipsShowVideoAudioChannelType() const;
388 
389  void setToolTipsShowVideoAudioCodec(bool val);
390  bool getToolTipsShowVideoAudioCodec() const;
391 
392  void setToolTipsShowVideoDuration(bool val);
393  bool getToolTipsShowVideoDuration() const;
394 
395  void setToolTipsShowVideoFrameRate(bool val);
396  bool getToolTipsShowVideoFrameRate() const;
397 
398  void setToolTipsShowVideoVideoCodec(bool val);
399  bool getToolTipsShowVideoVideoCodec() const;
400 
401  // -- Miscs Settings -------------------------------------------------------
402 
403  void setScanAtStart(bool val);
404  bool getScanAtStart() const;
405 
406  void setCleanAtStart(bool val);
407  bool getCleanAtStart() const;
408 
409  void setDatabaseDirSetAtCmd(bool val);
410  bool getDatabaseDirSetAtCmd() const;
411 
412  void setUseTrash(bool val);
413  bool getUseTrash() const;
414 
415  void setShowTrashDeleteDialog(bool val);
416  bool getShowTrashDeleteDialog() const;
417 
418  void setShowPermanentDeleteDialog(bool val);
419  bool getShowPermanentDeleteDialog() const;
420 
421  void setApplySidebarChangesDirectly(bool val);
422  bool getApplySidebarChangesDirectly() const;
423 
424  void setUseNativeFileDialog(bool val);
425  bool getUseNativeFileDialog() const;
426 
427  void setDrawFramesToGrouped(bool val);
428  bool getDrawFramesToGrouped() const;
429 
430  void setExpandNewCurrentItem(bool val);
431  bool getExpandNewCurrentItem() const;
432 
433  void setScrollItemToCenter(bool val);
434  bool getScrollItemToCenter() const;
435 
436  void setShowOnlyPersonTagsInPeopleSidebar(bool val);
437  bool showOnlyPersonTagsInPeopleSidebar() const;
438 
439  void setDetectFacesInNewImages(bool val);
440  bool getDetectFacesInNewImages() const;
441 
447  void setStringComparisonType(ApplicationSettings::StringComparisonType val);
448 
454  StringComparisonType getStringComparisonType() const;
455 
456  bool isStringTypeNatural() const;
457 
458  void setApplicationStyle(const QString& style);
459  QString getApplicationStyle() const;
460 
461  void setIconTheme(const QString& theme);
462  QString getIconTheme() const;
463 
464  void setApplicationFont(const QFont& fnt);
465  QFont getApplicationFont() const;
466 
467  void setShowSplashScreen(bool val);
468  bool getShowSplashScreen() const;
469 
470  void setCurrentTheme(const QString& theme);
471  QString getCurrentTheme() const;
472 
473  void setSidebarTitleStyle(DMultiTabBar::TextStyle style);
474  DMultiTabBar::TextStyle getSidebarTitleStyle() const;
475 
476  int getUpdateType() const;
477  void setUpdateType(int type);
478 
479  bool getUpdateWithDebug() const;
480  void setUpdateWithDebug(bool dbg);
481 
482  void setVersionManagerSettings(const VersionManagerSettings& settings);
483  VersionManagerSettings getVersionManagerSettings() const;
484 
485  double getFaceDetectionAccuracy() const;
486  void setFaceDetectionAccuracy(double value);
487 
488  bool getFaceDetectionYoloV3() const;
489  void setFaceDetectionYoloV3(bool yolo);
490 
491  void setShowThumbbar(bool val);
492  bool getShowThumbbar() const;
493 
494  void setRatingFilterCond(int val);
495  int getRatingFilterCond() const;
496 
497  void setMinimumSimilarityBound(int val);
498  int getMinimumSimilarityBound() const;
499 
500  void setDuplicatesSearchLastMinSimilarity(int val);
501  int getDuplicatesSearchLastMinSimilarity() const;
502 
503  void setDuplicatesSearchLastMaxSimilarity(int val);
504  int getDuplicatesSearchLastMaxSimilarity() const;
505 
513  void setGroupingOperateOnAll(OperationType type, ApplyToEntireGroup applyAll);
514 
522  ApplyToEntireGroup getGroupingOperateOnAll(OperationType type) const;
523 
531  bool askGroupingOperateOnAll(OperationType type);
532 
539  static QString operationTypeTitle(OperationType type);
540 
548  static QString operationTypeExplanation(OperationType type);
549 
550  void setDuplicatesAlbumTagRelation(int val);
551  int getDuplicatesAlbumTagRelation() const;
552 
553  void setDuplicatesSearchRestrictions(int val);
554  int getDuplicatesSearchRestrictions() const;
555 
556  void setHelpBoxNotificationSeen(bool val);
557  bool getHelpBoxNotificationSeen();
558 
559 private Q_SLOTS:
560 
561  void applyBalooSettings();
562 
563 private:
564 
565  // Disabled
567  explicit ApplicationSettings(QObject*) = delete;
568  ~ApplicationSettings() override;
569 
570  KConfigGroup generalConfigGroup() const;
571 
572 private:
573 
574  friend class ApplicationSettingsCreator;
575 
576  class Private;
577  Private* const d;
578 };
579 
580 } // namespace Digikam
581 
582 #endif // DIGIKAM_APPLICATION_SETTINGS_H
Definition: applicationsettings_p.h:77
Definition: applicationsettings.h:57
ApplyToEntireGroup
Definition: applicationsettings.h:111
@ Yes
Definition: applicationsettings.h:113
StringComparisonType
Definition: applicationsettings.h:81
QHash< ApplicationSettings::OperationType, ApplicationSettings::ApplyToEntireGroup > OperationModes
Definition: applicationsettings.h:118
AlbumSortRole
Definition: applicationsettings.h:63
@ ByCategory
Definition: applicationsettings.h:65
ItemLeftClickAction
Definition: applicationsettings.h:70
@ ShowOnTable
Definition: applicationsettings.h:73
@ StartEditor
Definition: applicationsettings.h:72
@ OpenDefault
Definition: applicationsettings.h:74
QHash< ApplicationSettings::OperationType, QString > OperationStrings
Definition: applicationsettings.h:117
bool readMsgBoxShouldBeShown(const QString &dontShowAgainName)
void saveMsgBoxShouldBeShown(const QString &dontShowAgainName)
OperationType
Definition: applicationsettings.h:99
@ Tools
Definition: applicationsettings.h:106
@ ImportExport
Definition: applicationsettings.h:101
@ LightTable
Definition: applicationsettings.h:103
@ Slideshow
Definition: applicationsettings.h:104
@ Rename
Definition: applicationsettings.h:105
@ BQM
Definition: applicationsettings.h:102
void addToImageFileFilter(const QString &extensions)
TextStyle
Definition: sidebar.h:66
Definition: dbengineparameters.h:49
Definition: previewsettings.h:35
Definition: versionmanagersettings.h:43
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43