File indexing completed on 2025-01-05 03:53:15
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 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 #ifndef DIGIKAM_ADV_PRINT_PHOTO_PAGE_H 0016 #define DIGIKAM_ADV_PRINT_PHOTO_PAGE_H 0017 0018 // Qt includes 0019 0020 #include <QString> 0021 #include <QPrinter> 0022 #include <QList> 0023 #include <QUrl> 0024 #include <QXmlStreamReader> 0025 #include <QXmlStreamWriter> 0026 0027 // Local includes 0028 0029 #include "dwizardpage.h" 0030 #include "ditemslist.h" 0031 #include "advprintphoto.h" 0032 #include "ui_advprintphotopage.h" 0033 0034 using namespace Digikam; 0035 0036 namespace DigikamGenericPrintCreatorPlugin 0037 { 0038 0039 class TemplateIcon; 0040 0041 class AdvPrintPhotoPage : public DWizardPage 0042 { 0043 Q_OBJECT 0044 0045 public: 0046 0047 explicit AdvPrintPhotoPage(QWizard* const wizard, const QString& title); 0048 ~AdvPrintPhotoPage() override; 0049 0050 QPrinter* printer() const; 0051 DItemsList* imagesList() const; 0052 Ui_AdvPrintPhotoPage* ui() const; 0053 bool isComplete() const override; 0054 int getPageCount() const; 0055 0056 void initializePage() override; 0057 bool validatePage() override; 0058 0059 /** 0060 * Create a MxN grid of photos, fitting on the page. 0061 */ 0062 void createPhotoGrid(AdvPrintPhotoSize* const p, 0063 int pageWidth, 0064 int pageHeight, 0065 int rows, 0066 int columns, 0067 TemplateIcon* const iconpreview); 0068 0069 void manageBtnPreviewPage(); 0070 0071 /** 0072 * Initialize page layout to the given pageSize in mm. 0073 */ 0074 void initPhotoSizes(const QSizeF& pageSize); 0075 0076 private: 0077 0078 /** 0079 * To parse template file with 'fn' as filename, and 'pageSize' in mm. 0080 */ 0081 void parseTemplateFile(const QString& fn, 0082 const QSizeF& pageSize); 0083 0084 public Q_SLOTS: 0085 0086 void slotOutputChanged(const QString&); 0087 0088 private Q_SLOTS: 0089 0090 void slotXMLLoadElement(QXmlStreamReader&); 0091 0092 /** 0093 * Save item list => we catch the signal to add 0094 * our PA attributes and elements Image children 0095 */ 0096 void slotXMLSaveItem(QXmlStreamWriter&, int); 0097 0098 /** 0099 * Save item list => we catch the signal to add 0100 * our PA elements (not per image) 0101 */ 0102 void slotXMLCustomElement(QXmlStreamWriter&); 0103 0104 void slotXMLCustomElement(QXmlStreamReader&); 0105 void slotContextMenuRequested(); 0106 void slotIncreaseCopies(); 0107 void slotDecreaseCopies(); 0108 void slotAddItems(const QList<QUrl>&); 0109 void slotRemovingItems(const QList<int>&); 0110 void slotBtnPrintOrderDownClicked(); 0111 void slotBtnPrintOrderUpClicked(); 0112 void slotBtnPreviewPageDownClicked(); 0113 void slotBtnPreviewPageUpClicked(); 0114 void slotListPhotoSizesSelected(); 0115 void slotPageSetup(); 0116 0117 private: 0118 0119 class Private; 0120 Private* const d; 0121 }; 0122 0123 } // namespace DigikamGenericPrintCreatorPlugin 0124 0125 #endif // DIGIKAM_ADV_PRINT_PHOTO_PAGE_H