[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/gwenview/lib/resize
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2010-09-26 21:43:35
Message-ID: 20100926214335.C611AAC896 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1180060 by gateau:

Added "keep aspect ratio" checkbox

 M  +14 -0     resizeimagedialog.cpp  
 M  +1 -0      resizeimagedialog.h  
 M  +10 -6     resizeimagewidget.ui  


--- trunk/KDE/kdegraphics/gwenview/lib/resize/resizeimagedialog.cpp #1180059:1180060
@@ -53,6 +53,7 @@
 
 	connect(d->mWidthSpinBox, SIGNAL(valueChanged(int)), SLOT(slotWidthChanged(int)));
 	connect(d->mHeightSpinBox, SIGNAL(valueChanged(int)), SLOT(slotHeightChanged(int)));
+	connect(d->mKeepAspectCheckBox, SIGNAL(toggled(bool)), SLOT(slotKeepAspectChanged(bool)));
 }
 
 
@@ -79,6 +80,9 @@
 
 
 void ResizeImageDialog::slotWidthChanged(int width) {
+	if (!d->mKeepAspectCheckBox->isChecked()) {
+		return;
+	}
 	if (d->mUpdateFromRatio) {
 		return;
 	}
@@ -89,6 +93,9 @@
 
 
 void ResizeImageDialog::slotHeightChanged(int height) {
+	if (!d->mKeepAspectCheckBox->isChecked()) {
+		return;
+	}
 	if (d->mUpdateFromRatio) {
 		return;
 	}
@@ -97,4 +104,11 @@
 	d->mUpdateFromRatio = false;
 }
 
+
+void ResizeImageDialog::slotKeepAspectChanged(bool value) {
+	if (value) {
+		slotWidthChanged(d->mWidthSpinBox->value());
+	}
+}
+
 } // namespace
--- trunk/KDE/kdegraphics/gwenview/lib/resize/resizeimagedialog.h #1180059:1180060
@@ -46,6 +46,7 @@
 private Q_SLOTS:
 	void slotWidthChanged(int);
 	void slotHeightChanged(int);
+	void slotKeepAspectChanged(bool);
 
 private:
 	ResizeImageDialogPrivate* const d;
--- trunk/KDE/kdegraphics/gwenview/lib/resize/resizeimagewidget.ui #1180059:1180060
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>295</width>
-    <height>58</height>
+    <height>83</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -83,9 +83,6 @@
      <property name="maximum">
       <number>100000</number>
      </property>
-     <property name="singleStep">
-      <number>10</number>
-     </property>
     </widget>
    </item>
    <item row="1" column="2">
@@ -96,9 +93,16 @@
      <property name="maximum">
       <number>100000</number>
      </property>
-     <property name="singleStep">
-      <number>10</number>
+    </widget>
+   </item>
+   <item row="2" column="1" colspan="2">
+    <widget class="QCheckBox" name="mKeepAspectCheckBox">
+     <property name="text">
+      <string>Keep aspect ratio</string>
      </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
     </widget>
    </item>
   </layout>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic