File indexing completed on 2025-03-09 03:50:51
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-11-13 0007 * Description : a tool to blend bracketed images. 0008 * 0009 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2012-2015 by Benjamin Girault <benjamin dot girault at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #include "expoblendingintropage.h" 0017 0018 // Qt includes 0019 0020 #include <QTimer> 0021 #include <QLabel> 0022 #include <QPixmap> 0023 #include <QGroupBox> 0024 #include <QStandardPaths> 0025 0026 // KDE includes 0027 0028 #include <kconfiggroup.h> 0029 #include <klocalizedstring.h> 0030 0031 // local includes 0032 0033 #include "digikam_globals.h" 0034 #include "digikam_config.h" 0035 #include "dbinarysearch.h" 0036 #include "alignbinary.h" 0037 #include "enfusebinary.h" 0038 #include "dlayoutbox.h" 0039 0040 namespace DigikamGenericExpoBlendingPlugin 0041 { 0042 0043 class Q_DECL_HIDDEN ExpoBlendingIntroPage::Private 0044 { 0045 public: 0046 0047 explicit Private(ExpoBlendingManager* const m) 0048 : mngr (m), 0049 binariesWidget(nullptr) 0050 { 0051 } 0052 0053 ExpoBlendingManager* mngr; 0054 DBinarySearch* binariesWidget; 0055 }; 0056 0057 ExpoBlendingIntroPage::ExpoBlendingIntroPage(ExpoBlendingManager* const mngr, QWizard* const dlg) 0058 : DWizardPage(dlg, i18nc("@title:window", "Welcome to Stacked Images Tool")), 0059 d (new Private(mngr)) 0060 { 0061 DVBox* const vbox = new DVBox(this); 0062 QLabel* const title = new QLabel(vbox); 0063 title->setWordWrap(true); 0064 title->setOpenExternalLinks(true); 0065 title->setText(QString::fromUtf8("<qt>" 0066 "<p><h1><b>%1</b></h1></p>" 0067 "<p>%2</p>" 0068 "<p>%3</p>" 0069 "<p>%4</p>" 0070 "<p>%5</p>" 0071 "<p>%6 <a href='https://en.wikipedia.org/wiki/Bracketing'>%7</a></p>" 0072 "</qt>") 0073 .arg(i18nc("@info", "Welcome to Stacked Images Tool")) 0074 .arg(i18nc("@info", "This tool fuses bracketed images with different exposure to make pseudo HDR Image")) 0075 .arg(i18nc("@info", "It can also be used to merge focus bracketed stack to get a single image with increased depth of field.")) 0076 .arg(i18nc("@info", "This assistant will help you to configure how to import images before merging them to a single one.")) 0077 .arg(i18nc("@info", "Bracketed images must be taken with the same camera, in the same conditions, and if possible using a tripod.")) 0078 .arg(i18nc("@info", "For more information, please take a look at")) 0079 .arg(i18nc("@info", "this page"))); 0080 0081 QGroupBox* const binaryBox = new QGroupBox(vbox); 0082 QGridLayout* const binaryLayout = new QGridLayout; 0083 binaryBox->setLayout(binaryLayout); 0084 binaryBox->setTitle(i18nc("@title: group", "Exposure Blending Binaries")); 0085 d->binariesWidget = new DBinarySearch(binaryBox); 0086 d->binariesWidget->addBinary(d->mngr->alignBinary()); 0087 d->binariesWidget->addBinary(d->mngr->enfuseBinary()); 0088 0089 #ifdef Q_OS_MACOS 0090 0091 // Hugin bundle PKG install 0092 0093 d->binariesWidget->addDirectory(QLatin1String("/Applications/Hugin/HuginTools")); 0094 d->binariesWidget->addDirectory(QLatin1String("/Applications/Hugin/Hugin.app/Contents/MacOS")); 0095 d->binariesWidget->addDirectory(QLatin1String("/Applications/Hugin/tools_mac")); 0096 0097 // Std Macports install 0098 0099 d->binariesWidget->addDirectory(QLatin1String("/opt/local/bin")); 0100 0101 // digiKam Bundle PKG install 0102 0103 d->binariesWidget->addDirectory(macOSBundlePrefix() + QLatin1String("bin")); 0104 0105 #endif 0106 0107 #ifdef Q_OS_WIN 0108 0109 d->binariesWidget->addDirectory(QLatin1String("C:/Program Files/Hugin/bin")); 0110 d->binariesWidget->addDirectory(QLatin1String("C:/Program Files (x86)/Hugin/bin")); 0111 d->binariesWidget->addDirectory(QLatin1String("C:/Program Files/GnuWin32/bin")); 0112 d->binariesWidget->addDirectory(QLatin1String("C:/Program Files (x86)/GnuWin32/bin")); 0113 0114 #endif 0115 0116 setPageWidget(vbox); 0117 0118 QPixmap leftPix(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("digikam/data/assistant-stack.png"))); 0119 setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation)); 0120 0121 connect(d->binariesWidget, SIGNAL(signalBinariesFound(bool)), 0122 this, SIGNAL(signalExpoBlendingIntroPageIsValid(bool))); 0123 0124 QTimer::singleShot(1000, this, SLOT(slotExpoBlendingIntroPageIsValid())); 0125 } 0126 0127 ExpoBlendingIntroPage::~ExpoBlendingIntroPage() 0128 { 0129 delete d; 0130 } 0131 0132 bool ExpoBlendingIntroPage::binariesFound() 0133 { 0134 return d->binariesWidget->allBinariesFound(); 0135 } 0136 0137 void ExpoBlendingIntroPage::slotExpoBlendingIntroPageIsValid() 0138 { 0139 Q_EMIT signalExpoBlendingIntroPageIsValid(binariesFound()); 0140 } 0141 0142 } // namespace DigikamGenericExpoBlendingPlugin 0143 0144 #include "moc_expoblendingintropage.cpp"