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        : 2013-08-19
0007  * Description : Image Quality setup page
0008  *
0009  * SPDX-FileCopyrightText: 2013-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2013-2014 by Gowtham Ashok <gwty93 at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "setupimagequalitysorter.h"
0017 
0018 // Qt includes
0019 
0020 #include <QLabel>
0021 
0022 // KDE includes
0023 
0024 #include <klocalizedstring.h>
0025 
0026 // Local includes
0027 
0028 #include "imagequalitysettings.h"
0029 #include "dlayoutbox.h"
0030 
0031 namespace Digikam
0032 {
0033 
0034 class Q_DECL_HIDDEN SetupImageQualitySorter::Private
0035 {
0036 public:
0037 
0038     explicit Private()
0039       : settingsWidget(nullptr)
0040     {
0041     }
0042 
0043     ImageQualitySettings* settingsWidget;
0044 };
0045 
0046 // --------------------------------------------------------
0047 
0048 SetupImageQualitySorter::SetupImageQualitySorter(QWidget* const parent)
0049     : QScrollArea(parent),
0050       d          (new Private)
0051 {
0052     DVBox* const vbox = new DVBox(viewport());
0053 
0054     QLabel* const explanation = new QLabel(i18nc("@label", "These settings determines the quality of an image and convert it into a score, "
0055                                                  "stored in database as Pick Label property. This information can be evaluated by two ways: "
0056                                                  "using four basic factors sabotaging the images (blur, noise, exposure, and compression), "
0057                                                  "or using a deep learning neural network engine. The first one helps to determine whether "
0058                                                  "images are distorted by the basic factors, however it demands some drawbacks as fine-tuning "
0059                                                  "from the user’s side and it cannot work along the aesthetic image processing. "
0060                                                  "The second one uses an IA approach based on %1 model to predict the score. "
0061                                                  "As deep learning is an end-to-end solution, it doesn’t require hyper-parameter settings, "
0062                                                  "and make this feature easier to use.",
0063                                            QString::fromUtf8("<a href='https://expertphotography.com/aesthetic-photography/'>%1</a>")
0064                                                  .arg(i18nc("@label", "aesthetic image quality"))), vbox);
0065     explanation->setOpenExternalLinks(true);
0066     explanation->setWordWrap(true);
0067     explanation->setTextFormat(Qt::RichText);
0068 
0069     d->settingsWidget = new ImageQualitySettings(vbox);
0070 
0071     setWidget(vbox);
0072     setWidgetResizable(true);
0073 
0074     d->settingsWidget->readSettings();
0075 }
0076 
0077 SetupImageQualitySorter::~SetupImageQualitySorter()
0078 {
0079     delete d;
0080 }
0081 
0082 void SetupImageQualitySorter::applySettings()
0083 {
0084     d->settingsWidget->applySettings();
0085 }
0086 
0087 void SetupImageQualitySorter::readSettings()
0088 {
0089     d->settingsWidget->readSettings();
0090 }
0091 
0092 ImageQualityContainer SetupImageQualitySorter::getImageQualityContainer() const
0093 {
0094     return d->settingsWidget->getImageQualityContainer();
0095 }
0096 
0097 } // namespace Digikam
0098 
0099 #include "moc_setupimagequalitysorter.cpp"