File indexing completed on 2025-03-09 03:52:09

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 render presentation.
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 "presentationplugin.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 "presentationmngr.h"
0028 
0029 namespace DigikamGenericPresentationPlugin
0030 {
0031 
0032 PresentationPlugin::PresentationPlugin(QObject* const parent)
0033     : DPluginGeneric(parent)
0034 {
0035 }
0036 
0037 PresentationPlugin::~PresentationPlugin()
0038 {
0039 }
0040 
0041 void PresentationPlugin::cleanUp()
0042 {
0043     delete m_presentationMngr;
0044 }
0045 
0046 QString PresentationPlugin::name() const
0047 {
0048     return i18nc("@title", "Presentation");
0049 }
0050 
0051 QString PresentationPlugin::iid() const
0052 {
0053     return QLatin1String(DPLUGIN_IID);
0054 }
0055 
0056 QIcon PresentationPlugin::icon() const
0057 {
0058     return QIcon::fromTheme(QLatin1String("view-presentation"));
0059 }
0060 
0061 QString PresentationPlugin::description() const
0062 {
0063     return i18nc("@info", "A tool to render presentation");
0064 }
0065 
0066 QString PresentationPlugin::details() const
0067 {
0068     return i18nc("@info", "This tool render a series of items as an advanced slide-show.\n\n"
0069                  "Plenty of transition effects are available are ones based on OpenGL and the famous Ken Burns effect.\n\n"
0070                  "You can add a sound-track in background while your presentation.");
0071 }
0072 
0073 QString PresentationPlugin::handbookSection() const
0074 {
0075     return QLatin1String("slideshow_tools");
0076 }
0077 
0078 QString PresentationPlugin::handbookChapter() const
0079 {
0080     return QLatin1String("presentation_tool");
0081 }
0082 
0083 QList<DPluginAuthor> PresentationPlugin::authors() const
0084 {
0085     return QList<DPluginAuthor>()
0086             << DPluginAuthor(QString::fromUtf8("Renchi Raju"),
0087                              QString::fromUtf8("renchi dot raju at gmail dot com"),
0088                              QString::fromUtf8("(C) 2003-2004"))
0089             << DPluginAuthor(QString::fromUtf8("Valerio Fuoglio"),
0090                              QString::fromUtf8("valerio dot fuoglio at gmail dot com"),
0091                              QString::fromUtf8("(C) 2006-2009"))
0092             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
0093                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
0094                              QString::fromUtf8("(C) 2005-2023"))
0095             << DPluginAuthor(QString::fromUtf8("Phuoc Khanh Le"),
0096                              QString::fromUtf8("phuockhanhnk94 at gmail dot com"),
0097                              QString::fromUtf8("(C) 2021"))
0098             << DPluginAuthor(QString::fromUtf8("Fady Khalaf"),
0099                              QString::fromUtf8("fadykhalaf01 at gmail dot com"),
0100                              QString::fromUtf8("(C) 2019"))
0101             ;
0102 }
0103 
0104 void PresentationPlugin::setup(QObject* const parent)
0105 {
0106     DPluginAction* const ac = new DPluginAction(parent);
0107     ac->setIcon(icon());
0108     ac->setText(i18nc("@action", "Presentation..."));
0109     ac->setObjectName(QLatin1String("presentation"));
0110     ac->setActionCategory(DPluginAction::GenericView);
0111     ac->setShortcut(Qt::ALT | Qt::SHIFT | Qt::Key_F9);
0112 
0113     connect(ac, SIGNAL(triggered(bool)),
0114             this, SLOT(slotPresentation()));
0115 
0116     addAction(ac);
0117 }
0118 
0119 void PresentationPlugin::slotPresentation()
0120 {
0121     DInfoInterface* const iface = infoIface(sender());
0122 
0123     delete m_presentationMngr;
0124     m_presentationMngr = new PresentationMngr(this, iface);
0125 
0126     m_presentationMngr->addFiles(iface->currentSelectedItems());
0127     m_presentationMngr->setPlugin(this);
0128     m_presentationMngr->showConfigDialog();
0129 }
0130 
0131 } // namespace DigikamGenericPresentationPlugin
0132 
0133 #include "moc_presentationplugin.cpp"