void ReymentaHapPlayerApp::keyDown(KeyEvent event)
{
	fs::path moviePath;
	switch (event.getCode())
	{
	case ci::app::KeyEvent::KEY_o:
		moviePath = getOpenFilePath();
		if (!moviePath.empty())
			loadMovieFile(moviePath);
		break;
	case ci::app::KeyEvent::KEY_r:
		mMovie.reset();
		break;
	case ci::app::KeyEvent::KEY_p:
		if (mMovie) mMovie->play();
		break;
	case ci::app::KeyEvent::KEY_s:
		if (mMovie) mMovie->stop();
		break;
	case ci::app::KeyEvent::KEY_SPACE:
		if (mMovie->isPlaying()) mMovie->stop(); else mMovie->play();
		break;
	case ci::app::KeyEvent::KEY_ESCAPE:
		shutdown();
		break;
	case ci::app::KeyEvent::KEY_l:
		mLoopVideo = !mLoopVideo;
		if (mMovie) mMovie->setLoop(mLoopVideo);
		break;

	default:
		break;
	}
}
Beispiel #2
0
void MainWindow::on_actionOpen_triggered()
{
    QString path(getOpenFilePath());
    QString fn;
    if ( ui->view->GetLastPathName( &fn ) )
    {
        QFileInfo fi(fn);
        if ( fi.absolutePath() == path )
        {
            fn = fi.fileName();
        }
        else
        {
            fn.clear();
        }
    }

    OpenFileDlg dlg(this, ui->view, path, fn);
    if ( dlg.exec() && !dlg.fileName.isEmpty() )
    {
        qDebug() << "start load document";
        ui->view->loadDocument( dlg.fileName );
        qDebug() << "end load document";
    }
}
void Genetic_AlgorithmApp::loadImage()
{
    fs::path p = getOpenFilePath("", ImageIo::getLoadExtensions());

    if (!p.empty())
    {
        m_imageLoaded.clear();

        try
        {
            m_imageLoaded.push_back(cinder::loadImage(p));
            m_currentImage = m_imageLoaded.front();
            m_currentImageLoadedIndex = 0;
        }
        catch (ci::ImageIoException&)
        {
            console() << "Format non supporté pour l'image : " << p.filename() << std::endl;
        }
        catch (std::exception&)
        {
            console() << "Error occur" << std::endl;
        }
    }

    setupIHM();
}
Beispiel #4
0
bool Afileexplorer::handleEvent(Aevent* evt)
{
	if(evt->Type == MOUSE_PRESS_EVENT )
	{
		Vec3f localPoint = globalToLocal(evt->mousePos);
		if( pointInside( localPoint ))
		{
			//! Not threaded...
			try {
				std::string p = getOpenFilePath( CMN->rootResourcePath );
				if( ! p.empty() ) { // an empty string means the user canceled
					FilePath->makeTexture( p );
				}
			}
			catch( ... ) {
				console() << "Afileexplorer experienced an event error" << std::endl;
				return false;
			}
			return true;
		}
	}
	return false;
}