void onSnapshotRequest(const lcm::ReceiveBuffer* iBuffer, const std::string& iChannel, const drc::map_snapshot_request_t* iMessage) { switch (iMessage->command) { case drc::map_snapshot_request_t::STORE: storeView(iMessage); break; case drc::map_snapshot_request_t::DELETE: deleteView(iMessage); break; case drc::map_snapshot_request_t::PUBLISH: publishView(iMessage); break; case drc::map_snapshot_request_t::UPDATE_TRANSFORM: updateTransform(iMessage); break; default: std::cout << "error: unknown snapshot command" << std::endl; break; } }
void KateViewManager::closeViews(KTextEditor::Document *doc) { QList<KTextEditor::View*> closeList; for ( QList<KTextEditor::View*>::const_iterator it = m_viewList.constBegin(); it != m_viewList.constEnd(); ++it) { if ( (*it)->document() == doc ) closeList.append( *it ); } while ( !closeList.isEmpty() ) deleteView( closeList.takeFirst(), true ); if (m_blockViewCreationAndActivation) return; QTimer::singleShot(0, this, SIGNAL(viewChanged())); }
void HandleViewList::deleteNode() { // Get the current item QTreeWidgetItem * current = m_viewListDock->m_viewTree->currentItem (); if (!current) { return; } switch ( current->type() ) { case DatasetItemType : deleteDataset( dynamic_cast<DatasetItem*>(current) ); break; case PipelineItemType : break; case ViewItemType : deleteView( dynamic_cast<ViewItem*>(current) ); break; } }
void ViewManager::initActions() { mActionSelectView = new KSelectAction(i18n("Select View"), 0, mCore->actionCollection(), "select_view"); #if KDE_VERSION >= 309 mActionSelectView->setMenuAccelsEnabled(false); #endif connect(mActionSelectView, SIGNAL(activated(const QString &)), SLOT(setActiveView(const QString &))); KAction *action; action = new KAction(i18n("Modify View..."), "configure", 0, this, SLOT(editView()), mCore->actionCollection(), "view_modify"); action->setWhatsThis( i18n("By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example.")); action = new KAction(i18n("Add View..."), "window_new", 0, this, SLOT(addView()), mCore->actionCollection(), "view_add"); action->setWhatsThis( i18n("You can add a new view by choosing one from the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views.")); mActionDeleteView = new KAction(i18n("Delete View"), "view_remove", 0, this, SLOT(deleteView()), mCore->actionCollection(), "view_delete"); mActionDeleteView->setWhatsThis(i18n("By pressing this button you can delete the actual view, which you have added before.")); action = new KAction(i18n("Refresh View"), "reload", 0, this, SLOT(refreshView()), mCore->actionCollection(), "view_refresh"); action->setWhatsThis(i18n("The view will be refreshed by pressing this button.")); action = new KAction(i18n("Edit &Filters..."), "filter", 0, this, SLOT(configureFilters()), mCore->actionCollection(), "options_edit_filters"); action->setWhatsThis(i18n("Edit the contact filters<p>You will be presented with a dialog, where you can add, remove and edit filters.")); }
void WindowProxy::BackgroundTask::operator()() { if (!window) return; unsigned command; while (!((command = sleep()) & Abort)) { try { if (!window->getWindowPtr()) { state = Init; continue; } // // Restart // if (command & Restart) { deleteView(); state = Init; } // A binding document does not need a view. if (window->isBindingDocumentWindow()) { state = Done; continue; } // // Cascade // if (!view || (command & Cascade)) { state = Cascading; recordTime("%*sselector matching begin", window->windowDepth * 2, ""); if (!view) view = new(std::nothrow) ViewCSSImp(window->getWindowPtr()); if (view) { view->constructComputedStyles(); state = Cascaded; } else state = Init; recordTime("%*sselector matching end", window->windowDepth * 2, ""); continue; } // // Layout // if (command & Layout) { state = Layouting; view->setSize(window->width, window->height); // TODO: sync with mainloop recordTime("%*sstyle recalculation begin", window->windowDepth * 2, ""); view->calculateComputedStyles(); recordTime("%*sstyle recalculation end", window->windowDepth * 2, ""); recordTime("%*sreflow begin", window->windowDepth * 2, ""); view->layOut(); recordTime("%*sreflow end", window->windowDepth * 2, ""); // Even though every view flag should have been cleared now, // check them here and clear all of them after dumping the tree. if (view->gatherFlags() & ~Box::NEED_REPAINT) { std::cerr << "warning: reflow flags are not fully cleared:\n"; int level = getLogLevel(); if (level < 3) setLogLevel(3); view->dump(); setLogLevel(level); view->clearFlags(); } view->setFlags(Box::NEED_REPAINT); } state = Done; } catch (const std::exception& e) { std::cerr << "WindowProxy::BackgroundTask: " << e.what() << "\n"; throw; // TODO: Recover from exceptions } } }
WindowProxy::BackgroundTask::~BackgroundTask() { deleteView(); }
void KateViewManager::removeViewSpace (KateViewSpace *viewspace) { // abort if viewspace is 0 if (!viewspace) return; // abort if this is the last viewspace if (m_viewSpaceList.count() < 2) return; // get current splitter QSplitter *currentSplitter = qobject_cast<QSplitter*>(viewspace->parentWidget()); // no splitter found, bah if (!currentSplitter) return; // delete views of the viewspace while (viewspace->viewCount() > 0 && viewspace->currentView()) { deleteView( viewspace->currentView(), false ); } // cu viewspace m_viewSpaceList.removeAt( m_viewSpaceList.indexOf( viewspace ) ); delete viewspace; // at this point, the splitter has exactly 1 child Q_ASSERT( currentSplitter->count() == 1 ); // if we are not the root splitter, move the child one level up and delete // the splitter then. if (currentSplitter != this) { // get parent splitter QSplitter *parentSplitter = qobject_cast<QSplitter*>(currentSplitter->parentWidget()); // only do magic if found ;) if (parentSplitter) { int index = parentSplitter->indexOf (currentSplitter); // save current splitter size, as the removal of currentSplitter looses the info QList<int> parentSizes = parentSplitter->sizes(); parentSplitter->insertWidget (index, currentSplitter->widget (0)); if (qVersion() == QLatin1String("4.6.2")) currentSplitter->hide(); // bug in Qt v4.6.2, prevents crash (bug:232140), line can be removed once we are sure that noone uses Qt 4.6.2 anymore. delete currentSplitter; // now restore the sizes again parentSplitter->setSizes(parentSizes); } } else if( QSplitter* splitter = qobject_cast<QSplitter*>(currentSplitter->widget(0)) ) { // we are the root splitter and have only one child, which is also a splitter // -> eliminate the redundant splitter and move both children into the root splitter QList<int> sizes = splitter->sizes(); // adapt splitter orientation to the splitter we are about to delete currentSplitter->setOrientation(splitter->orientation()); currentSplitter->addWidget( splitter->widget(0) ); currentSplitter->addWidget( splitter->widget(0) ); delete splitter; currentSplitter->setSizes( sizes ); } // find the view that is now active. KTextEditor::View* v = activeViewSpace()->currentView(); if ( v ) activateView( v ); updateViewSpaceActions (); emit viewChanged(); }