SessionManager::vector_type::iterator SessionManager::find( const std::wstring& token ) { for ( SessionManager::vector_type::iterator it = sessions_.begin(); it != sessions_.end(); ++it ) { Dataprocessor& proc = it->getDataprocessor(); if ( proc.file()->filename() == token ) return it; } return sessions_.end(); }
NavigationWidget::NavigationWidget(QWidget *parent) : QWidget(parent) , pTreeView_( new QTreeView(this) ) , pModel_( new QStandardItemModel ) , pDelegate_( new NavigationDelegate ) { pTreeView_->setModel( pModel_ ); pTreeView_->setItemDelegate( pDelegate_ ); setFocusProxy( pTreeView_ ); initView(); QVBoxLayout * layout = new QVBoxLayout(); layout->addWidget( pTreeView_ ); layout->setSpacing( 0 ); layout->setContentsMargins( 0, 0, 0, 0 ); setLayout( layout ); for ( SessionManager::vector_type::iterator it = SessionManager::instance()->begin(); it != SessionManager::instance()->end(); ++it ) { handleSessionAdded( &(it->getDataprocessor()) ); } // connections connect( pModel_, SIGNAL( modelReset() ), this, SLOT( initView() ) ); connect( pTreeView_, SIGNAL(activated(const QModelIndex&)), this, SLOT(handle_activated(const QModelIndex&))); connect( pTreeView_, SIGNAL(clicked(const QModelIndex&)), this, SLOT(handle_clicked(const QModelIndex&))); connect( pTreeView_, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(handle_doubleClicked(const QModelIndex&))); connect( pTreeView_, SIGNAL(entered(const QModelIndex&)), this, SLOT(handle_entered(const QModelIndex&))); // connect( pTreeView_, SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(handle_currentChanged(const QModelIndex&, const QModelIndex&))); pTreeView_->setContextMenuPolicy(Qt::CustomContextMenu); connect( pTreeView_, SIGNAL(customContextMenuRequested( QPoint )), this, SLOT( handleContextMenuRequested( QPoint ) ) ); connect( SessionManager::instance(), SIGNAL( signalSessionAdded( Dataprocessor* ) ), this, SLOT( handleSessionAdded( Dataprocessor * ) ) ); connect( SessionManager::instance(), SIGNAL( signalSessionUpdated( Dataprocessor* ) ), this, SLOT( handleSessionUpdated( Dataprocessor * ) ) ); setAutoSynchronization(true); }