Bug 103243 - Logic error in image resize dialog
Summary: Logic error in image resize dialog
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Editor-Resize (show other bugs)
Version: 0.7.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-04 23:41 UTC by Dik Takken
Modified: 2022-01-17 22:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 7.6.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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: