View Issue Details

IDProjectCategoryView StatusLast Update
0004648ScribusGraphics / Image Framespublic2014-09-25 22:11
Reporterchristoph_s Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86OSLinuxOS VersionSuSE 10.1
Product Version1.3.4cvs 
Fixed in Version1.4.5.svn 
Summary0004648: Changing opacity is extremely slow
DescriptionOpacity means the feature in "Extended Image Effects"
TagsNo tags attached.
Patch

Relationships

related to 0012652 closedjghali Changing the opacity of layers in multi-layered PSD files essentially freezes Scribus 

Activities

fschmid

2006-11-29 17:11

administrator   ~0013635

Depends on the size of the image as for this its needed to reload the image.

fschmid

2008-03-19 10:19

administrator   ~0019220

Fixed with the improvements to this Dialog from 18.03.2008

christoph_s

2008-03-20 01:58

administrator   ~0019227

Sorry, Franz, but this is not fixed. It's even slower than before.

fschmid

2008-03-20 09:29

administrator   ~0019229

You can now uncheck the "Live Preview" in the Dialog, that prevents the Image on the Canvas from being updated when you change things in the Dialog.

christoph_s

2008-03-21 00:38

administrator   ~0019245

Last edited: 2008-03-21 00:59

Even unchecking the live preview takes forever -- up to 1 minute.

aliB

2009-08-25 12:56

reporter   ~0022426

