File indexing completed on 2025-03-09 03:50:51

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2018-07-30
0007  * Description : a plugin to blend bracketed images.
0008  *
0009  * SPDX-FileCopyrightText: 2018-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 "expoblendingplugin.h"
0016 
0017 // Qt includes
0018 
0019 #include <QPointer>
0020 
0021 // KDE includes
0022 
0023 #include <klocalizedstring.h>
0024 
0025 // Local includes
0026 
0027 #include "expoblendingmanager.h"
0028 
0029 namespace DigikamGenericExpoBlendingPlugin
0030 {
0031 
0032 ExpoBlendingPlugin::ExpoBlendingPlugin(QObject* const parent)
0033     : DPluginGeneric(parent)
0034 {
0035 }
0036 
0037 ExpoBlendingPlugin::~ExpoBlendingPlugin()
0038 {
0039 }
0040 
0041 void ExpoBlendingPlugin::cleanUp()
0042 {
0043     if (ExpoBlendingManager::isCreated())
0044     {
0045         delete ExpoBlendingManager::internalPtr;
0046     }
0047 }
0048 
0049 QString ExpoBlendingPlugin::name() const
0050 {
0051     return i18n("Exposure Blending");
0052 }
0053 
0054 QString ExpoBlendingPlugin::iid() const
0055 {
0056     return QLatin1String(DPLUGIN_IID);
0057 }
0058 
0059 QIcon ExpoBlendingPlugin::icon() const
0060 {
0061     return QIcon::fromTheme(QLatin1String("expoblending"));
0062 }
0063 
0064 QString ExpoBlendingPlugin::description() const
0065 {
0066     return i18n("A tool to blend bracketed images");
0067 }
0068 
0069 QString ExpoBlendingPlugin::details() const
0070 {
0071     return i18n("<p>This tool allows users to blend bracketed images together to create pseudo HDR photo.</p>"
0072                 "<p>To create high definition range image, you need to use images from same subject "
0073                 "taken with a tripod and exposed with different exposure settings.</p>"
0074                 "<p>To create image with better results, you can use RAW images instead JPEG, where "
0075                 "colors depth is higher and are well adapted for merging pixels by pixels.</p>");
0076 }
0077 
0078 QString ExpoBlendingPlugin::handbookSection() const
0079 {
0080     return QLatin1String("post_processing");
0081 }
0082 
0083 QString ExpoBlendingPlugin::handbookChapter() const
0084 {
0085     return QLatin1String("expo_blending");
0086 }
0087 
0088 QList<DPluginAuthor> ExpoBlendingPlugin::authors() const
0089 {
0090     return QList<DPluginAuthor>()
0091             << DPluginAuthor(QString::fromUtf8("Johannes Wienke"),
0092                              QString::fromUtf8("languitar at semipol dot de"),
0093                              QString::fromUtf8("(C) 2010"))
0094             << DPluginAuthor(QString::fromUtf8("Benjamin Girault"),
0095                              QString::fromUtf8("benjamin dot girault at gmail dot com"),
0096                              QString::fromUtf8("(C) 2014"))
0097             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
0098                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
0099                              QString::fromUtf8("(C) 2009-2020"),
0100                              i18n("Author and Maintainer"))
0101             ;
0102 }
0103 
0104 void ExpoBlendingPlugin::setup(QObject* const parent)
0105 {
0106     DPluginAction* const ac = new DPluginAction(parent);
0107     ac->setIcon(icon());
0108     ac->setText(i18nc("@action", "Blend Stacked Images..."));
0109     ac->setObjectName(QLatin1String("expoblending"));
0110     ac->setActionCategory(DPluginAction::GenericTool);
0111 
0112     connect(ac, SIGNAL(triggered(bool)),
0113             this, SLOT(slotExpoBlending()));
0114 
0115     addAction(ac);
0116 }
0117 
0118 void ExpoBlendingPlugin::slotExpoBlending()
0119 {
0120     DInfoInterface* const iface = infoIface(sender());
0121     bool created                = ExpoBlendingManager::isCreated();
0122 
0123     ExpoBlendingManager::instance()->checkBinaries();
0124     ExpoBlendingManager::instance()->setItemsList(iface->currentSelectedItems());
0125     ExpoBlendingManager::instance()->setPlugin(this);
0126 
0127     if (!created)
0128     {
0129         connect(ExpoBlendingManager::instance(), SIGNAL(updateHostApp(QUrl)),
0130                 iface, SLOT(slotMetadataChangedForUrl(QUrl)));
0131     }
0132 
0133     ExpoBlendingManager::instance()->run();
0134 }
0135 
0136 } // namespace DigikamGenericExpoBlendingPlugin
0137 
0138 #include "moc_expoblendingplugin.cpp"