File indexing completed on 2025-01-05 03:53:13
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2017-06-27 0007 * Description : a tool to print 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 "advprintalbumspage.h" 0016 0017 // Qt includes 0018 0019 #include <QIcon> 0020 0021 // Local includes 0022 0023 #include "advprintwizard.h" 0024 0025 namespace DigikamGenericPrintCreatorPlugin 0026 { 0027 0028 class Q_DECL_HIDDEN AdvPrintAlbumsPage::Private 0029 { 0030 public: 0031 0032 explicit Private(QWizard* const dialog) 0033 : albumSupport (false), 0034 albumSelector(nullptr), 0035 wizard (nullptr), 0036 iface (nullptr) 0037 { 0038 wizard = dynamic_cast<AdvPrintWizard*>(dialog); 0039 0040 if (wizard) 0041 { 0042 iface = wizard->iface(); 0043 } 0044 } 0045 0046 bool albumSupport; 0047 QWidget* albumSelector; 0048 AdvPrintWizard* wizard; 0049 DInfoInterface* iface; 0050 }; 0051 0052 AdvPrintAlbumsPage::AdvPrintAlbumsPage(QWizard* const dialog, const QString& title) 0053 : DWizardPage(dialog, title), 0054 d (new Private(dialog)) 0055 { 0056 if (d->iface) 0057 { 0058 d->albumSelector = d->iface->albumChooser(this); 0059 0060 connect(d->iface, SIGNAL(signalAlbumChooserSelectionChanged()), 0061 this, SIGNAL(completeChanged())); 0062 } 0063 else 0064 { 0065 d->albumSelector = new QWidget(this); 0066 } 0067 0068 setPageWidget(d->albumSelector); 0069 setLeftBottomPix(QIcon::fromTheme(QLatin1String("folder-mail"))); 0070 } 0071 0072 AdvPrintAlbumsPage::~AdvPrintAlbumsPage() 0073 { 0074 delete d; 0075 } 0076 0077 bool AdvPrintAlbumsPage::validatePage() 0078 { 0079 if (!d->iface) 0080 { 0081 return false; 0082 } 0083 0084 if (d->iface->albumChooserItems().isEmpty()) 0085 { 0086 return false; 0087 } 0088 0089 d->wizard->settings()->inputImages.clear(); 0090 0091 // update image list with album contents. 0092 0093 Q_FOREACH (const QUrl& url, d->iface->albumsItems(d->iface->albumChooserItems())) 0094 { 0095 d->wizard->settings()->inputImages << url; 0096 } 0097 0098 return true; 0099 } 0100 0101 bool AdvPrintAlbumsPage::isComplete() const 0102 { 0103 if (!d->iface) 0104 { 0105 return false; 0106 } 0107 0108 return (!d->iface->albumChooserItems().isEmpty()); 0109 } 0110 0111 } // namespace DigikamGenericPrintCreatorPlugin 0112 0113 #include "moc_advprintalbumspage.cpp"