Another issue is, that the image is already updated before I finished typing the value. For example if I want to change opacity to 15 %: Typing 1 (image is updated), typing 5 (image is updated again. This is not necessary.

jghali

2014-09-23 13:12

administrator  

4648_opacity_change.diff (7,489 bytes)   
Index: scribus/ui/extimageprops.cpp
===================================================================
--- scribus/ui/extimageprops.cpp	(revision 19529)
+++ scribus/ui/extimageprops.cpp	(working copy)
@@ -20,6 +20,7 @@
 #include <QHeaderView>
 #include <QTableWidget>
 #include <QTableWidgetItem>
+#include <QTimer>
 
 #include "commonstrings.h"
 #include "pageitem.h"
@@ -41,7 +42,14 @@
 	ExtImagePropsLayout = new QVBoxLayout( this );
 	ExtImagePropsLayout->setMargin(6);
 	ExtImagePropsLayout->setSpacing(6);
-	m_view = view;
+	m_view  = view;
+	m_timer = 0;
+	if (info->layerInfo.count() != 0)
+	{
+		m_timer = new QTimer(this);
+		m_timer->setSingleShot(true);
+		m_timer->setInterval(350);
+	}
 	currentItem = item;
 	currentLayer = 0;
 	originalInfo = *info;
@@ -160,62 +168,59 @@
 		FlagsSicht.clear();
 		int col2Width = 0;
 		int col1Width = 0;
-		if (info->layerInfo.count() != 0)
+		if ((info->isRequest) && (info->RequestProps.contains(0)))
 		{
-			if ((info->isRequest) && (info->RequestProps.contains(0)))
-			{
-				opacitySpinBox->setValue(qRound(info->RequestProps[0].opacity / 255.0 * 100));
-				setCurrentComboItem(blendMode, blendModes[info->RequestProps[0].blend]);
-			}
+			opacitySpinBox->setValue(qRound(info->RequestProps[0].opacity / 255.0 * 100));
+			setCurrentComboItem(blendMode, blendModes[info->RequestProps[0].blend]);
+		}
+		else
+		{
+			opacitySpinBox->setValue(qRound(info->layerInfo[0].opacity / 255.0 * 100));
+			setCurrentComboItem(blendMode, blendModes[info->layerInfo[0].blend]);
+		}
+		opacitySpinBox->setEnabled(true);
+		blendMode->setEnabled(true);
+		QString tmp;
+		QList<PSDLayer>::iterator it2;
+		uint counter = 0;
+		for (it2 = info->layerInfo.begin(); it2 != info->layerInfo.end(); ++it2)
+		{
+			QCheckBox *cp = new QCheckBox(it2->layerName, this);
+			cp->setPalette(palette);
+			QPixmap pm;
+			pm=QPixmap::fromImage(it2->thumb);
+			col1Width = qMax(col1Width, pm.width());
+			cp->setIcon(pm);
+			FlagsSicht.append(cp);
+			connect(cp, SIGNAL(clicked()), this, SLOT(changedLayer()));
+			layerTable->setCellWidget(info->layerInfo.count()-counter-1, 0, cp);
+			if ((info->isRequest) && (info->RequestProps.contains(counter)))
+				cp->setChecked(info->RequestProps[counter].visible);
 			else
+				cp->setChecked(!(it2->flags & 2));
+			if (!it2->thumb_mask.isNull())
 			{
-				opacitySpinBox->setValue(qRound(info->layerInfo[0].opacity / 255.0 * 100));
-				setCurrentComboItem(blendMode, blendModes[info->layerInfo[0].blend]);
-			}
-			opacitySpinBox->setEnabled(true);
-			blendMode->setEnabled(true);
-			QString tmp;
-			QList<PSDLayer>::iterator it2;
-			uint counter = 0;
-			for (it2 = info->layerInfo.begin(); it2 != info->layerInfo.end(); ++it2)
-			{
-				QCheckBox *cp = new QCheckBox(it2->layerName, this);
-				cp->setPalette(palette);
-				QPixmap pm;
-				pm=QPixmap::fromImage(it2->thumb);
-				col1Width = qMax(col1Width, pm.width());
-				cp->setIcon(pm);
-				FlagsSicht.append(cp);
-				connect(cp, SIGNAL(clicked()), this, SLOT(changedLayer()));
-				layerTable->setCellWidget(info->layerInfo.count()-counter-1, 0, cp);
+				QCheckBox *cp2 = new QCheckBox(it2->layerName, this);
+				cp2->setPalette(palette);
+				QPixmap pm2;
+				pm2=QPixmap::fromImage(it2->thumb_mask);
+				col2Width = qMax(col2Width, pm2.width());
+				cp2->setIcon(pm2);
+				connect(cp2, SIGNAL(clicked()), this, SLOT(changedLayer()));
+				layerTable->setCellWidget(info->layerInfo.count()-counter-1, 1, cp2);
 				if ((info->isRequest) && (info->RequestProps.contains(counter)))
-					cp->setChecked(info->RequestProps[counter].visible);
+					cp2->setChecked(info->RequestProps[counter].useMask);
 				else
-					cp->setChecked(!(it2->flags & 2));
-				if (!it2->thumb_mask.isNull())
-				{
-					QCheckBox *cp2 = new QCheckBox(it2->layerName, this);
-					cp2->setPalette(palette);
-					QPixmap pm2;
-					pm2=QPixmap::fromImage(it2->thumb_mask);
-					col2Width = qMax(col2Width, pm2.width());
-					cp2->setIcon(pm2);
-					connect(cp2, SIGNAL(clicked()), this, SLOT(changedLayer()));
-					layerTable->setCellWidget(info->layerInfo.count()-counter-1, 1, cp2);
-					if ((info->isRequest) && (info->RequestProps.contains(counter)))
-						cp2->setChecked(info->RequestProps[counter].useMask);
-					else
-						cp2->setChecked(true);
-					FlagsMask.append(cp2);
-				}
-				else
-					FlagsMask.append(0);
-				QTableWidgetItem *tW = new QTableWidgetItem(it2->layerName);
-				tW->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-				layerTable->setItem(info->layerInfo.count()-counter-1, 2, tW);
-				layerTable->setRowHeight(info->layerInfo.count()-counter-1, 40);
-				counter++;
+					cp2->setChecked(true);
+				FlagsMask.append(cp2);
 			}
+			else
+				FlagsMask.append(0);
+			QTableWidgetItem *tW = new QTableWidgetItem(it2->layerName);
+			tW->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+			layerTable->setItem(info->layerInfo.count()-counter-1, 2, tW);
+			layerTable->setRowHeight(info->layerInfo.count()-counter-1, 40);
+			counter++;
 		}
 		tabLayout->addWidget( layerTable );
 		layerTable->setColumnWidth(1, 24 + col2Width);
@@ -308,8 +313,9 @@
 		layerTable->selectionModel()->clearSelection();
 		opacitySpinBox->setEnabled(false);
 		blendMode->setEnabled(false);
+		connect(m_timer, SIGNAL(timeout()), this,  SLOT(changedLayer()));
 		connect(layerTable, SIGNAL(itemSelectionChanged()), this, SLOT(selLayer()));
-		connect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(changedLayer()));
+		connect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(delayedLayerChange()));
 		connect(blendMode, SIGNAL(activated(int)), this, SLOT(changedLayer()));
 	}
 }
@@ -426,6 +432,13 @@
 	}
 }
 
