File indexing completed on 2025-01-05 03:52:07

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 generate HTML image galleries.
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 "htmlgalleryplugin.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 "htmlwizard.h"
0028 
0029 namespace DigikamGenericHtmlGalleryPlugin
0030 {
0031 
0032 HtmlGalleryPlugin::HtmlGalleryPlugin(QObject* const parent)
0033     : DPluginGeneric(parent)
0034 {
0035 }
0036 
0037 HtmlGalleryPlugin::~HtmlGalleryPlugin()
0038 {
0039 }
0040 
0041 QString HtmlGalleryPlugin::name() const
0042 {
0043     return i18n("Html Gallery");
0044 }
0045 
0046 QString HtmlGalleryPlugin::iid() const
0047 {
0048     return QLatin1String(DPLUGIN_IID);
0049 }
0050 
0051 QIcon HtmlGalleryPlugin::icon() const
0052 {
0053     return QIcon::fromTheme(QLatin1String("text-html"));
0054 }
0055 
0056 QString HtmlGalleryPlugin::description() const
0057 {
0058     return i18n("A tool to generate HTML gallery from images");
0059 }
0060 
0061 QString HtmlGalleryPlugin::details() const
0062 {
0063     return i18n("<p>This tool allows users to back-process items (as resize) before to create W3C compliant html gallery.</p>"
0064                 "<p>Items to process can be selected one by one or by group through a selection of albums.</p>"
0065                 "<p>Themable HTML template with different layout can be used to assemble files on a gallery.</p>");
0066 }
0067 
0068 QString HtmlGalleryPlugin::handbookSection() const
0069 {
0070     return QLatin1String("post_processing");
0071 }
0072 
0073 QString HtmlGalleryPlugin::handbookChapter() const
0074 {
0075     return QLatin1String("html_gallery");
0076 }
0077 
0078 QList<DPluginAuthor> HtmlGalleryPlugin::authors() const
0079 {
0080     return QList<DPluginAuthor>()
0081             << DPluginAuthor(QString::fromUtf8("Aurelien Gateau"),
0082                              QString::fromUtf8("agateau at kde dot org"),
0083                              QString::fromUtf8("(C) 2006-2009"),
0084                              i18n("Former Author and Maintainer"))
0085             << DPluginAuthor(QString::fromUtf8("Gianluca Urgese"),
0086                              QString::fromUtf8("giasone dot 82 at gmail dot com"),
0087                              QString::fromUtf8("(C) 2010"))
0088             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
0089                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
0090                              QString::fromUtf8("(C) 2006-2020"),
0091                              i18n("Developer and Maintainer"))
0092             ;
0093 }
0094 
0095 void HtmlGalleryPlugin::setup(QObject* const parent)
0096 {
0097     DPluginAction* const ac = new DPluginAction(parent);
0098     ac->setIcon(icon());
0099     ac->setText(i18nc("@action", "Create Html gallery..."));
0100     ac->setObjectName(QLatin1String("htmlgallery"));
0101     ac->setShortcut(Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_H);
0102     ac->setActionCategory(DPluginAction::GenericTool);
0103 
0104     connect(ac, SIGNAL(triggered(bool)),
0105             this, SLOT(slotHtmlGallery()));
0106 
0107     addAction(ac);
0108 }
0109 
0110 void HtmlGalleryPlugin::slotHtmlGallery()
0111 {
0112     QPointer<HTMLWizard> wzrd = new HTMLWizard(nullptr, infoIface(sender()));
0113     wzrd->setPlugin(this);
0114     wzrd->exec();
0115     delete wzrd;
0116 }
0117 
0118 } // namespace DigikamGenericHtmlGalleryPlugin
0119 
0120 #include "moc_htmlgalleryplugin.cpp"