Esempio n. 1
0
void MindSondeApp::activeViewChanged(QAction* axnView) {

	
	if(axnView==axnSignalView)
		setActiveView(getSignalView());
	else
		setActiveView(getImpedanceView());

	
}
//---------------------------------------------------------------------------
void ofxTSPSPeopleTracker::updateSettings()
{
	setHaarXMLFile(p_Settings->haarFile);

	//check to enable OSC
	if (p_Settings->bSendOsc && !bOscEnabled) setupOsc(p_Settings->oscHost, p_Settings->oscPort);
	else if (!p_Settings->bSendOsc) bOscEnabled = false;
	
	//check to enable TUIO
	if (p_Settings->bSendTuio && !bTuioEnabled) setupTuio(p_Settings->tuioHost, p_Settings->tuioPort);
	else if (!p_Settings->bSendTuio) bTuioEnabled = false;

	//check to enable TCP
	if (p_Settings->bSendTcp && !bTcpEnabled) setupTcp(p_Settings->tcpPort);
	else if (!p_Settings->bSendTcp) bTcpEnabled = false;
        
    //check to enable websockets
    if (p_Settings->bSendWebSockets && !bWebSocketsEnabled){
        setupWebSocket(p_Settings->webSocketPort);
    } else if (!p_Settings->bSendWebSockets){
        bWebSocketsEnabled = false;
        webSocketServer.close();
    }
	//switch camera view if new panel is selected
	if (p_Settings->currentPanel != p_Settings->lastCurrentPanel) setActiveView(p_Settings->currentPanel + 1);

	// Set the current view within the gui so the image can only be warped when in Camera View
	if (cameraView.isActive()) {
		gui.changeGuiCameraView(true);
	} else {
		gui.changeGuiCameraView(false);
	}
}
Esempio n. 3
0
void KateViewManager::activateView ( KTextEditor::View *view )
{
  if (!view) return;

  if (!m_activeStates[view])
  {
    if ( !activeViewSpace()->showView(view) )
    {
      // since it wasn't found, give'em a new one
      createView( view->document() );
      return;
    }

    setActiveView (view);

    mainWindow()->setUpdatesEnabled( false );
    bool toolbarVisible = mainWindow()->toolBar()->isVisible();
    if (toolbarVisible)
      mainWindow()->toolBar()->hide(); // hide to avoid toolbar flickering

    if (guiMergedView)
      mainWindow()->guiFactory()->removeClient( guiMergedView );

    guiMergedView = view;

    if (!m_blockViewCreationAndActivation)
      mainWindow()->guiFactory()->addClient( view );

    if (toolbarVisible)
      mainWindow()->toolBar()->show();
    mainWindow()->setUpdatesEnabled( true );

    emit viewChanged();
  }
}
Esempio n. 4
0
void ViewManager::restoreSettings()
{
    mViewNameList = KABPrefs::instance()->viewNames();
    QString activeViewName = KABPrefs::instance()->currentView();

    mActionSelectView->setItems(mViewNameList);

    // Filter
    mFilterList = Filter::restore(mCore->config(), "Filter");
    mFilterSelectionWidget->setItems(filterNames());
    mFilterSelectionWidget->setCurrentItem(KABPrefs::instance()->currentFilter());

    // Tell the views to reread their config, since they may have
    // been modified by global settings
    QDictIterator<KAddressBookView> it(mViewDict);
    for(it.toFirst(); it.current(); ++it)
    {
        KConfigGroupSaver saver(mCore->config(), it.currentKey());
        it.current()->readConfig(mCore->config());
    }

    setActiveView(activeViewName);

    mActionDeleteView->setEnabled(mViewNameList.count() > 1);
}
Esempio n. 5
0
void ViewManager::deleteView()
{
    QString text = i18n("<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>")
                   .arg(mActiveView->caption());
    QString caption = i18n("Confirm Delete");

    if(KMessageBox::warningContinueCancel(this, text, caption, KGuiItem(i18n("&Delete"), "editdelete")) == KMessageBox::Continue)
    {
        mViewNameList.remove(mActiveView->caption());

        // remove the view from the config file
        KConfig *config = mCore->config();
        config->deleteGroup(mActiveView->caption());

        mViewDict.remove(mActiveView->caption());
        mActiveView = 0;

        // we are in an invalid state now, but that should be fixed after
        // we emit the signal
        mActionSelectView->setItems(mViewNameList);
        if(mViewNameList.count() > 0)
        {
            mActionSelectView->setCurrentItem(0);
            setActiveView(mViewNameList[ 0 ]);
        }
        mActionDeleteView->setEnabled(mViewNameList.count() > 1);
    }
}
Esempio n. 6
0
void WorkspacePart::removeView(WorkspaceView* view)
{
  WorkspaceViews::iterator it = std::find(m_views.begin(), m_views.end(), view);
  ASSERT(it != m_views.end());
  it = m_views.erase(it);

  removeChild(view->getContentWidget());

  setActiveView((it != m_views.end() ?
                 *it : (!m_views.empty() ? m_views.front(): NULL)));
}
Esempio n. 7
0
void UIContext::setActiveDocument(Document* document)
{
  bool notify = (m_lastSelectedDoc != document);
  m_lastSelectedDoc = document;

  DocumentView* docView = getFirstDocumentView(document);
  if (docView) {     // The view can be null if we are in --batch mode
    setActiveView(docView);
    notify = false;
  }

  if (notify)
    notifyActiveSiteChanged();
}
Esempio n. 8
0
void MindSondeApp::startAcquisition() {
	
	assert(activeSource!=NULL);
		
	startFileDaemon();
	
	//Setup the Acquisition Center and tell it to start broadcasting data
	AcquisitionCentral::Instance()->setSignalSource(activeSource);
	AcquisitionCentral::Instance()->start();
	
	View* prevView = setActiveView(getSignalView(),true);
	delete prevView;
	
	axnSignalView->setChecked(true);
	acqToolbar->setVisible(true);
	
}
Esempio n. 9
0
void UIContext::onAddDocument(doc::Document* doc)
{
  Context::onAddDocument(doc);

  // We don't create views in batch mode.
  if (!App::instance()->isGui())
    return;

  // Add a new view for this document
  DocumentView* view = new DocumentView(static_cast<app::Document*>(doc), DocumentView::Normal);

  // Add a tab with the new view for the document
  App::instance()->getMainWindow()->getWorkspace()->addView(view);

  setActiveView(view);
  view->getEditor()->setDefaultScroll();
}
Esempio n. 10
0
void ViewManager::addView()
{
    AddViewDialog dialog(&mViewFactoryDict, this);

    if(dialog.exec())
    {
        QString newName = dialog.viewName();
        QString type = dialog.viewType();

        // Check for name conflicts
        bool firstConflict = true;
        int numTries = 1;
        while(mViewNameList.contains(newName) > 0)
        {
            if(!firstConflict)
            {
                newName = newName.left(newName.length() - 4);
                firstConflict = false;
            }

            newName = QString("%1 <%2>").arg(newName).arg(numTries);
            numTries++;
        }

        // Add the new one to the list
        mViewNameList.append(newName);

        // write the view to the config file,
        KConfig *config = mCore->config();
        config->deleteGroup(newName);
        KConfigGroupSaver saver(config, newName);
        config->writeEntry("Type", type);

        // try to set the active view
        mActionSelectView->setItems(mViewNameList);
        mActionSelectView->setCurrentItem(mViewNameList.findIndex(newName));
        setActiveView(newName);

        editView();

        mActionDeleteView->setEnabled(mViewNameList.count() > 1);
    }
}
void ofxTSPSPeopleTracker::updateSettings()
{
	setHaarXMLFile(p_Settings->haarFile);

	//check to enable OSC
	if (p_Settings->bSendOsc && !bOscEnabled) setupOsc(p_Settings->oscHost, p_Settings->oscPort);
	else if (!p_Settings->bSendOsc) bOscEnabled = false;
	
	//check to enable TUIO
	if (p_Settings->bSendTuio && !bTuioEnabled) setupTuio(p_Settings->tuioHost, p_Settings->tuioPort);
	else if (!p_Settings->bSendTuio) bTuioEnabled = false;

	//check to enable TCP
	if (p_Settings->bSendTcp && !bTcpEnabled) setupTcp(p_Settings->tcpPort);
	else if (!p_Settings->bSendTcp) bTcpEnabled = false;
	
	//switch camera view if new panel is selected
	if (p_Settings->currentPanel != p_Settings->lastCurrentPanel) setActiveView(p_Settings->currentPanel + 1);
}
Esempio n. 12
0
void KateViewManager::restoreViewConfiguration (const KConfigGroup& config)
{
  // remove all views and viewspaces + remove their xml gui clients
  for (int i = 0; i < m_viewList.count(); ++i)
    mainWindow()->guiFactory ()->removeClient (m_viewList.at(i));

  qDeleteAll( m_viewList );
  m_viewList.clear();
  qDeleteAll( m_viewSpaceList );
  m_viewSpaceList.clear();
  m_activeStates.clear();

  // start recursion for the root splitter (Splitter 0)
  restoreSplitter( config.config(), config.name() + "-Splitter 0", this, config.name() );

  // finally, make the correct view from the last session active
  int lastViewSpace = config.readEntry("Active ViewSpace", 0);
  if( lastViewSpace > m_viewSpaceList.size() ) lastViewSpace = 0;
  if( lastViewSpace >= 0 && lastViewSpace < m_viewSpaceList.size())
  {
    setActiveSpace( m_viewSpaceList.at( lastViewSpace ) );
    setActiveView( m_viewSpaceList.at( lastViewSpace )->currentView() );
    m_viewSpaceList.at( lastViewSpace )->currentView()->setFocus();
  }

  // emergency
  if (m_viewSpaceList.empty())
  {
    // kill bad children
    while (count())
      delete widget (0);

    KateViewSpace* vs = new KateViewSpace( this, 0 );
    addWidget (vs);
    vs->setActive( true );
    m_viewSpaceList.append(vs);
  }

  updateViewSpaceActions();
  // the view has (maybe) changed - promote it to the world
  emit viewChanged();
}
Esempio n. 13
0
void CMainGameWindow::draw() {
	if (_gameManager) {
		if (!_gameView->_surface) {
			CViewItem *view = _gameManager->getView();
			if (view)
				setActiveView(view);
		}

		CScreenManager *scrManager = CScreenManager::setCurrent();
		scrManager->clearSurface(SURFACE_BACKBUFFER, &_gameManager->_bounds);

		switch (_gameManager->_gameState._mode) {
		case GSMODE_PENDING_LOAD:
			// Pending savegame to load
			_gameManager->_gameState.setMode(GSMODE_INTERACTIVE);
			_project->loadGame(_pendingLoadSlot);
			_pendingLoadSlot = -1;

			// Deliberate fall-through to draw loaded game

		case GSMODE_INTERACTIVE:
		case GSMODE_CUTSCENE:
			if (_gameManager->_gameState._petActive)
				drawPet(scrManager);

			drawView();
			drawViewContents(scrManager);
			scrManager->drawCursors();
			break;

		case GSMODE_INSERT_CD:
			scrManager->drawCursors();
			_vm->_filesManager->insertCD(scrManager);
			break;

		default:
			break;
		}
	}
}
Esempio n. 14
0
//---------------------------------------------------------------------------
void ofxTSPSPeopleTracker::setup(int w, int h)
{	
	ofAddListener(ofEvents.mousePressed, this, &ofxTSPSPeopleTracker::mousePressed);
	
	width  = w;
	height = h;
	
	grayImage.allocate(width, height);
	colorImage.allocate(width,height);
	grayImageWarped.allocate(width, height);
	colorImageWarped.allocate(width,height);
	grayBg.allocate(width, height);
	grayDiff.allocate(width, height);
	floatBgImg.allocate(width, height);
	graySmallImage.allocate( width*TRACKING_SCALE_FACTOR, height*TRACKING_SCALE_FACTOR );	
	grayLastImage.allocate( width*TRACKING_SCALE_FACTOR, height*TRACKING_SCALE_FACTOR );
	grayBabyImage.allocate( width*TRACKING_SCALE_FACTOR, height*TRACKING_SCALE_FACTOR );
	
	//set up optical flow
	opticalFlow.allocate( width*TRACKING_SCALE_FACTOR, height*TRACKING_SCALE_FACTOR );
	opticalFlow.setCalcStep(5,5);
	grayLastImage = graySmallImage;
	
	//set tracker
	bOscEnabled = bTuioEnabled = bTcpEnabled = bWebSocketsEnabled = false;
	p_Settings = ofxTSPSSettings::getInstance();
	
	//gui.loadFromXML();	
	//gui.setDraw(true);		
	
	//setup gui quad in manager
	gui.setup();
	gui.setupQuadGui( width, height );
	gui.loadSettings("settings/settings.xml");
	activeHeight = ofGetHeight();
	activeWidth = ofGetWidth();
	
	activeViewIndex = 4;
	
	//setup view rectangles 
	
	cameraView.setup(width, height);
	adjustedView.setup(width, height);
	bgView.setup(width, height);
	processedView.setup(width, height);
	dataView.setup(width, height);
	
	updateViewRectangles();
	
	cameraView.setImage(colorImage);
	cameraView.setTitle("Camera Source View", "Camera");
	cameraView.setColor(218,173,90);
	
	adjustedView.setImage(grayImageWarped);
	adjustedView.setTitle("Adjusted Camera View", "Adjusted");
	adjustedView.setColor(174,139,138);
	
	bgView.setImage(grayBg);
	bgView.setTitle("Background Reference View", "Background");
	bgView.setColor(213,105,68);
		
	processedView.setImage(grayDiff);
	processedView.setTitle("Differenced View", "Differencing");
	processedView.setColor(113,171,154);
	
	dataView.setTitle("Data View", "Data");
	dataView.setColor(191,120,0);
	
	setActiveView(PROCESSED_VIEW);
	
    persistentTracker.setListener( this );
	//updateSettings();
	lastHaarFile = "";
}
Esempio n. 15
0
YigNetworkChannelView::YigNetworkChannelView(QWidget *parent) :
    QGraphicsView(parent)
{

    QGLFormat glFormat( QGL::SampleBuffers );
    //glFormat.setSwapInterval( 1 ); // set VSync
    QGLWidget* viewportGL = new QGLWidget( glFormat );
    setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
    setViewport(viewportGL);
    setRenderHints(QPainter::Antialiasing);
    setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing, true);
    YigGraphicsScene* yigScene = new YigGraphicsScene;
    yigScene->setSceneRect(0, 0, 1920, 1200);
    setScene(yigScene);

    scaleFactor = 1.0;
    selectionRect = new QGraphicsRectItem( QRect( 0, 0, 0, 0 ) );
    selectionRect->setPen( QColor( 0, 0, 0, 200 ) );
    selectionRect->setFlag(QGraphicsItem::ItemIgnoresTransformations);
    //selectionRect->setBrush( QColor( 69, 139, 19, 40 ) );
    QColor rectColor = YigColorKit::accent;
    rectColor.setAlpha(130);
    selectionRect->setBrush(rectColor);
    selectionRect->setZValue( 10000 );
    scene()->addItem( selectionRect );
    selectionRect->hide();

    //glWidget->startRendering();

    mActiveBool = false;
    setActiveView(mActiveBool);
    currentCableBool = false;
    mouseDownBool = false;
    cableCounter = 0;
    srand((unsigned) time(0));
    /*
#ifdef __APPLE__
    verticalScrollBar()->setStyle(new QMacStyle);
    horizontalScrollBar()->setStyle(new QMacStyle);
#else
    verticalScrollBar()->setStyle(new QGtkStyle);
    horizontalScrollBar()->setStyle(new QGtkStyle);
#endif
    */

    QPalette scrollPalette = verticalScrollBar()->palette();
    scrollPalette.setColor(QPalette::Button, YigColorKit::focus2);
    verticalScrollBar()->setPalette(scrollPalette);

    scrollPalette = horizontalScrollBar()->palette();
    scrollPalette.setColor(QPalette::Button, YigColorKit::focus2);
    horizontalScrollBar()->setPalette(scrollPalette);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

    /*
    QLinearGradient gradient(0, 0, 0, parent->geometry().height());
    gradient.setColorAt(0, YigColorKit::background2);
    gradient.setColorAt(0.005, QColor(255, 255, 255));
    gradient.setColorAt(1, QColor(190, 190, 190));
    gradient.setInterpolationMode(QGradient::ColorInterpolation);
    QBrush backgroundBrush(gradient);
    backgroundBrush.setStyle(Qt::LinearGradientPattern);*/
    //QBrush backgroundBrush(QPixmap(":/images/gui/YigAttractorBackground.png"));
    //scene()->setBackgroundBrush(YigColorKit::background);
    //backgroundPixmap = scene()->addPixmap(YigAttractor::renderAttractor(width(), height()));
    modCableParent = new QGraphicsLineItem();
    modCableParent->setZValue(-20);
    modCableParent->setFlag(QGraphicsItem::ItemHasNoContents, true);
    //modCableParent->setVisible(false);
    scene()->addItem(modCableParent);
    audioCableParent = new QGraphicsLineItem();
    audioCableParent->setZValue(-5);
    //audioCableParent->setVisible(false);
    audioCableParent->setFlag(QGraphicsItem::ItemHasNoContents, true);
    scene()->addItem(audioCableParent);
    /*
    QObject::connect(this, SIGNAL(synthForGLAdded(int,QPointF)),
                     glWidget->getGLThread(), SLOT(addSynth(int,QPointF)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(synthForGLRemoved(int)), glWidget->getGLThread(), SLOT(removeSynth(int)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(synthForGLMoved(int,QPointF)),
                     glWidget->getGLThread(), SLOT(setSynthPos(int,QPointF)), Qt::QueuedConnection);

    */

    //glWidget.lower();

    //setupViewport(&glWidget);

    //scene()->setBackgroundBrush(Qt::transparent);
    //setAttribute(Qt::WA_TranslucentBackground);
    //setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
    //QPalette p = viewport()->palette();
    //p.setColor(QPalette::Base, Qt::transparent);
    //viewport()->setPalette(p);
    //viewport()->setAutoFillBackground(false);
    //parent->setAttribute(Qt::WA_TranslucentBackground);
    //parent->setAutoFillBackground(false);
    //setStyleSheet("background-color: transparent;");
    //lower();
    //glWidget.raise();
    //glWidget.lower();
    //glWidget.setStyleSheet("background-color: transparent;");
    //glParent = new QWidget(parent);
    //glWidget.setParent(glParent);
    //glParent->lower();
    //glWidget.show();
    setActiveView(true);
    setMouseTracking(true);
    setFrameStyle(0);
    mouseCounter = 0;
    centerOn(0, 0);
    show();
}