+void ExtImageProps::delayedLayerChange()
+{
+	if (m_timer->isActive())
+		m_timer->stop();
+	m_timer->start();
+}
+
 void ExtImageProps::selLayer()
 {
 	QModelIndexList selectedRows = layerTable->selectionModel()->selectedRows();
@@ -440,7 +453,7 @@
 	int selectedRow = selectedRows.at(0).row();
 	currentLayer = layerTable->rowCount() - selectedRow - 1;
 
-	disconnect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(changedLayer()));
+	disconnect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(delayedLayerChange()));
 	disconnect(blendMode, SIGNAL(activated(int)), this, SLOT(changedLayer()));
 	if ((currentItem->pixm.imgInfo.isRequest) && (currentItem->pixm.imgInfo.RequestProps.contains(currentLayer)))
 	{
@@ -454,7 +467,7 @@
 	}
 	opacitySpinBox->setEnabled(true);
 	blendMode->setEnabled(true);
-	connect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(changedLayer()));
+	connect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(delayedLayerChange()));
 	connect(blendMode, SIGNAL(activated(int)), this, SLOT(changedLayer()));
 }
 
Index: scribus/ui/extimageprops.h
===================================================================
--- scribus/ui/extimageprops.h	(revision 19527)
+++ scribus/ui/extimageprops.h	(working copy)
@@ -22,9 +22,11 @@
 class QListWidgetItem;
 class QPushButton;
 class QTableWidget;
+class QTimer;
 
 class ScribusView;
 class PageItem;
+
 #include "scribusapi.h"
 #include "scimage.h"
 
@@ -65,6 +67,7 @@
 	void leaveCancel();
 	void changePreview();
 	void changedLayer();
+	void delayedLayerChange();
 	void selLayer();
 	void selPath(QListWidgetItem *c);
 	void noPath();
@@ -76,6 +79,7 @@
 	QHBoxLayout* layout1;
 	QHBoxLayout* layoutBottom;
 
+	QTimer* m_timer;
 };
 
 #endif // EXTIMAGEPROPS_H
4648_opacity_change.diff (7,489 bytes)   

jghali

2014-09-23 13:14

administrator   ~0033827

I've uploaded a patch for trunk which should improve this issue particularly when using wheel or spinbox arrows. Would be happy if someone observing this issue could test.

jghali

2014-09-24 21:49

administrator   ~0033834

I have committed a improved version of the patch to 1.4.5svn and trunk. Please test.

christoph_s

2014-09-25 05:53

administrator   ~0033835

Fantastic, it works as it should now. Thanks a lot, Jean!

Issue History

Date Modified Username Field Change
2006-11-29 15:28 christoph_s New Issue
2006-11-29 17:11 fschmid Note Added: 0013635
2008-03-19 10:19 fschmid Status new => resolved
2008-03-19 10:19 fschmid Fixed in Version => 1.3.5svn
2008-03-19 10:19 fschmid Resolution open => fixed
2008-03-19 10:19 fschmid Assigned To => fschmid
2008-03-19 10:19 fschmid Note Added: 0019220
2008-03-20 01:58 christoph_s Status resolved => feedback
2008-03-20 01:58 christoph_s Resolution fixed => reopened
2008-03-20 01:58 christoph_s Note Added: 0019227
2008-03-20 09:29 fschmid Note Added: 0019229
2008-03-21 00:38 christoph_s Note Added: 0019245
2008-03-21 00:59 christoph_s Note Edited: 0019245
2009-08-25 12:56 aliB Note Added: 0022426
2014-09-18 18:55 Kunda Relationship added related to 0012652
2014-09-23 13:12 jghali File Added: 4648_opacity_change.diff
2014-09-23 13:14 jghali Note Added: 0033827
2014-09-24 21:49 jghali Note Added: 0033834
2014-09-25 05:52 christoph_s Status feedback => resolved
2014-09-25 05:52 christoph_s Resolution reopened => fixed
2014-09-25 05:52 christoph_s Assigned To fschmid => jghali
2014-09-25 05:53 christoph_s Note Added: 0033835
2014-09-25 05:53 christoph_s Status resolved => closed
2014-09-25 22:11 jghali Fixed in Version 1.3.5svn => 1.4.5.svn
2015-09-17 20:10 Kunda Category Graphics / Image Frames => Graphics/Img Frames
2015-09-17 20:11 Kunda Category Graphics/Img Frames => Graphics / Image Frames