digiKam
printconfig.h
Go to the documentation of this file.
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-2022 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 
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 
55  static void setPrintPosition(int v)
56  {
57  if (!self()->isImmutable(QLatin1String("PrintPosition")))
58  {
59  self()->mPrintPosition = v;
60  }
61  }
62 
63  static int printPosition()
64  {
65  return self()->mPrintPosition;
66  }
67 
69  {
70  if (!self()->isImmutable(QLatin1String("PrintScaleMode")))
71  {
72  self()->mPrintScaleMode = v;
73  }
74  }
75 
77  {
78  return static_cast<PrintOptionsPage::ScaleMode>(self()->mPrintScaleMode);
79  }
80 
81  static void setPrintEnlargeSmallerImages(bool v)
82  {
83  if (!self()->isImmutable(QLatin1String("PrintEnlargeSmallerImages")))
84  {
85  self()->mPrintEnlargeSmallerImages = v;
86  }
87  }
88 
90  {
91  return self()->mPrintEnlargeSmallerImages;
92  }
93 
94  static void setPrintWidth(double v)
95  {
96  if (!self()->isImmutable(QLatin1String("PrintWidth")))
97  {
98  self()->mPrintWidth = v;
99  }
100  }
101 
102  static double printWidth()
103  {
104  return self()->mPrintWidth;
105  }
106 
107  static void setPrintHeight(double v)
108  {
109  if (!self()->isImmutable(QLatin1String("PrintHeight")))
110  {
111  self()->mPrintHeight = v;
112  }
113  }
114 
115  static double printHeight()
116  {
117  return self()->mPrintHeight;
118  }
119 
121  {
122  if (!self()->isImmutable(QLatin1String("PrintUnit")))
123  {
124  self()->mPrintUnit = v;
125  }
126  }
127 
129  {
130  return static_cast<PrintOptionsPage::Unit>(self()->mPrintUnit);
131  }
132 
133  static void setPrintKeepRatio(bool v)
134  {
135  if (!self()->isImmutable(QLatin1String("PrintKeepRatio")))
136  {
137  self()->mPrintKeepRatio = v;
138  }
139  }
140 
141  static bool printKeepRatio()
142  {
143  return self()->mPrintKeepRatio;
144  }
145 
146  static void setPrintColorManaged( bool v )
147  {
148  if (!self()->isImmutable(QLatin1String("PrintColorManaged")))
149  {
150  self()->mPrintColorManaged = v;
151  }
152  }
153 
154  static bool printColorManaged()
155  {
156  return self()->mPrintColorManaged;
157  }
158 
159  static void setPrintAutoRotate(bool v)
160  {
161  if (!self()->isImmutable(QLatin1String("PrintAutoRotate")))
162  {
163  self()->mPrintAutoRotate = v;
164  }
165  }
166 
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
Definition: printconfig.h:45
friend class PrintConfigHelper
Definition: printconfig.h:190
static bool printColorManaged()
Definition: printconfig.h:154
static PrintOptionsPage::ScaleMode printScaleMode()
Definition: printconfig.h:76
static double printHeight()
Definition: printconfig.h:115
static void setPrintWidth(double v)
Definition: printconfig.h:94
static int printPosition()
Definition: printconfig.h:63
static bool printEnlargeSmallerImages()
Definition: printconfig.h:89
static double printWidth()
Definition: printconfig.h:102
static bool printAutoRotate()
Definition: printconfig.h:167
static void setPrintColorManaged(bool v)
Definition: printconfig.h:146
static void setPrintPosition(int v)
Definition: printconfig.h:55
static void setPrintUnit(PrintOptionsPage::Unit v)
Definition: printconfig.h:120
static void setPrintKeepRatio(bool v)
Definition: printconfig.h:133
static void setPrintHeight(double v)
Definition: printconfig.h:107
static PrintOptionsPage::Unit printUnit()
Definition: printconfig.h:128
static void setPrintEnlargeSmallerImages(bool v)
Definition: printconfig.h:81
static void setPrintAutoRotate(bool v)
Definition: printconfig.h:159
~PrintConfig() override
Definition: printconfig.cpp:161
static void setPrintScaleMode(PrintOptionsPage::ScaleMode v)
Definition: printconfig.h:68
static bool printKeepRatio()
Definition: printconfig.h:141
ScaleMode
Definition: printoptionspage.h:48
Unit
Definition: printoptionspage.h:58
Definition: printconfig.cpp:33