1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2009-02-06 7 * Description : image editor printing interface. 8 * 9 * Copyright (C) 2009 by Angelo Naselli <anaselli at linux dot it> 10 * Copyright (C) 2009-2021 by Gilles Caulier <caulier dot gilles at gmail dot com> 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) 16 * any later version. 17 * 18 * This program is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU General Public License for more details. 22 * 23 * ============================================================ */ 24 25 #ifndef DIGIKAM_PRINT_CONFIG_H 26 #define DIGIKAM_PRINT_CONFIG_H 27 28 // Qt includes 29 30 #include <QCoreApplication> 31 #include <QDebug> 32 33 // KDE includes 34 35 #include <kconfigskeleton.h> 36 37 // Local includes 38 39 #include "printoptionspage.h" 40 41 namespace DigikamEditorPrintToolPlugin 42 { 43 44 class PrintConfig : public KConfigSkeleton 45 { 46 Q_OBJECT 47 48 public: 49 50 static PrintConfig* self(); 51 ~PrintConfig() override; 52 53 public: 54 setPrintPosition(int v)55 static void setPrintPosition(int v) 56 { 57 if (!self()->isImmutable(QLatin1String("PrintPosition"))) 58 { 59 self()->mPrintPosition = v; 60 } 61 } 62 printPosition()63 static int printPosition() 64 { 65 return self()->mPrintPosition; 66 } 67 setPrintScaleMode(PrintOptionsPage::ScaleMode v)68 static void setPrintScaleMode(PrintOptionsPage::ScaleMode v) 69 { 70 if (!self()->isImmutable(QLatin1String("PrintScaleMode"))) 71 { 72 self()->mPrintScaleMode = v; 73 } 74 } 75 printScaleMode()76 static PrintOptionsPage::ScaleMode printScaleMode() 77 { 78 return static_cast<PrintOptionsPage::ScaleMode>(self()->mPrintScaleMode); 79 } 80 setPrintEnlargeSmallerImages(bool v)81 static void setPrintEnlargeSmallerImages(bool v) 82 { 83 if (!self()->isImmutable(QLatin1String("PrintEnlargeSmallerImages"))) 84 { 85 self()->mPrintEnlargeSmallerImages = v; 86 } 87 } 88 printEnlargeSmallerImages()89 static bool printEnlargeSmallerImages() 90 { 91 return self()->mPrintEnlargeSmallerImages; 92 } 93 setPrintWidth(double v)94 static void setPrintWidth(double v) 95 { 96 if (!self()->isImmutable(QLatin1String("PrintWidth"))) 97 { 98 self()->mPrintWidth = v; 99 } 100 } 101 printWidth()102 static double printWidth() 103 { 104 return self()->mPrintWidth; 105 } 106 setPrintHeight(double v)107 static void setPrintHeight(double v) 108 { 109 if (!self()->isImmutable(QLatin1String("PrintHeight"))) 110 { 111 self()->mPrintHeight = v; 112 } 113 } 114 printHeight()115 static double printHeight() 116 { 117 return self()->mPrintHeight; 118 } 119 setPrintUnit(PrintOptionsPage::Unit v)120 static void setPrintUnit(PrintOptionsPage::Unit v) 121 { 122 if (!self()->isImmutable(QLatin1String("PrintUnit"))) 123 { 124 self()->mPrintUnit = v; 125 } 126 } 127 printUnit()128 static PrintOptionsPage::Unit printUnit() 129 { 130 return static_cast<PrintOptionsPage::Unit>(self()->mPrintUnit); 131 } 132 setPrintKeepRatio(bool v)133 static void setPrintKeepRatio(bool v) 134 { 135 if (!self()->isImmutable(QLatin1String("PrintKeepRatio"))) 136 { 137 self()->mPrintKeepRatio = v; 138 } 139 } 140 printKeepRatio()141 static bool printKeepRatio() 142 { 143 return self()->mPrintKeepRatio; 144 } 145 setPrintColorManaged(bool v)146 static void setPrintColorManaged( bool v ) 147 { 148 if (!self()->isImmutable(QLatin1String("PrintColorManaged"))) 149 { 150 self()->mPrintColorManaged = v; 151 } 152 } 153 printColorManaged()154 static bool printColorManaged() 155 { 156 return self()->mPrintColorManaged; 157 } 158 setPrintAutoRotate(bool v)159 static void setPrintAutoRotate(bool v) 160 { 161 if (!self()->isImmutable(QLatin1String("PrintAutoRotate"))) 162 { 163 self()->mPrintAutoRotate = v; 164 } 165 } 166 printAutoRotate()167 static bool printAutoRotate() 168 { 169 return self()->mPrintAutoRotate; 170 } 171 172 private: 173 174 // Disable 175 PrintConfig(); 176 explicit PrintConfig(QObject*) = delete; 177 178 private: 179 180 int mPrintPosition; 181 int mPrintScaleMode; 182 bool mPrintEnlargeSmallerImages; 183 double mPrintWidth; 184 double mPrintHeight; 185 int mPrintUnit; 186 bool mPrintKeepRatio; 187 bool mPrintColorManaged; 188 bool mPrintAutoRotate; 189 190 friend class PrintConfigHelper; 191 }; 192 193 } // namespace DigikamEditorPrintToolPlugin 194 195 #endif // DIGIKAM_PRINT_CONFIG_H 196