File indexing completed on 2025-01-05 03:52:03

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-04-04
0007  * Description : a tool to generate HTML image galleries
0008  *
0009  * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "galleryconfig.h"
0016 
0017 // Qt includes
0018 
0019 #include <QCoreApplication>
0020 
0021 namespace DigikamGenericHtmlGalleryPlugin
0022 {
0023 
0024 GalleryConfig::GalleryConfig(QObject* const)
0025     : KConfigSkeleton(QLatin1String("digikamrc"))
0026 {
0027     setCurrentGroup(QLatin1String("general"));
0028 
0029     KConfigSkeleton::ItemString* const itemtheme
0030         = new KConfigSkeleton::ItemString(currentGroup(), QLatin1String("theme"), m_theme);
0031 
0032     addItem(itemtheme, QLatin1String("theme"));
0033 
0034     // -------------------
0035 
0036     KConfigSkeleton::ItemBool* const itemuseOriginalImageAsFullImage
0037         = new KConfigSkeleton::ItemBool(currentGroup(), QLatin1String("useOriginalImageAsFullImage"),
0038                                         m_useOriginalImageAsFullImage, false);
0039 
0040     addItem(itemuseOriginalImageAsFullImage, QLatin1String("useOriginalImageAsFullImage"));
0041 
0042     // -------------------
0043 
0044     KConfigSkeleton::ItemBool* const itemfullResize
0045         = new KConfigSkeleton::ItemBool(currentGroup(), QLatin1String("fullResize"), m_fullResize, true);
0046 
0047     addItem(itemfullResize, QLatin1String("fullResize"));
0048 
0049     KConfigSkeleton::ItemInt* const itemfullSize
0050         = new KConfigSkeleton::ItemInt(currentGroup(), QLatin1String("fullSize"), m_fullSize, 1024);
0051 
0052     addItem(itemfullSize, QLatin1String("fullSize"));
0053 
0054     // -------------------
0055 
0056     QList<KConfigSkeleton::ItemEnum::Choice> valuesfullFormat;
0057 
0058     KConfigSkeleton::ItemEnum::Choice choice1;
0059     choice1.name = QLatin1String("JPEG");
0060     valuesfullFormat.append(choice1);
0061 
0062     KConfigSkeleton::ItemEnum::Choice choice2;
0063     choice2.name = QLatin1String("PNG");
0064     valuesfullFormat.append(choice2);
0065 
0066     KConfigSkeleton::ItemEnum* const itemfullFormat
0067         = new KConfigSkeleton::ItemEnum(currentGroup(), QLatin1String("fullFormat"),
0068                                         m_fullFormat, valuesfullFormat, EnumFullFormat::JPEG);
0069 
0070     addItem(itemfullFormat, QLatin1String("fullFormat"));
0071 
0072     // -------------------
0073 
0074     KConfigSkeleton::ItemInt* const itemfullQuality
0075         = new KConfigSkeleton::ItemInt(currentGroup(), QLatin1String("fullQuality"), m_fullQuality, 80);
0076 
0077     addItem(itemfullQuality, QLatin1String("fullQuality"));
0078 
0079     KConfigSkeleton::ItemBool* const itemcopyOriginalImage
0080         = new KConfigSkeleton::ItemBool(currentGroup(), QLatin1String("copyOriginalImage"),
0081                                         m_copyOriginalImage, false);
0082 
0083     addItem(itemcopyOriginalImage, QLatin1String("copyOriginalImage"));
0084 
0085     // -------------------
0086 
0087     KConfigSkeleton::ItemInt* const itemthumbnailSize
0088         = new KConfigSkeleton::ItemInt(currentGroup(), QLatin1String("thumbnailSize"), m_thumbnailSize, 120);
0089 
0090     addItem(itemthumbnailSize, QLatin1String("thumbnailSize"));
0091 
0092     // -------------------
0093 
0094     QList<KConfigSkeleton::ItemEnum::Choice> valuesthumbnailFormat;
0095 
0096     KConfigSkeleton::ItemEnum::Choice choice3;
0097     choice3.name = QLatin1String("JPEG");
0098     valuesthumbnailFormat.append(choice3);
0099 
0100     KConfigSkeleton::ItemEnum::Choice choice4;
0101     choice4.name = QLatin1String("PNG");
0102     valuesthumbnailFormat.append(choice4);
0103 
0104     KConfigSkeleton::ItemEnum* const itemthumbnailFormat
0105         = new KConfigSkeleton::ItemEnum(currentGroup(), QLatin1String("thumbnailFormat"),
0106                                         m_thumbnailFormat, valuesthumbnailFormat, EnumThumbnailFormat::JPEG);
0107 
0108     addItem(itemthumbnailFormat, QLatin1String("thumbnailFormat"));
0109 
0110     // -------------------
0111 
0112     KConfigSkeleton::ItemInt* const itemthumbnailQuality
0113         = new KConfigSkeleton::ItemInt(currentGroup(), QLatin1String("thumbnailQuality"),
0114                                        m_thumbnailQuality, 80);
0115 
0116     addItem(itemthumbnailQuality, QLatin1String("thumbnailQuality"));
0117 
0118     // -------------------
0119 
0120     KConfigSkeleton::ItemBool* const itemthumbnailSquare
0121         = new KConfigSkeleton::ItemBool(currentGroup(), QLatin1String("thumbnailSquare"),
0122                                         m_thumbnailSquare, true);
0123 
0124     addItem(itemthumbnailSquare, QLatin1String("thumbnailSquare"));
0125 
0126     // -------------------
0127 
0128     KConfigSkeleton::ItemUrl* const itemdestUrl
0129         = new KConfigSkeleton::ItemUrl(currentGroup(), QLatin1String("destUrl"), m_destUrl);
0130 
0131     addItem(itemdestUrl, QLatin1String("destUrl"));
0132 
0133     // -------------------
0134 
0135     QList<KConfigSkeleton::ItemEnum::Choice> valueswebBrowser;
0136 
0137     KConfigSkeleton::ItemEnum::Choice choice5;
0138     choice5.name = QLatin1String("NONE");
0139     valueswebBrowser.append(choice5);
0140 
0141     KConfigSkeleton::ItemEnum::Choice choice6;
0142     choice6.name = QLatin1String("INTERNAL");
0143     valueswebBrowser.append(choice6);
0144 
0145     KConfigSkeleton::ItemEnum::Choice choice7;
0146     choice7.name = QLatin1String("DESKTOP");
0147     valueswebBrowser.append(choice7);
0148 
0149     KConfigSkeleton::ItemEnum* const itemwebBrowser
0150         = new KConfigSkeleton::ItemEnum(currentGroup(), QLatin1String("openInBrowser"),
0151                                         m_openInBrowser, valueswebBrowser,
0152                                         EnumWebBrowser::INTERNAL);
0153 
0154     addItem(itemwebBrowser, QLatin1String("openInBrowser"));
0155 
0156     // -------------------
0157 
0158     KConfigSkeleton::ItemString* const itemimageSelectionTitle
0159         = new KConfigSkeleton::ItemString(currentGroup(), QLatin1String("imageSelectionTitle"), m_imageSelectionTitle);
0160 
0161     addItem(itemimageSelectionTitle, QLatin1String("imageSelectionTitle"));
0162 }
0163 
0164 GalleryConfig::~GalleryConfig()
0165 {
0166 }
0167 
0168 void GalleryConfig::setTheme(const QString& v)
0169 {
0170     if (!isImmutable(QLatin1String("theme")))
0171         m_theme = v;
0172 }
0173 
0174 QString GalleryConfig::theme() const
0175 {
0176     return m_theme;
0177 }
0178 
0179 void GalleryConfig::setUseOriginalImageAsFullImage(bool v)
0180 {
0181     if (!isImmutable(QLatin1String("useOriginalImageAsFullImage")))
0182         m_useOriginalImageAsFullImage = v;
0183 }
0184 
0185 bool GalleryConfig::GalleryConfig::useOriginalImageAsFullImage() const
0186 {
0187     return m_useOriginalImageAsFullImage;
0188 }
0189 
0190 void GalleryConfig::setFullResize(bool v)
0191 {
0192     if (!isImmutable(QLatin1String("fullResize")))
0193         m_fullResize = v;
0194 }
0195 
0196 bool GalleryConfig::fullResize() const
0197 {
0198     return m_fullResize;
0199 }
0200 
0201 void GalleryConfig::setFullSize(int v)
0202 {
0203     if (!isImmutable(QLatin1String("fullSize")))
0204         m_fullSize = v;
0205 }
0206 
0207 int GalleryConfig::fullSize() const
0208 {
0209     return m_fullSize;
0210 }
0211 
0212 void GalleryConfig::setFullFormat(int v)
0213 {
0214     if (!isImmutable(QLatin1String("fullFormat")))
0215         m_fullFormat = v;
0216 }
0217 
0218 int GalleryConfig::fullFormat() const
0219 {
0220     return m_fullFormat;
0221 }
0222 
0223 void GalleryConfig::setFullQuality(int v)
0224 {
0225     if (!isImmutable(QLatin1String("fullQuality")))
0226         m_fullQuality = v;
0227 }
0228 
0229 int GalleryConfig::fullQuality() const
0230 {
0231     return m_fullQuality;
0232 }
0233 
0234 void GalleryConfig::setCopyOriginalImage(bool v)
0235 {
0236     if (!isImmutable(QLatin1String("copyOriginalImage")))
0237         m_copyOriginalImage = v;
0238 }
0239 
0240 bool GalleryConfig::copyOriginalImage() const
0241 {
0242     return m_copyOriginalImage;
0243 }
0244 
0245 void GalleryConfig::setThumbnailSize(int v)
0246 {
0247     if (!isImmutable(QLatin1String("thumbnailSize")))
0248         m_thumbnailSize = v;
0249 }
0250 
0251 int GalleryConfig::thumbnailSize() const
0252 {
0253     return m_thumbnailSize;
0254 }
0255 
0256 void GalleryConfig::setThumbnailFormat(int v)
0257 {
0258     if (!isImmutable(QLatin1String("thumbnailFormat")))
0259         m_thumbnailFormat = v;
0260 }
0261 
0262 int GalleryConfig::thumbnailFormat() const
0263 {
0264     return m_thumbnailFormat;
0265 }
0266 
0267 void GalleryConfig::setThumbnailQuality(int v)
0268 {
0269     if (!isImmutable(QLatin1String("thumbnailQuality")))
0270         m_thumbnailQuality = v;
0271 }
0272 
0273 int GalleryConfig::thumbnailQuality() const
0274 {
0275     return m_thumbnailQuality;
0276 }
0277 
0278 void GalleryConfig::setThumbnailSquare(bool v)
0279 {
0280     if (!isImmutable(QLatin1String("thumbnailSquare")))
0281         m_thumbnailSquare = v;
0282 }
0283 
0284 bool GalleryConfig::thumbnailSquare() const
0285 {
0286     return m_thumbnailSquare;
0287 }
0288 
0289 void GalleryConfig::setDestUrl(const QUrl& v)
0290 {
0291     if (!isImmutable(QLatin1String("destUrl")))
0292         m_destUrl = v;
0293 }
0294 
0295 QUrl GalleryConfig::destUrl() const
0296 {
0297     return m_destUrl;
0298 }
0299 
0300 void GalleryConfig::setOpenInBrowser(int v)
0301 {
0302     if (!isImmutable(QLatin1String("openInBrowser")))
0303         m_openInBrowser = v;
0304 }
0305 
0306 int GalleryConfig::openInBrowser() const
0307 {
0308     return m_openInBrowser;
0309 }
0310 
0311 void GalleryConfig::setImageSelectionTitle(const QString& v)
0312 {
0313     if (!isImmutable(QLatin1String("imageSelectionTitle")))
0314         m_imageSelectionTitle = v;
0315 }
0316 
0317 QString GalleryConfig::imageSelectionTitle() const
0318 {
0319     return m_imageSelectionTitle;
0320 }
0321 
0322 } // namespace DigikamGenericHtmlGalleryPlugin
0323 
0324 #include "moc_galleryconfig.cpp"