File indexing completed on 2025-01-05 04:00:15

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-07-09
0007  * Description : item tool tip configuration setup tab
0008  *
0009  * SPDX-FileCopyrightText: 2006-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 "setuptooltip.h"
0016 
0017 // Qt includes
0018 
0019 #include <QCheckBox>
0020 #include <QGroupBox>
0021 #include <QLabel>
0022 #include <QVBoxLayout>
0023 #include <QGridLayout>
0024 #include <QTabWidget>
0025 #include <QApplication>
0026 #include <QStyle>
0027 
0028 // KDE includes
0029 
0030 #include <klocalizedstring.h>
0031 
0032 // Local includes
0033 
0034 #include "dlayoutbox.h"
0035 #include "applicationsettings.h"
0036 #include "importsettings.h"
0037 #include "setupcamera.h"
0038 #include "dfontselect.h"
0039 #include "dexpanderbox.h"
0040 
0041 namespace Digikam
0042 {
0043 
0044 class Q_DECL_HIDDEN SetupToolTip::Private
0045 {
0046 public:
0047 
0048     explicit Private() :
0049         cameraUseFileMetadata(false),
0050         showToolTipsBox(nullptr),
0051         showFileNameBox(nullptr),
0052         showFileDateBox(nullptr),
0053         showFileSizeBox(nullptr),
0054         showImageTypeBox(nullptr),
0055         showImageDimBox(nullptr),
0056         showImageARBox(nullptr),
0057         showPhotoMakeBox(nullptr),
0058         showPhotoLensBox(nullptr),
0059         showPhotoDateBox(nullptr),
0060         showPhotoFocalBox(nullptr),
0061         showPhotoExpoBox(nullptr),
0062         showPhotoModeBox(nullptr),
0063         showPhotoFlashBox(nullptr),
0064         showPhotoWbBox(nullptr),
0065         showVideoAspectRatio(nullptr),
0066         showVideoAudioBitRate(nullptr),
0067         showVideoAudioChannelType(nullptr),
0068         showVideoAudioCodec(nullptr),
0069         showVideoDuration(nullptr),
0070         showVideoFrameRate(nullptr),
0071         showVideoVideoCodec(nullptr),
0072         showAlbumNameBox(nullptr),
0073         showTitlesBox(nullptr),
0074         showCommentsBox(nullptr),
0075         showTagsBox(nullptr),
0076         showLabelsBox(nullptr),
0077         showAlbumToolTipsBox(nullptr),
0078         showAlbumTitleBox(nullptr),
0079         showAlbumDateBox(nullptr),
0080         showAlbumCollectionBox(nullptr),
0081         showAlbumCategoryBox(nullptr),
0082         showAlbumCaptionBox(nullptr),
0083         showAlbumPreviewBox(nullptr),
0084         showImportToolTipsBox(nullptr),
0085         showItemTitleBox(nullptr),
0086         showItemDateBox(nullptr),
0087         showItemSizeBox(nullptr),
0088         showItemTypeBox(nullptr),
0089         showItemDimensionsBox(nullptr),
0090         showItemPhotoMakeBox(nullptr),
0091         showItemPhotoLensBox(nullptr),
0092         showItemPhotoFocalBox(nullptr),
0093         showItemPhotoExpoBox(nullptr),
0094         showItemPhotoFlashBox(nullptr),
0095         showItemPhotoWBBox(nullptr),
0096         fileSettingBox(nullptr),
0097         photoSettingBox(nullptr),
0098         videoSettingBox(nullptr),
0099         digikamSettingBox(nullptr),
0100         albumSettingBox(nullptr),
0101         importSettingBox(nullptr),
0102         tab(nullptr),
0103         fontSelect(nullptr)
0104     {
0105     }
0106 
0107     bool         cameraUseFileMetadata;
0108 
0109     QCheckBox*   showToolTipsBox;
0110 
0111     QCheckBox*   showFileNameBox;
0112     QCheckBox*   showFileDateBox;
0113     QCheckBox*   showFileSizeBox;
0114     QCheckBox*   showImageTypeBox;
0115     QCheckBox*   showImageDimBox;
0116     QCheckBox*   showImageARBox;
0117 
0118     QCheckBox*   showPhotoMakeBox;
0119     QCheckBox*   showPhotoLensBox;
0120     QCheckBox*   showPhotoDateBox;
0121     QCheckBox*   showPhotoFocalBox;
0122     QCheckBox*   showPhotoExpoBox;
0123     QCheckBox*   showPhotoModeBox;
0124     QCheckBox*   showPhotoFlashBox;
0125     QCheckBox*   showPhotoWbBox;
0126 
0127     QCheckBox*   showVideoAspectRatio;
0128     QCheckBox*   showVideoAudioBitRate;
0129     QCheckBox*   showVideoAudioChannelType;
0130     QCheckBox*   showVideoAudioCodec;
0131     QCheckBox*   showVideoDuration;
0132     QCheckBox*   showVideoFrameRate;
0133     QCheckBox*   showVideoVideoCodec;
0134 
0135     QCheckBox*   showAlbumNameBox;
0136     QCheckBox*   showTitlesBox;
0137     QCheckBox*   showCommentsBox;
0138     QCheckBox*   showTagsBox;
0139     QCheckBox*   showLabelsBox;
0140 
0141     QCheckBox*   showAlbumToolTipsBox;
0142     QCheckBox*   showAlbumTitleBox;
0143     QCheckBox*   showAlbumDateBox;
0144     QCheckBox*   showAlbumCollectionBox;
0145     QCheckBox*   showAlbumCategoryBox;
0146     QCheckBox*   showAlbumCaptionBox;
0147     QCheckBox*   showAlbumPreviewBox;
0148 
0149     QCheckBox*   showImportToolTipsBox;
0150     QCheckBox*   showItemTitleBox;
0151     QCheckBox*   showItemDateBox;
0152     QCheckBox*   showItemSizeBox;
0153     QCheckBox*   showItemTypeBox;
0154     QCheckBox*   showItemDimensionsBox;
0155     QCheckBox*   showItemPhotoMakeBox;
0156     QCheckBox*   showItemPhotoLensBox;
0157     QCheckBox*   showItemPhotoFocalBox;
0158     QCheckBox*   showItemPhotoExpoBox;
0159     QCheckBox*   showItemPhotoFlashBox;
0160     QCheckBox*   showItemPhotoWBBox;
0161 
0162     QGroupBox*   fileSettingBox;
0163     QGroupBox*   photoSettingBox;
0164     QGroupBox*   videoSettingBox;
0165     QGroupBox*   digikamSettingBox;
0166     QGroupBox*   albumSettingBox;
0167     QGroupBox*   importSettingBox;
0168 
0169     QTabWidget*  tab;
0170 
0171     DFontSelect* fontSelect;
0172 };
0173 
0174 SetupToolTip::SetupToolTip(QWidget* const parent)
0175     : QScrollArea(parent),
0176       d(new Private)
0177 {
0178     QWidget* const panel     = new QWidget(viewport());
0179     setWidget(panel);
0180     setWidgetResizable(true);
0181 
0182     const int spacing        = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing),
0183                              QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
0184 
0185     QVBoxLayout* const vlay  = new QVBoxLayout(panel);
0186 
0187     d->fontSelect            = new DFontSelect(i18n("Tool-Tips Font:"), panel);
0188     d->fontSelect->setToolTip(i18n("Select here the font used to display text in tool-tips."));
0189 
0190     d->tab                   = new QTabWidget(panel);
0191 
0192     // --------------------------------------------------------
0193 
0194     DVBox* const vbox        = new DVBox(panel);
0195 
0196     d->showToolTipsBox       = new QCheckBox(i18n("Show icon-view and thumb-bar items' tool-tips"), vbox);
0197     d->showToolTipsBox->setWhatsThis(i18n("Set this option to display image information when "
0198                                           "the mouse hovers over an icon-view or thumb-bar item."));
0199 
0200     d->fileSettingBox        = new QGroupBox(i18n("File/Item Information"), vbox);
0201     QGridLayout* const grid2 = new QGridLayout(d->fileSettingBox);
0202 
0203     d->showFileNameBox       = new QCheckBox(i18n("File name"), d->fileSettingBox);
0204     d->showFileNameBox->setWhatsThis(i18n("Set this option to display the image file name."));
0205 
0206     d->showFileDateBox       = new QCheckBox(i18n("File date"), d->fileSettingBox);
0207     d->showFileDateBox->setWhatsThis(i18n("Set this option to display the image file date."));
0208 
0209     d->showFileSizeBox       = new QCheckBox(i18n("File size"), d->fileSettingBox);
0210     d->showFileSizeBox->setWhatsThis(i18n("Set this option to display the image file size."));
0211 
0212     d->showImageTypeBox      = new QCheckBox(i18n("Image type"), d->fileSettingBox);
0213     d->showImageTypeBox->setWhatsThis(i18n("Set this option to display the image type."));
0214 
0215     d->showImageDimBox       = new QCheckBox(i18n("Image dimensions"), d->fileSettingBox);
0216     d->showImageDimBox->setWhatsThis(i18n("Set this option to display the image dimensions in pixels."));
0217 
0218     d->showImageARBox        = new QCheckBox(i18n("Image aspect ratio"), d->fileSettingBox);
0219     d->showImageARBox->setWhatsThis(i18n("Set this option to display the image aspect ratio."));
0220 
0221     grid2->addWidget(d->showFileNameBox,  0, 0, 1, 1);
0222     grid2->addWidget(d->showFileDateBox,  1, 0, 1, 1);
0223     grid2->addWidget(d->showFileSizeBox,  2, 0, 1, 1);
0224     grid2->addWidget(d->showImageTypeBox, 0, 1, 1, 1);
0225     grid2->addWidget(d->showImageDimBox,  1, 1, 1, 1);
0226     grid2->addWidget(d->showImageARBox,   2, 1, 1, 1);
0227     grid2->setContentsMargins(spacing, spacing, spacing, spacing);
0228     grid2->setSpacing(0);
0229 
0230     // --------------------------------------------------------
0231 
0232     d->photoSettingBox       = new QGroupBox(i18n("Photograph Information"), vbox);
0233     QGridLayout* const grid3 = new QGridLayout(d->photoSettingBox);
0234 
0235     d->showPhotoMakeBox      = new QCheckBox(i18n("Camera make and model"), d->photoSettingBox);
0236     d->showPhotoMakeBox->setWhatsThis(i18n("Set this option to display the make and model of the "
0237                                            "camera with which the image has been taken."));
0238 
0239     d->showPhotoLensBox      = new QCheckBox(i18n("Camera lens model"), d->photoSettingBox);
0240     d->showPhotoLensBox->setWhatsThis(i18n("Set this option to display the lens model with "
0241                                            "which the image was taken."));
0242 
0243     d->showPhotoDateBox      = new QCheckBox(i18n("Camera date"), d->photoSettingBox);
0244     d->showPhotoDateBox->setWhatsThis(i18n("Set this option to display the date when the image was taken."));
0245 
0246     d->showPhotoFocalBox     = new QCheckBox(i18n("Camera aperture and focal length"), d->photoSettingBox);
0247     d->showPhotoFocalBox->setWhatsThis(i18n("Set this option to display the camera aperture and focal settings "
0248                                             "used to take the image."));
0249 
0250     d->showPhotoExpoBox      = new QCheckBox(i18n("Camera exposure and sensitivity"), d->photoSettingBox);
0251     d->showPhotoExpoBox->setWhatsThis(i18n("Set this option to display the camera exposure and sensitivity "
0252                                            "used to take the image."));
0253 
0254     d->showPhotoModeBox      = new QCheckBox(i18n("Camera mode and program"), d->photoSettingBox);
0255     d->showPhotoModeBox->setWhatsThis(i18n("Set this option to display the camera mode and program "
0256                                            "used to take the image."));
0257 
0258     d->showPhotoFlashBox     = new QCheckBox(i18n("Camera flash settings"), d->photoSettingBox);
0259     d->showPhotoFlashBox->setWhatsThis(i18n("Set this option to display the camera flash settings "
0260                                             "used to take the image."));
0261 
0262     d->showPhotoWbBox        = new QCheckBox(i18n("Camera white balance settings"), d->photoSettingBox);
0263     d->showPhotoWbBox->setWhatsThis(i18n("Set this option to display the camera white balance settings "
0264                                          "used to take the image."));
0265 
0266     grid3->addWidget(d->showPhotoMakeBox,  0, 0, 1, 1);
0267     grid3->addWidget(d->showPhotoLensBox,  1, 0, 1, 1);
0268     grid3->addWidget(d->showPhotoDateBox,  2, 0, 1, 1);
0269     grid3->addWidget(d->showPhotoFocalBox, 3, 0, 1, 1);
0270     grid3->addWidget(d->showPhotoExpoBox,  0, 1, 1, 1);
0271     grid3->addWidget(d->showPhotoModeBox,  1, 1, 1, 1);
0272     grid3->addWidget(d->showPhotoFlashBox, 2, 1, 1, 1);
0273     grid3->addWidget(d->showPhotoWbBox,    3, 1, 1, 1);
0274     grid3->setContentsMargins(spacing, spacing, spacing, spacing);
0275     grid3->setSpacing(0);
0276 
0277     // --------------------------------------------------------
0278 
0279     d->digikamSettingBox     = new QGroupBox(i18n("digiKam Information"), vbox);
0280     QGridLayout* const grid4 = new QGridLayout(d->digikamSettingBox);
0281 
0282     d->showAlbumNameBox      = new QCheckBox(i18n("Album name"), d->digikamSettingBox);
0283     d->showAlbumNameBox->setWhatsThis(i18n("Set this option to display the album name."));
0284 
0285     d->showTitlesBox         = new QCheckBox(i18n("Image title"), d->digikamSettingBox);
0286     d->showTitlesBox->setWhatsThis(i18n("Set this option to display the image title."));
0287 
0288     d->showCommentsBox       = new QCheckBox(i18n("Image caption"), d->digikamSettingBox);
0289     d->showCommentsBox->setWhatsThis(i18n("Set this option to display the image captions."));
0290 
0291     d->showTagsBox           = new QCheckBox(i18n("Image tags"), d->digikamSettingBox);
0292     d->showTagsBox->setWhatsThis(i18n("Set this option to display the image tags."));
0293 
0294     d->showLabelsBox         = new QCheckBox(i18n("Image labels"), d->digikamSettingBox);
0295     d->showLabelsBox->setWhatsThis(i18n("Set this option to display the image pick, color, rating labels."));
0296 
0297     grid4->addWidget(d->showAlbumNameBox, 0, 0, 1, 1);
0298     grid4->addWidget(d->showTitlesBox,    1, 0, 1, 1);
0299     grid4->addWidget(d->showCommentsBox,  2, 0, 1, 1);
0300     grid4->addWidget(d->showTagsBox,      0, 1, 1, 1);
0301     grid4->addWidget(d->showLabelsBox,    1, 1, 1, 1);
0302     grid4->setContentsMargins(spacing, spacing, spacing, spacing);
0303     grid4->setSpacing(0);
0304 
0305     // --------------------------------------------------------
0306 
0307     d->videoSettingBox           = new QGroupBox(i18n("Audio/Video Information"), vbox);
0308     QGridLayout* const grid5     = new QGridLayout(d->videoSettingBox);
0309 
0310     d->showVideoAspectRatio      = new QCheckBox(i18n("Video Aspect Ratio"), d->videoSettingBox);
0311     d->showVideoAspectRatio->setWhatsThis(i18n("Set this option to display the Aspect Ratio of the Video."));
0312 
0313     d->showVideoAudioBitRate     = new QCheckBox(i18n("Audio Bit Rate"), d->videoSettingBox);
0314     d->showVideoAudioBitRate->setWhatsThis(i18n("Set this option to display the Audio Bit Rate of the Video."));
0315 
0316     d->showVideoAudioChannelType = new QCheckBox(i18n("Audio Channel Type"), d->videoSettingBox);
0317     d->showVideoAudioChannelType->setWhatsThis(i18n("Set this option to display the Audio Channel Type of the Video."));
0318 
0319     d->showVideoAudioCodec  = new QCheckBox(i18n("Audio Codec"), d->videoSettingBox);
0320     d->showVideoAudioCodec->setWhatsThis(i18n("Set this option to display the Audio Codec of the Video."));
0321 
0322     d->showVideoDuration         = new QCheckBox(i18n("Video Duration"), d->videoSettingBox);
0323     d->showVideoDuration->setWhatsThis(i18n("Set this option to display the Duration of the Video."));
0324 
0325     d->showVideoFrameRate        = new QCheckBox(i18n("Video Frame Rate"), d->videoSettingBox);
0326     d->showVideoFrameRate->setWhatsThis(i18n("Set this option to display the Aspect Ratio of the Video."));
0327 
0328     d->showVideoVideoCodec       = new QCheckBox(i18n("Video Codec"), d->videoSettingBox);
0329     d->showVideoVideoCodec->setWhatsThis(i18n("Set this option to display the Codec of the Video."));
0330 
0331     grid5->addWidget(d->showVideoAspectRatio,      0, 0, 1, 1);
0332     grid5->addWidget(d->showVideoAudioBitRate,     1, 0, 1, 1);
0333     grid5->addWidget(d->showVideoAudioChannelType, 2, 0, 1, 1);
0334     grid5->addWidget(d->showVideoAudioCodec,       3, 0, 1, 1);
0335     grid5->addWidget(d->showVideoDuration,         0, 1, 1, 1);
0336     grid5->addWidget(d->showVideoFrameRate,        1, 1, 1, 1);
0337     grid5->addWidget(d->showVideoVideoCodec,       2, 1, 1, 1);
0338     grid5->setContentsMargins(spacing, spacing, spacing, spacing);
0339     grid5->setSpacing(0);
0340 
0341     QWidget* const space = new QWidget(vbox);
0342     vbox->setStretchFactor(space, 10);
0343     vbox->setContentsMargins(spacing, spacing, spacing, spacing);
0344     vbox->setSpacing(spacing);
0345 
0346     // --------------------------------------------------------
0347 
0348     DVBox* const vbox2        = new DVBox(panel);
0349     d->showAlbumToolTipsBox   = new QCheckBox(i18n("Show album items' tool-tips"), vbox2);
0350     d->albumSettingBox        = new QGroupBox(i18n("Album Information"), vbox2);
0351 
0352     d->showAlbumToolTipsBox->setWhatsThis(i18n("Set this option to display album information when "
0353                                                "the mouse hovers over a folder-view item."));
0354 
0355     d->showAlbumTitleBox      = new QCheckBox(i18n("Album name"));
0356     d->showAlbumTitleBox->setWhatsThis(i18n("Set this option to display the album name."));
0357 
0358     d->showAlbumDateBox       = new QCheckBox(i18n("Album date"));
0359     d->showAlbumDateBox->setWhatsThis(i18n("Set this option to display the album date."));
0360 
0361     d->showAlbumCollectionBox = new QCheckBox(i18n("Album collection"));
0362     d->showAlbumCollectionBox->setWhatsThis(i18n("Set this option to display the album collection."));
0363 
0364     d->showAlbumCategoryBox   = new QCheckBox(i18n("Album category"));
0365     d->showAlbumCategoryBox->setWhatsThis(i18n("Set this option to display the album category."));
0366 
0367     d->showAlbumCaptionBox    = new QCheckBox(i18n("Album caption"));
0368     d->showAlbumCaptionBox->setWhatsThis(i18n("Set this option to display the album caption."));
0369 
0370     d->showAlbumPreviewBox    = new QCheckBox(i18n("Album preview"));
0371     d->showAlbumPreviewBox->setWhatsThis(i18n("Set this option to display the album preview."));
0372 
0373     QGridLayout* const albumSettingBoxLayout = new QGridLayout;
0374     albumSettingBoxLayout->addWidget(d->showAlbumTitleBox,      0, 0, 1, 1);
0375     albumSettingBoxLayout->addWidget(d->showAlbumDateBox,       1, 0, 1, 1);
0376     albumSettingBoxLayout->addWidget(d->showAlbumCollectionBox, 2, 0, 1, 1);
0377     albumSettingBoxLayout->addWidget(d->showAlbumCategoryBox,   0, 1, 1, 1);
0378     albumSettingBoxLayout->addWidget(d->showAlbumCaptionBox,    1, 1, 1, 1);
0379     albumSettingBoxLayout->addWidget(d->showAlbumPreviewBox,    2, 1, 1, 1);
0380     d->albumSettingBox->setLayout(albumSettingBoxLayout);
0381 
0382     QWidget* const space2 = new QWidget(vbox2);
0383     vbox2->setStretchFactor(space2, 10);
0384     vbox2->setContentsMargins(spacing, spacing, spacing, spacing);
0385     vbox2->setSpacing(spacing);
0386 
0387     // --------------------------------------------------------
0388 
0389     DVBox* const vbox3       = new DVBox(panel);
0390     d->showImportToolTipsBox = new QCheckBox(i18n("Show import items' tool-tips"), vbox3);
0391     d->importSettingBox      = new QGroupBox(i18n("Import Information"), vbox3);
0392 
0393     d->showAlbumToolTipsBox->setWhatsThis(i18n("Set this option to display album information when "
0394                                                "the mouse hovers over a folder-view item."));
0395 
0396     d->showItemTitleBox      = new QCheckBox(i18n("Item name"));
0397     d->showItemTitleBox->setWhatsThis(i18n("Set this option to display the item name."));
0398 
0399     d->showItemDateBox       = new QCheckBox(i18n("Item date"));
0400     d->showItemDateBox->setWhatsThis(i18n("Set this option to display the item date."));
0401 
0402     d->showItemSizeBox       = new QCheckBox(i18n("Item size"));
0403     d->showItemSizeBox->setWhatsThis(i18n("Set this option to display the item size."));
0404 
0405     d->showItemTypeBox       = new QCheckBox(i18n("Item type"));
0406     d->showItemTypeBox->setWhatsThis(i18n("Set this option to display the item type."));
0407 
0408     d->showItemDimensionsBox = new QCheckBox(i18n("Item dimensions"));
0409     d->showItemDimensionsBox->setWhatsThis(i18n("Set this option to display the item dimensions."));
0410 
0411     DLineWidget* const line  = new DLineWidget(Qt::Horizontal, d->photoSettingBox);
0412     QLabel* const label      = new QLabel(i18n("Note: these settings require \"Use File Metadata\" option "
0413                                                "from Camera Setup Behavior page."), d->photoSettingBox);
0414 
0415     d->showItemPhotoMakeBox  = new QCheckBox(i18n("Camera make and model"), d->photoSettingBox);
0416     d->showItemPhotoMakeBox->setWhatsThis(i18n("Set this option to display the make and model of the "
0417                                                "camera with which the image has been taken."));
0418 
0419     d->showItemPhotoLensBox  = new QCheckBox(i18n("Camera lens model"), d->photoSettingBox);
0420     d->showItemPhotoLensBox->setWhatsThis(i18n("Set this option to display the lens model with "
0421                                                "which the image was taken."));
0422 
0423     d->showItemPhotoFocalBox = new QCheckBox(i18n("Camera aperture and focal length"), d->photoSettingBox);
0424     d->showPhotoFocalBox->setWhatsThis(i18n("Set this option to display the camera aperture and focal settings "
0425                                             "used to take the image."));
0426 
0427     d->showItemPhotoExpoBox  = new QCheckBox(i18n("Camera exposure and sensitivity"), d->photoSettingBox);
0428     d->showPhotoExpoBox->setWhatsThis(i18n("Set this option to display the camera exposure and sensitivity "
0429                                            "used to take the image."));
0430 
0431     d->showItemPhotoFlashBox = new QCheckBox(i18n("Camera flash settings"), d->photoSettingBox);
0432     d->showPhotoFlashBox->setWhatsThis(i18n("Set this option to display the camera flash settings "
0433                                             "used to take the image."));
0434 
0435     d->showItemPhotoWBBox    = new QCheckBox(i18n("Camera white balance settings"), d->photoSettingBox);
0436     d->showItemPhotoWBBox->setWhatsThis(i18n("Set this option to display the camera white balance settings "
0437                                              "used to take the image."));
0438 
0439     QGridLayout* const importSettingBoxLayout = new QGridLayout;
0440     importSettingBoxLayout->addWidget(d->showItemTitleBox,      0, 0, 1, 1);
0441     importSettingBoxLayout->addWidget(d->showItemDateBox,       1, 0, 1, 1);
0442     importSettingBoxLayout->addWidget(d->showItemSizeBox,       2, 0, 1, 1);
0443     importSettingBoxLayout->addWidget(d->showItemTypeBox,       0, 1, 1, 1);
0444     importSettingBoxLayout->addWidget(d->showItemDimensionsBox, 1, 1, 1, 1);
0445     importSettingBoxLayout->addWidget(line,                     3, 0, 1, 2);
0446     importSettingBoxLayout->addWidget(label,                    4, 0, 1, 2);
0447     importSettingBoxLayout->addWidget(d->showItemPhotoMakeBox,  5, 0, 1, 1);
0448     importSettingBoxLayout->addWidget(d->showItemPhotoLensBox,  6, 0, 1, 1);
0449     importSettingBoxLayout->addWidget(d->showItemPhotoFocalBox, 7, 0, 1, 1);
0450     importSettingBoxLayout->addWidget(d->showItemPhotoExpoBox,  5, 1, 1, 1);
0451     importSettingBoxLayout->addWidget(d->showItemPhotoFlashBox, 6, 1, 1, 1);
0452     importSettingBoxLayout->addWidget(d->showItemPhotoWBBox,    7, 1, 1, 1);
0453     d->importSettingBox->setLayout(importSettingBoxLayout);
0454 
0455     QWidget* const space3 = new QWidget(vbox3);
0456     vbox3->setStretchFactor(space3, 10);
0457     vbox3->setContentsMargins(spacing, spacing, spacing, spacing);
0458     vbox3->setSpacing(spacing);
0459 
0460     // --------------------------------------------------------
0461 
0462     d->tab->insertTab(IconItems,   vbox,  i18n("Icon Items"));
0463     d->tab->insertTab(AlbumItems,  vbox2, i18n("Album Items"));
0464     d->tab->insertTab(ImportItems, vbox3, i18n("Import Items"));
0465 
0466     vlay->addWidget(d->fontSelect);
0467     vlay->addWidget(d->tab);
0468     vlay->addStretch();
0469     vlay->setContentsMargins(spacing, spacing, spacing, spacing);
0470     vlay->setSpacing(spacing);
0471 
0472     // --------------------------------------------------------
0473 
0474     connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
0475             d->fileSettingBox, SLOT(setEnabled(bool)));
0476 
0477     connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
0478             d->photoSettingBox, SLOT(setEnabled(bool)));
0479 
0480     connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
0481             d->videoSettingBox, SLOT(setEnabled(bool)));
0482 
0483     connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
0484             d->digikamSettingBox, SLOT(setEnabled(bool)));
0485 
0486     connect(d->showAlbumToolTipsBox, SIGNAL(toggled(bool)),
0487             d->albumSettingBox, SLOT(setEnabled(bool)));
0488 
0489     connect(d->showImportToolTipsBox, SIGNAL(toggled(bool)),
0490             this, SLOT(slotImportToolTipsChanged()));
0491 
0492     // --------------------------------------------------------
0493 
0494     readSettings();
0495     adjustSize();
0496 }
0497 
0498 SetupToolTip::~SetupToolTip()
0499 {
0500     delete d;
0501 }
0502 
0503 void SetupToolTip::setActiveTab(ToolTipTab tab)
0504 {
0505     d->tab->setCurrentIndex(tab);
0506 }
0507 
0508 SetupToolTip::ToolTipTab SetupToolTip::activeTab() const
0509 {
0510     return (ToolTipTab)d->tab->currentIndex();
0511 }
0512 
0513 void SetupToolTip::applySettings()
0514 {
0515     ApplicationSettings* const settings = ApplicationSettings::instance();
0516 
0517     if (!settings)
0518     {
0519         return;
0520     }
0521 
0522     settings->setToolTipsFont(d->fontSelect->font());
0523 
0524     settings->setShowToolTips(d->showToolTipsBox->isChecked());
0525     settings->setToolTipsShowFileName(d->showFileNameBox->isChecked());
0526     settings->setToolTipsShowFileDate(d->showFileDateBox->isChecked());
0527     settings->setToolTipsShowFileSize(d->showFileSizeBox->isChecked());
0528     settings->setToolTipsShowImageAR(d->showImageARBox->isChecked());
0529     settings->setToolTipsShowImageType(d->showImageTypeBox->isChecked());
0530     settings->setToolTipsShowImageDim(d->showImageDimBox->isChecked());
0531 
0532     settings->setToolTipsShowPhotoMake(d->showPhotoMakeBox->isChecked());
0533     settings->setToolTipsShowPhotoLens(d->showPhotoLensBox->isChecked());
0534     settings->setToolTipsShowPhotoDate(d->showPhotoDateBox->isChecked());
0535     settings->setToolTipsShowPhotoFocal(d->showPhotoFocalBox->isChecked());
0536     settings->setToolTipsShowPhotoExpo(d->showPhotoExpoBox->isChecked());
0537     settings->setToolTipsShowPhotoMode(d->showPhotoModeBox->isChecked());
0538     settings->setToolTipsShowPhotoFlash(d->showPhotoFlashBox->isChecked());
0539     settings->setToolTipsShowPhotoWB(d->showPhotoWbBox->isChecked());
0540 
0541     settings->setToolTipsShowVideoAspectRatio(d->showVideoAspectRatio->isChecked());
0542     settings->setToolTipsShowVideoAudioBitRate(d->showVideoAudioBitRate->isChecked());
0543     settings->setToolTipsShowVideoAudioChannelType(d->showVideoAudioChannelType->isChecked());
0544     settings->setToolTipsShowVideoAudioCodec(d->showVideoAudioCodec->isChecked());
0545     settings->setToolTipsShowVideoDuration(d->showVideoDuration->isChecked());
0546     settings->setToolTipsShowVideoFrameRate(d->showVideoFrameRate->isChecked());
0547     settings->setToolTipsShowVideoVideoCodec(d->showVideoVideoCodec->isChecked());
0548 
0549     settings->setToolTipsShowAlbumName(d->showAlbumNameBox->isChecked());
0550     settings->setToolTipsShowTitles(d->showTitlesBox->isChecked());
0551     settings->setToolTipsShowComments(d->showCommentsBox->isChecked());
0552     settings->setToolTipsShowTags(d->showTagsBox->isChecked());
0553     settings->setToolTipsShowLabelRating(d->showLabelsBox->isChecked());
0554 
0555     settings->setShowAlbumToolTips(d->showAlbumToolTipsBox->isChecked());
0556     settings->setToolTipsShowAlbumTitle(d->showAlbumTitleBox->isChecked());
0557     settings->setToolTipsShowAlbumDate(d->showAlbumDateBox->isChecked());
0558     settings->setToolTipsShowAlbumCollection(d->showAlbumCollectionBox->isChecked());
0559     settings->setToolTipsShowAlbumCategory(d->showAlbumCategoryBox->isChecked());
0560     settings->setToolTipsShowAlbumCaption(d->showAlbumCaptionBox->isChecked());
0561     settings->setToolTipsShowAlbumPreview(d->showAlbumPreviewBox->isChecked());
0562 
0563     settings->saveSettings();
0564 
0565     // -- Import Settings ------------------------------------------------------------------------
0566 
0567     ImportSettings* const importSettings = ImportSettings::instance();
0568 
0569     if (!importSettings)
0570     {
0571         return;
0572     }
0573 
0574     importSettings->setShowToolTips(d->showImportToolTipsBox->isChecked());
0575     importSettings->setToolTipsShowFileName(d->showItemTitleBox->isChecked());
0576     importSettings->setToolTipsShowFileDate(d->showItemDateBox->isChecked());
0577     importSettings->setToolTipsShowFileSize(d->showItemSizeBox->isChecked());
0578     importSettings->setToolTipsShowImageType(d->showItemTypeBox->isChecked());
0579     importSettings->setToolTipsShowImageDim(d->showItemDimensionsBox->isChecked());
0580     importSettings->setToolTipsShowPhotoMake(d->showItemPhotoMakeBox->isChecked());
0581     importSettings->setToolTipsShowPhotoLens(d->showItemPhotoLensBox->isChecked());
0582     importSettings->setToolTipsShowPhotoFocal(d->showItemPhotoFocalBox->isChecked());
0583     importSettings->setToolTipsShowPhotoExpo(d->showItemPhotoExpoBox->isChecked());
0584     importSettings->setToolTipsShowPhotoFlash(d->showItemPhotoFlashBox->isChecked());
0585     importSettings->setToolTipsShowPhotoWB(d->showItemPhotoWBBox->isChecked());
0586 
0587     importSettings->saveSettings();
0588 }
0589 
0590 void SetupToolTip::readSettings()
0591 {
0592     ApplicationSettings* const settings = ApplicationSettings::instance();
0593 
0594     if (!settings)
0595     {
0596         return;
0597     }
0598 
0599     d->fontSelect->setFont(settings->getToolTipsFont());
0600 
0601     d->showToolTipsBox->setChecked(settings->getShowToolTips());
0602     d->showFileNameBox->setChecked(settings->getToolTipsShowFileName());
0603     d->showFileDateBox->setChecked(settings->getToolTipsShowFileDate());
0604     d->showFileSizeBox->setChecked(settings->getToolTipsShowFileSize());
0605     d->showImageARBox->setChecked(settings->getToolTipsShowImageAR());
0606     d->showImageTypeBox->setChecked(settings->getToolTipsShowImageType());
0607     d->showImageDimBox->setChecked(settings->getToolTipsShowImageDim());
0608 
0609     d->showPhotoMakeBox->setChecked(settings->getToolTipsShowPhotoMake());
0610     d->showPhotoLensBox->setChecked(settings->getToolTipsShowPhotoLens());
0611     d->showPhotoDateBox->setChecked(settings->getToolTipsShowPhotoDate());
0612     d->showPhotoFocalBox->setChecked(settings->getToolTipsShowPhotoFocal());
0613     d->showPhotoExpoBox->setChecked(settings->getToolTipsShowPhotoExpo());
0614     d->showPhotoModeBox->setChecked(settings->getToolTipsShowPhotoMode());
0615     d->showPhotoFlashBox->setChecked(settings->getToolTipsShowPhotoFlash());
0616     d->showPhotoWbBox->setChecked(settings->getToolTipsShowPhotoWB());
0617 
0618     d->showVideoAspectRatio->setChecked(settings->getToolTipsShowVideoAspectRatio());
0619     d->showVideoAudioBitRate->setChecked(settings->getToolTipsShowVideoAudioBitRate());
0620     d->showVideoAudioChannelType->setChecked(settings->getToolTipsShowVideoAudioChannelType());
0621     d->showVideoAudioCodec->setChecked(settings->getToolTipsShowVideoAudioCodec());
0622     d->showVideoDuration->setChecked(settings->getToolTipsShowVideoDuration());
0623     d->showVideoFrameRate->setChecked(settings->getToolTipsShowVideoFrameRate());
0624     d->showVideoVideoCodec->setChecked(settings->getToolTipsShowVideoVideoCodec());
0625 
0626     d->showAlbumNameBox->setChecked(settings->getToolTipsShowAlbumName());
0627     d->showTitlesBox->setChecked(settings->getToolTipsShowTitles());
0628     d->showCommentsBox->setChecked(settings->getToolTipsShowComments());
0629     d->showTagsBox->setChecked(settings->getToolTipsShowTags());
0630     d->showLabelsBox->setChecked(settings->getToolTipsShowLabelRating());
0631 
0632     d->fileSettingBox->setEnabled(d->showToolTipsBox->isChecked());
0633     d->photoSettingBox->setEnabled(d->showToolTipsBox->isChecked());
0634     d->digikamSettingBox->setEnabled(d->showToolTipsBox->isChecked());
0635     d->videoSettingBox->setEnabled(d->showToolTipsBox->isChecked());
0636 
0637     d->albumSettingBox->setEnabled(d->showAlbumToolTipsBox->isChecked());
0638 
0639     d->showAlbumToolTipsBox->setChecked(settings->getShowAlbumToolTips());
0640     d->showAlbumTitleBox->setChecked(settings->getToolTipsShowAlbumTitle());
0641     d->showAlbumDateBox->setChecked(settings->getToolTipsShowAlbumDate());
0642     d->showAlbumCollectionBox->setChecked(settings->getToolTipsShowAlbumCollection());
0643     d->showAlbumCategoryBox->setChecked(settings->getToolTipsShowAlbumCategory());
0644     d->showAlbumCaptionBox->setChecked(settings->getToolTipsShowAlbumCaption());
0645     d->showAlbumPreviewBox->setChecked(settings->getToolTipsShowAlbumPreview());
0646 
0647     // -- Import Settings ------------------------------------------------------------------------
0648 
0649     ImportSettings* const importSettings = ImportSettings::instance();
0650 
0651     if (!importSettings)
0652     {
0653         return;
0654     }
0655 
0656     d->showImportToolTipsBox->setChecked(importSettings->getShowToolTips());
0657     d->showItemTitleBox->setChecked(importSettings->getToolTipsShowFileName());
0658     d->showItemDateBox->setChecked(importSettings->getToolTipsShowFileDate());
0659     d->showItemSizeBox->setChecked(importSettings->getToolTipsShowFileSize());
0660     d->showItemTypeBox->setChecked(importSettings->getToolTipsShowImageType());
0661     d->showItemDimensionsBox->setChecked(importSettings->getToolTipsShowImageDim());
0662     d->showItemPhotoMakeBox->setChecked(importSettings->getToolTipsShowPhotoMake());
0663     d->showItemPhotoLensBox->setChecked(importSettings->getToolTipsShowPhotoLens());
0664     d->showItemPhotoFocalBox->setChecked(importSettings->getToolTipsShowPhotoFocal());
0665     d->showItemPhotoExpoBox->setChecked(importSettings->getToolTipsShowPhotoExpo());
0666     d->showItemPhotoFlashBox->setChecked(importSettings->getToolTipsShowPhotoFlash());
0667     d->showItemPhotoWBBox->setChecked(importSettings->getToolTipsShowPhotoWB());
0668 
0669     refreshCameraOptions();
0670 }
0671 
0672 void SetupToolTip::slotUseFileMetadataChanged(bool b)
0673 {
0674     d->cameraUseFileMetadata = b;
0675     refreshCameraOptions();
0676 }
0677 
0678 void SetupToolTip::slotImportToolTipsChanged()
0679 {
0680     refreshCameraOptions();
0681 }
0682 
0683 void SetupToolTip::refreshCameraOptions()
0684 {
0685     bool b = d->showImportToolTipsBox->isChecked();
0686     d->importSettingBox->setEnabled(b);
0687     d->showItemPhotoMakeBox->setEnabled(b && d->cameraUseFileMetadata);
0688     d->showItemPhotoLensBox->setEnabled(b && d->cameraUseFileMetadata);
0689     d->showItemPhotoFocalBox->setEnabled(b && d->cameraUseFileMetadata);
0690     d->showItemPhotoExpoBox->setEnabled(b && d->cameraUseFileMetadata);
0691     d->showItemPhotoFlashBox->setEnabled(b && d->cameraUseFileMetadata);
0692     d->showItemPhotoWBBox->setEnabled(b && d->cameraUseFileMetadata);
0693 }
0694 
0695 } // namespace Digikam
0696 
0697 #include "moc_setuptooltip.cpp"