r19538 by jghali - some refactoring of extended image properties dialog

scribus-commit scribus-commit at lists.scribus.net
Wed Sep 24 22:20:32 UTC 2014


Author: jghali
Date: Wed Sep 24 22:20:32 2014
New Revision: 19538

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19538
Log:
some refactoring of extended image properties dialog

Modified:
    trunk/Scribus/scribus/ui/extimageprops.cpp
    trunk/Scribus/scribus/ui/extimageprops.h

Modified: trunk/Scribus/scribus/ui/extimageprops.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19538&path=/trunk/Scribus/scribus/ui/extimageprops.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/extimageprops.cpp (original)
+++ trunk/Scribus/scribus/ui/extimageprops.cpp Wed Sep 24 22:20:32 2014
@@ -50,7 +50,7 @@
 		m_timer->setSingleShot(true);
 		m_timer->setInterval(350);
 	}
-	currentItem = item;
+	m_item = item;
 	currentLayer = 0;
 	originalInfo = *info;
 	originalImageClip = item->imageClip.copy();
@@ -328,36 +328,36 @@
 	doPreview = false;
 	if (originalInfo.layerInfo.count() != 0)
 		changedLayer();
-	m_view->Doc->loadPict(currentItem->Pfile, currentItem, true);
+	m_view->Doc->loadPict(m_item->Pfile, m_item, true);
 	if (pathList->count() != 0)
 	{
 		QList<QListWidgetItem *>sel = pathList->selectedItems();
 		if (sel.count() != 0)
 		{
-			currentItem->imageClip = currentItem->pixm.imgInfo.PDSpathData[sel[0]->text()].copy();
-			currentItem->pixm.imgInfo.usedPath = sel[0]->text();
+			m_item->imageClip = m_item->pixm.imgInfo.PDSpathData[sel[0]->text()].copy();
+			m_item->pixm.imgInfo.usedPath = sel[0]->text();
 			QTransform cl;
-			cl.translate(currentItem->imageXOffset()*currentItem->imageXScale(), currentItem->imageYOffset()*currentItem->imageYScale());
-			cl.rotate(currentItem->imageRotation());
-			cl.scale(currentItem->imageXScale(), currentItem->imageYScale());
-			currentItem->imageClip.map(cl);
+			cl.translate(m_item->imageXOffset()*m_item->imageXScale(), m_item->imageYOffset()*m_item->imageYScale());
+			cl.rotate(m_item->imageRotation());
+			cl.scale(m_item->imageXScale(), m_item->imageYScale());
+			m_item->imageClip.map(cl);
 		}
 		else
 		{
-			currentItem->imageClip.resize(0);
-			currentItem->pixm.imgInfo.usedPath = "";
-		}
-	}
-	currentItem->update();
+			m_item->imageClip.resize(0);
+			m_item->pixm.imgInfo.usedPath = "";
+		}
+	}
+	m_item->update();
 	accept();
 }
 
 void ExtImageProps::leaveCancel()
 {
-	currentItem->pixm.imgInfo = originalInfo;
-	m_view->Doc->loadPict(currentItem->Pfile, currentItem, true);
-	currentItem->imageClip = originalImageClip.copy();
-	currentItem->update();
+	m_item->pixm.imgInfo = originalInfo;
+	m_view->Doc->loadPict(m_item->Pfile, m_item, true);
+	m_item->imageClip = originalImageClip.copy();
+	m_item->update();
 	reject();
 }
 
@@ -368,34 +368,34 @@
 	{
 		if (originalInfo.layerInfo.count() != 0)
 			changedLayer();
-		m_view->Doc->loadPict(currentItem->Pfile, currentItem, true);
+		m_view->Doc->loadPict(m_item->Pfile, m_item, true);
 		if (pathList->count() != 0)
 		{
 			QList<QListWidgetItem *>sel = pathList->selectedItems();
 			if (sel.count() != 0)
 			{
-				currentItem->imageClip = currentItem->pixm.imgInfo.PDSpathData[sel[0]->text()].copy();
-				currentItem->pixm.imgInfo.usedPath = sel[0]->text();
+				m_item->imageClip = m_item->pixm.imgInfo.PDSpathData[sel[0]->text()].copy();
+				m_item->pixm.imgInfo.usedPath = sel[0]->text();
 				QTransform cl;
-				cl.translate(currentItem->imageXOffset()*currentItem->imageXScale(), currentItem->imageYOffset()*currentItem->imageYScale());
-				cl.rotate(currentItem->imageRotation());
-				cl.scale(currentItem->imageXScale(), currentItem->imageYScale());
-				currentItem->imageClip.map(cl);
+				cl.translate(m_item->imageXOffset()*m_item->imageXScale(), m_item->imageYOffset()*m_item->imageYScale());
+				cl.rotate(m_item->imageRotation());
+				cl.scale(m_item->imageXScale(), m_item->imageYScale());
+				m_item->imageClip.map(cl);
 			}
 			else
 			{
-				currentItem->imageClip.resize(0);
-				currentItem->pixm.imgInfo.usedPath = "";
-			}
-		}
-		currentItem->update();
+				m_item->imageClip.resize(0);
+				m_item->pixm.imgInfo.usedPath = "";
+			}
+		}
+		m_item->update();
 	}
 	else
 	{
-		currentItem->pixm.imgInfo = originalInfo;
-		m_view->Doc->loadPict(currentItem->Pfile, currentItem, true);
-		currentItem->imageClip = originalImageClip.copy();
-		currentItem->update();
+		m_item->pixm.imgInfo = originalInfo;
+		m_view->Doc->loadPict(m_item->Pfile, m_item, true);
+		m_item->imageClip = originalImageClip.copy();
+		m_item->update();
 	}
 }
 
