Bug 103243

Summary: Logic error in image resize dialog
Product: [Applications] digikam Reporter: Dik Takken <kde>
Component: Plugin-Editor-ResizeAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.7.2   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 7.6.0

Description Dik Takken 2005-04-04 23:41:57 UTC
Version:           0.7.2 (using KDE KDE 3.3.2)
Installed from:    Gentoo Packages
OS:                Linux

When you change only one value in the resize dialog and the aspect ratio is locked, the other values must be re-calculated as well. This happens correctly when you change focus to another widget after adjusting one value, but it does _not_ happen when you press OK immediately after entering a new value (using the keyboard). The result is that the resizing operation is not carried out. To reproduce:

* Load any image in the image editor
* Open the resize dialog
* Change the Width percentage value, using the keyboard.
* Press OK
* Nothing happens.
Comment 1 Renchi Raju 2005-04-05 17:32:04 UTC
CVS commit by pahlibar: 




if user has changed values and pressed ok without allowing the focus to return
to the resizedialog, then the changed signal is not fired. so check for this 
change before exiting.

BUGS: 103243


  M +16 -2     imageresizedlg.cpp   1.11
  M +5 -0      imageresizedlg.h   1.7


--- kdeextragear-3/digikam/utilities/imageeditor/imageresizedlg.cpp  #1.10:1.11
@@ -44,4 +44,9 @@ ImageResizeDlg::ImageResizeDlg(QWidget *
     m_height = height;
 
+    m_prevW  = *m_width;
+    m_prevH  = *m_height;
+    m_prevWP = 100.0;
+    m_prevHP = 100.0;
+    
     QGridLayout *topLayout =
         new QGridLayout( plainPage(), 0, 3, 4, spacingHint());
@@ -96,6 +101,10 @@ ImageResizeDlg::~ImageResizeDlg()
 void ImageResizeDlg::slotOk()
 {
-    *m_width  = m_wInput->value();
-    *m_height = m_hInput->value();
+    if (m_prevW != m_wInput->value() || m_prevH != m_hInput->value() ||
+        m_prevWP != m_wpInput->value() || m_prevHP != m_hpInput->value())
+        slotChanged();
+    
+    *m_width  = m_prevW;
+    *m_height = m_prevH;
     accept();
 }
@@ -163,4 +172,9 @@ void ImageResizeDlg::slotChanged()
     }
 
+    m_prevW = m_wInput->value();
+    m_prevH = m_hInput->value();
+    m_prevWP = m_wpInput->value();
+    m_prevHP = m_hpInput->value();
+    
     m_wInput->blockSignals(false);
     m_hInput->blockSignals(false);

--- kdeextragear-3/digikam/utilities/imageeditor/imageresizedlg.h  #1.6:1.7
@@ -51,4 +51,9 @@ private:
     int      *m_height;
     
+    int       m_prevW;
+    int       m_prevH;
+    double    m_prevWP;
+    double    m_prevHP;
+    
 private slots: