"Fossies" - the Fresh Open Source Software Archive

Member "digikam-6.3.0/core/dplugins/generic/tools/panorama/panoramaplugin.cpp" (4 Sep 2019, 3785 Bytes) of package /linux/misc/digikam-6.3.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "panoramaplugin.cpp" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 6.2.0_vs_6.3.0.

    1 /* ============================================================
    2  *
    3  * This file is a part of digiKam project
    4  * https://www.digikam.org
    5  *
    6  * Date        : 2018-07-30
    7  * Description : a plugin to create panorama.
    8  *
    9  * Copyright (C) 2018-2019 by Gilles Caulier <caulier dot gilles at gmail dot com>
   10  *
   11  * This program is free software; you can redistribute it
   12  * and/or modify it under the terms of the GNU General
   13  * Public License as published by the Free Software Foundation;
   14  * either version 2, or (at your option) any later version.
   15  *
   16  * This program is distributed in the hope that it will be useful,
   17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19  * GNU General Public License for more details.
   20  *
   21  * ============================================================ */
   22 
   23 #include "panoramaplugin.h"
   24 
   25 // Qt includes
   26 
   27 #include <QPointer>
   28 
   29 // KDE includes
   30 
   31 #include <klocalizedstring.h>
   32 
   33 // Local includes
   34 
   35 #include "panomanager.h"
   36 
   37 namespace DigikamGenericPanoramaPlugin
   38 {
   39 
   40 PanoramaPlugin::PanoramaPlugin(QObject* const parent)
   41     : DPluginGeneric(parent)
   42 {
   43 }
   44 
   45 PanoramaPlugin::~PanoramaPlugin()
   46 {
   47 }
   48 
   49 void PanoramaPlugin::cleanUp()
   50 {
   51     if (PanoManager::isCreated())
   52     {
   53         delete PanoManager::internalPtr;
   54     }
   55 }
   56 
   57 QString PanoramaPlugin::name() const
   58 {
   59     return i18n("Create Panorama");
   60 }
   61 
   62 QString PanoramaPlugin::iid() const
   63 {
   64     return QLatin1String(DPLUGIN_IID);
   65 }
   66 
   67 QIcon PanoramaPlugin::icon() const
   68 {
   69     return QIcon::fromTheme(QLatin1String("panorama"));
   70 }
   71 
   72 QString PanoramaPlugin::description() const
   73 {
   74     return i18n("A tool to create panorama");
   75 }
   76 
   77 QString PanoramaPlugin::details() const
   78 {
   79     return i18n("<p>This tool permit to assemble images together to create large panorama.</p>"
   80                 "<p>To create panorama image, you need to use images taken from same point of "
   81                 "view with a tripod and exposed with same settings.</p>"
   82                 "<p>The tool is able to assemble shot taken horizontally, vertically, or as a "
   83                 "matrix. Take a care that target image will become huge and require a lots of "
   84                 "memory to be processed.</p>");
   85 }
   86 
   87 QList<DPluginAuthor> PanoramaPlugin::authors() const
   88 {
   89     return QList<DPluginAuthor>()
   90             << DPluginAuthor(QString::fromUtf8("Benjamin Girault"),
   91                              QString::fromUtf8("benjamin dot girault at gmail dot com"),
   92                              QString::fromUtf8("(C) 2011-2016"))
   93             << DPluginAuthor(QString::fromUtf8("Gilles Caulier"),
   94                              QString::fromUtf8("caulier dot gilles at gmail dot com"),
   95                              QString::fromUtf8("(C) 2009-2019"),
   96                              i18n("Author and Maintainer"))
   97             ;
   98 }
   99 
  100 void PanoramaPlugin::setup(QObject* const parent)
  101 {
  102     DPluginAction* const ac = new DPluginAction(parent);
  103     ac->setIcon(icon());
  104     ac->setText(i18nc("@action", "Create panorama..."));
  105     ac->setObjectName(QLatin1String("panorama"));
  106     ac->setActionCategory(DPluginAction::GenericTool);
  107 
  108     connect(ac, SIGNAL(triggered(bool)),
  109             this, SLOT(slotPanorama()));
  110 
  111     addAction(ac);
  112 }
  113 
  114 void PanoramaPlugin::slotPanorama()
  115 {
  116     DInfoInterface* const iface = infoIface(sender());
  117     bool created                = PanoManager::isCreated();
  118 
  119     PanoManager::instance()->checkBinaries();
  120     PanoManager::instance()->setItemsList(iface->currentSelectedItems());
  121     PanoManager::instance()->setPlugin(this);
  122 
  123     if (!created)
  124     {
  125         connect(PanoManager::instance(), SIGNAL(updateHostApp(QUrl)),
  126                 iface, SLOT(slotMetadataChangedForUrl(QUrl)));
  127     }
  128 
  129     PanoManager::instance()->run();
  130 }
  131 
  132 } // namespace DigikamGenericPanoramaPlugin