File indexing completed on 2025-01-05 03:53:12
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 create panorama. 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 "panoramaplugin.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 "panomanager.h" 0028 0029 namespace DigikamGenericPanoramaPlugin 0030 { 0031 0032 PanoramaPlugin::PanoramaPlugin(QObject* const parent) 0033 : DPluginGeneric(parent) 0034 { 0035 } 0036 0037 PanoramaPlugin::~PanoramaPlugin() 0038 { 0039 } 0040 0041 void PanoramaPlugin::cleanUp() 0042 { 0043 if (PanoManager::isCreated()) 0044 { 0045 delete PanoManager::internalPtr; 0046 } 0047 } 0048 0049 QString PanoramaPlugin::name() const 0050 { 0051 return i18n("Create Panorama"); 0052 } 0053 0054 QString PanoramaPlugin::iid() const 0055 { 0056 return QLatin1String(DPLUGIN_IID); 0057 } 0058 0059 QIcon PanoramaPlugin::icon() const 0060 { 0061 return QIcon::fromTheme(QLatin1String("panorama")); 0062 } 0063 0064 QString PanoramaPlugin::description() const 0065 { 0066 return i18n("A tool to create panorama"); 0067 } 0068 0069 QString PanoramaPlugin::details() const 0070 { 0071 return i18n("<p>This tool allows users to assemble images together to create large panorama.</p>" 0072 "<p>To create panorama image, you need to use images taken from same point of " 0073 "view with a tripod and exposed with same settings.</p>" 0074 "<p>The tool is able to assemble shot taken horizontally, vertically, or as a " 0075 "matrix. Take a care that target image will become huge and require a lots of " 0076 "memory to be processed.</p>"); 0077 } 0078 0079 QString PanoramaPlugin::handbookSection() const 0080 { 0081 return QLatin1String("post_processing"); 0082 } 0083 0084 QString PanoramaPlugin::handbookChapter() const 0085 { 0086 return QLatin1String("panorama_tool"); 0087 } 0088 0089 QList<DPluginAuthor> PanoramaPlugin::authors() const 0090 { 0091 return QList<DPluginAuthor>() 0092 << DPluginAuthor(QString::fromUtf8("Benjamin Girault"), 0093 QString::fromUtf8("benjamin dot girault at gmail dot com"), 0094 QString::fromUtf8("(C) 2011-2016")) 0095 << DPluginAuthor(QString::fromUtf8("Gilles Caulier"), 0096 QString::fromUtf8("caulier dot gilles at gmail dot com"), 0097 QString::fromUtf8("(C) 2009-2020"), 0098 i18n("Author and Maintainer")) 0099 ; 0100 } 0101 0102 void PanoramaPlugin::setup(QObject* const parent) 0103 { 0104 DPluginAction* const ac = new DPluginAction(parent); 0105 ac->setIcon(icon()); 0106 ac->setText(i18nc("@action", "Create panorama...")); 0107 ac->setObjectName(QLatin1String("panorama")); 0108 ac->setActionCategory(DPluginAction::GenericTool); 0109 0110 connect(ac, SIGNAL(triggered(bool)), 0111 this, SLOT(slotPanorama())); 0112 0113 addAction(ac); 0114 } 0115 0116 void PanoramaPlugin::slotPanorama() 0117 { 0118 DInfoInterface* const iface = infoIface(sender()); 0119 bool created = PanoManager::isCreated(); 0120 0121 PanoManager::instance()->checkBinaries(); 0122 PanoManager::instance()->setItemsList(iface->currentSelectedItems()); 0123 PanoManager::instance()->setPlugin(this); 0124 0125 if (!created) 0126 { 0127 connect(PanoManager::instance(), SIGNAL(updateHostApp(QUrl)), 0128 iface, SLOT(slotMetadataChangedForUrl(QUrl))); 0129 } 0130 0131 PanoManager::instance()->run(); 0132 } 0133 0134 } // namespace DigikamGenericPanoramaPlugin 0135 0136 #include "moc_panoramaplugin.cpp"