Commit 9d7248a5 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix cyclic dependencies in Image Size dialog

1) Now the dialog uses KisAspectRatioLocker and
   KisAcyclicSignalConnector which break update loops
   that caused rounding errors right after opening the
   dialog.

2) Now the user can choose the unit of the field by switching
   a single combo box, not two separate ones: for width and height.
parent 77ed769e
......@@ -200,6 +200,7 @@ void KisAspectRatioLocker::slotAspectButtonChanged()
if (!m_d->spinTwo->isDragging()) {
emit aspectButtonChanged();
emit aspectButtonToggled(m_d->aspectButton->keepAspectRatio());
}
}
......
......@@ -50,6 +50,7 @@ private Q_SLOTS:
Q_SIGNALS:
void sliderValueChanged();
void aspectButtonChanged();
void aspectButtonToggled(bool value);
private:
struct Private;
......
......@@ -27,6 +27,7 @@ class KisFilterStrategy;
class WdgImageSize;
class KisDocumentAwareSpinBoxUnitManager;
class KisSpinBoxUnitManager;
class KisAspectRatioLocker;
#include "ui_wdg_imagesize.h"
......@@ -56,36 +57,34 @@ public:
KisFilterStrategy *filterType();
private Q_SLOTS:
void slotPixelWidthChanged(double w);
void slotPixelHeightChanged(double h);
void slotPrintWidthChanged(double w);
void slotPrintHeightChanged(double h);
void slotAspectChanged(bool keep);
void slotPrintResolutionChanged(double r);
void slotPrintResolutionEditFinished();
void slotSyncPrintToPixelSize();
void slotSyncPixelToPrintSize();
void slotPrintResolutionChanged();
void slotPrintResolutionUnitChanged();
void slotLockPixelRatioSwitched(bool value);
void slotLockPrintRatioSwitched(bool value);
void slotLockAllRatioSwitched(bool value);
void slotAdjustSeparatelySwitched(bool value);
void slotPixelUnitBoxChanged();
void slotPixelWidthUnitSuffixChanged();
void slotPixelHeightUnitSuffixChanged();
private:
void updatePixelWidthUIValue(double value);
void updatePixelHeightUIValue(double value);
void updatePrintWidthUIValue(double value);
void updatePrintHeightUIValue(double value);
void updatePrintResolutionUIValue(double value);
qreal currentResolutionPPI() const;
void setCurrentResilutionPPI(qreal value);
void updatePrintSizeMaximum();
WdgImageSize *m_page;
const double m_aspectRatio;
const int m_originalWidth, m_originalHeight;
int m_width, m_height;
double m_printWidth, m_printHeight; // in points
const double m_originalResolution;
double m_resolution;
bool m_keepAspect;
KisAspectRatioLocker *m_pixelSizeLocker;
KisAspectRatioLocker *m_printSizeLocker;
KisDocumentAwareSpinBoxUnitManager* m_widthUnitManager;
KisDocumentAwareSpinBoxUnitManager* m_heightUnitManager;
KisSpinBoxUnitManager* m_printWidthUnitManager;
KisSpinBoxUnitManager* m_printHeightUnitManager;
KisSpinBoxUnitManager* m_printSizeUnitManager;
};
#endif // DLG_IMAGESIZE
......@@ -45,9 +45,6 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="pixelWidthUnit"/>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
......@@ -94,9 +91,6 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="pixelHeightUnit"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lblPixelHeight">
<property name="text">
......@@ -148,6 +142,9 @@
<item row="2" column="2" colspan="2">
<widget class="KisCmbIDList" name="pixelFilterCmb" native="true"/>
</item>
<item row="0" column="3" rowspan="2">
<widget class="QComboBox" name="pixelSizeUnit"/>
</item>
</layout>
</widget>
</item>
......@@ -173,9 +170,6 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="printHeightUnit"/>
</item>
<item row="0" column="2">
<widget class="KisDoubleParseUnitSpinBox" name="printWidth">
<property name="minimumSize">
......@@ -240,9 +234,6 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="printWidthUnit"/>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lblResolution">
<property name="text">
......@@ -313,6 +304,9 @@
</property>
</spacer>
</item>
<item row="0" column="3" rowspan="2">
<widget class="QComboBox" name="printWidthUnit"/>
</item>
</layout>
</widget>
</item>
......@@ -395,14 +389,12 @@
</customwidgets>
<tabstops>
<tabstop>pixelWidthDouble</tabstop>
<tabstop>pixelWidthUnit</tabstop>
<tabstop>pixelSizeUnit</tabstop>
<tabstop>pixelHeightDouble</tabstop>
<tabstop>pixelHeightUnit</tabstop>
<tabstop>pixelFilterCmb</tabstop>
<tabstop>printWidth</tabstop>
<tabstop>printWidthUnit</tabstop>
<tabstop>printHeight</tabstop>
<tabstop>printHeightUnit</tabstop>
<tabstop>printResolution</tabstop>
<tabstop>printResolutionUnit</tabstop>
<tabstop>constrainProportionsCkb</tabstop>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment