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-2021 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) 2014      by Veaceslav Munteanu <veaceslav dot munteanu90 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 #include "applicationsettings_p.h"
29 
30 namespace Digikam
31 {
32 
setTreeViewIconSize(int val)33 void ApplicationSettings::setTreeViewIconSize(int val)
34 {
35     d->treeThumbnailSize = val;
36 }
37 
getTreeViewIconSize() const38 int ApplicationSettings::getTreeViewIconSize() const
39 {
40     return ((d->treeThumbnailSize < 8) ||
41             (d->treeThumbnailSize > 64)) ? 32 : d->treeThumbnailSize;
42 }
43 
setTreeViewFaceSize(int val)44 void ApplicationSettings::setTreeViewFaceSize(int val)
45 {
46     d->treeThumbFaceSize = val;
47 }
48 
getTreeViewFaceSize() const49 int ApplicationSettings::getTreeViewFaceSize() const
50 {
51     return ((d->treeThumbFaceSize < 8) ||
52             (d->treeThumbFaceSize > 128)) ? 48 : d->treeThumbFaceSize;
53 }
54 
setTreeViewFont(const QFont & font)55 void ApplicationSettings::setTreeViewFont(const QFont& font)
56 {
57     d->treeviewFont = font;
58 }
59 
getTreeViewFont() const60 QFont ApplicationSettings::getTreeViewFont() const
61 {
62     return d->treeviewFont;
63 }
64 
setAlbumSortRole(const ApplicationSettings::AlbumSortRole role)65 void ApplicationSettings::setAlbumSortRole(const ApplicationSettings::AlbumSortRole role)
66 {
67     d->albumSortRole = role;
68 }
69 
getAlbumSortRole() const70 ApplicationSettings::AlbumSortRole ApplicationSettings::getAlbumSortRole() const
71 {
72     return d->albumSortRole;
73 }
74 
setAlbumMonitoring(bool val)75 void ApplicationSettings::setAlbumMonitoring(bool val)
76 {
77     d->albumMonitoring = val;
78 }
79 
getAlbumMonitoring() const80 bool ApplicationSettings::getAlbumMonitoring() const
81 {
82     return d->albumMonitoring;
83 }
84 
setRecurseAlbums(bool val)85 void ApplicationSettings::setRecurseAlbums(bool val)
86 {
87     d->recursiveAlbums = val;
88     emit recurseSettingsChanged();
89 }
90 
getRecurseAlbums() const91 bool ApplicationSettings::getRecurseAlbums() const
92 {
93     return d->recursiveAlbums;
94 }
95 
setRecurseTags(bool val)96 void ApplicationSettings::setRecurseTags(bool val)
97 {
98     d->recursiveTags = val;
99     emit recurseSettingsChanged();
100 }
101 
getRecurseTags() const102 bool ApplicationSettings::getRecurseTags() const
103 {
104     return d->recursiveTags;
105 }
106 
setAllGroupsOpen(bool val)107 void ApplicationSettings::setAllGroupsOpen(bool val)
108 {
109     d->allGroupsOpen = val;
110 }
111 
getAllGroupsOpen() const112 bool ApplicationSettings::getAllGroupsOpen() const
113 {
114     return d->allGroupsOpen;
115 }
116 
setShowFolderTreeViewItemsCount(bool val)117 void ApplicationSettings::setShowFolderTreeViewItemsCount(bool val)
118 {
119     d->showFolderTreeViewItemsCount = val;
120 }
121 
getShowFolderTreeViewItemsCount() const122 bool ApplicationSettings::getShowFolderTreeViewItemsCount() const
123 {
124     return d->showFolderTreeViewItemsCount;
125 }
126 
setAlbumSortChanged(bool val)127 void ApplicationSettings::setAlbumSortChanged(bool val)
128 {
129     d->albumSortChanged = val;
130 }
131 
getAlbumSortChanged() const132 bool ApplicationSettings::getAlbumSortChanged() const
133 {
134     return d->albumSortChanged;
135 }
136 
setAlbumCategoryNames(const QStringList & list)137 void ApplicationSettings::setAlbumCategoryNames(const QStringList& list)
138 {
139     d->albumCategoryNames = list;
140 }
141 
getAlbumCategoryNames() const142 QStringList ApplicationSettings::getAlbumCategoryNames() const
143 {
144     return d->albumCategoryNames;
145 }
146 
addAlbumCategoryName(const QString & name) const147 bool ApplicationSettings::addAlbumCategoryName(const QString& name) const
148 {
149     if (d->albumCategoryNames.contains(name))
150     {
151         return false;
152     }
153 
154     d->albumCategoryNames.append(name);
155 
156     return true;
157 }
158 
delAlbumCategoryName(const QString & name) const159 bool ApplicationSettings::delAlbumCategoryName(const QString& name) const
160 {
161     uint count = d->albumCategoryNames.removeAll(name);
162 
163     return ((count > 0) ? true : false);
164 }
165 
166 } // namespace Digikam
167