Exemple #1
0
void ViewManager::detachActiveView()
{
    // find the currently active view and remove it from its container
    ViewContainer* container = _viewSplitter->activeContainer();

    detachView(container, container->activeView());
}
Exemple #2
0
void ViewManager::detachActiveView()
{
    // find the currently active view and remove it from its container
    ViewContainer* container = _viewSplitter->activeContainer();
    TerminalDisplay* activeView = dynamic_cast<TerminalDisplay*>(container->activeView());

    if (!activeView)
        return;

    emit viewDetached(_sessionMap[activeView]);

    _sessionMap.remove(activeView);

    // remove the view from this window
    container->removeView(activeView);
    activeView->deleteLater();

    // if the container from which the view was removed is now empty then it can be deleted,
    // unless it is the only container in the window, in which case it is left empty
    // so that there is always an active container
    if ( _viewSplitter->containers().count() > 1 &&
            container->views().count() == 0 )
    {
        removeContainer(container);
    }

}
Exemple #3
0
void ViewManager::moveActiveViewRight()
{
    kDebug() << "Moving active view to the right";
    ViewContainer* container = _viewSplitter->activeContainer();
    Q_ASSERT( container );
    container->moveActiveView( ViewContainer::MoveViewRight );
}
    void ServerGroupDialog::editIdentity()
    {
        QPointer<IdentityDialog> dlg = new IdentityDialog(this);
        dlg->setCurrentIdentity(m_mainWidget->m_identityCBox->currentIndex());

        if(dlg->exec() == KDialog::Accepted)
        {
            IdentityList identities = Preferences::identityList();
            m_mainWidget->m_identityCBox->clear();

            for(IdentityList::ConstIterator it = identities.constBegin(); it != identities.constEnd(); ++it)
            {
                m_mainWidget->m_identityCBox->addItem((*it)->getName());
            }

            const int i = m_mainWidget->m_identityCBox->findText(dlg->currentIdentity()->getName());
            if (i != -1)
            {
                m_mainWidget->m_identityCBox->setCurrentIndex(i);
            }
            else
            {
                m_mainWidget->m_identityCBox->setItemText(m_mainWidget->m_identityCBox->currentIndex(), dlg->currentIdentity()->getName());
            }

            m_identitiesNeedsUpdate = true; // and what's this for?
            ViewContainer* vc = Application::instance()->getMainWindow()->getViewContainer();
            vc->updateViewEncoding(vc->getFrontView());
        }
        delete dlg;
    }
