File indexing completed on 2025-03-09 03:52:04
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2017-05-25 0007 * Description : a tool to generate video slideshow from images. 0008 * 0009 * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "vidslidewizard.h" 0016 0017 // Qt includes 0018 0019 #include <QCheckBox> 0020 #include <QLabel> 0021 #include <QMenu> 0022 #include <QApplication> 0023 #include <QComboBox> 0024 #include <QListWidget> 0025 #include <QTextBrowser> 0026 0027 // KDE includes 0028 0029 #include <klocalizedstring.h> 0030 #include <ksharedconfig.h> 0031 #include <kconfiggroup.h> 0032 0033 // Local includes 0034 0035 #include "dwizardpage.h" 0036 #include "digikam_debug.h" 0037 #include "vidslideintropage.h" 0038 #include "vidslidealbumspage.h" 0039 #include "vidslideimagespage.h" 0040 #include "vidslidevideopage.h" 0041 #include "vidslideoutputpage.h" 0042 #include "vidslidefinalpage.h" 0043 0044 namespace DigikamGenericVideoSlideShowPlugin 0045 { 0046 0047 class Q_DECL_HIDDEN VidSlideWizard::Private 0048 { 0049 public: 0050 0051 Private() = default; 0052 0053 VidSlideIntroPage* introPage = nullptr; 0054 VidSlideAlbumsPage* albumsPage = nullptr; 0055 VidSlideImagesPage* imagesPage = nullptr; 0056 VidSlideVideoPage* videoPage = nullptr; 0057 VidSlideOutputPage* outputPage = nullptr; 0058 VidSlideFinalPage* finalPage = nullptr; 0059 VidSlideSettings* settings = nullptr; 0060 }; 0061 0062 VidSlideWizard::VidSlideWizard(QWidget* const parent, DInfoInterface* const iface) 0063 : DWizardDlg(parent, QLatin1String("Video SlideShow Dialog")), 0064 d (new Private) 0065 { 0066 setOption(QWizard::NoCancelButtonOnLastPage); 0067 setWindowTitle(i18nc("@title:window", "Create a Video Slideshow")); 0068 0069 d->settings = new VidSlideSettings; 0070 d->settings->iface = iface; 0071 0072 KSharedConfigPtr config = KSharedConfig::openConfig(); 0073 KConfigGroup group = config->group(QLatin1String("Video SlideShow Dialog Settings")); 0074 d->settings->readSettings(group); 0075 0076 d->introPage = new VidSlideIntroPage(this, i18n("Welcome to Video Slideshow Tool")); 0077 d->albumsPage = new VidSlideAlbumsPage(this, i18n("Albums Selection")); 0078 d->imagesPage = new VidSlideImagesPage(this, i18n("Images List")); 0079 d->videoPage = new VidSlideVideoPage(this, i18n("Video Settings")); 0080 d->outputPage = new VidSlideOutputPage(this, i18n("Output Settings")); 0081 d->finalPage = new VidSlideFinalPage(this, i18n("Generating Video Slideshow")); 0082 0083 connect(this, SIGNAL(currentIdChanged(int)), 0084 this, SLOT(slotCurrentIdChanged(int))); 0085 } 0086 0087 VidSlideWizard::~VidSlideWizard() 0088 { 0089 KSharedConfigPtr config = KSharedConfig::openConfig(); 0090 KConfigGroup group = config->group(QLatin1String("Video SlideShow Dialog Settings")); 0091 d->settings->writeSettings(group); 0092 0093 delete d; 0094 } 0095 0096 void VidSlideWizard::setItemsList(const QList<QUrl>& urls) 0097 { 0098 d->imagesPage->setItemsList(urls); 0099 } 0100 0101 VidSlideSettings* VidSlideWizard::settings() const 0102 { 0103 return d->settings; 0104 } 0105 0106 bool VidSlideWizard::validateCurrentPage() 0107 { 0108 if (!DWizardDlg::validateCurrentPage()) 0109 { 0110 return false; 0111 } 0112 0113 return true; 0114 } 0115 0116 int VidSlideWizard::nextId() const 0117 { 0118 if (d->settings->selMode == VidSlideSettings::ALBUMS) 0119 { 0120 if (currentPage() == d->introPage) 0121 { 0122 return d->albumsPage->id(); 0123 } 0124 } 0125 else 0126 { 0127 if (currentPage() == d->introPage) 0128 { 0129 return d->imagesPage->id(); 0130 } 0131 } 0132 0133 return DWizardDlg::nextId(); 0134 } 0135 0136 void VidSlideWizard::slotCurrentIdChanged(int id) 0137 { 0138 if (page(id) == d->videoPage) 0139 { 0140 d->videoPage->slotTransitionChanged(); 0141 d->videoPage->slotEffectChanged(); 0142 } 0143 } 0144 0145 } // namespace DigikamGenericVideoSlideShowPlugin 0146 0147 #include "moc_vidslidewizard.cpp"