File indexing completed on 2024-05-12 15:58:22
0001 /* 0002 * SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __KIS_IMAGE_SIGNAL_ROUTER_H 0008 #define __KIS_IMAGE_SIGNAL_ROUTER_H 0009 0010 #include <QObject> 0011 #include "KisImageSignals.h" 0012 0013 class KoColorSpace; 0014 class KoColorProfile; 0015 0016 0017 class KRITAIMAGE_EXPORT KisImageSignalRouter : public QObject 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 KisImageSignalRouter(KisImageWSP image); 0023 ~KisImageSignalRouter() override; 0024 0025 void emitNotification(KisImageSignalType type); 0026 void emitNotifications(KisImageSignalVector notifications); 0027 0028 void emitNodeChanged(KisNodeSP node); 0029 void emitNodeHasBeenAdded(KisNode *parent, int index); 0030 void emitAboutToRemoveANode(KisNode *parent, int index); 0031 0032 void emitRequestLodPlanesSyncBlocked(bool value); 0033 void emitNotifyBatchUpdateStarted(); 0034 void emitNotifyBatchUpdateEnded(); 0035 0036 public Q_SLOTS: 0037 void emitImageModifiedNotification(); 0038 0039 private Q_SLOTS: 0040 void slotNotification(KisImageSignalType type); 0041 0042 Q_SIGNALS: 0043 0044 void sigNotification(KisImageSignalType type); 0045 0046 /** 0047 * Emitted whenever the image wants to update Lod0 plane of the canvas. Blocking 0048 * syncing effectively means that the canvas will not try to read from these planes 0049 * until the **all** the data is loaded. Otherwise the user will see weird flickering 0050 * because of partially loaded lod0 tiles. 0051 * 0052 * NOTE: while the sync is blockes, the canvas is considered to use LodN planes 0053 * that are expected to contain valid data. 0054 */ 0055 void sigRequestLodPlanesSyncBlocked(bool value); 0056 0057 /** 0058 * Emitted whenever the image is going to issue a lot of canvas update signals and 0059 * it is a good idea to group then and rerender the canvas in one go. The canvas 0060 * should initiate new rerenders while the batch is in progress. 0061 * 0062 * NOTE: even though the batched updates will not initiate a rerender, it does 0063 * **not** guarantee that there will be processed during the batch. The 0064 * updates may come from other sources, e.g. from mouse moves. 0065 * 0066 * NOTE: this feature is used to avoid flickering when switching 0067 * back from lodN plane back to lod0. All the texture tiles should 0068 * be loaded with new information before mipmaps can be regenerated. 0069 */ 0070 void sigNotifyBatchUpdateStarted(); 0071 0072 /** 0073 * \see sigNotifyBatchUpdateStarted() 0074 */ 0075 void sigNotifyBatchUpdateEnded(); 0076 0077 // Notifications 0078 void sigImageModified(); 0079 void sigImageModifiedWithoutUndo(); 0080 0081 void sigSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint); 0082 void sigProfileChanged(const KoColorProfile * profile); 0083 void sigColorSpaceChanged(const KoColorSpace* cs); 0084 void sigResolutionChanged(double xRes, double yRes); 0085 void sigRequestNodeReselection(KisNodeSP activeNode, const KisNodeList &selectedNodes); 0086 0087 // Graph change signals 0088 void sigNodeChanged(KisNodeSP node); 0089 void sigNodeAddedAsync(KisNodeSP node); 0090 void sigRemoveNodeAsync(KisNodeSP node); 0091 void sigLayersChangedAsync(); 0092 0093 private: 0094 KisImageWSP m_image; 0095 }; 0096 0097 #endif /* __KIS_IMAGE_SIGNAL_ROUTER_H */