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