File indexing completed on 2024-06-09 04:24:27
0001 /* 0002 * dlg_imagesize.h -- part of KimageShop^WKrayon^WKrita 0003 * 0004 * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <boud@valdyas.org> 0005 * SPDX-FileCopyrightText: 2013 Juan Palacios <jpalaciosdev@gmail.com> 0006 * 0007 * SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #ifndef DLG_IMAGESIZE 0010 #define DLG_IMAGESIZE 0011 0012 #include <KoDialog.h> 0013 0014 class KisFilterStrategy; 0015 class WdgImageSize; 0016 class KisDocumentAwareSpinBoxUnitManager; 0017 class KisSpinBoxUnitManager; 0018 class KisAspectRatioLocker; 0019 0020 #include "ui_wdg_imagesize.h" 0021 0022 class WdgImageSize : public QWidget, public Ui::WdgImageSize 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 WdgImageSize(QWidget *parent) : QWidget(parent) { 0028 setupUi(this); 0029 } 0030 }; 0031 0032 class DlgImageSize: public KoDialog 0033 { 0034 0035 Q_OBJECT 0036 0037 public: 0038 0039 static const QString PARAM_PREFIX; 0040 static const QString PARAM_IMSIZE_UNIT; 0041 static const QString PARAM_SIZE_UNIT; 0042 static const QString PARAM_RES_UNIT; 0043 static const QString PARAM_RATIO_LOCK; 0044 static const QString PARAM_PRINT_SIZE_SEPARATE; 0045 0046 DlgImageSize(QWidget * parent, int width, int height, double resolution); 0047 ~DlgImageSize() override; 0048 0049 qint32 desiredWidth(); 0050 qint32 desiredHeight(); 0051 double desiredResolution(); 0052 0053 KisFilterStrategy *filterType(); 0054 0055 Q_SIGNALS: 0056 void sigDesiredSizeChanged(qint32 width, qint32 height, double resolution); 0057 0058 private Q_SLOTS: 0059 void slotSyncPrintToPixelSize(); 0060 void slotSyncPixelToPrintSize(); 0061 void slotPrintResolutionChanged(); 0062 void slotPrintResolutionUnitChanged(); 0063 0064 void slotLockPixelRatioSwitched(bool value); 0065 void slotLockPrintRatioSwitched(bool value); 0066 void slotLockAllRatioSwitched(bool value); 0067 void slotAdjustSeparatelySwitched(bool value); 0068 0069 private: 0070 qreal currentResolutionPPI() const; 0071 void setCurrentResolutionPPI(qreal value); 0072 0073 void updatePrintSizeMaximum(); 0074 0075 WdgImageSize *m_page; 0076 0077 QSize m_originalSize; 0078 0079 KisAspectRatioLocker *m_pixelSizeLocker; 0080 KisAspectRatioLocker *m_printSizeLocker; 0081 0082 KisDocumentAwareSpinBoxUnitManager* m_widthUnitManager; 0083 KisDocumentAwareSpinBoxUnitManager* m_heightUnitManager; 0084 KisSpinBoxUnitManager* m_printSizeUnitManager; 0085 }; 0086 0087 #endif // DLG_IMAGESIZE