File indexing completed on 2025-01-05 03:52:06
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-04-04 0007 * Description : a tool to generate HTML image galleries 0008 * 0009 * SPDX-FileCopyrightText: 2012-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 "htmlintropage.h" 0016 0017 // Qt includes 0018 0019 #include <QLabel> 0020 #include <QPixmap> 0021 #include <QComboBox> 0022 #include <QIcon> 0023 0024 // KDE includes 0025 0026 #include <klocalizedstring.h> 0027 0028 // Local includes 0029 0030 #include "digikam_debug.h" 0031 #include "htmlwizard.h" 0032 #include "galleryinfo.h" 0033 #include "dlayoutbox.h" 0034 0035 namespace DigikamGenericHtmlGalleryPlugin 0036 { 0037 0038 class Q_DECL_HIDDEN HTMLIntroPage::Private 0039 { 0040 public: 0041 0042 explicit Private(QWizard* const dialog) 0043 : imageGetOption (nullptr), 0044 hbox (nullptr), 0045 wizard (nullptr), 0046 info (nullptr), 0047 iface (nullptr) 0048 { 0049 wizard = dynamic_cast<HTMLWizard*>(dialog); 0050 0051 if (wizard) 0052 { 0053 info = wizard->galleryInfo(); 0054 iface = info->m_iface; 0055 } 0056 } 0057 0058 QComboBox* imageGetOption; 0059 DHBox* hbox; 0060 HTMLWizard* wizard; 0061 GalleryInfo* info; 0062 DInfoInterface* iface; 0063 }; 0064 0065 HTMLIntroPage::HTMLIntroPage(QWizard* const dialog, const QString& title) 0066 : DWizardPage(dialog, title), 0067 d (new Private(dialog)) 0068 { 0069 DVBox* const vbox = new DVBox(this); 0070 QLabel* const desc = new QLabel(vbox); 0071 0072 desc->setWordWrap(true); 0073 desc->setOpenExternalLinks(true); 0074 desc->setText(i18n("<qt>" 0075 "<p><h1><b>Welcome to HTML Gallery tool</b></h1></p>" 0076 "<p>This assistant will guide you to export quickly</p><p></p>" 0077 "<p>your images as a small static HTML photo gallery.</p>" 0078 "<p>This tool is fully compliant with " 0079 "<a href='https://en.wikipedia.org/wiki/HTML'>HTML and CSS standards</a></p>" 0080 "<p>and the output can be customized with a nice theme.</p>" 0081 "</qt>")); 0082 0083 // ComboBox for image selection method 0084 0085 d->hbox = new DHBox(vbox); 0086 QLabel* const getImageLabel = new QLabel(i18n("&Choose image selection method:"), d->hbox); 0087 d->imageGetOption = new QComboBox(d->hbox); 0088 d->imageGetOption->insertItem(GalleryInfo::ALBUMS, i18n("Albums")); 0089 d->imageGetOption->insertItem(GalleryInfo::IMAGES, i18n("Images")); 0090 getImageLabel->setBuddy(d->imageGetOption); 0091 0092 setPageWidget(vbox); 0093 setLeftBottomPix(QIcon::fromTheme(QLatin1String("text-html"))); 0094 } 0095 0096 HTMLIntroPage::~HTMLIntroPage() 0097 { 0098 delete d; 0099 } 0100 0101 void HTMLIntroPage::initializePage() 0102 { 0103 bool albumSupport = (d->iface && d->iface->supportAlbums()); 0104 0105 if (!albumSupport) 0106 { 0107 d->imageGetOption->setCurrentIndex(GalleryInfo::IMAGES); 0108 d->hbox->setEnabled(false); 0109 } 0110 else 0111 { 0112 d->imageGetOption->setCurrentIndex(d->info->m_getOption); 0113 } 0114 } 0115 0116 bool HTMLIntroPage::validatePage() 0117 { 0118 d->info->m_getOption = (GalleryInfo::ImageGetOption)d->imageGetOption->currentIndex(); 0119 0120 return true; 0121 } 0122 0123 } // namespace DigikamGenericHtmlGalleryPlugin 0124 0125 #include "moc_htmlintropage.cpp"