@@ -404,8 +404,8 @@
 	updateLayerInfo();
 	if (doPreview)
 	{
-		m_view->Doc->loadPict(currentItem->Pfile, currentItem, true);
-		currentItem->update();
+		m_view->Doc->loadPict(m_item->Pfile, m_item, true);
+		m_item->update();
 	}
 }
 
@@ -433,15 +433,15 @@
 
 	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)))
-	{
-		opacitySpinBox->setValue(qRound(currentItem->pixm.imgInfo.RequestProps[currentLayer].opacity / 255.0 * 100));
-		setCurrentComboItem(blendMode, blendModes[currentItem->pixm.imgInfo.RequestProps[currentLayer].blend]);
+	if ((m_item->pixm.imgInfo.isRequest) && (m_item->pixm.imgInfo.RequestProps.contains(currentLayer)))
+	{
+		opacitySpinBox->setValue(qRound(m_item->pixm.imgInfo.RequestProps[currentLayer].opacity / 255.0 * 100));
+		setCurrentComboItem(blendMode, blendModes[m_item->pixm.imgInfo.RequestProps[currentLayer].blend]);
 	}
 	else
 	{
-		opacitySpinBox->setValue(qRound(currentItem->pixm.imgInfo.layerInfo[currentLayer].opacity / 255.0 * 100));
-		setCurrentComboItem(blendMode, blendModes[currentItem->pixm.imgInfo.layerInfo[currentLayer].blend]);
+		opacitySpinBox->setValue(qRound(m_item->pixm.imgInfo.layerInfo[currentLayer].opacity / 255.0 * 100));
+		setCurrentComboItem(blendMode, blendModes[m_item->pixm.imgInfo.layerInfo[currentLayer].blend]);
 	}
 	opacitySpinBox->setEnabled(true);
 	blendMode->setEnabled(true);
@@ -452,7 +452,7 @@
 void ExtImageProps::updateLayerInfo()
 {
 	struct ImageLoadRequest loadingInfo;
-	bool isRequest = currentItem->pixm.imgInfo.isRequest;
+	bool isRequest = m_item->pixm.imgInfo.isRequest;
 	for (int r = 0; r < layerTable->rowCount(); ++r)
 	{
 		int layerIndex = layerTable->rowCount() - r - 1;
@@ -461,24 +461,24 @@
 			loadingInfo.blend = blendModesRev[blendMode->currentText()];
 			loadingInfo.opacity = qRound(opacitySpinBox->value() / 100.0 * 255);
 		}
-		else if ((isRequest) && (currentItem->pixm.imgInfo.RequestProps.contains(layerIndex)))
-		{
-			loadingInfo.blend = currentItem->pixm.imgInfo.RequestProps[layerIndex].blend;
-			loadingInfo.opacity = currentItem->pixm.imgInfo.RequestProps[layerIndex].opacity;
+		else if ((isRequest) && (m_item->pixm.imgInfo.RequestProps.contains(layerIndex)))
+		{
+			loadingInfo.blend = m_item->pixm.imgInfo.RequestProps[layerIndex].blend;
+			loadingInfo.opacity = m_item->pixm.imgInfo.RequestProps[layerIndex].opacity;
 		}
 		else
 		{
-			loadingInfo.blend = currentItem->pixm.imgInfo.layerInfo[layerIndex].blend;
-			loadingInfo.opacity = currentItem->pixm.imgInfo.layerInfo[layerIndex].opacity;
+			loadingInfo.blend = m_item->pixm.imgInfo.layerInfo[layerIndex].blend;
+			loadingInfo.opacity = m_item->pixm.imgInfo.layerInfo[layerIndex].opacity;
 		}
 		loadingInfo.visible = FlagsSicht.at(layerIndex)->isChecked();
 		if (FlagsMask.at(layerIndex))
 			loadingInfo.useMask = FlagsMask.at(layerIndex)->isChecked();
 		else
 			loadingInfo.useMask = true;
-		currentItem->pixm.imgInfo.RequestProps.insert(layerIndex, loadingInfo);
-	}
-	currentItem->pixm.imgInfo.isRequest = true;
+		m_item->pixm.imgInfo.RequestProps.insert(layerIndex, loadingInfo);
+	}
+	m_item->pixm.imgInfo.isRequest = true;
 }
 
 void ExtImageProps::noPath()
