| 1 |
/* ============================================================ |
| 2 |
* |
| 3 |
* This file is a part of digiKam project |
| 4 |
* https://www.digikam.org |
| 5 |
* |
| 6 |
* Date : 2018-07-30 |
| 7 |
* Description : image editor plugin to fix hot pixels |
| 8 |
* |
| 9 |
* SPDX-FileCopyrightText: 2018-2026 by Gilles Caulier <caulier dot gilles at gmail dot com> |
| 10 |
* |
| 11 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 12 |
* |
| 13 |
* ============================================================ */ |
| 14 |
|
| 15 |
#include "hotpixelstoolplugin.h" |
| 16 |
|
| 17 |
// Qt includes |
| 18 |
|
| 19 |
#include <QPointer> |
| 20 |
|
| 21 |
// KDE includes |
| 22 |
|
| 23 |
#include <klocalizedstring.h> |
| 24 |
|
| 25 |
// Local includes |
| 26 |
|
| 27 |
#include "editorwindow.h" |
| 28 |
#include "hotpixelstool.h" |
| 29 |
|
| 30 |
namespace DigikamEditorHotPixelsToolPlugin |
| 31 |
{ |
| 32 |
|
| 33 |
HotPixelsToolPlugin::HotPixelsToolPlugin(QObject* const parent) |
| 34 |
: DPluginEditor(parent) |
| 35 |
{ |
| 36 |
} |
| 37 |
|
| 38 |
QString HotPixelsToolPlugin::name() const |
| 39 |
{ |
| 40 |
return i18nc("@title", "Hot Pixels"); |
| 41 |
} |
| 42 |
|
| 43 |
QString HotPixelsToolPlugin::iid() const |
| 44 |
{ |
| 45 |
return QLatin1String(DPLUGIN_IID); |
| 46 |
} |
| 47 |
|
| 48 |
QIcon HotPixelsToolPlugin::icon() const |
| 49 |
{ |
| 50 |
return QIcon::fromTheme(QLatin1String("hotpixels")); |
| 51 |
} |
| 52 |
|
| 53 |
QString HotPixelsToolPlugin::description() const |
| 54 |
{ |
| 55 |
return i18nc("@info", "A tool to fix hot pixels"); |
| 56 |
} |
| 57 |
|
| 58 |
QString HotPixelsToolPlugin::details() const |
| 59 |
{ |
| 60 |
return i18nc("@info", "This Image Editor tool can fix hot pixels from an image."); |
| 61 |
} |
| 62 |
|
| 63 |
QString HotPixelsToolPlugin::handbookSection() const |
| 64 |
{ |
| 65 |
return QLatin1String("image_editor"); |
| 66 |
} |
| 67 |
|
| 68 |
QString HotPixelsToolPlugin::handbookChapter() const |
| 69 |
{ |
| 70 |
return QLatin1String("enhancement_tools"); |
| 71 |
} |
| 72 |
|
| 73 |
QString HotPixelsToolPlugin::handbookReference() const |
| 74 |
{ |
| 75 |
return QLatin1String("enhance-hotpixels"); |
| 76 |
} |
| 77 |
|
| 78 |
QList<DPluginAuthor> HotPixelsToolPlugin::authors() const |
| 79 |
{ |
| 80 |
return QList<DPluginAuthor>() |
| 81 |
<< DPluginAuthor(QString::fromUtf8("Unai Garro"), |
| 82 |
QString::fromUtf8("ugarro at users dot sourceforge dot net"), |
| 83 |
QString::fromUtf8("(C) 2005-2006")) |
| 84 |
<< DPluginAuthor(QString::fromUtf8("Gilles Caulier"), |
| 85 |
QString::fromUtf8("caulier dot gilles at gmail dot com"), |
| 86 |
QString::fromUtf8("(C) 2005-2024")) |
| 87 |
; |
| 88 |
} |
| 89 |
|
| 90 |
void HotPixelsToolPlugin::setup(QObject* const parent) |
| 91 |
{ |
| 92 |
DPluginAction* const ac = new DPluginAction(parent); |
| 93 |
ac->setIcon(icon()); |
| 94 |
ac->setText(i18nc("@action", "Hot Pixels...")); |
| 95 |
ac->setObjectName(QLatin1String("editorwindow_enhance_hotpixels")); |
| 96 |
ac->setActionCategory(DPluginAction::EditorEnhance); |
| 97 |
|
| 98 |
connect(ac, SIGNAL(triggered(bool)), |
| 99 |
this, SLOT(slotHotPixels())); |
| 100 |
|
| 101 |
addAction(ac); |
| 102 |
|
| 103 |
HotPixelsTool::registerFilter(); |
| 104 |
} |
| 105 |
|
| 106 |
void HotPixelsToolPlugin::slotHotPixels() |
| 107 |
{ |
| 108 |
EditorWindow* const editor = dynamic_cast<EditorWindow*>(sender()->parent()); |
| 109 |
|
| 110 |
if (editor) |
| 111 |
{ |
| 112 |
HotPixelsTool* const tool = new HotPixelsTool(editor); |
| 113 |
tool->setPlugin(this); |
| 114 |
editor->loadTool(tool); |
| 115 |
} |
| 116 |
} |
| 117 |
|
| 118 |
} // namespace DigikamEditorHotPixelsToolPlugin |
| 119 |
|
| 120 |
#include "moc_hotpixelstoolplugin.cpp" |