1 /* ============================================================ 2 * 3 * This file is a part of KDE project 4 * 5 * 6 * Date : 2002-12-09 7 * Description : a kipi plugin to print images 8 * 9 * Copyright 2002-2003 by Todd Shoemaker <todd@theshoemakers.net> 10 * Copyright 2007-2012 by Angelo Naselli <anaselli at linux dot it> 11 * 12 * This program is free software; you can redistribute it 13 * and/or modify it under the terms of the GNU General 14 * Public License as published by the Free Software Foundation; 15 * either version 2, or (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * ============================================================ */ 23 24 #ifndef TPHOTO_H 25 #define TPHOTO_H 26 27 // Qt includes 28 29 #include <QRect> 30 #include <QFont> 31 #include <QColor> 32 #include <QUrl> 33 #include <QPointer> 34 35 // Libkipi includes 36 37 #include <KIPI/Interface> 38 39 using namespace KIPI; 40 41 namespace KIPIPrintImagesPlugin 42 { 43 44 class AdditionalInfo 45 { 46 public: 47 48 int mUnit; 49 int mPrintPosition; 50 int mScaleMode; 51 bool mKeepRatio; 52 bool mAutoRotate; 53 double mPrintWidth, mPrintHeight; 54 bool mEnlargeSmallerImages; 55 56 public: 57 AdditionalInfo()58 AdditionalInfo() 59 : mUnit(0), 60 mPrintPosition(0), 61 mScaleMode(0), 62 mKeepRatio(true), 63 mAutoRotate(true), 64 mPrintWidth(0.0), 65 mPrintHeight(0.0), 66 mEnlargeSmallerImages(false) 67 { 68 } 69 AdditionalInfo(const AdditionalInfo & ai)70 AdditionalInfo(const AdditionalInfo& ai) 71 { 72 mUnit = ai.mUnit; 73 mPrintPosition = ai.mPrintPosition; 74 mScaleMode = ai.mScaleMode; 75 mKeepRatio = ai.mKeepRatio; 76 mAutoRotate = ai.mAutoRotate; 77 mPrintWidth = ai.mPrintWidth; 78 mPrintHeight = ai.mPrintHeight; 79 mEnlargeSmallerImages = ai.mEnlargeSmallerImages; 80 } 81 }; 82 83 // ----------------------------------------------------------- 84 85 class CaptionInfo 86 { 87 public: 88 89 enum AvailableCaptions 90 { 91 NoCaptions = 0, 92 FileNames, 93 ExifDateTime, 94 Comment, 95 Free 96 }; 97 98 public: 99 100 AvailableCaptions m_caption_type; 101 QFont m_caption_font; 102 QColor m_caption_color; 103 int m_caption_size; 104 QString m_caption_text; 105 106 public: 107 CaptionInfo()108 CaptionInfo() 109 : m_caption_type(NoCaptions), 110 m_caption_font(QLatin1String("Sans Serif")), 111 m_caption_color(Qt::yellow), 112 m_caption_size(2), 113 m_caption_text(QLatin1String("")) 114 { 115 } 116 CaptionInfo(const CaptionInfo & ci)117 CaptionInfo(const CaptionInfo& ci) 118 { 119 m_caption_type = ci.m_caption_type; 120 m_caption_font = ci.m_caption_font; 121 m_caption_color = ci.m_caption_color; 122 m_caption_size = ci.m_caption_size; 123 m_caption_text = ci.m_caption_text; 124 } 125 ~CaptionInfo()126 virtual ~CaptionInfo() 127 { 128 } 129 }; 130 131 // ----------------------------------------------------------- 132 133 class TPhoto 134 { 135 136 public: 137 138 explicit TPhoto(int thumbnailSize); 139 TPhoto(const TPhoto&); 140 ~TPhoto(); 141 142 QPixmap& thumbnail(); 143 QImage loadPhoto(); 144 145 int width(); 146 int height(); 147 QSize& size(); 148 149 double scaleWidth(double unitToInches); 150 double scaleHeight(double unitToInches); 151 152 MetadataProcessor* metaIface(); 153 154 public: 155 156 // full path 157 QUrl filename; 158 int m_thumbnailSize; 159 160 QRect cropRegion; 161 // to get first copy quickly 162 bool first; 163 // number of copies 164 int copies; 165 int rotation; 166 AdditionalInfo* pAddInfo; 167 CaptionInfo* pCaptionInfo; 168 169 private: 170 171 void loadCache(); 172 173 private: 174 175 QPixmap* m_thumbnail; 176 QSize* m_size; 177 Interface* m_iface; 178 QPointer<MetadataProcessor> m_meta; 179 }; 180 181 } // NameSpace KIPIPrintImagesPlugin 182 183 #endif // TPHOTO_H 184