@@ -487,9 +487,9 @@
 	pathList->clearSelection();
 	if (doPreview)
 	{
-		currentItem->imageClip.resize(0);
-		currentItem->pixm.imgInfo.usedPath = "";
-		currentItem->update();
+		m_item->imageClip.resize(0);
+		m_item->pixm.imgInfo.usedPath = "";
+		m_item->update();
 	}
 	connect(pathList, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( selPath(QListWidgetItem*) ) );
 }
@@ -498,14 +498,14 @@
 {
 	if ((c != NULL) && (doPreview))
 	{
-		currentItem->imageClip = currentItem->pixm.imgInfo.PDSpathData[c->text()].copy();
-		currentItem->pixm.imgInfo.usedPath = c->text();
+		m_item->imageClip = m_item->pixm.imgInfo.PDSpathData[c->text()].copy();
+		m_item->pixm.imgInfo.usedPath = c->text();
 		QTransform cl;
-		cl.translate(currentItem->imageXOffset()*currentItem->imageXScale(), currentItem->imageYOffset()*currentItem->imageYScale());
-		cl.rotate(currentItem->imageRotation());
-		cl.scale(currentItem->imageXScale(), currentItem->imageYScale());
-		currentItem->imageClip.map(cl);
-		currentItem->update();
-	}
-}
-
+		cl.translate(m_item->imageXOffset()*m_item->imageXScale(), m_item->imageYOffset()*m_item->imageYScale());
+		cl.rotate(m_item->imageRotation());
+		cl.scale(m_item->imageXScale(), m_item->imageYScale());
+		m_item->imageClip.map(cl);
+		m_item->update();
+	}
+}
+

Modified: trunk/Scribus/scribus/ui/extimageprops.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19538&path=/trunk/Scribus/scribus/ui/extimageprops.h
==============================================================================
--- trunk/Scribus/scribus/ui/extimageprops.h (original)
+++ trunk/Scribus/scribus/ui/extimageprops.h Wed Sep 24 22:20:32 2014
@@ -38,6 +38,17 @@
 	ExtImageProps( QWidget* parent, ImageInfoRecord *info, PageItem *item, ScribusView *view );
 	~ExtImageProps() {};
 
+public slots:
+	void leaveOK();
+	void leaveCancel();
+	void changePreview();
+	void changedLayer();
+	void delayedLayerChange();
+	void selLayer();
+	void selPath(QListWidgetItem *c);
+	void noPath();
+
+protected:
 	QTabWidget* propsTab;
 	QWidget* tab;
 	QLabel* textLabel1;
@@ -53,8 +64,17 @@
 	QPushButton* cancelButton;
 	QList<QCheckBox*> FlagsSicht;
 	QList<QCheckBox*> FlagsMask;
+
+	QVBoxLayout* ExtImagePropsLayout;
+	QVBoxLayout* tabLayout;
+	QVBoxLayout* tabLayout_2;
+	QHBoxLayout* layout1;
+	QHBoxLayout* layoutBottom;
+
+	QTimer* m_timer;
 	ScribusView *m_view;
-	PageItem *currentItem;
+	PageItem *m_item;
+
 	int currentLayer;
 	bool doPreview;
 	ImageInfoRecord originalInfo;
@@ -62,25 +82,6 @@
 	QMap<QString, QString> blendModes;
 	QMap<QString, QString> blendModesRev;
 
-public slots:
-	void leaveOK();
-	void leaveCancel();
-	void changePreview();
-	void changedLayer();
-	void delayedLayerChange();
-	void selLayer();
-	void selPath(QListWidgetItem *c);
-	void noPath();
-
-protected:
-	QVBoxLayout* ExtImagePropsLayout;
-	QVBoxLayout* tabLayout;
-	QVBoxLayout* tabLayout_2;
-	QHBoxLayout* layout1;
-	QHBoxLayout* layoutBottom;
-
-	QTimer* m_timer;
-
 	void updateLayerInfo();
 };
 




More information about the scribus-commit mailing list