void RenderView::removeDataObject(DataObject * dataObject) { AbstractVisualizedData * renderedData = m_dataObjectToVisualization.value(dataObject, nullptr); // for the case that we are currently loading this object m_deletedData << dataObject; // we didn't render this object if (!renderedData) { return; } implementation().removeContent(renderedData, 0); emit beforeDeleteVisualizations({ renderedData }); auto toDelete = removeFromInternalLists({ dataObject }); updateGuiForRemovedData(); implementation().renderViewContentsChanged(); emit visualizationsChanged(); render(); toDelete.clear(); m_deletedData.clear(); }
void RenderView::hideDataObjectsImpl(const QList<DataObject *> & dataObjects, int /*suViewIndex*/) { bool changed = false; for (auto dataObject : dataObjects) { auto rendered = m_dataObjectToVisualization.value(dataObject); if (!rendered) { continue; } // cached data is only accessible internally in the view, so let others know that it's gone for the moment emit beforeDeleteVisualizations({ rendered }); // move data to cache if it isn't already invisible auto contentsIt = findUnique(m_contents, rendered); if (contentsIt != m_contents.end()) { m_contentCache.push_back(std::move(*contentsIt)); m_contents.erase(contentsIt); rendered->setVisible(false); changed = true; } assert(!containsUnique(m_contents, (AbstractVisualizedData*)nullptr)); } if (!changed) { return; } resetFriendlyName(); updateGuiForRemovedData(); implementation().renderViewContentsChanged(); emit visualizationsChanged(); render(); }
SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : QMainWindow(parent) , fCentralSplitter(this) , fStatusBar(this) , fToolBar(this) , fActionOpen(this) , fActionBreakpoint(this) , fActionCancel(this) , fActionClearBreakpoints(this) , fActionClearDeletes(this) , fActionClose(this) , fActionCreateBreakpoint(this) , fActionDelete(this) , fActionDirectory(this) , fActionGoToLine(this) , fActionInspector(this) , fActionSettings(this) , fActionPlay(this) , fActionPause(this) , fActionRewind(this) , fActionSave(this) , fActionSaveAs(this) , fActionShowDeletes(this) , fActionStepBack(this) , fActionStepForward(this) , fActionZoomIn(this) , fActionZoomOut(this) , fMapper(this) , fListWidget(&fCentralSplitter) , fDirectoryWidget(&fCentralSplitter) , fCanvasWidget(this, &fDebugger) , fDrawCommandGeometryWidget(&fDebugger) , fMenuBar(this) , fMenuFile(this) , fMenuNavigate(this) , fMenuView(this) , fLoading(false) { setupUi(this); fListWidget.setSelectionMode(QAbstractItemView::ExtendedSelection); connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(updateDrawCommandInfo())); connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile())); connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory())); connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(loadFile(QListWidgetItem *))); connect(&fDirectoryWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(populateDirectoryWidget())); connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete())); connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(toggleBreakpoint())); connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind())); connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay())); connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack())); connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForward())); connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoints())); connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector())); connect(&fActionSettings, SIGNAL(triggered()), this, SLOT(actionSettings())); connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QString))); connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel())); connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClearBreakpoints())); connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDeletes())); connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose())); #if SK_SUPPORT_GPU connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLSettingsChanged())); #endif connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(actionRasterSettingsChanged())); connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(actionVisualizationsChanged())); connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(actionTextureFilter())); connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool))); connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBreakpoint())); connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(int))); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int))); connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(actionScale(float))); connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand); fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand); connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int))); fViewStateFrame.setDisabled(true); fInspectorWidget.setDisabled(true); fMenuEdit.setDisabled(true); fMenuNavigate.setDisabled(true); fMenuView.setDisabled(true); }
void RenderView::showDataObjectsImpl(const QList<DataObject *> & uncheckedDataObjects, QList<DataObject *> & incompatibleObjects, unsigned int /*subViewIndex*/) { if (uncheckedDataObjects.isEmpty()) { return; } const bool wasEmpty = m_contents.empty(); if (wasEmpty) { updateImplementation(uncheckedDataObjects); } AbstractVisualizedData * aNewObject = nullptr; const auto && dataObjects = implementation().filterCompatibleObjects(uncheckedDataObjects, incompatibleObjects); if (dataObjects.isEmpty()) { return; } for (auto dataObject : dataObjects) { auto previouslyRendered = m_dataObjectToVisualization.value(dataObject); // create new rendered representation if (!previouslyRendered) { aNewObject = addDataObject(dataObject); if (m_closingRequested) // just abort here, if we processed a close event while addDataObject() { return; } continue; } // reuse currently rendered / cached data auto contensIt = findUnique(m_contents, previouslyRendered); if (contensIt != m_contents.end()) { continue; } aNewObject = previouslyRendered; auto cacheIt = findUnique(m_contentCache, previouslyRendered); m_contents.push_back(std::move(*cacheIt)); m_contentCache.erase(cacheIt); previouslyRendered->setVisible(true); } if (aNewObject) { implementation().renderViewContentsChanged(); updateGuiForSelectedData(aNewObject); emit visualizationsChanged(); } if (aNewObject) { implementation().resetCamera(wasEmpty, 0); } resetFriendlyName(); updateTitle(); }