File indexing completed on 2025-01-05 03:53:11
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 * Acknowledge : based on the expoblending tool 0009 * 0010 * SPDX-FileCopyrightText: 2011-2016 by Benjamin Girault <benjamin dot girault at gmail dot com> 0011 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #include "panoitemspage.h" 0018 0019 // Qt includes 0020 0021 #include <QLabel> 0022 #include <QVBoxLayout> 0023 #include <QPixmap> 0024 #include <QTimer> 0025 #include <QStandardPaths> 0026 0027 // KDE includes 0028 0029 #include <klocalizedstring.h> 0030 0031 // Local includes 0032 0033 #include "ditemslist.h" 0034 #include "panomanager.h" 0035 #include "dlayoutbox.h" 0036 0037 namespace DigikamGenericPanoramaPlugin 0038 { 0039 0040 class Q_DECL_HIDDEN PanoItemsPage::Private 0041 { 0042 public: 0043 0044 explicit Private() 0045 : list(nullptr), 0046 mngr(nullptr) 0047 { 0048 } 0049 0050 DItemsList* list; 0051 0052 PanoManager* mngr; 0053 }; 0054 0055 PanoItemsPage::PanoItemsPage(PanoManager* const mngr, QWizard* const dlg) 0056 : DWizardPage(dlg, QString::fromLatin1("<b>%1</b>").arg(i18nc("@title:window", "Set Panorama Images"))), 0057 d (new Private) 0058 { 0059 d->mngr = mngr; 0060 DVBox* const vbox = new DVBox(this); 0061 QLabel* const label1 = new QLabel(vbox); 0062 label1->setWordWrap(true); 0063 label1->setText(QString::fromUtf8("<qt>" 0064 "<p>%1</p>" 0065 "<ul><li>%2</li>" 0066 "<li>%3</li>" 0067 "<li>%4</li></ul>" 0068 "<p>%5</p>" 0069 "</qt>") 0070 .arg(i18nc("@info", "Set here the list of your images to blend into a panorama. Please follow these conditions:")) 0071 .arg(i18nc("@info", "Images are taken from the same point of view.")) 0072 .arg(i18nc("@info", "Images are taken with the same camera (and lens).")) 0073 .arg(i18nc("@info", "Do not mix images with different color depth.")) 0074 .arg(i18nc("@info", "Note that, in the case of a 360° panorama, the first image " 0075 "in the list will be the image that will be in the center of " 0076 "the panorama."))); 0077 0078 d->list = new DItemsList(vbox); 0079 d->list->setObjectName(QLatin1String("Panorama ImagesList")); 0080 d->list->slotAddImages(d->mngr->itemsList()); 0081 0082 setPageWidget(vbox); 0083 0084 QPixmap leftPix(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("digikam/data/assistant-stack.png"))); 0085 setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation)); 0086 0087 connect(d->list, SIGNAL(signalImageListChanged()), 0088 this, SLOT(slotImageListChanged())); 0089 0090 QTimer::singleShot(0, this, SLOT(slotSetupList())); 0091 } 0092 0093 PanoItemsPage::~PanoItemsPage() 0094 { 0095 delete d; 0096 } 0097 0098 void PanoItemsPage::slotSetupList() 0099 { 0100 slotImageListChanged(); 0101 } 0102 0103 QList<QUrl> PanoItemsPage::itemUrls() const 0104 { 0105 return d->list->imageUrls(); 0106 } 0107 0108 bool PanoItemsPage::validatePage() 0109 { 0110 d->mngr->setItemsList(d->list->imageUrls()); 0111 0112 return true; 0113 } 0114 0115 void PanoItemsPage::slotImageListChanged() 0116 { 0117 setComplete(d->list->imageUrls().count() > 1); 0118 Q_EMIT completeChanged(); 0119 } 0120 0121 } // namespace DigikamGenericPanoramaPlugin 0122 0123 #include "moc_panoitemspage.cpp"