void KisDummiesFacadeBase::setImage(KisImageWSP image) { if (m_d->image) { emit sigActivateNode(0); m_d->image->disconnect(this); KisNodeDummy *rootDummy = this->rootDummy(); if(rootDummy) { slotRemoveNode(rootDummy->node()); } } m_d->image = image; if (image) { slotNodeAdded(image->root()); connect(image, SIGNAL(sigNodeAddedAsync(KisNodeSP)), SLOT(slotNodeAdded(KisNodeSP)), Qt::DirectConnection); connect(image, SIGNAL(sigRemoveNodeAsync(KisNodeSP)), SLOT(slotRemoveNode(KisNodeSP)), Qt::DirectConnection); connect(image, SIGNAL(sigLayersChangedAsync()), SLOT(slotLayersChanged()), Qt::DirectConnection); connect(image, SIGNAL(sigNodeChanged(KisNodeSP)), SLOT(slotNodeChanged(KisNodeSP))); connect(image, SIGNAL(sigNodeAddedAsync(KisNodeSP)), SLOT(slotNodeActivationRequested(KisNodeSP)), Qt::AutoConnection); emit sigActivateNode(findFirstLayer(image->root())); } }
void KisDummiesFacadeBase::slotRemoveNode(KisNodeSP node) { KisNodeSP childNode = node->lastChild(); while (childNode) { slotRemoveNode(childNode); childNode = childNode->prevSibling(); } emit sigContinueRemoveNode(node); }
/** * Class constructor. * @param pParent The parent widget * @param szName The widget's name */ GraphWidget::GraphWidget(QWidget* pParent, const char* szName) : QCanvasView(pParent, szName), m_progress(this), m_dot(this), m_dZoom(1.0), m_nMaxNodeDegree(10), // will be overriden by CallTreeDlg m_nMultiCallNum(0), m_pProgressDlg(NULL) { // Automatically delete nodes when they are removed m_dictNodes.setAutoDelete(true); // Create a canvas setCanvas(new QCanvas(this)); canvas()->setBackgroundColor(Config().getColor(KScopeConfig::GraphBack)); // Create a persistent Cscope process m_pCscope = new CscopeFrontend(); // Add records output by the Cscope process connect(m_pCscope, SIGNAL(dataReady(FrontendToken*)), this, SLOT(slotDataReady(FrontendToken*))); // Display query progress information connect(m_pCscope, SIGNAL(progress(int, int)), this, SLOT(slotProgress(int, int))); // Draw the graph when the process has finished connect(m_pCscope, SIGNAL(finished(uint)), this, SLOT(slotFinished(uint))); // Show a multi-call node when a query results in too many records connect(m_pCscope, SIGNAL(aborted()), this, SLOT(slotAborted())); // Redraw the graph when Dot exits connect(&m_dot, SIGNAL(finished(uint)), this, SLOT(slotDotFinished())); // Create the node popup menu m_pNodePopup = new QPopupMenu(this); m_pNodePopup->insertItem(new MenuLabel(i18n("<b>Called Functions</b>"), m_pNodePopup)); m_pNodePopup->insertItem(i18n("Show"), this, SLOT(slotShowCalled())); m_pNodePopup->insertItem(i18n("List/Filter..."), this, SLOT(slotListCalled())); m_pNodePopup->insertItem(i18n("Hide"), this, SLOT(slotHideCalled())); m_pNodePopup->insertItem(new MenuLabel(i18n("<b>Calling Functions</b>"), m_pNodePopup)); m_pNodePopup->insertItem(i18n("Show"), this, SLOT(slotShowCalling())); m_pNodePopup->insertItem(i18n("List/Filter..."), this, SLOT(slotListCalling())); m_pNodePopup->insertItem(i18n("Hide"), this, SLOT(slotHideCalling())); m_pNodePopup->insertItem(new MenuLabel(i18n("<b>This Function</b>"), m_pNodePopup)); m_pNodePopup->insertItem(i18n("Find Definition"), this, SLOT(slotFindDef())); m_pNodePopup->insertItem(i18n("Remove"), this, SLOT(slotRemoveNode())); // Create the multi-call node popup menu m_pMultiCallPopup = new QPopupMenu(this); m_pMultiCallPopup->insertItem(i18n("List..."), this, SLOT(slotMultiCallDetails())); m_pMultiCallPopup->insertSeparator(); m_pMultiCallPopup->insertItem(i18n("Remove"), this, SLOT(slotRemoveNode())); // Create the edge menu m_pEdgePopup = new QPopupMenu(this); m_pEdgePopup->insertItem(i18n("Open Call"), this, SLOT(slotOpenCall())); (void)new GraphTip(this); }