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 : 2002-12-09 0007 * Description : a tool to print images 0008 * 0009 * SPDX-FileCopyrightText: 2002-2003 by Todd Shoemaker <todd at theshoemakers dot net> 0010 * SPDX-FileCopyrightText: 2007-2012 by Angelo Naselli <anaselli at linux dot it> 0011 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_ADV_PRINT_PHOTO_H 0018 #define DIGIKAM_ADV_PRINT_PHOTO_H 0019 0020 // Qt includes 0021 0022 #include <QRect> 0023 #include <QFont> 0024 #include <QColor> 0025 #include <QUrl> 0026 #include <QPointer> 0027 #include <QIcon> 0028 #include <QList> 0029 #include <QSize> 0030 #include <QTransform> 0031 0032 // Local includes 0033 0034 #include "dinfointerface.h" 0035 #include "dimg.h" 0036 #include "advprintsettings.h" 0037 0038 using namespace Digikam; 0039 0040 namespace DigikamGenericPrintCreatorPlugin 0041 { 0042 0043 class AdvPrintPhotoSize 0044 { 0045 public: 0046 0047 explicit AdvPrintPhotoSize(); 0048 AdvPrintPhotoSize(const AdvPrintPhotoSize& other); 0049 ~AdvPrintPhotoSize(); 0050 0051 public: 0052 0053 QString m_label; 0054 int m_dpi; 0055 bool m_autoRotate; 0056 QList<QRect*> m_layouts; ///< first element is page size 0057 QIcon m_icon; 0058 }; 0059 0060 // ----------------------------------------------------------- 0061 0062 class AdvPrintAdditionalInfo 0063 { 0064 public: 0065 0066 explicit AdvPrintAdditionalInfo(); 0067 AdvPrintAdditionalInfo(const AdvPrintAdditionalInfo& other); 0068 ~AdvPrintAdditionalInfo(); 0069 0070 public: 0071 0072 int m_unit; 0073 int m_printPosition; 0074 int m_scaleMode; 0075 bool m_keepRatio; 0076 bool m_autoRotate; 0077 double m_printWidth; 0078 double m_printHeight; 0079 bool m_enlargeSmallerImages; 0080 }; 0081 0082 // ----------------------------------------------------------- 0083 0084 class AdvPrintCaptionInfo 0085 { 0086 0087 public: 0088 0089 explicit AdvPrintCaptionInfo(); 0090 0091 /// Copy constructor to get old photo info. 0092 AdvPrintCaptionInfo(const AdvPrintCaptionInfo& other); 0093 ~AdvPrintCaptionInfo(); 0094 0095 public: 0096 0097 AdvPrintSettings::CaptionType m_captionType; 0098 QFont m_captionFont; 0099 QColor m_captionColor; 0100 int m_captionSize; 0101 QString m_captionText; 0102 }; 0103 0104 // ----------------------------------------------------------- 0105 0106 class AdvPrintPhoto 0107 { 0108 0109 public: 0110 0111 explicit AdvPrintPhoto(int thumbnailSize, DInfoInterface* const iface); 0112 AdvPrintPhoto(const AdvPrintPhoto& other); 0113 ~AdvPrintPhoto(); 0114 0115 DImg& thumbnail(); 0116 DImg loadPhoto(); 0117 int width(); 0118 int height(); 0119 QSize& size(); 0120 0121 QTransform updateCropRegion(int woutlay, int houtlay, bool autoRotate); 0122 0123 double scaleWidth(double unitToInches); 0124 double scaleHeight(double unitToInches); 0125 0126 public: 0127 0128 /// Url of original image file. 0129 QUrl m_url; 0130 0131 /// Thumbnail size in pixels. 0132 int m_thumbnailSize; 0133 0134 /// Region to crop while print from original image. 0135 QRect m_cropRegion; 0136 0137 /// To get first copy quickly. 0138 bool m_first; 0139 0140 /// Number of copies while printing stage. 0141 int m_copies; 0142 0143 /// Rotation angle in degrees. 0144 int m_rotation; 0145 0146 AdvPrintAdditionalInfo* m_pAddInfo; 0147 AdvPrintCaptionInfo* m_pAdvPrintCaptionInfo; 0148 DInfoInterface* m_iface; 0149 0150 private: 0151 0152 void loadInCache(); 0153 0154 private: 0155 0156 DImg* m_thumbnail; 0157 QSize* m_size; 0158 }; 0159 0160 } // Namespace Digikam 0161 0162 #endif // DIGIKAM_ADV_PRINT_PHOTO_H