File indexing completed on 2025-01-05 03:53:08
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2011-05-23 0007 * Description : a tool to create panorama by fusion of several images. 0008 * 0009 * SPDX-FileCopyrightText: 2011-2016 by Benjamin Girault <benjamin dot girault at gmail dot com> 0010 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * SPDX-FileCopyrightText: 2009-2011 by Johannes Wienke <languitar at semipol dot de> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_PANO_ACTION_THREAD_H 0018 #define DIGIKAM_PANO_ACTION_THREAD_H 0019 0020 // Qt includes 0021 0022 #include <QThread> 0023 #include <QUrl> 0024 0025 // KDE includes 0026 0027 #include <ThreadWeaver/Sequence> 0028 0029 // Local includes 0030 0031 #include "panoactions.h" 0032 #include "ptotype.h" 0033 0034 using namespace Digikam; 0035 0036 namespace DigikamGenericPanoramaPlugin 0037 { 0038 0039 struct PanoActionData; 0040 0041 class PanoActionThread : public QObject 0042 { 0043 Q_OBJECT 0044 0045 public: 0046 0047 explicit PanoActionThread(QObject* const parent); 0048 ~PanoActionThread() override; 0049 0050 public: 0051 0052 void preProcessFiles(const QList<QUrl>& urlList, 0053 PanoramaItemUrlsMap& preProcessedMap, 0054 QUrl& baseUrl, 0055 QUrl& cpFindPtoUrl, 0056 QUrl& cpCleanPtoUrl, 0057 bool celeste, 0058 PanoramaFileType fileType, 0059 bool gPano, 0060 const QString& huginVersion, 0061 const QString& cpCleanPath, 0062 const QString& cpFindPath); 0063 0064 void optimizeProject(const QUrl& ptoUrl, 0065 QUrl& optimizePtoUrl, 0066 QUrl& viewCropPtoUrl, 0067 bool levelHorizon, 0068 bool buildGPano, 0069 const QString& autooptimiserPath, 0070 const QString& panoModifyPath); 0071 0072 void generatePanoramaPreview(QSharedPointer<const PTOType> ptoData, 0073 QUrl& previewPtoUrl, 0074 QUrl& previewMkUrl, 0075 QUrl& previewUrl, 0076 const PanoramaItemUrlsMap& preProcessedUrlsMap, 0077 const QString& makePath, 0078 const QString& pto2mkPath, 0079 const QString& huginExecutorPath, 0080 bool hugin2015, 0081 const QString& enblendPath, 0082 const QString& nonaPath); 0083 0084 void compileProject(QSharedPointer<const PTOType> basePtoData, 0085 QUrl& panoPtoUrl, 0086 QUrl& mkUrl, 0087 QUrl& panoUrl, 0088 const PanoramaItemUrlsMap& preProcessedUrlsMap, 0089 PanoramaFileType fileType, 0090 const QRect& crop, 0091 const QString& makePath, 0092 const QString& pto2mkPath, 0093 const QString& huginExecutorPath, 0094 bool hugin2015, 0095 const QString& enblendPath, 0096 const QString& nonaPath); 0097 0098 void copyFiles(const QUrl& ptoUrl, 0099 const QUrl& panoUrl, 0100 const QUrl& finalPanoUrl, 0101 const PanoramaItemUrlsMap& preProcessedUrlsMap, 0102 bool savePTO, 0103 bool addGPlusMetadata); 0104 0105 void cancel(); 0106 void finish(); 0107 0108 Q_SIGNALS: 0109 0110 void starting(const DigikamGenericPanoramaPlugin::PanoActionData& ad); 0111 void stepFinished(const DigikamGenericPanoramaPlugin::PanoActionData& ad); 0112 void jobCollectionFinished(const DigikamGenericPanoramaPlugin::PanoActionData& ad); 0113 0114 void cpFindPtoReady(const QUrl& cpFindPtoUrl); 0115 void cpCleanPtoReady(const QUrl& cpCleanPtoUrl); 0116 void optimizePtoReady(const QUrl& optimizePtoUrl); 0117 void previewFileReady(const QUrl& previewFileUrl); 0118 void panoFileReady(const QUrl& panoFileUrl); 0119 0120 private Q_SLOTS: 0121 0122 void slotDone(ThreadWeaver::JobPointer j); 0123 void slotStepDone(ThreadWeaver::JobPointer j); 0124 void slotStarting(ThreadWeaver::JobPointer j); 0125 0126 private: 0127 0128 void appendStitchingJobs(const QSharedPointer<ThreadWeaver::Sequence>& js, 0129 const QUrl& ptoUrl, 0130 QUrl& mkUrl, 0131 QUrl& outputUrl, 0132 const PanoramaItemUrlsMap& preProcessedUrlsMap, 0133 PanoramaFileType fileType, 0134 const QString& makePath, 0135 const QString& pto2mkPath, 0136 const QString& enblendPath, 0137 const QString& nonaPath, 0138 bool preview); 0139 0140 private: 0141 0142 class Private; 0143 Private* const d; 0144 }; 0145 0146 } // namespace DigikamGenericPanoramaPlugin 0147 0148 #endif // DIGIKAM_PANO_ACTION_THREAD_H