File indexing completed on 2025-01-05 03:53:12
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2007-11-07 0007 * Description : a tool to print images 0008 * 0009 * SPDX-FileCopyrightText: 2007-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_SETTINGS_H 0016 #define DIGIKAM_ADV_PRINT_SETTINGS_H 0017 0018 // Qt includes 0019 0020 #include <QtGlobal> 0021 #include <QList> 0022 #include <QString> 0023 #include <QStringList> 0024 #include <QUrl> 0025 #include <QMap> 0026 #include <QColor> 0027 #include <QPrinter> 0028 #include <QFont> 0029 0030 // Local includes 0031 0032 #include "filesaveconflictbox.h" 0033 0034 using namespace Digikam; 0035 0036 class KConfigGroup; 0037 0038 namespace DigikamGenericPrintCreatorPlugin 0039 { 0040 0041 class AdvPrintPhoto; 0042 class AdvPrintPhotoSize; 0043 0044 class AdvPrintSettings 0045 { 0046 0047 public: 0048 0049 /// Images selection mode 0050 enum Selection 0051 { 0052 IMAGES = 0, 0053 ALBUMS 0054 }; 0055 0056 /// Print output destination, outside real printers configured 0057 enum Output 0058 { 0059 FILES = 0, 0060 0061 #ifndef Q_OS_WIN 0062 0063 PDF, 0064 0065 #endif 0066 0067 GIMP 0068 }; 0069 0070 /// Image format for Output::FILES 0071 enum ImageFormat 0072 { 0073 JPEG = 0, 0074 PNG, 0075 TIFF 0076 }; 0077 0078 /// Caption type to print over the images 0079 enum CaptionType 0080 { 0081 NONE = 0, 0082 FILENAME, 0083 DATETIME, 0084 COMMENT, 0085 CUSTOM 0086 }; 0087 0088 public: 0089 0090 explicit AdvPrintSettings(); 0091 ~AdvPrintSettings(); 0092 0093 /// Read and write settings in config file between sessions. 0094 void readSettings(KConfigGroup& group); 0095 void writeSettings(KConfigGroup& group); 0096 0097 QString format() const; 0098 QString outputName(Output out) const; 0099 QRect* getLayout(int photoIndex, int sizeIndex) const; 0100 0101 /// Helper methods to fill combobox from GUI. 0102 static QMap<Output, QString> outputNames(); 0103 static QMap<ImageFormat, QString> imageFormatNames(); 0104 static QMap<CaptionType, QString> captionTypeNames(); 0105 0106 public: 0107 0108 Selection selMode; ///< Items selection mode 0109 0110 QList<QUrl> inputImages; 0111 0112 QString printerName; 0113 0114 QSizeF pageSize; ///< Page Size in mm 0115 0116 QList<AdvPrintPhoto*> photos; 0117 QList<AdvPrintPhotoSize*> photosizes; 0118 0119 /// Caption management. 0120 CaptionType captionType; 0121 QColor captionColor; 0122 QFont captionFont; 0123 int captionSize; 0124 QString captionTxt; ///< String use to customize caption with CUSTOM mode. 0125 0126 int currentPreviewPage; 0127 0128 /// Crop management 0129 int currentCropPhoto; 0130 bool disableCrop; 0131 0132 /// For Print to Gimp only 0133 QString tempPath; 0134 QStringList gimpFiles; 0135 QString gimpPath; 0136 QString savedPhotoSize; 0137 0138 /// For print to image files only. 0139 ImageFormat imageFormat; 0140 FileSaveConflictBox::ConflictRule conflictRule; ///< Rule if output image files already exists. 0141 QUrl outputDir; ///< Directory where to store output images. 0142 bool openInFileBrowser; 0143 0144 /// Generic data used by printing thread. 0145 AdvPrintPhotoSize* outputLayouts; 0146 QPrinter* outputPrinter; 0147 QString outputPath; 0148 }; 0149 0150 } // namespace DigikamGenericPrintCreatorPlugin 0151 0152 #endif // DIGIKAM_ADV_PRINT_SETTINGS_H