void
StatisticsFilter::DependSources( const Context& ioContext ) const
{
  const ParamRef& VisualizeViews = Parameter( "VisualizeViews" );
  ViewContainer visViews;
  string OutputView = Parameter( "OutputView" );
  for( size_t i = 0; i < ioContext.views->size(); ++i )
  {
    ViewSource* pView = ( *ioContext.views )[i];
    if( pView->Name() == OutputView )
      *ioContext.outputView = pView;
    for( int i = 0; i < VisualizeViews->NumValues(); ++i )
      if( WildcardMatch( VisualizeViews( i ), pView->Name() ) )
        visViews.push_back( pView );
  }
  if( *ioContext.outputView == NULL && !OutputView.empty() )
    bcierr << "No view name matches the OutputView parameter: " << OutputView << endl;
  if( visViews.empty() && VisualizeViews->NumValues() > 0 )
    bciout << "No view name matches any of the pattern(s) specified in the VisualizeViews parameter" << endl;
  *ioContext.views = visViews;
  if( *ioContext.outputView )
    ( *ioContext.outputView )->Depends( ioContext, *ioContext.dependencies );
  for( size_t i = 0; i < ioContext.views->size(); ++i )
    ( *ioContext.views )[i]->Depends( ioContext, *ioContext.dependencies );
}
Exemple #6
0
ViewContainer* ViewSplitter::activeContainer() const
{
    if (QWidget* focusW = focusWidget()) {
        ViewContainer* focusContainer = 0;

        while (focusW != 0) {
            QListIterator<ViewContainer*> containerIter(_containers);
            while (containerIter.hasNext()) {
                ViewContainer* nextContainer = containerIter.next();

                if (nextContainer->containerWidget() == focusW) {
                    focusContainer = nextContainer;
                    break;
                }
            }
            focusW = focusW->parentWidget();
        }

        if (focusContainer)
            return focusContainer;
    }

    QList<ViewSplitter*> splitters = findChildren<ViewSplitter*>();

    if (splitters.count() > 0) {
        return splitters.last()->activeContainer();
    } else {
        if (_containers.count() > 0)
            return _containers.last();
        else
            return 0;
    }
}
Exemple #7
0
void ViewManager::lastView()
{
    ViewContainer* container = _viewSplitter->activeContainer();

    Q_ASSERT(container);

    container->activateLastView();
}
Exemple #8
0
void ViewManager::previousView()
{
    ViewContainer* container = _viewSplitter->activeContainer();

    Q_ASSERT(container);

    container->activatePreviousView();
}
Exemple #9
0
QWidget* ViewManager::activeView() const
{
    ViewContainer* container = _viewSplitter->activeContainer();
    if (container) {
        return container->activeView();
    } else {
        return 0;
    }
}
Exemple #10
0
void ViewManager::switchToView(int index)
{
    Q_ASSERT(index >= 0);
    ViewContainer* container = _viewSplitter->activeContainer();
    Q_ASSERT(container);
    QList<QWidget*> containerViews = container->views();
    if (index >= containerViews.count())
        return;
    container->setActiveView(containerViews.at(index));
}
Exemple #11
0
Document* DocManager::openURL( const KURL &url, ViewArea *viewArea )
{
	if ( url.isEmpty() ) return 0;
	
	if ( url.isLocalFile() )
	{
		QFile file(url.path());
		if ( file.open(IO_ReadOnly) == false )
		{
			KMessageBox::sorry( 0l, i18n("Could not open '%1'").arg( url.prettyURL() ) );
			return 0l;
		}
		file.close();
	}
	
	// If the currently active view area is empty, and we were not given a view area
	// to open into, then use the empty view area
	if ( !viewArea )
	{
		ViewContainer * currentVC = static_cast<ViewContainer*>( KTechlab::self()->tabWidget()->currentPage() );
		if ( currentVC )
		{
			ViewArea * va = currentVC->viewArea( currentVC->activeViewArea() );
			if ( !va->view() )
				viewArea = va;
		}
	}
	
	// If the document is already open, and a specific view area hasn't been
	// specified, then just return that document - otherwise, create a new
	// view in the viewarea
	Document *document = findDocument(url);
	if ( document ) {
		if ( viewArea )
			createNewView( document, viewArea );
		else	giveDocumentFocus( document, viewArea );
		return document;
	}
	
	QString fileName = url.fileName();
	QString extension = fileName.right( fileName.length() - fileName.findRev('.') );
	
	if ( extension == ".circuit" )
		return openCircuitFile( url, viewArea );
	else if ( extension == ".flowcode" )
		return openFlowCodeFile( url, viewArea );
	else if ( extension == ".mechanics" )
		return openMechanicsFile( url, viewArea );
	else	return openTextFile( url, viewArea );
}
Exemple #12
0
void ViewManager::focusActiveView()
{
    // give the active view in a container the focus.  this ensures
    // that controller associated with that view is activated and the session-specific
    // menu items are replaced with the ones for the newly focused view

    // see the viewFocused() method

    ViewContainer* container = _viewSplitter->activeContainer();
    if (container) {
        QWidget* activeView = container->activeView();
        if (activeView) {
            activeView->setFocus(Qt::MouseFocusReason);
        }
    }
}
Exemple #13
0
void DocManager::slotViewFocused( View *view )
{
	ViewContainer * vc = static_cast<ViewContainer*>(KTechlab::self()->tabWidget()->currentWidget());
	if (!vc)
		view = 0l;
	
	if (!view)
		return;
	
	// This function can get called with a view that is not in the current view
	// container (such as when the user right clicks and then the popup is
	// destroyed - not too sure why, but this is the easiest way to fix it).
	if ( view->viewContainer() != vc )
		view = vc->activeView();
	
	if ( !view || (View*)p_focusedView == view )
		return;
	
	if (p_focusedView)
		slotViewUnfocused();
	
	p_focusedView = view;
	
	if ( TextView * textView = dynamic_cast<TextView*>((View*)p_focusedView) )
		KTechlab::self()->factory()->addClient( textView->kateView() );
	else
		KTechlab::self()->factory()->addClient( p_focusedView );
	
	Document *document = view->document();
	
	connect( document, SIGNAL(undoRedoStateChanged()), KTechlab::self(), SLOT(slotDocUndoRedoChanged()) );
	p_connectedDocument = document;
		
	if ( document->type() == Document::dt_circuit ||
			   document->type() == Document::dt_flowcode ||
			   document->type() == Document::dt_mechanics )
	{
		ItemDocument *cvb = static_cast<ItemDocument*>(view->document());
		ItemInterface::self()->slotItemDocumentChanged(cvb);
	}
	
	KTechlab::self()->slotDocUndoRedoChanged();
	KTechlab::self()->slotDocModifiedChanged();
	KTechlab::self()->requestUpdateCaptions();
}
Exemple #14
0
void ViewManager::splitView(Qt::Orientation orientation)
{
    // iterate over each session which has a view in the current active
    // container and create a new view for that session in a new container
    QListIterator<QWidget*> existingViewIter(_viewSplitter->activeContainer()->views());

    ViewContainer* container = 0;

    while (existingViewIter.hasNext()) {
        Session* session = _sessionMap[(TerminalDisplay*)existingViewIter.next()];
        TerminalDisplay* display = createTerminalDisplay(session);
        const Profile::Ptr profile = SessionManager::instance()->sessionProfile(session);
        applyProfileToView(display, profile);
        ViewProperties* properties = createController(session, display);

        _sessionMap[display] = session;

        // create a container using settings from the first
        // session in the previous container
        if (!container) {
            container = createContainer(profile);
            applyProfileToContainer(container, profile);
        }

        container->addView(display, properties);
        session->addView(display);
    }

    _viewSplitter->addContainer(container, orientation);
    emit splitViewToggle(_viewSplitter->containers().count() > 0);

    // focus the new container
    container->containerWidget()->setFocus();

    // ensure that the active view is focused after the split / unsplit
    ViewContainer* activeContainer = _viewSplitter->activeContainer();
    QWidget* activeView = activeContainer ? activeContainer->activeView() : 0;

    if (activeView)
        activeView->setFocus(Qt::OtherFocusReason);
}
void ViewSplitter::addContainer( ViewContainer* container , 
                                 Qt::Orientation containerOrientation )
{
   ViewSplitter* splitter = activeSplitter();   

    if ( splitter->count() < 2 || 
         containerOrientation == splitter->orientation() ||
         !_recursiveSplitting )
    {
        splitter->registerContainer(container); 
        splitter->addWidget(container->containerWidget());

        if ( splitter->orientation() != containerOrientation )
            splitter->setOrientation( containerOrientation );

        splitter->updateSizes();
    }
    else
    {
        ViewSplitter* newSplitter = new ViewSplitter(this);
        connect( newSplitter , SIGNAL(empty(ViewSplitter*)) , splitter , SLOT(childEmpty(ViewSplitter*)) );

        ViewContainer* oldContainer = splitter->activeContainer();
        int oldContainerIndex = splitter->indexOf(oldContainer->containerWidget());

        splitter->unregisterContainer(oldContainer);   

        newSplitter->registerContainer(oldContainer);
        newSplitter->registerContainer(container);

        newSplitter->addWidget(oldContainer->containerWidget());
        newSplitter->addWidget(container->containerWidget());
        newSplitter->setOrientation(containerOrientation); 
        newSplitter->updateSizes();
        newSplitter->show();

        splitter->insertWidget(oldContainerIndex,newSplitter);
    }

}
Exemple #16
0
void ViewManager::moveActiveViewRight()
{
    ViewContainer* container = _viewSplitter->activeContainer();
    Q_ASSERT(container);
    container->moveActiveView(ViewContainer::MoveViewRight);
}