File indexing completed on 2025-01-05 03:51:42

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2018-07-30
0007  * Description : image editor plugin to restore an image
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 "redeyetoolplugin.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 "editorwindow.h"
0028 #include "redeyetool.h"
0029 
0030 namespace DigikamEditorRedEyeToolPlugin
0031 {
0032 
0033 RedEyeToolPlugin::RedEyeToolPlugin(QObject* const parent)
0034     : DPluginEditor(parent)
0035 {
0036 }
0037 
0038 RedEyeToolPlugin::~RedEyeToolPlugin()
0039 {
0040 }
0041 
0042 QString RedEyeToolPlugin::name() const
0043 {
0044     return i18nc("@title", "Red Eye");
0045 }
0046 
0047 QString RedEyeToolPlugin::iid() const
0048 {
0049     return QLatin1String(DPLUGIN_IID);
0050 }
0051 
0052 QIcon RedEyeToolPlugin::icon() const
0053 {
0054     return QIcon::fromTheme(QLatin1String("redeyes"));
0055 }
0056 
0057 QString RedEyeToolPlugin::description() const
0058 {
0059     return i18nc("@info", "A tool to automatically detect and correct red eye effect");
0060 }
0061 
0062 QString RedEyeToolPlugin::details() const
0063 {
0064     return i18nc("@info", "This Image Editor tool can reduce red eye effect on image.");
0065 }
0066 
0067 QString RedEyeToolPlugin::handbookSection() const
0068 {
0069     return QLatin1String("image_editor");
0070 }
0071 
0072 QString RedEyeToolPlugin::handbookChapter() const
0073 {
0074     return QLatin1String("enhancement_tools");
0075 }
0076 
0077 QString RedEyeToolPlugin::handbookReference() const
0078 {
0079     return QLatin1String("enhance-redeyes");
0080 }
0081 
0082 QList<DPluginAuthor> RedEyeToolPlugin::authors() const
0083 {
0084     return QList<DPluginAuthor>()
0085             << DPluginAuthor(QString::fromUtf8("Renchi Raju"),
0086                              QString::fromUtf8("renchi dot raju at gmail dot com"),
0087                              QString::fromUtf8("(C) 2004-2005"))
0088 
0089             << DPluginAuthor(QString::fromUtf8("Omar Amin"),
0090                              QString::fromUtf8("Omar dot moh dot amin at gmail dot com"),
0091                              QString::fromUtf8("(C) 2016"))
0092 
0093             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
0094                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
0095                              QString::fromUtf8("(C) 2005-2021"))
0096             ;
0097 }
0098 
0099 void RedEyeToolPlugin::setup(QObject* const parent)
0100 {
0101     DPluginAction* const ac = new DPluginAction(parent);
0102     ac->setIcon(icon());
0103     ac->setText(i18nc("@action", "Red Eye..."));
0104     ac->setWhatsThis(i18nc("@info", "This filter can be used to correct red eyes in a photo. "
0105                            "Select a region including the eyes to use this option."));
0106     ac->setObjectName(QLatin1String("editorwindow_enhance_redeye"));
0107     ac->setActionCategory(DPluginAction::EditorEnhance);
0108 
0109     connect(ac, SIGNAL(triggered(bool)),
0110             this, SLOT(slotRedEye()));
0111 
0112     addAction(ac);
0113 }
0114 
0115 void RedEyeToolPlugin::slotRedEye()
0116 {
0117     EditorWindow* const editor = dynamic_cast<EditorWindow*>(sender()->parent());
0118 
0119     if (editor)
0120     {
0121         RedEyeTool* const tool = new RedEyeTool(editor);
0122         tool->setPlugin(this);
0123         editor->loadTool(tool);
0124     }
0125 }
0126 
0127 } // namespace DigikamEditorRedEyeToolPlugin
0128 
0129 #include "moc_redeyetoolplugin.cpp"