File indexing completed on 2025-01-19 03:51:10

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-02-06
0007  * Description : image editor printing interface.
0008  *
0009  * SPDX-FileCopyrightText: 2009      by Angelo Naselli <anaselli at linux dot it>
0010  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_PRINT_CONFIG_H
0017 #define DIGIKAM_PRINT_CONFIG_H
0018 
0019 // Qt includes
0020 
0021 #include <QCoreApplication>
0022 #include <QDebug>
0023 
0024 // KDE includes
0025 
0026 #include <kconfigskeleton.h>
0027 
0028 // Local includes
0029 
0030 #include "printoptionspage.h"
0031 
0032 namespace DigikamEditorPrintToolPlugin
0033 {
0034 
0035 class PrintConfig : public KConfigSkeleton
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040 
0041     static PrintConfig* self();
0042     ~PrintConfig() override;
0043 
0044 public:
0045 
0046     static void setPrintPosition(int v)
0047     {
0048         if (!self()->isImmutable(QLatin1String("PrintPosition")))
0049         {
0050             self()->mPrintPosition = v;
0051         }
0052     }
0053 
0054     static int printPosition()
0055     {
0056         return self()->mPrintPosition;
0057     }
0058 
0059     static void setPrintScaleMode(PrintOptionsPage::ScaleMode v)
0060     {
0061         if (!self()->isImmutable(QLatin1String("PrintScaleMode")))
0062         {
0063             self()->mPrintScaleMode = v;
0064         }
0065     }
0066 
0067     static PrintOptionsPage::ScaleMode printScaleMode()
0068     {
0069         return static_cast<PrintOptionsPage::ScaleMode>(self()->mPrintScaleMode);
0070     }
0071 
0072     static void setPrintEnlargeSmallerImages(bool v)
0073     {
0074         if (!self()->isImmutable(QLatin1String("PrintEnlargeSmallerImages")))
0075         {
0076             self()->mPrintEnlargeSmallerImages = v;
0077         }
0078     }
0079 
0080     static bool printEnlargeSmallerImages()
0081     {
0082         return self()->mPrintEnlargeSmallerImages;
0083     }
0084 
0085     static void setPrintWidth(double v)
0086     {
0087         if (!self()->isImmutable(QLatin1String("PrintWidth")))
0088         {
0089             self()->mPrintWidth = v;
0090         }
0091     }
0092 
0093     static double printWidth()
0094     {
0095         return self()->mPrintWidth;
0096     }
0097 
0098     static void setPrintHeight(double v)
0099     {
0100         if (!self()->isImmutable(QLatin1String("PrintHeight")))
0101         {
0102             self()->mPrintHeight = v;
0103         }
0104     }
0105 
0106     static double printHeight()
0107     {
0108         return self()->mPrintHeight;
0109     }
0110 
0111     static void setPrintUnit(PrintOptionsPage::Unit v)
0112     {
0113         if (!self()->isImmutable(QLatin1String("PrintUnit")))
0114         {
0115             self()->mPrintUnit = v;
0116         }
0117     }
0118 
0119     static PrintOptionsPage::Unit printUnit()
0120     {
0121         return static_cast<PrintOptionsPage::Unit>(self()->mPrintUnit);
0122     }
0123 
0124     static void setPrintKeepRatio(bool v)
0125     {
0126         if (!self()->isImmutable(QLatin1String("PrintKeepRatio")))
0127         {
0128             self()->mPrintKeepRatio = v;
0129         }
0130     }
0131 
0132     static bool printKeepRatio()
0133     {
0134         return self()->mPrintKeepRatio;
0135     }
0136 
0137     static void setPrintColorManaged( bool v )
0138     {
0139         if (!self()->isImmutable(QLatin1String("PrintColorManaged")))
0140         {
0141             self()->mPrintColorManaged = v;
0142         }
0143     }
0144 
0145     static bool printColorManaged()
0146     {
0147         return self()->mPrintColorManaged;
0148     }
0149 
0150     static void setPrintAutoRotate(bool v)
0151     {
0152         if (!self()->isImmutable(QLatin1String("PrintAutoRotate")))
0153         {
0154             self()->mPrintAutoRotate = v;
0155         }
0156     }
0157 
0158     static bool printAutoRotate()
0159     {
0160         return self()->mPrintAutoRotate;
0161     }
0162 
0163 private:
0164 
0165     // Disable
0166     PrintConfig();
0167     explicit PrintConfig(QObject*) = delete;
0168 
0169 private:
0170 
0171     int    mPrintPosition;
0172     int    mPrintScaleMode;
0173     bool   mPrintEnlargeSmallerImages;
0174     double mPrintWidth;
0175     double mPrintHeight;
0176     int    mPrintUnit;
0177     bool   mPrintKeepRatio;
0178     bool   mPrintColorManaged;
0179     bool   mPrintAutoRotate;
0180 
0181     friend class PrintConfigHelper;
0182 };
0183 
0184 } // namespace DigikamEditorPrintToolPlugin
0185 
0186 #endif // DIGIKAM_PRINT_CONFIG_H