File indexing completed on 2025-01-05 03:53:10

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-03-15
0007  * Description : a tool to create panorama by fusion of several images.
0008  *
0009  * SPDX-FileCopyrightText: 2012-2016 by Benjamin Girault <benjamin dot girault at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "compilemksteptask.h"
0016 
0017 // Qt includes
0018 
0019 #include <QFileInfo>
0020 
0021 // Local includes
0022 
0023 #include "digikam_debug.h"
0024 #include "digikam_globals.h"
0025 
0026 namespace DigikamGenericPanoramaPlugin
0027 {
0028 
0029 CompileMKStepTask::CompileMKStepTask(const QString& workDirPath, int id, const QUrl& mkUrl,
0030                                      const QString& nonaPath, const QString& enblendPath,
0031                                      const QString& makePath, bool preview)
0032     : CommandTask(preview ? PANO_NONAFILEPREVIEW : PANO_NONAFILE, workDirPath, makePath),
0033       id(id),
0034       mkUrl(mkUrl),
0035       nonaPath(nonaPath),
0036       enblendPath(enblendPath)
0037 {
0038 }
0039 
0040 void CompileMKStepTask::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread*)
0041 {
0042     QFileInfo fi(mkUrl.toLocalFile());
0043 
0044     QString mkFile = fi.completeBaseName() + QString::number(id).rightJustified(4, QLatin1Char('0')) + QLatin1String(".tif");
0045     QStringList args;
0046     args << QLatin1String("-f");
0047     args << mkUrl.toLocalFile();
0048     args << QString::fromLatin1("ENBLEND='%1'").arg(enblendPath);
0049     args << QString::fromLatin1("NONA='%1'").arg(nonaPath);
0050     args << mkFile;
0051 
0052     runProcess(args);
0053 
0054     qCDebug(DIGIKAM_DPLUGIN_GENERIC_LOG) << "make job command line: " << getCommandLine();
0055 
0056     qCDebug(DIGIKAM_DPLUGIN_GENERIC_LOG) << "make job output (" << mkFile << "):" << QT_ENDL << output;
0057 }
0058 
0059 } // namespace DigikamGenericPanoramaPlugin