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

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 reduce image artifacts
0008  *
0009  * SPDX-FileCopyrightText: 2018-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2019      by Ahmed Fathi <ahmed dot fathi dot abdelmageed at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "healingclonetoolplugin.h"
0017 
0018 // Qt includes
0019 
0020 #include <QPointer>
0021 
0022 // KDE includes
0023 
0024 #include <klocalizedstring.h>
0025 
0026 // Local includes
0027 
0028 #include "editorwindow.h"
0029 #include "healingclonetool.h"
0030 
0031 namespace DigikamEditorHealingCloneToolPlugin
0032 {
0033 
0034 HealingCloneToolPlugin::HealingCloneToolPlugin(QObject* const parent)
0035     : DPluginEditor(parent)
0036 {
0037 }
0038 
0039 HealingCloneToolPlugin::~HealingCloneToolPlugin()
0040 {
0041 }
0042 
0043 QString HealingCloneToolPlugin::name() const
0044 {
0045     return i18nc("@title", "Healing Clone Tool");
0046 }
0047 
0048 QString HealingCloneToolPlugin::iid() const
0049 {
0050     return QLatin1String(DPLUGIN_IID);
0051 }
0052 
0053 QIcon HealingCloneToolPlugin::icon() const
0054 {
0055     return QIcon::fromTheme(QLatin1String("edit-clone"));
0056 }
0057 
0058 QString HealingCloneToolPlugin::description() const
0059 {
0060     return i18nc("@info", "A tool to fix image artifacts");
0061 }
0062 
0063 QString HealingCloneToolPlugin::details() const
0064 {
0065     return i18nc("@info", "This Image Editor tool can fix image artifacts by cloning area.");
0066 }
0067 
0068 QString HealingCloneToolPlugin::handbookSection() const
0069 {
0070     return QLatin1String("image_editor");
0071 }
0072 
0073 QString HealingCloneToolPlugin::handbookChapter() const
0074 {
0075     return QLatin1String("enhancement_tools");
0076 }
0077 
0078 QString HealingCloneToolPlugin::handbookReference() const
0079 {
0080     return QLatin1String("enhance-clone");
0081 }
0082 
0083 QList<DPluginAuthor> HealingCloneToolPlugin::authors() const
0084 {
0085     return QList<DPluginAuthor>()
0086             << DPluginAuthor(QString::fromUtf8("Shaza Ismail Kaoud"),
0087                              QString::fromUtf8("shaza dot ismail dot k at gmail dot com"),
0088                              QString::fromUtf8("(C) 2017"))
0089             << DPluginAuthor(QString::fromUtf8("Ahmed Fathi"),
0090                              QString::fromUtf8("ahmed dot fathi dot abdelmageed at gmail dot com"),
0091                              QString::fromUtf8("(C) 2019"))
0092             ;
0093 }
0094 
0095 void HealingCloneToolPlugin::setup(QObject* const parent)
0096 {
0097     DPluginAction* const ac = new DPluginAction(parent);
0098     ac->setIcon(icon());
0099     ac->setText(i18nc("@action", "Healing Clone..."));
0100     ac->setObjectName(QLatin1String("editorwindow_enhance_healingclone"));
0101     ac->setWhatsThis(i18nc("@info", "This filter can be used to clone a part in a photo to erase unwanted region."));
0102     ac->setActionCategory(DPluginAction::EditorEnhance);
0103 
0104     connect(ac, SIGNAL(triggered(bool)),
0105             this, SLOT(slotHealingClone()));
0106 
0107     addAction(ac);
0108 }
0109 
0110 void HealingCloneToolPlugin::slotHealingClone()
0111 {
0112     EditorWindow* const editor = dynamic_cast<EditorWindow*>(sender()->parent());
0113 
0114     if (editor)
0115     {
0116         HealingCloneTool* const tool = new HealingCloneTool(editor);
0117         tool->setPlugin(this);
0118         editor->loadTool(tool);
0119     }
0120 }
0121 
0122 } // namespace DigikamEditorHealingCloneToolPlugin
0123 
0124 #include "moc_healingclonetoolplugin.cpp"