File indexing completed on 2025-03-09 03:58:57

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2003-02-01
0007  * Description : album view configuration setup tab
0008  *
0009  * SPDX-FileCopyrightText: 2003-2004 by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2005-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "setupalbumview.h"
0017 
0018 // Qt includes
0019 
0020 #include <QButtonGroup>
0021 #include <QCheckBox>
0022 #include <QGridLayout>
0023 #include <QGroupBox>
0024 #include <QLabel>
0025 #include <QRadioButton>
0026 #include <QVBoxLayout>
0027 #include <QStyle>
0028 #include <QComboBox>
0029 #include <QApplication>
0030 #include <QMessageBox>
0031 
0032 // KDE includes
0033 
0034 #include <klocalizedstring.h>
0035 #include <ksharedconfig.h>
0036 #include <kconfiggroup.h>
0037 
0038 // Local includes
0039 
0040 #include "digikam_debug.h"
0041 #include "thumbnailsize.h"
0042 #include "applicationsettings.h"
0043 #include "dfontselect.h"
0044 #include "fullscreensettings.h"
0045 #include "dxmlguiwindow.h"
0046 #include "previewsettings.h"
0047 #include "setupcategory.h"
0048 #include "setupmime.h"
0049 
0050 namespace Digikam
0051 {
0052 
0053 class Q_DECL_HIDDEN SetupAlbumView::Private
0054 {
0055 public:
0056 
0057     explicit Private()
0058       : useLargeThumbsOriginal      (false),
0059         useLargeThumbsShowedInfo    (false),
0060         iconShowNameBox             (nullptr),
0061         iconShowSizeBox             (nullptr),
0062         iconShowDateBox             (nullptr),
0063         iconShowModDateBox          (nullptr),
0064         iconShowResolutionBox       (nullptr),
0065         iconShowAspectRatioBox      (nullptr),
0066         iconShowTitleBox            (nullptr),
0067         iconShowCommentsBox         (nullptr),
0068         iconShowTagsBox             (nullptr),
0069         iconShowOverlaysBox         (nullptr),
0070         iconShowFullscreenBox       (nullptr),
0071         iconShowRatingBox           (nullptr),
0072         iconShowPickLabelBox        (nullptr),
0073         iconShowColorLabelBox       (nullptr),
0074         iconShowFormatBox           (nullptr),
0075         iconShowCoordinatesBox      (nullptr),
0076         previewFastPreview          (nullptr),
0077         previewFullView             (nullptr),
0078         previewRawMode              (nullptr),
0079         previewConvertToEightBit    (nullptr),
0080         previewScaleFitToWindow     (nullptr),
0081         previewShowIcons            (nullptr),
0082         showFolderTreeViewItemsCount(nullptr),
0083         largeThumbsBox              (nullptr),
0084         iconTreeThumbSize           (nullptr),
0085         iconTreeFaceSize            (nullptr),
0086         leftClickActionComboBox     (nullptr),
0087         tab                         (nullptr),
0088         iconViewFontSelect          (nullptr),
0089         treeViewFontSelect          (nullptr),
0090         fullScreenSettings          (nullptr),
0091         category                    (nullptr),
0092         mimetype                    (nullptr)
0093     {
0094     }
0095 
0096     bool                useLargeThumbsOriginal;
0097     bool                useLargeThumbsShowedInfo;
0098 
0099     QCheckBox*          iconShowNameBox;
0100     QCheckBox*          iconShowSizeBox;
0101     QCheckBox*          iconShowDateBox;
0102     QCheckBox*          iconShowModDateBox;
0103     QCheckBox*          iconShowResolutionBox;
0104     QCheckBox*          iconShowAspectRatioBox;
0105     QCheckBox*          iconShowTitleBox;
0106     QCheckBox*          iconShowCommentsBox;
0107     QCheckBox*          iconShowTagsBox;
0108     QCheckBox*          iconShowOverlaysBox;
0109     QCheckBox*          iconShowFullscreenBox;
0110     QCheckBox*          iconShowRatingBox;
0111     QCheckBox*          iconShowPickLabelBox;
0112     QCheckBox*          iconShowColorLabelBox;
0113     QCheckBox*          iconShowFormatBox;
0114     QCheckBox*          iconShowCoordinatesBox;
0115     QRadioButton*       previewFastPreview;
0116     QRadioButton*       previewFullView;
0117     QComboBox*          previewRawMode;
0118     QCheckBox*          previewConvertToEightBit;
0119     QCheckBox*          previewScaleFitToWindow;
0120     QCheckBox*          previewShowIcons;
0121     QCheckBox*          showFolderTreeViewItemsCount;
0122     QCheckBox*          largeThumbsBox;
0123 
0124     QComboBox*          iconTreeThumbSize;
0125     QComboBox*          iconTreeFaceSize;
0126     QComboBox*          leftClickActionComboBox;
0127 
0128     QTabWidget*         tab;
0129 
0130     DFontSelect*        iconViewFontSelect;
0131     DFontSelect*        treeViewFontSelect;
0132 
0133     FullScreenSettings* fullScreenSettings;
0134 
0135     SetupCategory*      category;
0136     SetupMime*          mimetype;
0137 };
0138 
0139 SetupAlbumView::SetupAlbumView(QWidget* const parent)
0140     : QScrollArea(parent),
0141       d          (new Private)
0142 {
0143     d->tab                     = new QTabWidget(viewport());
0144     setWidget(d->tab);
0145     setWidgetResizable(true);
0146 
0147     QWidget* const iwpanel     = new QWidget(d->tab);
0148     const int spacing          = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing),
0149                              QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
0150 
0151     // --------------------------------------------------------
0152 
0153     QGridLayout* const grid    = new QGridLayout(iwpanel);
0154 
0155     d->iconShowNameBox         = new QCheckBox(i18n("Show file&name"), iwpanel);
0156     d->iconShowNameBox->setWhatsThis(i18n("Set this option to show the filename below the image thumbnail."));
0157 
0158     d->iconShowSizeBox         = new QCheckBox(i18n("Show file si&ze"), iwpanel);
0159     d->iconShowSizeBox->setWhatsThis(i18n("Set this option to show the file size below the image thumbnail."));
0160 
0161     d->iconShowDateBox         = new QCheckBox(i18n("Show camera creation &date"), iwpanel);
0162     d->iconShowDateBox->setWhatsThis(i18n("Set this option to show the camera creation date "
0163                                           "below the image thumbnail."));
0164 
0165     d->iconShowModDateBox      = new QCheckBox(i18n("Show file &modification date"), iwpanel);
0166     d->iconShowModDateBox->setWhatsThis(i18n("Set this option to show the file modification date "
0167                                              "below the image thumbnail if it is different than camera creation date. "
0168                                              "This option is useful to identify quickly which items have been modified."));
0169 
0170     d->iconShowResolutionBox   = new QCheckBox(i18n("Show ima&ge dimensions"), iwpanel);
0171     d->iconShowResolutionBox->setWhatsThis(i18n("Set this option to show the image size in pixels "
0172                                                 "below the image thumbnail."));
0173 
0174     d->iconShowAspectRatioBox  = new QCheckBox(i18n("Show image aspect ratio"), iwpanel);
0175     d->iconShowAspectRatioBox->setWhatsThis(i18n("Set this option to show the image aspect ratio "
0176                                                 "below the image thumbnail."));
0177 
0178     d->iconShowFormatBox       = new QCheckBox(i18n("Show image format"), iwpanel);
0179     d->iconShowFormatBox->setWhatsThis(i18n("Set this option to show image mime type over image thumbnail."));
0180 
0181     d->iconShowTitleBox        = new QCheckBox(i18n("Show digiKam tit&le"), iwpanel);
0182     d->iconShowTitleBox->setWhatsThis(i18n("Set this option to show the digiKam title "
0183                                            "below the image thumbnail."));
0184 
0185     d->iconShowCommentsBox     = new QCheckBox(i18n("Show digiKam &captions"), iwpanel);
0186     d->iconShowCommentsBox->setWhatsThis(i18n("Set this option to show the digiKam captions "
0187                                               "below the image thumbnail."));
0188 
0189     d->iconShowTagsBox         = new QCheckBox(i18n("Show digiKam &tags"), iwpanel);
0190     d->iconShowTagsBox->setWhatsThis(i18n("Set this option to show the digiKam tags list "
0191                                           "below the image thumbnail."));
0192 
0193     d->iconShowRatingBox       = new QCheckBox(i18n("Show digiKam &rating"), iwpanel);
0194     d->iconShowRatingBox->setWhatsThis(i18n("Set this option to show the digiKam rating "
0195                                             "below the image thumbnail."));
0196 
0197     d->iconShowPickLabelBox    = new QCheckBox(i18n("Show digiKam &pick label"), iwpanel);
0198     d->iconShowPickLabelBox->setWhatsThis(i18n("Set this option to show the digiKam pick label "
0199                                             "below the image thumbnail."));
0200 
0201     d->iconShowColorLabelBox   = new QCheckBox(i18n("Show digiKam color &label"), iwpanel);
0202     d->iconShowColorLabelBox->setWhatsThis(i18n("Set this option to show the digiKam color label "
0203                                             "as a border around the thumbnail."));
0204 
0205     d->iconShowOverlaysBox     = new QCheckBox(i18n("Show rotation overlay buttons"), iwpanel);
0206     d->iconShowOverlaysBox->setWhatsThis(i18n("Set this option to show overlay buttons over "
0207                                               "the image thumbnail to be able to process left or right image rotation."));
0208 
0209     d->iconShowFullscreenBox   = new QCheckBox(i18n("Show fullscreen overlay button"), iwpanel);
0210     d->iconShowFullscreenBox->setWhatsThis(i18n("Set this option to show an overlay button over the "
0211                                                 "image thumbnail to open it in fullscreen mode."));
0212 
0213     d->iconShowCoordinatesBox  = new QCheckBox(i18n("Show Geolocation Indicator"), iwpanel);
0214     d->iconShowCoordinatesBox->setWhatsThis(i18n("Set this option to show an icon over the image thumbnail if item has geolocation information."));
0215 
0216     QLabel* leftClickLabel     = new QLabel(i18n("Thumbnail click action:"), iwpanel);
0217     d->leftClickActionComboBox = new QComboBox(iwpanel);
0218     d->leftClickActionComboBox->addItem(i18n("Show Preview"),                  ApplicationSettings::ShowPreview);
0219     d->leftClickActionComboBox->addItem(i18n("Start Image Editor"),            ApplicationSettings::StartEditor);
0220     d->leftClickActionComboBox->addItem(i18n("Show on Light Table"),           ApplicationSettings::ShowOnTable);
0221     d->leftClickActionComboBox->addItem(i18n("Open with Default Application"), ApplicationSettings::OpenDefault);
0222     d->leftClickActionComboBox->setToolTip(i18n("Choose what should happen when you click on a thumbnail."));
0223 
0224     d->iconViewFontSelect      = new DFontSelect(i18n("Icon View font:"), iwpanel);
0225     d->iconViewFontSelect->setToolTip(i18n("Select here the font used to display text in icon views."));
0226 
0227     d->largeThumbsBox          = new QCheckBox(i18n("Use large thumbnail size for high screen resolution"), iwpanel);
0228     d->largeThumbsBox->setWhatsThis(i18n("Set this option to render icon-view with large thumbnail size, for example in case of 4K monitor is used.\n"
0229                                          "By default this option is turned off and the maximum thumbnail size is limited to 256x256 pixels. "
0230                                          "When this option is enabled, thumbnail size can be extended to 512x512 pixels.\n"
0231                                          "This option will store more data in thumbnail database and will use more system memory. "
0232                                          "digiKam needs to be restarted to take effect, and Rebuild Thumbnails option from Maintenance tool "
0233                                          "needs to be processed over whole collections."));
0234 
0235     grid->addWidget(d->iconShowNameBox,          0, 0, 1, 1);
0236     grid->addWidget(d->iconShowSizeBox,          1, 0, 1, 1);
0237     grid->addWidget(d->iconShowDateBox,          2, 0, 1, 1);
0238     grid->addWidget(d->iconShowModDateBox,       3, 0, 1, 1);
0239     grid->addWidget(d->iconShowResolutionBox,    4, 0, 1, 1);
0240     grid->addWidget(d->iconShowAspectRatioBox,   5, 0, 1, 1);
0241     grid->addWidget(d->iconShowFormatBox,        6, 0, 1, 1);
0242     grid->addWidget(d->iconShowCoordinatesBox,   7, 0, 1, 1);
0243 
0244     grid->addWidget(d->iconShowTitleBox,         0, 1, 1, 1);
0245     grid->addWidget(d->iconShowCommentsBox,      1, 1, 1, 1);
0246     grid->addWidget(d->iconShowTagsBox,          2, 1, 1, 1);
0247     grid->addWidget(d->iconShowRatingBox,        3, 1, 1, 1);
0248     grid->addWidget(d->iconShowPickLabelBox,     4, 1, 1, 1);
0249     grid->addWidget(d->iconShowColorLabelBox,    5, 1, 1, 1);
0250     grid->addWidget(d->iconShowOverlaysBox,      6, 1, 1, 1);
0251     grid->addWidget(d->iconShowFullscreenBox,    7, 1, 1, 1);
0252 
0253     grid->addWidget(leftClickLabel,              9, 0, 1, 1);
0254     grid->addWidget(d->leftClickActionComboBox,  9, 1, 1, 1);
0255     grid->addWidget(d->iconViewFontSelect,       10, 0, 1, 2);
0256     grid->addWidget(d->largeThumbsBox,           11, 0, 1, 2);
0257 
0258     grid->setRowMinimumHeight(8, 10); // vertical space
0259     grid->setContentsMargins(spacing, spacing, spacing, spacing);
0260     grid->setSpacing(spacing);
0261     grid->setRowStretch(13, 13);
0262 
0263     d->tab->insertTab(IconView, iwpanel, i18nc("@title:tab", "Icons"));
0264 
0265     // --------------------------------------------------------
0266 
0267     QWidget* const fwpanel           = new QWidget(d->tab);
0268     QGridLayout* const grid2         = new QGridLayout(fwpanel);
0269 
0270     QLabel* const iconTreeThumbLabel = new QLabel(i18n("Tree View icon size:"), fwpanel);
0271     d->iconTreeThumbSize             = new QComboBox(fwpanel);
0272     d->iconTreeThumbSize->addItem(QLatin1String("16"), 16);
0273     d->iconTreeThumbSize->addItem(QLatin1String("22"), 22);
0274     d->iconTreeThumbSize->addItem(QLatin1String("32"), 32);
0275     d->iconTreeThumbSize->addItem(QLatin1String("48"), 48);
0276     d->iconTreeThumbSize->addItem(QLatin1String("64"), 64);
0277     d->iconTreeThumbSize->setToolTip(i18n("Set this option to configure the size in pixels of "
0278                                           "the Tree View icons in digiKam's sidebars."));
0279 
0280     QLabel* const iconTreeFaceLabel  = new QLabel(i18n("People Tree View icon size:"), fwpanel);
0281     d->iconTreeFaceSize              = new QComboBox(fwpanel);
0282     d->iconTreeFaceSize->addItem(QLatin1String("16"),   16);
0283     d->iconTreeFaceSize->addItem(QLatin1String("22"),   22);
0284     d->iconTreeFaceSize->addItem(QLatin1String("32"),   32);
0285     d->iconTreeFaceSize->addItem(QLatin1String("48"),   48);
0286     d->iconTreeFaceSize->addItem(QLatin1String("64"),   64);
0287     d->iconTreeFaceSize->addItem(QLatin1String("128"), 128);
0288     d->iconTreeFaceSize->setToolTip(i18n("Set this option to configure the size in pixels of "
0289                                          "the Tree View icons in digiKam's people sidebar."));
0290 
0291     d->treeViewFontSelect            = new DFontSelect(i18n("Tree View font:"), fwpanel);
0292     d->treeViewFontSelect->setToolTip(i18n("Select here the font used to display text in Tree Views."));
0293 
0294     d->showFolderTreeViewItemsCount  = new QCheckBox(i18n("Show a count of items in Tree Views"), fwpanel);
0295     d->showFolderTreeViewItemsCount->setToolTip(i18n("Set this option to display along the album name the number of icon-view items inside."));
0296 
0297     grid2->addWidget(iconTreeThumbLabel,              0, 0, 1, 1);
0298     grid2->addWidget(d->iconTreeThumbSize,            0, 1, 1, 1);
0299     grid2->addWidget(iconTreeFaceLabel,               1, 0, 1, 1);
0300     grid2->addWidget(d->iconTreeFaceSize,             1, 1, 1, 1);
0301     grid2->addWidget(d->treeViewFontSelect,           2, 0, 1, 2);
0302     grid2->addWidget(d->showFolderTreeViewItemsCount, 3, 0, 1, 2);
0303     grid2->setContentsMargins(spacing, spacing, spacing, spacing);
0304     grid2->setSpacing(spacing);
0305     grid2->setRowStretch(4, 10);
0306 
0307     d->tab->insertTab(FolderView, fwpanel, i18nc("@title:tab", "Tree-Views"));
0308 
0309     // --------------------------------------------------------
0310 
0311     QWidget* const pwpanel        = new QWidget(d->tab);
0312     QGridLayout* const grid3      = new QGridLayout(pwpanel);
0313 
0314     d->previewFastPreview         = new QRadioButton(i18nc("@option:radio",
0315                                                            "Preview shows embedded view if available (faster)"));
0316     d->previewFullView            = new QRadioButton(i18nc("@option:radio",
0317                                                            "Preview shows the full image"));
0318     QLabel* const rawPreviewLabel = new QLabel(i18nc("@label:listbox Mode of RAW preview decoding:",
0319                                                      "Raw images:"));
0320     d->previewRawMode             = new QComboBox;
0321     d->previewRawMode->addItem(i18nc("@item Automatic choice of RAW image preview source",
0322                                      "Automatic"), PreviewSettings::RawPreviewAutomatic);
0323     d->previewRawMode->addItem(i18nc("@item Embedded preview as RAW image preview source",
0324                                      "Embedded preview"), PreviewSettings::RawPreviewFromEmbeddedPreview);
0325     d->previewRawMode->addItem(i18nc("@item Original, half-size data as RAW image preview source",
0326                                      "Raw data in half size"), PreviewSettings::RawPreviewFromRawHalfSize);
0327     d->previewRawMode->addItem(i18nc("@item Original, full-size data as RAW image preview source",
0328                                      "Raw data in full size (high quality)"), PreviewSettings::RawPreviewFromRawFullSize);
0329 
0330     d->previewConvertToEightBit   = new QCheckBox(i18n("Preview image is converted to 8 bits for a faster viewing"), pwpanel);
0331     d->previewConvertToEightBit->setWhatsThis(i18n("Uncheck this if you do not want to convert a 16 bits preview image to 8 bits."));
0332 
0333     d->previewScaleFitToWindow    = new QCheckBox(i18n("Preview image is always scaled to fit to window"), pwpanel);
0334     d->previewScaleFitToWindow->setWhatsThis(i18n("Uncheck this if you do not want to scale small images to fit to window."));
0335 
0336     d->previewShowIcons           = new QCheckBox(i18n("Show icons and text over preview"), pwpanel);
0337     d->previewShowIcons->setWhatsThis(i18n("Uncheck this if you do not want to see icons and text in the image preview."));
0338 
0339     grid3->setContentsMargins(spacing, spacing, spacing, spacing);
0340     grid3->setSpacing(spacing);
0341     grid3->addWidget(d->previewFastPreview,       0, 0, 1, 2);
0342     grid3->addWidget(d->previewFullView,          1, 0, 1, 2);
0343     grid3->addWidget(rawPreviewLabel,             2, 0, 1, 1);
0344     grid3->addWidget(d->previewRawMode,           2, 1, 1, 1);
0345     grid3->addWidget(d->previewConvertToEightBit, 3, 0, 1, 2);
0346     grid3->addWidget(d->previewScaleFitToWindow,  4, 0, 1, 2);
0347     grid3->addWidget(d->previewShowIcons,         5, 0, 1, 2);
0348     grid3->setRowStretch(6, 10);
0349 
0350     d->previewFastPreview->setChecked(true);
0351     d->previewRawMode->setCurrentIndex(0);
0352     d->previewRawMode->setEnabled(false);
0353 
0354     d->tab->insertTab(Preview, pwpanel, i18nc("@title:tab", "Preview"));
0355 
0356     // --------------------------------------------------------
0357 
0358     QWidget* const fspanel    = new QWidget(d->tab);
0359     QVBoxLayout* const layout = new QVBoxLayout(fspanel);
0360     d->fullScreenSettings     = new FullScreenSettings(FS_ALBUMGUI, d->tab);
0361     d->fullScreenSettings->setTitle(QString());
0362     d->fullScreenSettings->setFlat(true);
0363 
0364     layout->setContentsMargins(QMargins());
0365     layout->setSpacing(spacing);
0366     layout->addWidget(d->fullScreenSettings);
0367     layout->addStretch();
0368 
0369     d->tab->insertTab(FullScreen, fspanel, i18nc("@title:tab", "Full-Screen"));
0370 
0371     // --------------------------------------------------------
0372 
0373     d->mimetype = new SetupMime();
0374     d->tab->insertTab(MimeType, d->mimetype, i18nc("@title:tab", "Mime Types"));
0375 
0376     d->category = new SetupCategory(d->tab);
0377     d->tab->insertTab(Category, d->category, i18nc("@title:tab", "Categories"));
0378 
0379     // --------------------------------------------------------
0380 
0381     readSettings();
0382     adjustSize();
0383 
0384     // --------------------------------------------------------
0385 
0386     connect(d->previewFullView, SIGNAL(toggled(bool)),
0387             d->previewRawMode, SLOT(setEnabled(bool)));
0388 
0389     connect(d->largeThumbsBox, SIGNAL(toggled(bool)),
0390             this, SLOT(slotUseLargeThumbsToggled(bool)));
0391 
0392     // --------------------------------------------------------
0393 }
0394 
0395 SetupAlbumView::~SetupAlbumView()
0396 {
0397     delete d;
0398 }
0399 
0400 void SetupAlbumView::setActiveTab(AlbumTab tab)
0401 {
0402     d->tab->setCurrentIndex(tab);
0403 }
0404 
0405 SetupAlbumView::AlbumTab SetupAlbumView::activeTab() const
0406 {
0407     return (AlbumTab)d->tab->currentIndex();
0408 }
0409 
0410 void SetupAlbumView::applySettings()
0411 {
0412     ApplicationSettings* const settings = ApplicationSettings::instance();
0413 
0414     if (!settings)
0415     {
0416         return;
0417     }
0418 
0419     settings->setTreeViewIconSize(d->iconTreeThumbSize->currentData().toInt());
0420     settings->setTreeViewFaceSize(d->iconTreeFaceSize->currentData().toInt());
0421     settings->setTreeViewFont(d->treeViewFontSelect->font());
0422     settings->setIconShowName(d->iconShowNameBox->isChecked());
0423     settings->setIconShowTags(d->iconShowTagsBox->isChecked());
0424     settings->setIconShowSize(d->iconShowSizeBox->isChecked());
0425     settings->setIconShowDate(d->iconShowDateBox->isChecked());
0426     settings->setIconShowModDate(d->iconShowModDateBox->isChecked());
0427     settings->setIconShowResolution(d->iconShowResolutionBox->isChecked());
0428     settings->setIconShowAspectRatio(d->iconShowAspectRatioBox->isChecked());
0429     settings->setIconShowTitle(d->iconShowTitleBox->isChecked());
0430     settings->setIconShowComments(d->iconShowCommentsBox->isChecked());
0431     settings->setIconShowOverlays(d->iconShowOverlaysBox->isChecked());
0432     settings->setIconShowFullscreen(d->iconShowFullscreenBox->isChecked());
0433     settings->setIconShowCoordinates(d->iconShowCoordinatesBox->isChecked());
0434     settings->setIconShowRating(d->iconShowRatingBox->isChecked());
0435     settings->setIconShowPickLabel(d->iconShowPickLabelBox->isChecked());
0436     settings->setIconShowColorLabel(d->iconShowColorLabelBox->isChecked());
0437     settings->setIconShowImageFormat(d->iconShowFormatBox->isChecked());
0438     settings->setIconViewFont(d->iconViewFontSelect->font());
0439     settings->setItemLeftClickAction(d->leftClickActionComboBox->currentIndex());
0440 
0441     PreviewSettings previewSettings;
0442     previewSettings.quality           = d->previewFastPreview->isChecked() ? PreviewSettings::FastPreview : PreviewSettings::HighQualityPreview;
0443     previewSettings.rawLoading        = (PreviewSettings::RawLoading)d->previewRawMode->itemData(d->previewRawMode->currentIndex()).toInt();
0444     previewSettings.convertToEightBit = d->previewConvertToEightBit->isChecked();
0445     settings->setPreviewSettings(previewSettings);
0446 
0447     settings->setPreviewShowIcons(d->previewShowIcons->isChecked());
0448     settings->setScaleFitToWindow(d->previewScaleFitToWindow->isChecked());
0449     settings->setShowFolderTreeViewItemsCount(d->showFolderTreeViewItemsCount->isChecked());
0450     settings->saveSettings();
0451 
0452     KConfigGroup group = KSharedConfig::openConfig()->group(settings->generalConfigGroupName());
0453     d->fullScreenSettings->saveSettings(group);
0454 
0455     d->category->applySettings();
0456     d->mimetype->applySettings();
0457 
0458     // Method ThumbnailSize::setUseLargeThumbs() is not called here to prevent
0459     // dysfunction between Thumbs DB and icon if
0460     // thumb size is over 256 and when large thumbs size support is disabled.
0461     // digiKam need to be restarted to take effect.
0462 
0463     ThumbnailSize::saveSettings(group, d->largeThumbsBox->isChecked());
0464 }
0465 
0466 void SetupAlbumView::readSettings()
0467 {
0468     ApplicationSettings* const settings = ApplicationSettings::instance();
0469 
0470     if (!settings)
0471     {
0472         return;
0473     }
0474 
0475     d->iconTreeThumbSize->setCurrentIndex(d->iconTreeThumbSize->findData(settings->getTreeViewIconSize()));
0476     d->iconTreeFaceSize->setCurrentIndex(d->iconTreeFaceSize->findData(settings->getTreeViewFaceSize()));
0477 
0478     d->treeViewFontSelect->setFont(settings->getTreeViewFont());
0479     d->iconShowNameBox->setChecked(settings->getIconShowName());
0480     d->iconShowTagsBox->setChecked(settings->getIconShowTags());
0481     d->iconShowSizeBox->setChecked(settings->getIconShowSize());
0482     d->iconShowDateBox->setChecked(settings->getIconShowDate());
0483     d->iconShowModDateBox->setChecked(settings->getIconShowModDate());
0484     d->iconShowResolutionBox->setChecked(settings->getIconShowResolution());
0485     d->iconShowAspectRatioBox->setChecked(settings->getIconShowAspectRatio());
0486     d->iconShowTitleBox->setChecked(settings->getIconShowTitle());
0487     d->iconShowCommentsBox->setChecked(settings->getIconShowComments());
0488     d->iconShowOverlaysBox->setChecked(settings->getIconShowOverlays());
0489     d->iconShowFullscreenBox->setChecked(settings->getIconShowFullscreen());
0490     d->iconShowCoordinatesBox->setChecked(settings->getIconShowCoordinates());
0491     d->iconShowRatingBox->setChecked(settings->getIconShowRating());
0492     d->iconShowPickLabelBox->setChecked(settings->getIconShowPickLabel());
0493     d->iconShowColorLabelBox->setChecked(settings->getIconShowColorLabel());
0494     d->iconShowFormatBox->setChecked(settings->getIconShowImageFormat());
0495     d->iconViewFontSelect->setFont(settings->getIconViewFont());
0496 
0497     d->leftClickActionComboBox->setCurrentIndex(settings->getItemLeftClickAction());
0498 
0499     PreviewSettings previewSettings = settings->getPreviewSettings();
0500 
0501     if (previewSettings.quality == PreviewSettings::FastPreview)
0502     {
0503         d->previewFastPreview->setChecked(true);
0504     }
0505     else
0506     {
0507         d->previewFullView->setChecked(true);
0508         d->previewRawMode->setEnabled(true);
0509     }
0510 
0511     d->previewRawMode->setCurrentIndex(d->previewRawMode->findData(previewSettings.rawLoading));
0512 
0513     d->previewShowIcons->setChecked(settings->getPreviewShowIcons());
0514     d->previewScaleFitToWindow->setChecked(settings->getScaleFitToWindow());
0515     d->previewConvertToEightBit->setChecked(previewSettings.convertToEightBit);
0516     d->showFolderTreeViewItemsCount->setChecked(settings->getShowFolderTreeViewItemsCount());
0517 
0518     KConfigGroup group = KSharedConfig::openConfig()->group(settings->generalConfigGroupName());
0519     d->fullScreenSettings->readSettings(group);
0520 
0521     ThumbnailSize::readSettings(group);
0522     d->useLargeThumbsOriginal = ThumbnailSize::getUseLargeThumbs();
0523     d->largeThumbsBox->setChecked(d->useLargeThumbsOriginal);
0524 
0525     d->category->readSettings();
0526     d->mimetype->readSettings();
0527 }
0528 
0529 bool SetupAlbumView::useLargeThumbsHasChanged() const
0530 {
0531     return (d->largeThumbsBox->isChecked() != d->useLargeThumbsOriginal);
0532 }
0533 
0534 void SetupAlbumView::slotUseLargeThumbsToggled(bool b)
0535 {
0536     // Show info if large thumbs were enabled, and only once.
0537 
0538     if (b && d->useLargeThumbsShowedInfo && useLargeThumbsHasChanged())
0539     {
0540         d->useLargeThumbsShowedInfo = true;
0541         QMessageBox::information(this, qApp->applicationName(),
0542                                  i18nc("@info",
0543                                        "This option changes the size in which thumbnails are generated. "
0544                                        "You need to restart digiKam for this option to take effect. "
0545                                        "Furthermore, you need to regenerate all already stored thumbnails via "
0546                                        "the <interface>Tools / Maintenance</interface> menu."));
0547     }
0548 }
0549 
0550 } // namespace Digikam
0551 
0552 #include "moc_setupalbumview.cpp"