File indexing completed on 2025-01-19 03:57:01
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2021-07-24 0007 * Description : frame on screen display settings widget 0008 * 0009 * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2021 by Quoc Hưng Tran <quochungtran1999 at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #include "frameosdwidget.h" 0017 0018 // Qt includes 0019 0020 #include <QCheckBox> 0021 #include <QGridLayout> 0022 0023 // KDE includes 0024 0025 #include <klocalizedstring.h> 0026 0027 // Local includes 0028 0029 #include "dfontselect.h" 0030 0031 namespace Digikam 0032 { 0033 0034 class Q_DECL_HIDDEN FrameOsdWidget::Private 0035 { 0036 public: 0037 0038 Private() = default; 0039 0040 QCheckBox* showName = nullptr; 0041 QCheckBox* showDate = nullptr; 0042 QCheckBox* showApertureFocal = nullptr; 0043 QCheckBox* showExpoSensitivity = nullptr; 0044 QCheckBox* showMakeModel = nullptr; 0045 QCheckBox* showLensModel = nullptr; 0046 QCheckBox* showComment = nullptr; 0047 QCheckBox* showTitle = nullptr; 0048 QCheckBox* showTags = nullptr; 0049 QCheckBox* showRating = nullptr; 0050 QCheckBox* showCapIfNoTitle = nullptr; 0051 DFontSelect* osdFont = nullptr; 0052 }; 0053 0054 FrameOsdWidget::FrameOsdWidget(QWidget* const parent) 0055 : QWidget(parent), 0056 d (new Private) 0057 { 0058 d->showName = new QCheckBox(i18nc("@option:check", "Show image file name"), this); 0059 d->showName->setWhatsThis(i18nc("@info", "Show the image file name at the bottom of the screen.")); 0060 0061 d->showDate = new QCheckBox(i18nc("@option:check", "Show image creation date"), this); 0062 d->showDate->setWhatsThis(i18nc("@info", "Show the image creation time/date at the bottom of the screen.")); 0063 0064 d->showApertureFocal = new QCheckBox(i18nc("@option:check", "Show camera aperture and focal length"), this); 0065 d->showApertureFocal->setWhatsThis(i18nc("@info", "Show the camera aperture and focal length at the bottom of the screen.")); 0066 0067 d->showExpoSensitivity = new QCheckBox(i18nc("@option:check", "Show camera exposure and sensitivity"), this); 0068 d->showExpoSensitivity->setWhatsThis(i18nc("@info", "Show the camera exposure and sensitivity at the bottom of the screen.")); 0069 0070 d->showMakeModel = new QCheckBox(i18nc("@option:check", "Show camera make and model"), this); 0071 d->showMakeModel->setWhatsThis(i18nc("@info", "Show the camera make and model at the bottom of the screen.")); 0072 0073 d->showLensModel = new QCheckBox(i18nc("@option:check", "Show camera lens model"), this); 0074 d->showLensModel->setWhatsThis(i18nc("@info", "Show the camera lens model at the bottom of the screen.")); 0075 0076 d->showComment = new QCheckBox(i18nc("@option:check", "Show image caption"), this); 0077 d->showComment->setWhatsThis(i18nc("@info", "Show the image caption at the bottom of the screen.")); 0078 0079 d->showTitle = new QCheckBox(i18nc("@option:check", "Show image title"), this); 0080 d->showTitle->setWhatsThis(i18nc("@info", "Show the image title at the bottom of the screen.")); 0081 0082 d->showCapIfNoTitle = new QCheckBox(i18nc("@option:check", "Show image caption if it has not title"), this); 0083 d->showCapIfNoTitle->setWhatsThis(i18nc("@info", "Show the image caption at the bottom of the screen if no titles existed.")); 0084 0085 d->showRating = new QCheckBox(i18nc("@option:check", "Show image rating"), this); 0086 d->showRating->setWhatsThis(i18nc("@info", "Show the digiKam image rating at the bottom of the screen.")); 0087 0088 d->showTags = new QCheckBox(i18nc("@option:check", "Show image tags"), this); 0089 d->showTags->setWhatsThis(i18nc("@info", "Show the digiKam image tag names at the bottom of the screen.")); 0090 0091 d->osdFont = new DFontSelect(i18nc("@option", "On Screen Display Font:"), this); 0092 d->osdFont->setToolTip(i18nc("@info", "Select here the font used to display text on the screen display .")); 0093 0094 QGridLayout* const grid = new QGridLayout(this); 0095 grid->addWidget(d->showName, 1, 0, 1, 1); 0096 grid->addWidget(d->showRating, 1, 1, 1, 1); 0097 grid->addWidget(d->showApertureFocal, 2, 0, 1, 1); 0098 grid->addWidget(d->showDate, 2, 1, 1, 1); 0099 grid->addWidget(d->showMakeModel, 3, 0, 1, 1); 0100 grid->addWidget(d->showExpoSensitivity, 3, 1, 1, 1); 0101 grid->addWidget(d->showLensModel, 4, 0, 1, 1); 0102 grid->addWidget(d->showComment, 4, 1, 1, 1); 0103 grid->addWidget(d->showTitle, 5, 0, 1, 1); 0104 grid->addWidget(d->showCapIfNoTitle, 5, 1, 1, 1); 0105 grid->addWidget(d->showTags, 6, 0, 1, 1); 0106 grid->addWidget(d->osdFont, 7, 0, 1, 2); 0107 0108 connect(d->showName, SIGNAL(stateChanged(int)), 0109 this, SIGNAL(signalSettingsChanged())); 0110 0111 connect(d->showApertureFocal, SIGNAL(stateChanged(int)), 0112 this, SIGNAL(signalSettingsChanged())); 0113 0114 connect(d->showDate, SIGNAL(stateChanged(int)), 0115 this, SIGNAL(signalSettingsChanged())); 0116 0117 connect(d->showMakeModel, SIGNAL(stateChanged(int)), 0118 this, SIGNAL(signalSettingsChanged())); 0119 0120 connect(d->showExpoSensitivity, SIGNAL(stateChanged(int)), 0121 this, SIGNAL(signalSettingsChanged())); 0122 0123 connect(d->showLensModel, SIGNAL(stateChanged(int)), 0124 this, SIGNAL(signalSettingsChanged())); 0125 0126 connect(d->showComment, SIGNAL(stateChanged(int)), 0127 this, SIGNAL(signalSettingsChanged())); 0128 0129 // Disable and uncheck the "Show captions if no title" checkbox if the "Show comment" checkbox enabled 0130 0131 connect(d->showComment, SIGNAL(stateChanged(int)), 0132 this, SLOT(slotSetUnchecked(int))); 0133 0134 connect(d->showComment, SIGNAL(toggled(bool)), 0135 d->showCapIfNoTitle, SLOT(setDisabled(bool))); 0136 0137 connect(d->showTitle, SIGNAL(stateChanged(int)), 0138 this, SIGNAL(signalSettingsChanged())); 0139 0140 connect(d->showCapIfNoTitle, SIGNAL(stateChanged(int)), 0141 this, SIGNAL(signalSettingsChanged())); 0142 0143 connect(d->showTags, SIGNAL(stateChanged(int)), 0144 this, SIGNAL(signalSettingsChanged())); 0145 0146 connect(d->showRating, SIGNAL(stateChanged(int)), 0147 this, SIGNAL(signalSettingsChanged())); 0148 0149 connect(d->osdFont, SIGNAL(signalFontChanged()), 0150 this, SIGNAL(signalSettingsChanged())); 0151 } 0152 0153 FrameOsdWidget::~FrameOsdWidget() 0154 { 0155 delete d; 0156 } 0157 0158 void FrameOsdWidget::slotSetUnchecked(int) 0159 { 0160 d->showCapIfNoTitle->setCheckState(Qt::Unchecked); 0161 } 0162 0163 void FrameOsdWidget::setSettings(const FrameOsdSettings& settings) 0164 { 0165 d->showDate->blockSignals(true); 0166 d->showApertureFocal->blockSignals(true); 0167 d->showCapIfNoTitle->blockSignals(true); 0168 d->showComment->blockSignals(true); 0169 d->showExpoSensitivity->blockSignals(true); 0170 d->showLensModel->blockSignals(true); 0171 d->showMakeModel->blockSignals(true); 0172 d->showName->blockSignals(true); 0173 d->showTags->blockSignals(true); 0174 d->showRating->blockSignals(true); 0175 d->showTitle->blockSignals(true); 0176 d->osdFont->blockSignals(true); 0177 0178 d->showDate->setChecked(settings.printDate); 0179 d->showApertureFocal->setChecked(settings.printApertureFocal); 0180 d->showCapIfNoTitle->setChecked(settings.printCapIfNoTitle); 0181 d->showComment->setChecked(settings.printComment); 0182 d->showExpoSensitivity->setChecked(settings.printExpoSensitivity); 0183 d->showLensModel->setChecked(settings.printLensModel); 0184 d->showMakeModel->setChecked(settings.printMakeModel); 0185 d->showName->setChecked(settings.printName); 0186 d->showTags->setChecked(settings.printTags); 0187 d->showRating->setChecked(settings.printRating); 0188 d->showTitle->setChecked(settings.printTitle); 0189 d->osdFont->setFont(settings.osdFont); 0190 0191 d->showDate->blockSignals(false); 0192 d->showApertureFocal->blockSignals(false); 0193 d->showCapIfNoTitle->blockSignals(false); 0194 d->showComment->blockSignals(false); 0195 d->showExpoSensitivity->blockSignals(false); 0196 d->showLensModel->blockSignals(false); 0197 d->showMakeModel->blockSignals(false); 0198 d->showName->blockSignals(false); 0199 d->showTags->blockSignals(false); 0200 d->showRating->blockSignals(false); 0201 d->showTitle->blockSignals(false); 0202 d->osdFont->blockSignals(false); 0203 } 0204 0205 FrameOsdSettings FrameOsdWidget::settings() const 0206 { 0207 FrameOsdSettings settings; 0208 0209 settings.printName = d->showName->isChecked(); 0210 settings.printDate = d->showDate->isChecked(); 0211 settings.printApertureFocal = d->showApertureFocal->isChecked(); 0212 settings.printExpoSensitivity = d->showExpoSensitivity->isChecked(); 0213 settings.printMakeModel = d->showMakeModel->isChecked(); 0214 settings.printLensModel = d->showLensModel->isChecked(); 0215 settings.printComment = d->showComment->isChecked(); 0216 settings.printTitle = d->showTitle->isChecked(); 0217 settings.printCapIfNoTitle = d->showCapIfNoTitle->isChecked(); 0218 settings.printTags = d->showTags->isChecked(); 0219 settings.printRating = d->showRating->isChecked(); 0220 settings.osdFont = d->osdFont->font(); 0221 0222 return settings; 0223 } 0224 0225 } // namespace Digikam 0226 0227 #include "moc_frameosdwidget.cpp"