r19539 by jghali - some refactoring of extended image properties dialog
scribus-commit
scribus-commit at lists.scribus.net
Wed Sep 24 22:21:55 UTC 2014
Author: jghali
Date: Wed Sep 24 22:21:54 2014
New Revision: 19539
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19539
Log:
some refactoring of extended image properties dialog
Modified:
branches/Version14x/Scribus/scribus/extimageprops.cpp
branches/Version14x/Scribus/scribus/extimageprops.h
Modified: branches/Version14x/Scribus/scribus/extimageprops.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19539&path=/branches/Version14x/Scribus/scribus/extimageprops.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/extimageprops.cpp (original)
+++ branches/Version14x/Scribus/scribus/extimageprops.cpp Wed Sep 24 22:21:54 2014
@@ -42,7 +42,7 @@
ExtImagePropsLayout = new QVBoxLayout( this );
ExtImagePropsLayout->setMargin(6);
ExtImagePropsLayout->setSpacing(6);
- viewWidget = view;
+ m_view = view;
m_timer = 0;
if (info->layerInfo.count() != 0)
{
@@ -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();
@@ -319,35 +319,35 @@
doPreview = false;
if (originalInfo.layerInfo.count() != 0)
changedLayer();
- viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
+ m_view->Doc->LoadPict(m_item->Pfile, m_item->ItemNr, 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();
QMatrix cl;
- cl.translate(currentItem->imageXOffset()*currentItem->imageXScale(), currentItem->imageYOffset()*currentItem->imageYScale());
- 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.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;
- viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
- currentItem->imageClip = originalImageClip.copy();
- currentItem->update();
+ m_item->pixm.imgInfo = originalInfo;
+ m_view->Doc->LoadPict(m_item->Pfile, m_item->ItemNr, true);
+ m_item->imageClip = originalImageClip.copy();
+ m_item->update();
reject();
}
@@ -358,33 +358,33 @@
{
if (originalInfo.layerInfo.count() != 0)
changedLayer();
- viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
+ m_view->Doc->LoadPict(m_item->Pfile, m_item->ItemNr, 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();
QMatrix cl;
- cl.translate(currentItem->imageXOffset()*currentItem->imageXScale(), currentItem->imageYOffset()*currentItem->imageYScale());
- 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.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;
- viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
- currentItem->imageClip = originalImageClip.copy();
- currentItem->update();
+ m_item->pixm.imgInfo = originalInfo;
+ m_view->Doc->LoadPict(m_item->Pfile, m_item->ItemNr, true);
+ m_item->imageClip = originalImageClip.copy();
+ m_item->update();
}
}
@@ -393,8 +393,8 @@
updateLayerInfo();
if (doPreview)
{
- viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
- currentItem->update();
+ m_view->Doc->LoadPict(m_item->Pfile, m_item->ItemNr, true);
+ m_item->update();
}
}
@@ -422,15 +422,15 @@
disconnect(opacitySpinBox, SIGNAL(valueChanged(int)), 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);
@@ -442,7 +442,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;
@@ -451,24 +451,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()
@@ -477,9 +477,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*) ) );
}
@@ -488,13 +488,13 @@
{
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();
QMatrix cl;
- cl.translate(currentItem->imageXOffset()*currentItem->imageXScale(), currentItem->imageYOffset()*currentItem->imageYScale());
- 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.scale(m_item->imageXScale(), m_item->imageYScale());
+ m_item->imageClip.map(cl);
+ m_item->update();
+ }
+}
+
Modified: branches/Version14x/Scribus/scribus/extimageprops.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19539&path=/branches/Version14x/Scribus/scribus/extimageprops.h
==============================================================================
--- branches/Version14x/Scribus/scribus/extimageprops.h (original)
+++ branches/Version14x/Scribus/scribus/extimageprops.h Wed Sep 24 22:21:54 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;
- ScribusView *viewWidget;
- PageItem *currentItem;
+
+ QVBoxLayout* ExtImagePropsLayout;
+ QVBoxLayout* tabLayout;
+ QVBoxLayout* tabLayout_2;
+ QHBoxLayout* layout1;
+ QHBoxLayout* layoutBottom;
+
+ QTimer* m_timer;
+ ScribusView *m_view;
+ 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