[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita
From: Sven Langkamp <sven.langkamp () gmail ! com>
Date: 2010-09-19 14:29:12
Message-ID: 20100919142912.24AB9AC7CB () svn ! kde ! org
[Download RAW message or body]
SVN commit 1177121 by langkamp:
fix update of previews in layerbox
BUG:220179
M +3 -1 image/kis_base_node.cpp
M +6 -1 image/kis_base_node.h
M +4 -0 image/kis_image.cc
M +6 -0 image/kis_image.h
M +8 -0 image/kis_node.cpp
M +2 -0 image/kis_node.h
M +5 -0 image/kis_node_graph_listener.h
M +4 -0 image/tests/kis_node_facade_test.cpp
M +3 -0 image/tests/kis_node_test.cpp
M +1 -1 plugins/tools/defaulttools/kis_tool_gradient.cc
M +27 -0 ui/kis_node_model.cpp
M +4 -0 ui/kis_node_model.h
--- trunk/koffice/krita/image/kis_base_node.cpp #1177120:1177121
@@ -195,11 +195,13 @@
return m_d->systemLocked;
}
-void KisBaseNode::setSystemLocked(bool locked)
+void KisBaseNode::setSystemLocked(bool locked, bool update)
{
m_d->systemLocked = locked;
+ if (update) {
emit(systemLockingChanged(locked));
}
+}
bool KisBaseNode::isEditable() const
{
--- trunk/koffice/krita/image/kis_base_node.h #1177120:1177121
@@ -275,8 +275,13 @@
* Set the locked status of this node. System Locked nodes indicates
* that an algorithm is processing them and that an other
* algorithm need to wait before accessing it.
+ *
+ * A KisNode will update the layer model when the lock is released.
+ *
+ * @param l lock state
+ * @param update set false if the tools shouldn't be locked
*/
- void setSystemLocked(bool l);
+ virtual void setSystemLocked(bool l, bool update = true);
/**
* @return true if the node can be edited: if it's visible and neither locked
--- trunk/koffice/krita/image/kis_image.cc #1177120:1177121
@@ -213,6 +213,10 @@
emit sigNodeHasBeenMoved(parent, oldIndex, newIndex);
}
+void KisImage::nodeChanged(KisNode* node)
+{
+ emit sigNodeChanged(node);
+}
KisSelectionSP KisImage::globalSelection() const
{
--- trunk/koffice/krita/image/kis_image.h #1177120:1177121
@@ -74,6 +74,7 @@
void nodeHasBeenRemoved(KisNode *parent, int index);
void aboutToMoveNode(KisNode * parent, int oldIndex, int newIndex);
void nodeHasBeenMoved(KisNode * parent, int oldIndex, int newIndex);
+ void nodeChanged(KisNode * node);
public:
@@ -526,6 +527,11 @@
*/
void sigNodeHasBeenMoved(KisNode *parent, int oldIndex, int newIndex);
+ /**
+ * Inform the model that a node was changed
+ */
+ void sigNodeChanged(KisNode * node);
+
public slots:
void slotProjectionUpdated(const QRect & rc);
--- trunk/koffice/krita/image/kis_node.cpp #1177120:1177121
@@ -103,6 +103,14 @@
return rect;
}
+void KisNode::setSystemLocked(bool l, bool update)
+{
+ KisBaseNode::setSystemLocked(l, update);
+ if (!l && m_d->graphListener) {
+ m_d->graphListener->nodeChanged(this);
+ }
+}
+
bool KisNode::accept(KisNodeVisitor &v)
{
return v.visit(this);
--- trunk/koffice/krita/image/kis_node.h #1177120:1177121
@@ -124,6 +124,8 @@
*/
virtual QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) \
const;
+ virtual void setSystemLocked(bool l, bool update = true);
+
public: // Graph methods
/**
--- trunk/koffice/krita/image/kis_node_graph_listener.h #1177120:1177121
@@ -69,6 +69,11 @@
* removed and added successfully
*/
virtual void nodeHasBeenMoved(KisNode * parent, int oldIndex, int newIndex) = 0;
+
+ /**
+ * Inform the model that a node has been changed (setDirty)
+ */
+ virtual void nodeChanged(KisNode * node) = 0;
};
#endif
--- trunk/koffice/krita/image/tests/kis_node_facade_test.cpp #1177120:1177121
@@ -56,7 +56,11 @@
afterMove = true;
}
+ virtual void nodeChanged(KisNode* node) {
+ }
+
+
bool beforeInsertRow;
bool afterInsertRow;
bool beforeRemoveRow;
--- trunk/koffice/krita/image/tests/kis_node_test.cpp #1177120:1177121
@@ -53,7 +53,10 @@
afterMove = true;
}
+ virtual void nodeChanged(KisNode* node) {
+ }
+
bool beforeInsertRow;
bool afterInsertRow;
bool beforeRemoveRow;
--- trunk/koffice/krita/plugins/tools/defaulttools/kis_tool_gradient.cc \
#1177120:1177121 @@ -241,7 +241,7 @@
if (m_dragging && e->button() == Qt::LeftButton) {
- currentNode()->setSystemLocked(true);
+ currentNode()->setSystemLocked(true, false);
#if defined(HAVE_OPENGL) && defined(HAVE_GLEW)
delete m_gradientProgram;
--- trunk/koffice/krita/ui/kis_node_model.cpp #1177120:1177121
@@ -36,12 +36,15 @@
#include "kis_config.h"
#include "kis_config_notifier.h"
+#include <QTimer>
class KisNodeModel::Private
{
public:
KisImageWSP image;
bool showRootLayer;
+ QList<KisNode*> updateQueue;
+ QTimer* updateTimer;
};
KisNodeModel::KisNodeModel(QObject * parent)
@@ -50,6 +53,8 @@
{
updateSettings();
connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), this, \
SLOT(updateSettings())); + m_d->updateTimer = new QTimer(this);
+ connect(m_d->updateTimer, SIGNAL(timeout()), SLOT(updateNodes()));
}
KisNodeModel::~KisNodeModel()
@@ -74,6 +79,8 @@
SLOT(beginRemoveNodes(KisNode*, int)));
connect(m_d->image, SIGNAL(sigNodeHasBeenRemoved(KisNode*, int)),
SLOT(endRemoveNodes(KisNode*, int)));
+ connect(m_d->image, SIGNAL(sigNodeChanged(KisNode*)),
+ SLOT(nodeChanged(KisNode*)));
}
KisNodeSP KisNodeModel::nodeFromIndex(const QModelIndex &index)
@@ -354,6 +361,9 @@
void KisNodeModel::beginRemoveNodes(KisNode * parent, int index)
{
+ m_d->updateTimer->stop();
+ m_d->updateQueue.clear();
+
//dbgUI <<"KisNodeModel::beginRemoveNodes parent=" << parent << ", index=" << \
index;
beginRemoveRows(indexFromNode(parent), parent->childCount() - 1 - index, \
parent->childCount() - 1 - index); }
@@ -475,5 +485,22 @@
reset();
}
+void KisNodeModel::nodeChanged(KisNode* node)
+{
+ if (!m_d->updateQueue.contains(node)) {
+ m_d->updateQueue.append(node);
+ }
+ m_d->updateTimer->start(1000);
+}
+void KisNodeModel::updateNodes()
+{
+ foreach(KisNode * node, m_d->updateQueue) {
+ QModelIndex index = indexFromNode(node);
+ emit dataChanged(index, index);
+ }
+ m_d->updateTimer->stop();
+ m_d->updateQueue.clear();
+}
+
#include "kis_node_model.moc"
--- trunk/koffice/krita/ui/kis_node_model.h #1177120:1177121
@@ -78,6 +78,10 @@
void updateSettings();
void progressPercentageChanged(int, const KisNodeSP);
void layersChanged();
+ void nodeChanged(KisNode * node);
+
+ void updateNodes();
+
private:
class Private;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic