Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Extract image resize widget into a separate class

Dmitry Kazakov76420af7c5f8
diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
index abbcf18420..9f65b96cb7 100644
--- a/libs/ui/CMakeLists.txt
+++ b/libs/ui/CMakeLists.txt
@@ -399,6 +399,7 @@ set(kritaui_LIB_SRCS
imagesize/imagesize.cc
imagesize/dlg_canvassize.cc
imagesize/dlg_imagesize.cc
+ imagesize/wdg_imagesize.cc
imagesize/dlg_layersize.cc
kcanvaspreview.cc
diff --git a/libs/ui/KisImportExportManager.cpp b/libs/ui/KisImportExportManager.cpp
index 666dff213c..e46cc20d87 100644
--- a/libs/ui/KisImportExportManager.cpp
+++ b/libs/ui/KisImportExportManager.cpp
@@ -54,7 +54,7 @@
#include "KisImportExportFilter.h"
#include "KisMainWindow.h"
#include "KisReferenceImagesLayer.h"
-#include "imagesize/dlg_imagesize.h"
+#include "imagesize/wdg_imagesize.h"
#include "kis_async_action_feedback.h"
#include "kis_config.h"
#include "kis_grid_config.h"
@@ -692,13 +692,12 @@ bool KisImportExportManager::askUserAboutExportConfiguration(
box->addTab(wdg,i18n("Options"));
}
- DlgImageSize *dlgImageSize = nullptr;
+ WdgImageSize *wdgImageSize = nullptr;
if (isAdvancedExporting) {
- dlgImageSize = new DlgImageSize(box, m_document->image()->width(), m_document->image()->height(), m_document->image()->yRes());
- dlgImageSize->setButtons(KoDialog::None);
+ wdgImageSize = new WdgImageSize(box, m_document->image()->width(), m_document->image()->height(), m_document->image()->yRes());
- box->addTab(dlgImageSize,i18n("Resize"));
+ box->addTab(wdgImageSize,i18n("Resize"));
}
layout->addWidget(box);
@@ -727,17 +726,17 @@ bool KisImportExportManager::askUserAboutExportConfiguration(
*alsoAsKra = chkAlsoAsKra->isChecked();
}
- KIS_SAFE_ASSERT_RECOVER_NOOP(bool(isAdvancedExporting) == bool(dlgImageSize));
+ KIS_SAFE_ASSERT_RECOVER_NOOP(bool(isAdvancedExporting) == bool(wdgImageSize));
- if (isAdvancedExporting && dlgImageSize) {
+ if (isAdvancedExporting && wdgImageSize) {
if (shouldFlattenTheImageBeforeScaling) {
m_document->savingImage()->flatten(KisNodeSP());
m_document->savingImage()->waitForDone();
}
- const QSize desiredSize(dlgImageSize->desiredWidth(), dlgImageSize->desiredHeight());
- double res = dlgImageSize->desiredResolution();
- m_document->savingImage()->scaleImage(desiredSize,res,res,dlgImageSize->filterType());
+ const QSize desiredSize(wdgImageSize->desiredWidth(), wdgImageSize->desiredHeight());
+ double res = wdgImageSize->desiredResolution();
+ m_document->savingImage()->scaleImage(desiredSize,res,res,wdgImageSize->filterType());
m_document->savingImage()->waitForDone();
KisLayerUtils::forceAllDelayedNodesUpdate(m_document->savingImage()->root());
m_document->savingImage()->waitForDone();
diff --git a/libs/ui/imagesize/dlg_imagesize.cc b/libs/ui/imagesize/dlg_imagesize.cc
index e3cb9db51e..ebe41c13e9 100644
--- a/libs/ui/imagesize/dlg_imagesize.cc
+++ b/libs/ui/imagesize/dlg_imagesize.cc
@@ -10,44 +10,9 @@
#include "dlg_imagesize.h"
-#include <QLocale>
-#include <kis_config.h>
-
-#include <KoUnit.h>
-#include <kis_size_group.h>
+#include "wdg_imagesize.h"
#include <klocalizedstring.h>
-#include <kis_filter_strategy.h>
-
-#include "kis_aspect_ratio_locker.h"
-#include "kis_acyclic_signal_connector.h"
-#include "kis_signals_blocker.h"
-
-#include "kis_double_parse_unit_spin_box.h"
-#include "kis_document_aware_spin_box_unit_manager.h"
-
-static const int maxImagePixelSize = 100000000;
-static KisFilterStrategy *lastUsedFilter = nullptr;
-
-const QString DlgImageSize::PARAM_PREFIX = "imagesizedlg";
-const QString DlgImageSize::PARAM_IMSIZE_UNIT = DlgImageSize::PARAM_PREFIX + "_imsizeunit";
-const QString DlgImageSize::PARAM_SIZE_UNIT = DlgImageSize::PARAM_PREFIX + "_sizeunit";
-const QString DlgImageSize::PARAM_RES_UNIT = DlgImageSize::PARAM_PREFIX + "_resunit";
-const QString DlgImageSize::PARAM_RATIO_LOCK = DlgImageSize::PARAM_PREFIX + "_ratioLock";
-const QString DlgImageSize::PARAM_PRINT_SIZE_SEPARATE = DlgImageSize::PARAM_PREFIX + "_printSizeSeparatly";
-
-static QString pixelsInchStr()
-{
- static QString str = i18n("Pixels/Inch");
- return str;
-}
-
-static const QString pixelsCentimeterStr()
-{
- static QString str = i18n("Pixels/Centimeter");
- return str;
-}
-
DlgImageSize::DlgImageSize(QWidget *parent, int width, int height, double resolution)
: KoDialog(parent)
{
@@ -55,398 +20,32 @@ DlgImageSize::DlgImageSize(QWidget *parent, int width, int height, double resolu
setButtons(Ok | Cancel);
setDefaultButton(Ok);
- // Store original size.
- m_originalSize.setWidth(width);
- m_originalSize.setHeight(height);
-
- m_page = new WdgImageSize(this);
-
+ m_page.reset(new WdgImageSize(this, width, height, resolution));
Q_CHECK_PTR(m_page);
- m_page->layout()->setContentsMargins(0, 0, 0, 0);
- m_page->setObjectName("image_size");
-
- m_page->pixelFilterCmb->setIDList(KisFilterStrategyRegistry::instance()->listKeys());
- m_page->pixelFilterCmb->allowAuto(true);
- m_page->pixelFilterCmb->setToolTip(KisFilterStrategyRegistry::instance()->formattedDescriptions());
-
- if (lastUsedFilter) { // Restore or Init..
- m_page->pixelFilterCmb->setCurrent(lastUsedFilter->id());
- } else {
- m_page->pixelFilterCmb->setCurrent(KisCmbIDList::AutoOptionID);
- }
-
- connect(this, &DlgImageSize::sigDesiredSizeChanged, [this](qint32 width, qint32 height, double){
- KisFilterStrategy *filterStrategy = KisFilterStrategyRegistry::instance()->autoFilterStrategy(m_originalSize, QSize(width, height));
- m_page->pixelFilterCmb->setAutoHint(filterStrategy->name());
- });
-
- /**
- * Initialize Pixel Width and Height fields
- */
-
- m_widthUnitManager = new KisDocumentAwareSpinBoxUnitManager(this);
- m_heightUnitManager = new KisDocumentAwareSpinBoxUnitManager(this, KisDocumentAwareSpinBoxUnitManager::PIX_DIR_Y);
-
- KisConfig cfg(true);
-
- /// configure the unit to image length, default unit is pixel and printing units are forbidden.
- m_widthUnitManager->setUnitDimension(KisSpinBoxUnitManager::IMLENGTH);
- m_heightUnitManager->setUnitDimension(KisSpinBoxUnitManager::IMLENGTH);
-
- m_widthUnitManager->syncWithOtherUnitManager(m_heightUnitManager); //sync the two managers, so that the units will be the same, but each manager will know a different reference for percents.
-
- m_widthUnitManager->setApparentUnitFromSymbol("px"); //set unit to pixel.
-
- m_page->pixelWidthDouble->setUnitManager(m_widthUnitManager);
- m_page->pixelHeightDouble->setUnitManager(m_heightUnitManager);
- m_page->pixelWidthDouble->setMaximum(maxImagePixelSize);
- m_page->pixelHeightDouble->setMaximum(maxImagePixelSize);
- m_page->pixelWidthDouble->changeValue(width);
- m_page->pixelHeightDouble->changeValue(height);
- m_page->pixelWidthDouble->setDisplayUnit(false);
- m_page->pixelHeightDouble->setDisplayUnit(false);
- m_page->pixelWidthDouble->setFocus();
-
- connect(m_page->pixelWidthDouble, qOverload<double>(&KisDoubleParseUnitSpinBox::valueChanged), [this](){
- Q_EMIT sigDesiredSizeChanged(desiredWidth(), desiredHeight(), desiredResolution());
- });
- connect(m_page->pixelHeightDouble, qOverload<double>(&KisDoubleParseUnitSpinBox::valueChanged), [this](){
- Q_EMIT sigDesiredSizeChanged(desiredWidth(), desiredHeight(), desiredResolution());
- });
-
- /// add custom units
-
- int unitId = m_widthUnitManager->getApparentUnitId();
-
- m_page->pixelSizeUnit->setModel(m_widthUnitManager);
- m_page->pixelSizeUnit->setCurrentIndex(unitId);
-
- /**
- * Connect Pixel Unit switching controls
- */
-
- KisAcyclicSignalConnector *pixelUnitConnector = new KisAcyclicSignalConnector(this);
- pixelUnitConnector->connectForwardInt(m_page->pixelSizeUnit, SIGNAL(currentIndexChanged(int)),
- m_widthUnitManager, SLOT(selectApparentUnitFromIndex(int)));
- pixelUnitConnector->connectBackwardInt(m_widthUnitManager, SIGNAL(unitChanged(int)),
- m_page->pixelSizeUnit, SLOT(setCurrentIndex(int)));
-
- QString imSizeUnit = cfg.readEntry<QString>(PARAM_IMSIZE_UNIT, "px");
-
- m_widthUnitManager->setApparentUnitFromSymbol(imSizeUnit);
-
- /**
- * Initialize Print Width, Height and Resolution fields
- */
-
- m_printSizeUnitManager = new KisSpinBoxUnitManager(this);
-
- m_page->printWidth->setUnitManager(m_printSizeUnitManager);
- m_page->printHeight->setUnitManager(m_printSizeUnitManager);
- m_page->printWidth->setDisplayUnit(false);
- m_page->printHeight->setDisplayUnit(false);
- m_page->printResolution->setAlignment(Qt::AlignRight);
-
- m_page->printWidthUnit->setModel(m_printSizeUnitManager);
-
- //TODO: create a resolution dimension in the unit manager.
- m_page->printResolutionUnit->addItem(pixelsInchStr());
- m_page->printResolutionUnit->addItem(pixelsCentimeterStr());
-
-
- /**
- * Initialize labels and layout
- */
- KisSizeGroup *labelsGroup = new KisSizeGroup(this);
- labelsGroup->addWidget(m_page->lblPixelWidth);
- labelsGroup->addWidget(m_page->lblPixelHeight);
- labelsGroup->addWidget(m_page->lblPixelFilter);
- labelsGroup->addWidget(m_page->lblPrintWidth);
- labelsGroup->addWidget(m_page->lblPrintHeight);
- labelsGroup->addWidget(m_page->lblResolution);
-
- KisSizeGroup *spinboxesGroup = new KisSizeGroup(this);
- spinboxesGroup->addWidget(m_page->pixelWidthDouble);
- spinboxesGroup->addWidget(m_page->pixelHeightDouble);
- spinboxesGroup->addWidget(m_page->printWidth);
- spinboxesGroup->addWidget(m_page->printHeight);
- spinboxesGroup->addWidget(m_page->printResolution);
-
- KisSizeGroup *comboboxesGroup = new KisSizeGroup(this);
- comboboxesGroup->addWidget(m_page->pixelSizeUnit);
- comboboxesGroup->addWidget(m_page->printWidthUnit);
- comboboxesGroup->addWidget(m_page->printResolutionUnit);
- connect(this, SIGNAL(okClicked()), this, SLOT(accept()));
-
- /**
- * Initialize aspect ratio buttons and lockers
- */
-
- m_page->pixelAspectRatioBtn->setKeepAspectRatio(true);
- m_page->printAspectRatioBtn->setKeepAspectRatio(true);
- m_page->constrainProportionsCkb->setChecked(true);
-
- m_pixelSizeLocker = new KisAspectRatioLocker(this);
- m_pixelSizeLocker->connectSpinBoxes(m_page->pixelWidthDouble, m_page->pixelHeightDouble, m_page->pixelAspectRatioBtn);
-
- m_printSizeLocker = new KisAspectRatioLocker(this);
- m_printSizeLocker->connectSpinBoxes(m_page->printWidth, m_page->printHeight, m_page->printAspectRatioBtn);
-
- /**
- * Connect Keep Aspect Lock buttons
- */
-
- KisAcyclicSignalConnector *constrainsConnector = new KisAcyclicSignalConnector(this);
- constrainsConnector->connectBackwardBool(
- m_page->constrainProportionsCkb, SIGNAL(toggled(bool)),
- this, SLOT(slotLockAllRatioSwitched(bool)));
-
- constrainsConnector->connectForwardBool(
- m_pixelSizeLocker, SIGNAL(aspectButtonToggled(bool)),
- this, SLOT(slotLockPixelRatioSwitched(bool)));
-
- constrainsConnector->createCoordinatedConnector()->connectBackwardBool(
- m_printSizeLocker, SIGNAL(aspectButtonToggled(bool)),
- this, SLOT(slotLockPrintRatioSwitched(bool)));
-
- constrainsConnector->createCoordinatedConnector()->connectBackwardBool(
- m_page->adjustPrintSizeSeparatelyCkb, SIGNAL(toggled(bool)),
- this, SLOT(slotAdjustSeparatelySwitched(bool)));
-
- /**
- * Connect Print Unit switching controls
- */
-
- KisAcyclicSignalConnector *printUnitConnector = new KisAcyclicSignalConnector(this);
- printUnitConnector->connectForwardInt(
- m_page->printWidthUnit, SIGNAL(currentIndexChanged(int)),
- m_printSizeUnitManager, SLOT(selectApparentUnitFromIndex(int)));
-
- printUnitConnector->connectBackwardInt(
- m_printSizeUnitManager, SIGNAL(unitChanged(int)),
- m_page->printWidthUnit, SLOT(setCurrentIndex(int)));
-
- /// connect resolution
- connect(m_page->printResolutionUnit, SIGNAL(currentIndexChanged(int)),
- this, SLOT(slotPrintResolutionUnitChanged()));
-
- /**
- * Create syncing connections between Pixel and Print values
- */
- KisAcyclicSignalConnector *syncConnector = new KisAcyclicSignalConnector(this);
- syncConnector->connectForwardVoid(
- m_pixelSizeLocker, SIGNAL(sliderValueChanged()),
- this, SLOT(slotSyncPixelToPrintSize()));
-
- syncConnector->connectBackwardVoid(
- m_printSizeLocker, SIGNAL(sliderValueChanged()),
- this, SLOT(slotSyncPrintToPixelSize()));
-
- syncConnector->createCoordinatedConnector()->connectBackwardVoid(
- m_page->printResolution, SIGNAL(valueChanged(double)),
- this, SLOT(slotPrintResolutionChanged()));
-
-
- /**
- * Initialize printing values from the predefined image values
- */
- QString printSizeUnit;
- if (QLocale().measurementSystem() == QLocale::MetricSystem) {
- printSizeUnit = "cm";
- } else { // Imperial
- printSizeUnit = "in";
- }
-
- printSizeUnit = cfg.readEntry<QString>(PARAM_SIZE_UNIT, printSizeUnit);
-
- m_printSizeUnitManager->setApparentUnitFromSymbol(printSizeUnit);
-
- setCurrentResolutionPPI(resolution);
- slotSyncPixelToPrintSize();
-
- /**
- * Initialize aspect ratio lockers with the current proportion.
- */
- m_pixelSizeLocker->updateAspect();
- m_printSizeLocker->updateAspect();
-
- QString printResUnit = cfg.readEntry<QString>(PARAM_RES_UNIT, "");
- m_page->printResolutionUnit->setCurrentText(printResUnit);
-
- m_page->constrainProportionsCkb->setChecked(cfg.readEntry<bool>(PARAM_RATIO_LOCK, true));
- m_page->adjustPrintSizeSeparatelyCkb->setChecked(cfg.readEntry<bool>(PARAM_PRINT_SIZE_SEPARATE, false));
-
- setMainWidget(m_page);
-
- m_page->pixelWidthDouble->setFocus();
+ setMainWidget(m_page.data());
}
DlgImageSize::~DlgImageSize()
{
- KisConfig cfg(false);
- cfg.writeEntry<bool>(PARAM_PRINT_SIZE_SEPARATE, m_page->adjustPrintSizeSeparatelyCkb->isChecked());
- cfg.writeEntry<bool>(PARAM_RATIO_LOCK, m_page->constrainProportionsCkb->isChecked());
-
- cfg.writeEntry<QString>(PARAM_IMSIZE_UNIT, m_widthUnitManager->getApparentUnitSymbol());
- cfg.writeEntry<QString>(PARAM_SIZE_UNIT, m_printSizeUnitManager->getApparentUnitSymbol());
- cfg.writeEntry<QString>(PARAM_RES_UNIT, m_page->printResolutionUnit->currentText());
-
- delete m_page;
}
qint32 DlgImageSize::desiredWidth()
{
- return qRound(m_page->pixelWidthDouble->value());
+ return m_page->desiredWidth();
}
qint32 DlgImageSize::desiredHeight()
{
- return qRound(m_page->pixelHeightDouble->value());
+ return m_page->desiredHeight();
}
double DlgImageSize::desiredResolution()
{
- return currentResolutionPPI();
+ return m_page->desiredResolution();
}
KisFilterStrategy *DlgImageSize::filterType()
{
- KoID filterID = m_page->pixelFilterCmb->currentItem();
-
- KisFilterStrategy *filter;
- if (filterID == KisCmbIDList::AutoOptionID) {
- filter = KisFilterStrategyRegistry::instance()->autoFilterStrategy(m_originalSize, QSize(desiredWidth(), desiredHeight()));
- } else {
- filter = KisFilterStrategyRegistry::instance()->value(filterID.id());
- lastUsedFilter = filter; // Save for next time!
- }
-
- return filter;
-}
-
-void DlgImageSize::slotSyncPrintToPixelSize()
-{
- const bool printIsSeparate = m_page->adjustPrintSizeSeparatelyCkb->isChecked();
-
- if (!printIsSeparate) {
- KisSignalsBlocker b(m_page->pixelWidthDouble, m_page->pixelHeightDouble);
- m_page->pixelWidthDouble->changeValue(m_page->printWidth->value() * currentResolutionPPI());
- m_page->pixelHeightDouble->changeValue(m_page->printHeight->value() * currentResolutionPPI());
- } else if (m_page->pixelWidthDouble->value() != 0.0) {
- const qreal resolution = qMax(0.001, m_page->pixelWidthDouble->value() / m_page->printWidth->value());
- setCurrentResolutionPPI(resolution);
- }
-}
-
-void DlgImageSize::slotSyncPixelToPrintSize()
-{
- const qreal resolution = currentResolutionPPI();
- if (resolution != 0.0) {
- KisSignalsBlocker b(m_page->printWidth, m_page->printHeight);
- m_page->printWidth->changeValue(m_page->pixelWidthDouble->value() / resolution);
- m_page->printHeight->changeValue(m_page->pixelHeightDouble->value() / resolution);
- }
-}
-
-void DlgImageSize::slotPrintResolutionChanged()
-{
- const bool printIsSeparate = m_page->adjustPrintSizeSeparatelyCkb->isChecked();
-
- if (printIsSeparate) {
- slotSyncPixelToPrintSize();
- } else {
- slotSyncPrintToPixelSize();
- }
-
- updatePrintSizeMaximum();
-}
-
-void DlgImageSize::slotPrintResolutionUnitChanged()
-{
- qreal resolution = m_page->printResolution->value();
-
- if (m_page->printResolutionUnit->currentText() == pixelsInchStr()) {
- resolution = KoUnit::convertFromUnitToUnit(resolution, KoUnit(KoUnit::Inch), KoUnit(KoUnit::Centimeter));
- } else {
- resolution = KoUnit::convertFromUnitToUnit(resolution, KoUnit(KoUnit::Centimeter), KoUnit(KoUnit::Inch));
- }
-
- {
- KisSignalsBlocker b(m_page->printResolution);
- m_page->printResolution->setValue(resolution);
- }
-}
-
-void DlgImageSize::slotLockPixelRatioSwitched(bool value)
-{
- const bool printIsSeparate = m_page->adjustPrintSizeSeparatelyCkb->isChecked();
-
- if (!printIsSeparate) {
- m_page->printAspectRatioBtn->setKeepAspectRatio(value);
- }
- m_page->constrainProportionsCkb->setChecked(value);
-}
-
-void DlgImageSize::slotLockPrintRatioSwitched(bool value)
-{
- m_page->pixelAspectRatioBtn->setKeepAspectRatio(value);
- m_page->constrainProportionsCkb->setChecked(value);
-}
-
-void DlgImageSize::slotLockAllRatioSwitched(bool value)
-{
- const bool printIsSeparate = m_page->adjustPrintSizeSeparatelyCkb->isChecked();
-
- m_page->pixelAspectRatioBtn->setKeepAspectRatio(value);
-
- if (!printIsSeparate) {
- m_page->printAspectRatioBtn->setKeepAspectRatio(value);
- }
-}
-
-void DlgImageSize::slotAdjustSeparatelySwitched(bool value)
-{
- m_page->printAspectRatioBtn->setEnabled(!value);
- m_page->printAspectRatioBtn->setKeepAspectRatio(!value ? m_page->constrainProportionsCkb->isChecked() : true);
-}
-
-qreal DlgImageSize::currentResolutionPPI() const
-{
- qreal resolution = m_page->printResolution->value();
-
- if (m_page->printResolutionUnit->currentText() == pixelsInchStr()) {
- resolution = KoUnit::convertFromUnitToUnit(resolution, KoUnit(KoUnit::Point), KoUnit(KoUnit::Inch));
- } else {
- resolution = KoUnit::convertFromUnitToUnit(resolution, KoUnit(KoUnit::Point), KoUnit(KoUnit::Centimeter));
- }
-
- return resolution;
-}
-
-void DlgImageSize::setCurrentResolutionPPI(qreal value)
-{
- qreal newValue = value;
-
- if (m_page->printResolutionUnit->currentText() == pixelsInchStr()) {
- newValue = KoUnit::convertFromUnitToUnit(value, KoUnit(KoUnit::Inch), KoUnit(KoUnit::Point));
- } else {
- newValue = KoUnit::convertFromUnitToUnit(value, KoUnit(KoUnit::Centimeter), KoUnit(KoUnit::Point));
- }
-
- {
- KisSignalsBlocker b(m_page->printResolution);
- m_page->printResolution->setValue(newValue);
- }
-
- updatePrintSizeMaximum();
-}
-
-void DlgImageSize::updatePrintSizeMaximum()
-{
- const qreal value = currentResolutionPPI();
- if (value == 0.0) return;
-
- m_page->printWidth->setMaximum(maxImagePixelSize / value);
- m_page->printHeight->setMaximum(maxImagePixelSize / value);
+ return m_page->filterType();
}
diff --git a/libs/ui/imagesize/dlg_imagesize.h b/libs/ui/imagesize/dlg_imagesize.h
index 81abcc3106..b979efa040 100644
--- a/libs/ui/imagesize/dlg_imagesize.h
+++ b/libs/ui/imagesize/dlg_imagesize.h
@@ -13,21 +13,6 @@
class KisFilterStrategy;
class WdgImageSize;
-class KisDocumentAwareSpinBoxUnitManager;
-class KisSpinBoxUnitManager;
-class KisAspectRatioLocker;
-
-#include "ui_wdg_imagesize.h"
-
-class WdgImageSize : public QWidget, public Ui::WdgImageSize
-{
- Q_OBJECT
-
-public:
- WdgImageSize(QWidget *parent) : QWidget(parent) {
- setupUi(this);
- }
-};
class DlgImageSize: public KoDialog
{
@@ -36,13 +21,6 @@ class DlgImageSize: public KoDialog
public:
- static const QString PARAM_PREFIX;
- static const QString PARAM_IMSIZE_UNIT;
- static const QString PARAM_SIZE_UNIT;
- static const QString PARAM_RES_UNIT;
- static const QString PARAM_RATIO_LOCK;
- static const QString PARAM_PRINT_SIZE_SEPARATE;
-
DlgImageSize(QWidget * parent, int width, int height, double resolution);
~DlgImageSize() override;
@@ -52,36 +30,8 @@ public:
KisFilterStrategy *filterType();
-Q_SIGNALS:
- void sigDesiredSizeChanged(qint32 width, qint32 height, double resolution);
-
-private Q_SLOTS:
- void slotSyncPrintToPixelSize();
- void slotSyncPixelToPrintSize();
- void slotPrintResolutionChanged();
- void slotPrintResolutionUnitChanged();
-
- void slotLockPixelRatioSwitched(bool value);
- void slotLockPrintRatioSwitched(bool value);
- void slotLockAllRatioSwitched(bool value);
- void slotAdjustSeparatelySwitched(bool value);
-
private:
- qreal currentResolutionPPI() const;
- void setCurrentResolutionPPI(qreal value);
-
- void updatePrintSizeMaximum();
-
- WdgImageSize *m_page;
-
- QSize m_originalSize;
-
- KisAspectRatioLocker *m_pixelSizeLocker;
- KisAspectRatioLocker *m_printSizeLocker;
-
- KisDocumentAwareSpinBoxUnitManager* m_widthUnitManager;
- KisDocumentAwareSpinBoxUnitManager* m_heightUnitManager;
- KisSpinBoxUnitManager* m_printSizeUnitManager;
+ QScopedPointer<WdgImageSize> m_page;
};
#endif // DLG_IMAGESIZE
diff --git a/libs/ui/imagesize/wdg_imagesize.cc b/libs/ui/imagesize/wdg_imagesize.cc
new file mode 100644
index 0000000000..3d4f527dfe
--- /dev/null
+++ b/libs/ui/imagesize/wdg_imagesize.cc
@@ -0,0 +1,465 @@
+/*
+ * dlg_imagesize.cc - part of KimageShop^WKrayon^WKrita
+ *
+ * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <[email protected]>
+ * SPDX-FileCopyrightText: 2009 C. Boemann <[email protected]>
+ * SPDX-FileCopyrightText: 2013 Juan Palacios <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "wdg_imagesize.h"
+
+#include <QLocale>
+#include <kis_config.h>
+
+#include <KoUnit.h>
+#include <kis_size_group.h>
+#include <klocalizedstring.h>
+
+#include <kis_filter_strategy.h>
+
+#include "kis_aspect_ratio_locker.h"
+#include "kis_acyclic_signal_connector.h"
+#include "kis_signals_blocker.h"
+
+#include "kis_double_parse_unit_spin_box.h"
+#include "kis_document_aware_spin_box_unit_manager.h"
+
+static const int maxImagePixelSize = 100000000;
+static KisFilterStrategy *lastUsedFilter = nullptr;
+
+const QString WdgImageSize::PARAM_PREFIX = "imagesizedlg";
+const QString WdgImageSize::PARAM_IMSIZE_UNIT = WdgImageSize::PARAM_PREFIX + "_imsizeunit";
+const QString WdgImageSize::PARAM_SIZE_UNIT = WdgImageSize::PARAM_PREFIX + "_sizeunit";
+const QString WdgImageSize::PARAM_RES_UNIT = WdgImageSize::PARAM_PREFIX + "_resunit";
+const QString WdgImageSize::PARAM_RATIO_LOCK = WdgImageSize::PARAM_PREFIX + "_ratioLock";
+const QString WdgImageSize::PARAM_PRINT_SIZE_SEPARATE = WdgImageSize::PARAM_PREFIX + "_printSizeSeparatly";
+
+#include "ui_wdg_imagesize.h"
+
+class PageImageSize : public QWidget, public Ui::WdgImageSize
+{
+ Q_OBJECT
+
+public:
+ PageImageSize(QWidget *parent) : QWidget(parent) {
+ setupUi(this);
+ }
+};
+
+
+static QString pixelsInchStr()
+{
+ static QString str = i18n("Pixels/Inch");
+ return str;
+}
+
+static const QString pixelsCentimeterStr()
+{
+ static QString str = i18n("Pixels/Centimeter");
+ return str;
+}
+
+WdgImageSize::WdgImageSize(QWidget *parent, int width, int height, double resolution)
+ : QWidget(parent)
+{
+ // Store original size.
+ m_originalSize.setWidth(width);
+ m_originalSize.setHeight(height);
+
+ m_page = new PageImageSize(this);
+
+ Q_CHECK_PTR(m_page);
+ m_page->layout()->setContentsMargins(0, 0, 0, 0);
+ m_page->setObjectName("image_size");
+
+ m_page->pixelFilterCmb->setIDList(KisFilterStrategyRegistry::instance()->listKeys());
+ m_page->pixelFilterCmb->allowAuto(true);
+ m_page->pixelFilterCmb->setToolTip(KisFilterStrategyRegistry::instance()->formattedDescriptions());
+
+ if (lastUsedFilter) { // Restore or Init..
+ m_page->pixelFilterCmb->setCurrent(lastUsedFilter->id());
+ } else {
+ m_page->pixelFilterCmb->setCurrent(KisCmbIDList::AutoOptionID);
+ }
+
+ connect(this, &WdgImageSize::sigDesiredSizeChanged, [this](qint32 width, qint32 height, double){
+ KisFilterStrategy *filterStrategy = KisFilterStrategyRegistry::instance()->autoFilterStrategy(m_originalSize, QSize(width, height));
+ m_page->pixelFilterCmb->setAutoHint(filterStrategy->name());
+ });
+
+ /**
+ * Initialize Pixel Width and Height fields
+ */
+
+ m_widthUnitManager = new KisDocumentAwareSpinBoxUnitManager(this);
+ m_heightUnitManager = new KisDocumentAwareSpinBoxUnitManager(this, KisDocumentAwareSpinBoxUnitManager::PIX_DIR_Y);
+
+ KisConfig cfg(true);
+
+ /// configure the unit to image length, default unit is pixel and printing units are forbidden.
+ m_widthUnitManager->setUnitDimension(KisSpinBoxUnitManager::IMLENGTH);
+ m_heightUnitManager->setUnitDimension(KisSpinBoxUnitManager::IMLENGTH);
+
+ m_widthUnitManager->syncWithOtherUnitManager(m_heightUnitManager); //sync the two managers, so that the units will be the same, but each manager will know a different reference for percents.
+
+ m_widthUnitManager->setApparentUnitFromSymbol("px"); //set unit to pixel.
+
+ m_page->pixelWidthDouble->setUnitManager(m_widthUnitManager);
+ m_page->pixelHeightDouble->setUnitManager(m_heightUnitManager);
+ m_page->pixelWidthDouble->setMaximum(maxImagePixelSize);
+ m_page->pixelHeightDouble->setMaximum(maxImagePixelSize);
+ m_page->pixelWidthDouble->changeValue(width);
+ m_page->pixelHeightDouble->changeValue(height);
+ m_page->pixelWidthDouble->setDisplayUnit(false);
+ m_page->pixelHeightDouble->setDisplayUnit(false);
+ m_page->pixelWidthDouble->setFocus();
+
+ connect(m_page->pixelWidthDouble, qOverload<double>(&KisDoubleParseUnitSpinBox::valueChanged), [this](){
+ Q_EMIT sigDesiredSizeChanged(desiredWidth(), desiredHeight(), desiredResolution());
+ });
+ connect(m_page->pixelHeightDouble, qOverload<double>(&KisDoubleParseUnitSpinBox::valueChanged), [this](){
+ Q_EMIT sigDesiredSizeChanged(desiredWidth(), desiredHeight(), desiredResolution());
+ });
+
+ /// add custom units
+
+ int unitId = m_widthUnitManager->getApparentUnitId();
+
+ m_page->pixelSizeUnit->setModel(m_widthUnitManager);
+ m_page->pixelSizeUnit->setCurrentIndex(unitId);
+
+ /**
+ * Connect Pixel Unit switching controls
+ */
+
+ KisAcyclicSignalConnector *pixelUnitConnector = new KisAcyclicSignalConnector(this);
+ pixelUnitConnector->connectForwardInt(m_page->pixelSizeUnit, SIGNAL(currentIndexChanged(int)),
+ m_widthUnitManager, SLOT(selectApparentUnitFromIndex(int)));
+ pixelUnitConnector->connectBackwardInt(m_widthUnitManager, SIGNAL(unitChanged(int)),
+ m_page->pixelSizeUnit, SLOT(setCurrentIndex(int)));
+
+ QString imSizeUnit = cfg.readEntry<QString>(PARAM_IMSIZE_UNIT, "px");
+
+ m_widthUnitManager->setApparentUnitFromSymbol(imSizeUnit);
+
+ /**
+ * Initialize Print Width, Height and Resolution fields
+ */
+
+ m_printSizeUnitManager = new KisSpinBoxUnitManager(this);
+
+ m_page->printWidth->setUnitManager(m_printSizeUnitManager);
+ m_page->printHeight->setUnitManager(m_printSizeUnitManager);
+ m_page->printWidth->setDisplayUnit(false);
+ m_page->printHeight->setDisplayUnit(false);
+ m_page->printResolution->setAlignment(Qt::AlignRight);
+
+ m_page->printWidthUnit->setModel(m_printSizeUnitManager);
+
+ //TODO: create a resolution dimension in the unit manager.
+ m_page->printResolutionUnit->addItem(pixelsInchStr());
+ m_page->printResolutionUnit->addItem(pixelsCentimeterStr());
+
+
+ /**
+ * Initialize labels and layout
+ */
+ KisSizeGroup *labelsGroup = new KisSizeGroup(this);
+ labelsGroup->addWidget(m_page->lblPixelWidth);
+ labelsGroup->addWidget(m_page->lblPixelHeight);
+ labelsGroup->addWidget(m_page->lblPixelFilter);
+ labelsGroup->addWidget(m_page->lblPrintWidth);
+ labelsGroup->addWidget(m_page->lblPrintHeight);
+ labelsGroup->addWidget(m_page->lblResolution);
+
+ KisSizeGroup *spinboxesGroup = new KisSizeGroup(this);
+ spinboxesGroup->addWidget(m_page->pixelWidthDouble);
+ spinboxesGroup->addWidget(m_page->pixelHeightDouble);
+ spinboxesGroup->addWidget(m_page->printWidth);
+ spinboxesGroup->addWidget(m_page->printHeight);
+ spinboxesGroup->addWidget(m_page->printResolution);
+
+ KisSizeGroup *comboboxesGroup = new KisSizeGroup(this);
+ comboboxesGroup->addWidget(m_page->pixelSizeUnit);
+ comboboxesGroup->addWidget(m_page->printWidthUnit);
+ comboboxesGroup->addWidget(m_page->printResolutionUnit);
+ connect(this, SIGNAL(okClicked()), this, SLOT(accept()));
+
+ /**
+ * Initialize aspect ratio buttons and lockers
+ */
+
+ m_page->pixelAspectRatioBtn->setKeepAspectRatio(true);
+ m_page->printAspectRatioBtn->setKeepAspectRatio(true);
+ m_page->constrainProportionsCkb->setChecked(true);
+
+ m_pixelSizeLocker = new KisAspectRatioLocker(this);
+ m_pixelSizeLocker->connectSpinBoxes(m_page->pixelWidthDouble, m_page->pixelHeightDouble, m_page->pixelAspectRatioBtn);
+
+ m_printSizeLocker = new KisAspectRatioLocker(this);
+ m_printSizeLocker->connectSpinBoxes(m_page->printWidth, m_page->printHeight, m_page->printAspectRatioBtn);
+
+ /**
+ * Connect Keep Aspect Lock buttons
+ */
+
+ KisAcyclicSignalConnector *constrainsConnector = new KisAcyclicSignalConnector(this);
+ constrainsConnector->connectBackwardBool(
+ m_page->constrainProportionsCkb, SIGNAL(toggled(bool)),
+ this, SLOT(slotLockAllRatioSwitched(bool)));
+
+ constrainsConnector->connectForwardBool(
+ m_pixelSizeLocker, SIGNAL(aspectButtonToggled(bool)),
+ this, SLOT(slotLockPixelRatioSwitched(bool)));
+
+ constrainsConnector->createCoordinatedConnector()->connectBackwardBool(
+ m_printSizeLocker, SIGNAL(aspectButtonToggled(bool)),
+ this, SLOT(slotLockPrintRatioSwitched(bool)));
+
+ constrainsConnector->createCoordinatedConnector()->connectBackwardBool(
+ m_page->adjustPrintSizeSeparatelyCkb, SIGNAL(toggled(bool)),
+ this, SLOT(slotAdjustSeparatelySwitched(bool)));
+
+ /**
+ * Connect Print Unit switching controls
+ */
+
+ KisAcyclicSignalConnector *printUnitConnector = new KisAcyclicSignalConnector(this);
+ printUnitConnector->connectForwardInt(
+ m_page->printWidthUnit, SIGNAL(currentIndexChanged(int)),
+ m_printSizeUnitManager, SLOT(selectApparentUnitFromIndex(int)));
+
+ printUnitConnector->connectBackwardInt(
+ m_printSizeUnitManager, SIGNAL(unitChanged(int)),
+ m_page->printWidthUnit, SLOT(setCurrentIndex(int)));
+
+ /// connect resolution
+ connect(m_page->printResolutionUnit, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(slotPrintResolutionUnitChanged()));
+
+ /**
+ * Create syncing connections between Pixel and Print values
+ */
+ KisAcyclicSignalConnector *syncConnector = new KisAcyclicSignalConnector(this);
+ syncConnector->connectForwardVoid(
+ m_pixelSizeLocker, SIGNAL(sliderValueChanged()),
+ this, SLOT(slotSyncPixelToPrintSize()));
+
+ syncConnector->connectBackwardVoid(
+ m_printSizeLocker, SIGNAL(sliderValueChanged()),
+ this, SLOT(slotSyncPrintToPixelSize()));
+
+ syncConnector->createCoordinatedConnector()->connectBackwardVoid(
+ m_page->printResolution, SIGNAL(valueChanged(double)),
+ this, SLOT(slotPrintResolutionChanged()));
+
+
+ /**
+ * Initialize printing values from the predefined image values
+ */
+ QString printSizeUnit;
+
+ if (QLocale().measurementSystem() == QLocale::MetricSystem) {
+ printSizeUnit = "cm";
+ } else { // Imperial
+ printSizeUnit = "in";
+ }
+
+ printSizeUnit = cfg.readEntry<QString>(PARAM_SIZE_UNIT, printSizeUnit);
+
+ m_printSizeUnitManager->setApparentUnitFromSymbol(printSizeUnit);
+
+ setCurrentResolutionPPI(resolution);
+ slotSyncPixelToPrintSize();
+
+ /**
+ * Initialize aspect ratio lockers with the current proportion.
+ */
+ m_pixelSizeLocker->updateAspect();
+ m_printSizeLocker->updateAspect();
+
+ QString printResUnit = cfg.readEntry<QString>(PARAM_RES_UNIT, "");
+ m_page->printResolutionUnit->setCurrentText(printResUnit);
+
+ m_page->constrainProportionsCkb->setChecked(cfg.readEntry<bool>(PARAM_RATIO_LOCK, true));
+ m_page->adjustPrintSizeSeparatelyCkb->setChecked(cfg.readEntry<bool>(PARAM_PRINT_SIZE_SEPARATE, false));
+
+ QHBoxLayout *l = new QHBoxLayout();
+ l->addWidget(m_page);
+ this->setLayout(l);
+
+ m_page->pixelWidthDouble->setFocus();
+}
+
+WdgImageSize::~WdgImageSize()
+{
+ KisConfig cfg(false);
+ cfg.writeEntry<bool>(PARAM_PRINT_SIZE_SEPARATE, m_page->adjustPrintSizeSeparatelyCkb->isChecked());
+ cfg.writeEntry<bool>(PARAM_RATIO_LOCK, m_page->constrainProportionsCkb->isChecked());
+
+ cfg.writeEntry<QString>(PARAM_IMSIZE_UNIT, m_widthUnitManager->getApparentUnitSymbol());
+ cfg.writeEntry<QString>(PARAM_SIZE_UNIT, m_printSizeUnitManager->getApparentUnitSymbol());
+ cfg.writeEntry<QString>(PARAM_RES_UNIT, m_page->printResolutionUnit->currentText());
+
+ delete m_page;
+}
+
+qint32 WdgImageSize::desiredWidth()
+{
+ return qRound(m_page->pixelWidthDouble->value());
+}
+
+qint32 WdgImageSize::desiredHeight()
+{
+ return qRound(m_page->pixelHeightDouble->value());
+}
+
+double WdgImageSize::desiredResolution()
+{
+ return currentResolutionPPI();
+}
+
+KisFilterStrategy *WdgImageSize::filterType()
+{
+ KoID filterID = m_page->pixelFilterCmb->currentItem();
+
+ KisFilterStrategy *filter;
+ if (filterID == KisCmbIDList::AutoOptionID) {
+ filter = KisFilterStrategyRegistry::instance()->autoFilterStrategy(m_originalSize, QSize(desiredWidth(), desiredHeight()));
+ } else {
+ filter = KisFilterStrategyRegistry::instance()->value(filterID.id());
+ lastUsedFilter = filter; // Save for next time!
+ }
+
+ return filter;
+}
+
+void WdgImageSize::slotSyncPrintToPixelSize()
+{
+ const bool printIsSeparate = m_page->adjustPrintSizeSeparatelyCkb->isChecked();
+
+ if (!printIsSeparate) {
+ KisSignalsBlocker b(m_page->pixelWidthDouble, m_page->pixelHeightDouble);
+ m_page->pixelWidthDouble->changeValue(m_page->printWidth->value() * currentResolutionPPI());
+ m_page->pixelHeightDouble->changeValue(m_page->printHeight->value() * currentResolutionPPI());
+ } else if (m_page->pixelWidthDouble->value() != 0.0) {
+ const qreal resolution = qMax(0.001, m_page->pixelWidthDouble->value() / m_page->printWidth->value());
+ setCurrentResolutionPPI(resolution);
+ }
+}
+
+void WdgImageSize::slotSyncPixelToPrintSize()
+{
+ const qreal resolution = currentResolutionPPI();
+ if (resolution != 0.0) {
+ KisSignalsBlocker b(m_page->printWidth, m_page->printHeight);
+ m_page->printWidth->changeValue(m_page->pixelWidthDouble->value() / resolution);
+ m_page->printHeight->changeValue(m_page->pixelHeightDouble->value() / resolution);
+ }
+}
+
+void WdgImageSize::slotPrintResolutionChanged()
+{
+ const bool printIsSeparate = m_page->adjustPrintSizeSeparatelyCkb->isChecked();
+
+ if (printIsSeparate) {
+ slotSyncPixelToPrintSize();
+ } else {
+ slotSyncPrintToPixelSize();
+ }
+
+ updatePrintSizeMaximum();
+}
+
+void WdgImageSize::slotPrintResolutionUnitChanged()
+{
+ qreal resolution = m_page->printResolution->value();
+
+ if (m_page->printResolutionUnit->currentText() == pixelsInchStr()) {
+ resolution = KoUnit::convertFromUnitToUnit(resolution, KoUnit(KoUnit::Inch), KoUnit(KoUnit::Centimeter));
+ } else {
+ resolution = KoUnit::convertFromUnitToUnit(resolution, KoUnit(KoUnit::Centimeter), KoUnit(KoUnit::Inch));
+ }
+
+ {
+ KisSignalsBlocker b(m_page->printResolution);
+ m_page->printResolution->setValue(resolution);
+ }
+}
+
+void WdgImageSize::slotLockPixelRatioSwitched(bool value)
+{
+ const bool printIsSeparate = m_page->adjustPrintSizeSeparatelyCkb->isChecked();
+
+ if (!printIsSeparate) {
+ m_page->printAspectRatioBtn->setKeepAspectRatio(value);
+ }
+ m_page->constrainProportionsCkb->setChecked(value);
+}
+
+void WdgImageSize::slotLockPrintRatioSwitched(bool value)
+{
+ m_page->pixelAspectRatioBtn->setKeepAspectRatio(value);
+ m_page->constrainProportionsCkb->setChecked(value);
+}
+
+void WdgImageSize::slotLockAllRatioSwitched(bool value)
+{
+ const bool printIsSeparate = m_page->adjustPrintSizeSeparatelyCkb->isChecked();
+
+ m_page->pixelAspectRatioBtn->setKeepAspectRatio(value);
+
+ if (!printIsSeparate) {
+ m_page->printAspectRatioBtn->setKeepAspectRatio(value);
+ }
+}
+
+void WdgImageSize::slotAdjustSeparatelySwitched(bool value)
+{
+ m_page->printAspectRatioBtn->setEnabled(!value);
+ m_page->printAspectRatioBtn->setKeepAspectRatio(!value ? m_page->constrainProportionsCkb->isChecked() : true);
+}
+
+qreal WdgImageSize::currentResolutionPPI() const
+{
+ qreal resolution = m_page->printResolution->value();
+
+ if (m_page->printResolutionUnit->currentText() == pixelsInchStr()) {
+ resolution = KoUnit::convertFromUnitToUnit(resolution, KoUnit(KoUnit::Point), KoUnit(KoUnit::Inch));
+ } else {
+ resolution = KoUnit::convertFromUnitToUnit(resolution, KoUnit(KoUnit::Point), KoUnit(KoUnit::Centimeter));
+ }
+
+ return resolution;
+}
+
+void WdgImageSize::setCurrentResolutionPPI(qreal value)
+{
+ qreal newValue = value;
+
+ if (m_page->printResolutionUnit->currentText() == pixelsInchStr()) {
+ newValue = KoUnit::convertFromUnitToUnit(value, KoUnit(KoUnit::Inch), KoUnit(KoUnit::Point));
+ } else {
+ newValue = KoUnit::convertFromUnitToUnit(value, KoUnit(KoUnit::Centimeter), KoUnit(KoUnit::Point));
+ }
+
+ {
+ KisSignalsBlocker b(m_page->printResolution);
+ m_page->printResolution->setValue(newValue);
+ }
+
+ updatePrintSizeMaximum();
+}
+
+void WdgImageSize::updatePrintSizeMaximum()
+{
+ const qreal value = currentResolutionPPI();
+ if (value == 0.0) return;
+
+ m_page->printWidth->setMaximum(maxImagePixelSize / value);
+ m_page->printHeight->setMaximum(maxImagePixelSize / value);
+}
+
+#include "wdg_imagesize.moc"
diff --git a/libs/ui/imagesize/wdg_imagesize.h b/libs/ui/imagesize/wdg_imagesize.h
new file mode 100644
index 0000000000..ef6627d3e6
--- /dev/null
+++ b/libs/ui/imagesize/wdg_imagesize.h
@@ -0,0 +1,74 @@
+/*
+ * dlg_imagesize.h -- part of KimageShop^WKrayon^WKrita
+ *
+ * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <[email protected]>
+ * SPDX-FileCopyrightText: 2013 Juan Palacios <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef WDG_IMAGESIZE
+#define WDG_IMAGESIZE
+
+#include <QWidget>
+
+class KisFilterStrategy;
+class PageImageSize;
+class KisDocumentAwareSpinBoxUnitManager;
+class KisSpinBoxUnitManager;
+class KisAspectRatioLocker;
+
+class WdgImageSize : public QWidget
+{
+ Q_OBJECT
+
+public:
+
+ static const QString PARAM_PREFIX;
+ static const QString PARAM_IMSIZE_UNIT;
+ static const QString PARAM_SIZE_UNIT;
+ static const QString PARAM_RES_UNIT;
+ static const QString PARAM_RATIO_LOCK;
+ static const QString PARAM_PRINT_SIZE_SEPARATE;
+
+ WdgImageSize(QWidget * parent, int width, int height, double resolution);
+ ~WdgImageSize() override;
+
+ qint32 desiredWidth();
+ qint32 desiredHeight();
+ double desiredResolution();
+
+ KisFilterStrategy *filterType();
+
+Q_SIGNALS:
+ void sigDesiredSizeChanged(qint32 width, qint32 height, double resolution);
+
+private Q_SLOTS:
+ void slotSyncPrintToPixelSize();
+ void slotSyncPixelToPrintSize();
+ void slotPrintResolutionChanged();
+ void slotPrintResolutionUnitChanged();
+
+ void slotLockPixelRatioSwitched(bool value);
+ void slotLockPrintRatioSwitched(bool value);
+ void slotLockAllRatioSwitched(bool value);
+ void slotAdjustSeparatelySwitched(bool value);
+
+private:
+ qreal currentResolutionPPI() const;
+ void setCurrentResolutionPPI(qreal value);
+
+ void updatePrintSizeMaximum();
+
+ PageImageSize *m_page;
+
+ QSize m_originalSize;
+
+ KisAspectRatioLocker *m_pixelSizeLocker;
+ KisAspectRatioLocker *m_printSizeLocker;
+
+ KisDocumentAwareSpinBoxUnitManager* m_widthUnitManager;
+ KisDocumentAwareSpinBoxUnitManager* m_heightUnitManager;
+ KisSpinBoxUnitManager* m_printSizeUnitManager;
+};
+
+#endif // WDG_IMAGESIZE