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 fix hot pixels 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 "hotpixelstoolplugin.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 "hotpixelstool.h" 0029 0030 namespace DigikamEditorHotPixelsToolPlugin 0031 { 0032 0033 HotPixelsToolPlugin::HotPixelsToolPlugin(QObject* const parent) 0034 : DPluginEditor(parent) 0035 { 0036 } 0037 0038 HotPixelsToolPlugin::~HotPixelsToolPlugin() 0039 { 0040 } 0041 0042 QString HotPixelsToolPlugin::name() const 0043 { 0044 return i18nc("@title", "Hot Pixels"); 0045 } 0046 0047 QString HotPixelsToolPlugin::iid() const 0048 { 0049 return QLatin1String(DPLUGIN_IID); 0050 } 0051 0052 QIcon HotPixelsToolPlugin::icon() const 0053 { 0054 return QIcon::fromTheme(QLatin1String("hotpixels")); 0055 } 0056 0057 QString HotPixelsToolPlugin::description() const 0058 { 0059 return i18nc("@info", "A tool to fix hot pixels"); 0060 } 0061 0062 QString HotPixelsToolPlugin::details() const 0063 { 0064 return i18nc("@info", "This Image Editor tool can fix hot pixels from an image."); 0065 } 0066 0067 QString HotPixelsToolPlugin::handbookSection() const 0068 { 0069 return QLatin1String("image_editor"); 0070 } 0071 0072 QString HotPixelsToolPlugin::handbookChapter() const 0073 { 0074 return QLatin1String("enhancement_tools"); 0075 } 0076 0077 QString HotPixelsToolPlugin::handbookReference() const 0078 { 0079 return QLatin1String("enhance-hotpixels"); 0080 } 0081 0082 QList<DPluginAuthor> HotPixelsToolPlugin::authors() const 0083 { 0084 return QList<DPluginAuthor>() 0085 << DPluginAuthor(QString::fromUtf8("Unai Garro"), 0086 QString::fromUtf8("ugarro at users dot sourceforge dot net"), 0087 QString::fromUtf8("(C) 2005-2006")) 0088 << DPluginAuthor(QString::fromUtf8("Gilles Caulier"), 0089 QString::fromUtf8("caulier dot gilles at gmail dot com"), 0090 QString::fromUtf8("(C) 2005-2021")) 0091 ; 0092 } 0093 0094 void HotPixelsToolPlugin::setup(QObject* const parent) 0095 { 0096 DPluginAction* const ac = new DPluginAction(parent); 0097 ac->setIcon(icon()); 0098 ac->setText(i18nc("@action", "Hot Pixels...")); 0099 ac->setObjectName(QLatin1String("editorwindow_enhance_hotpixels")); 0100 ac->setActionCategory(DPluginAction::EditorEnhance); 0101 0102 connect(ac, SIGNAL(triggered(bool)), 0103 this, SLOT(slotHotPixels())); 0104 0105 addAction(ac); 0106 0107 HotPixelsTool::registerFilter(); 0108 } 0109 0110 void HotPixelsToolPlugin::slotHotPixels() 0111 { 0112 EditorWindow* const editor = dynamic_cast<EditorWindow*>(sender()->parent()); 0113 0114 if (editor) 0115 { 0116 HotPixelsTool* const tool = new HotPixelsTool(editor); 0117 tool->setPlugin(this); 0118 editor->loadTool(tool); 0119 } 0120 } 0121 0122 } // namespace DigikamEditorHotPixelsToolPlugin 0123 0124 #include "moc_hotpixelstoolplugin.cpp"