Example #1
0
void MoviePlayerView::UpdateUI( const VrFrame & vrFrame )
{
	if ( uiActive )
	{
		double timeSinceLastGaze = ovr_GetTimeInSeconds() - GazeTimer.GetLastGazeTime();
		if ( !ScrubBar.IsScrubbing() && ( SeekSpeed == 0 ) && ( timeSinceLastGaze > GazeTimeTimeout ) )
		{
			LOG( "Gaze timeout" );
			HideUI();
			PlayMovie();
		}

		// if we press the touchpad or a button outside of the playback controls, then close the UI
		if ( ( ( vrFrame.Input.buttonPressed & BUTTON_A ) != 0 ) || ( ( vrFrame.Input.buttonPressed & BUTTON_TOUCH ) != 0 ) )
		{
			// ignore button A or touchpad until release so we don't close the UI immediately after opening it
			BackgroundClicked = !GazeTimer.IsFocused() && !UIOpened;
		}

		if ( ( ( vrFrame.Input.buttonReleased & BUTTON_A ) != 0 ) ||
			( ( ( vrFrame.Input.buttonReleased & BUTTON_TOUCH ) != 0 ) && ( ( vrFrame.Input.buttonState & BUTTON_TOUCH_WAS_SWIPE ) == 0 ) )	)
		{
			if ( !GazeTimer.IsFocused() && BackgroundClicked )
			{
				LOG( "Clicked outside playback controls" );
				Cinema.app->PlaySound( "touch_up" );
				HideUI();
				PlayMovie();
			}
			BackgroundClicked = false;
		}

		if ( Cinema.SceneMgr.MovieDuration > 0 )
		{
			const int currentPosition = Native::GetPosition( Cinema.app );
			float progress = ( float )currentPosition / ( float )Cinema.SceneMgr.MovieDuration;
			ScrubBar.SetProgress( progress );
		}

		if ( Cinema.SceneMgr.FreeScreenActive )
		{
			// update the screen position & size;
			PlaybackControlsScale.SetLocalScale( Vector3f( Cinema.SceneMgr.GetScreenSize().y * ( 500.0f / 1080.0f ) ) );
			PlaybackControlsPosition.SetLocalPose( Cinema.SceneMgr.GetScreenPose() );
		}
	}

	// clear the flag for ignoring button A or touchpad until release
	UIOpened = false;
}
Example #2
0
void MoviePlayerView::OnOpen()
{
	LOG( "OnOpen" );
	CurViewState = VIEWSTATE_OPEN;

	Cinema.SceneMgr.ClearMovie();

	SeekSpeed = 0;
	PlaybackPos = 0;
	NextSeekTime = 0;

	SetSeekIcon( SeekSpeed );

	ScrubBar.SetProgress( 0.0f );

	RepositionScreen = false;
	MoveScreenAlpha.Set( 0, 0, 0, 0.0f );

	HideUI();
	Cinema.SceneMgr.LightsOff( 1.5f );

	Cinema.StartMoviePlayback();

	MovieTitleLabel.SetText( Cinema.GetCurrentMovie()->Title );
	Bounds3f titleBounds = MovieTitleLabel.GetTextLocalBounds( Cinema.app->GetDefaultFont() ) * VRMenuObject::TEXELS_PER_METER;
	MovieTitleLabel.SetImage( 0, SURFACE_TEXTURE_DIFFUSE, BackgroundTintTexture, titleBounds.GetSize().x + 88, titleBounds.GetSize().y + 32 );

	PlayButton.SetButtonImages( PauseTexture, PauseHoverTexture, PausePressedTexture );
}
Example #3
0
void createkeyfile::pbCancel()
{
	if( m_task == NULL ){
		HideUI() ;
	}else{
		m_task->cancelOperation() ;
	}
}
Example #4
0
void MoviePlayerView::BackPressed()
{
	LOG( "BackPressed" );
	HideUI();
	if ( Cinema.AllowTheaterSelection() )
	{
		LOG( "Opening TheaterSelection" );
		Cinema.TheaterSelection();
	}
	else
	{
		LOG( "Opening MovieSelection" );
		Cinema.MovieSelection( true );
	}
}
void MoviePlayerView::OnOpen()
{
	LOG( "OnOpen" );
	CurViewState = VIEWSTATE_OPEN;

	Cinema.SceneMgr.ClearMovie();

	SeekSpeed = 0;
	PlaybackPos = 0;
	NextSeekTime = 0;

	RepositionScreen = false;
	MoveScreenAlpha.Set( 0, 0, 0, 0.0f );

	HideUI();
	Cinema.SceneMgr.LightsOff( 1.5f );

	Cinema.StartMoviePlayback();
}
Example #6
0
void MoviePlayerView::OnClose()
{
	LOG( "OnClose" );
	CurViewState = VIEWSTATE_CLOSED;
	HideUI();
	Cinema.app->GetGazeCursor().ShowCursor();

	if ( MoveScreenMenu->IsOpen() )
	{
		MoveScreenLabel.SetVisible( false );
		MoveScreenMenu->Close();
	}

	Cinema.SceneMgr.ClearMovie();

	if ( Cinema.SceneMgr.VoidedScene )
	{
		Cinema.SceneMgr.SetSceneModel( Cinema.GetCurrentTheater() );
	}
}
void MoviePlayerView::OnClose()
{
	LOG( "OnClose" );
	CurViewState = VIEWSTATE_CLOSED;
	HideUI();
	Cinema.app->GetGazeCursor().ShowCursor();

	if ( MenuOpen )
	{
		Cinema.app->GetGuiSys().CloseMenu( Cinema.app, Menu, false );
		MenuOpen = false;
	}

	Cinema.app->GetActivityPanel().Visible = false;

	Cinema.SceneMgr.ClearMovie();

	if ( Cinema.SceneMgr.VoidedScene )
	{
		Cinema.SceneMgr.SetSceneModel( Cinema.GetCurrentTheater() );
	}
}
void ampsWidgetAutheticateUser::CancelPressed(void)
{
  HideUI();
  emit CancelLogin();
}
Example #9
0
void MoviePlayerView::CheckInput( const VrFrame & vrFrame )
{
	if ( !uiActive && !RepositionScreen )
	{
		if ( ( vrFrame.Input.buttonPressed & BUTTON_A ) || ( ( vrFrame.Input.buttonReleased & BUTTON_TOUCH ) && !( vrFrame.Input.buttonState & BUTTON_TOUCH_WAS_SWIPE ) ) )
		{
			// open ui if it's not visible
			Cinema.app->PlaySound( "touch_up" );
			ShowUI();

			// ignore button A or touchpad until release so we don't close the UI immediately after opening it
			UIOpened = true;
		}
	}

	if ( vrFrame.Input.buttonPressed & ( BUTTON_DPAD_LEFT | BUTTON_SWIPE_BACK ) )
	{
		if ( ( vrFrame.Input.buttonPressed & BUTTON_DPAD_LEFT ) || !GazeTimer.IsFocused() )
		{
			ShowUI();
			if ( SeekSpeed == 0 )
			{
				PauseMovie();
			}

			SeekSpeed--;
			if ( ( SeekSpeed == 0 ) || ( SeekSpeed < -MaxSeekSpeed ) )
			{
				SeekSpeed = 0;
				PlayMovie();
			}
			SetSeekIcon( SeekSpeed );

			Cinema.app->PlaySound( "touch_up" );
		}
	}

	if ( vrFrame.Input.buttonPressed & ( BUTTON_DPAD_RIGHT | BUTTON_SWIPE_FORWARD ) )
	{
		if ( ( vrFrame.Input.buttonPressed & BUTTON_DPAD_RIGHT ) || !GazeTimer.IsFocused() )
		{
			ShowUI();
			if ( SeekSpeed == 0 )
			{
				PauseMovie();
			}

			SeekSpeed++;
			if ( ( SeekSpeed == 0 ) || ( SeekSpeed > MaxSeekSpeed ) )
			{
				SeekSpeed = 0;
				PlayMovie();
			}
			SetSeekIcon( SeekSpeed );

			Cinema.app->PlaySound( "touch_up" );
		}
	}

	if ( Cinema.SceneMgr.FreeScreenActive )
	{
		const Vector2f screenCursor = GazeCoordinatesOnScreen( Cinema.SceneMgr.Scene.CenterViewMatrix(), Cinema.SceneMgr.ScreenMatrix() );
		bool onscreen = false;
		if ( InsideUnit( screenCursor ) )
		{
			onscreen = true;
		}
		else if ( uiActive )
		{
			onscreen = GazeTimer.IsFocused();
		}

		if ( !onscreen )
		{
			// outside of screen, so show reposition message
			const double now = ovr_GetTimeInSeconds();
			float alpha = MoveScreenAlpha.Value( now );
			if ( alpha > 0.0f )
			{
				MoveScreenLabel.SetVisible( true );
				MoveScreenLabel.SetTextColor( Vector4f( alpha ) );
			}

			if ( vrFrame.Input.buttonPressed & ( BUTTON_A | BUTTON_TOUCH ) )
			{
				RepositionScreen = true;
			}
		}
		else
		{
			// onscreen, so hide message
			const double now = ovr_GetTimeInSeconds();
			MoveScreenAlpha.Set( now, -1.0f, now + 1.0f, 1.0f );
			MoveScreenLabel.SetVisible( false );
		}
	}

	// while we're holding down the button or touchpad, reposition screen
	if ( RepositionScreen )
	{
		if ( vrFrame.Input.buttonState & ( BUTTON_A | BUTTON_TOUCH ) )
		{
			Cinema.SceneMgr.PutScreenInFront();
		}
		else
		{
			RepositionScreen = false;
		}
	}

	if ( vrFrame.Input.buttonPressed & BUTTON_START )
	{
		TogglePlayback();
	}

	if ( vrFrame.Input.buttonPressed & BUTTON_SELECT )
	{
		// movie select
		Cinema.app->PlaySound( "touch_up" );
		Cinema.MovieSelection( false );
	}

	if ( vrFrame.Input.buttonPressed & BUTTON_B )
	{
		if ( !uiActive )
		{
			BackPressed();
		}
		else
		{
			LOG( "User pressed button 2" );
			Cinema.app->PlaySound( "touch_up" );
			HideUI();
			PlayMovie();
		}
	}
}
void MoviePlayerView::UpdateUI( const VrFrame & vrFrame )
{
	// only show cursor when uiActive
	if ( uiActive )
	{
		const Matrix4f screenModel = Cinema.app->GetActivityPanel().Matrix;

		// -1 to 1 range on panelMatrix, returns -2,-2 if looking away from the panel
		const Vector2f cursor = GazeCoordinatesOnPanel( Cinema.SceneMgr.Scene.CenterViewMatrix(), screenModel, Cinema.app->GetActivityPanel().AlternateGazeCheck );

		const bool press = ( vrFrame.Input.buttonPressed & ( BUTTON_A | BUTTON_TOUCH ) ) != 0;
		const bool release = ( ( vrFrame.Input.buttonReleased & ( BUTTON_A | BUTTON_TOUCH ) ) != 0 );

		ePlaybackControlsEvent uiButtonPressed = ( ePlaybackControlsEvent )Native::GazeCursor( Cinema.app, (cursor.x * 0.5 + 0.5) * Cinema.app->GetActivityPanel().Width,
			(0.5 - cursor.y * 0.5) * Cinema.app->GetActivityPanel().Height, press, release, SeekSpeed );

		// don't register a button press if we just finished a swipe
		if ( !( vrFrame.Input.buttonState & BUTTON_TOUCH_WAS_SWIPE ) )
		{
			switch( uiButtonPressed )
			{
			case UI_RW_PRESSED :
				// rewind
				Cinema.app->PlaySound( "touch_up" );
				if ( SeekSpeed == 0 )
				{
					Native::PauseMovie( Cinema.app );
					PlaybackPos = Native::GetPosition( Cinema.app );
				}

				SeekSpeed--;
				if ( ( SeekSpeed == 0 ) || ( SeekSpeed < -MaxSeekSpeed ) )
				{
					SeekSpeed = 0;
					Native::ResumeMovie( Cinema.app );
				}
				break;

			case UI_PLAY_PRESSED :
				// play/pause
				Cinema.app->PlaySound( "touch_up" );
				Native::TogglePlaying( Cinema.app );
				SeekSpeed = 0;
				break;

			case UI_FF_PRESSED :
				// fast forward
				Cinema.app->PlaySound( "touch_up" );
				if ( SeekSpeed == 0 )
				{
					Native::PauseMovie( Cinema.app );
					PlaybackPos = Native::GetPosition( Cinema.app );
				}

				SeekSpeed++;
				if ( ( SeekSpeed == 0 ) || ( SeekSpeed > MaxSeekSpeed ) )
				{
					SeekSpeed = 0;
					Native::ResumeMovie( Cinema.app );
				}
				break;

			case UI_CAROUSEL_PRESSED :
				// movie select
				Cinema.app->PlaySound( "touch_up" );
				Cinema.MovieSelection( false );
				break;

			case UI_CLOSE_UI_PRESSED :
				Cinema.app->PlaySound( "touch_up" );
				HideUI();
				Native::ResumeMovie( Cinema.app );
				break;

			case UI_USER_TIMEOUT :
				HideUI();
				Native::ResumeMovie( Cinema.app );
				break;

			case UI_SEEK_PRESSED :
				PlaybackPos = Native::GetPosition( Cinema.app );
				NextSeekTime = TimeInSeconds() + 0.25;
				break;

			default:
			case UI_NO_EVENT :
				break;
			}
		}

		float cursorDistance = FLT_MAX;
		eGazeCursorStateType cursorState = CURSOR_STATE_NORMAL;

		if ( InsideUnit( cursor ) )
		{
			// FIXME: Project onto Free Screen
			const Vector3f pos = screenModel.Transform( Vector3f( cursor.x, cursor.y, 0.0f ) );
			cursorDistance = ( pos - Cinema.SceneMgr.Scene.CenterViewMatrix().GetTranslation() ).Length();
		}
		Cinema.app->GetGazeCursor().UpdateForUser( GazeUserId, cursorDistance, cursorState );
	}
}
void MoviePlayerView::CheckInput( const VrFrame & vrFrame )
{
	if ( !uiActive && !RepositionScreen )
	{
		if ( ( vrFrame.Input.buttonPressed & BUTTON_A ) || ( ( vrFrame.Input.buttonReleased & BUTTON_TOUCH ) && !( vrFrame.Input.buttonState & BUTTON_TOUCH_WAS_SWIPE ) ) )
		{
			// open ui if it's not visible
			Cinema.app->PlaySound( "touch_up" );
			ShowUI();
		}
	}

	if ( vrFrame.Input.buttonPressed & ( BUTTON_DPAD_LEFT | BUTTON_SWIPE_BACK ) )
	{
		if ( ( vrFrame.Input.buttonPressed & BUTTON_DPAD_LEFT ) || !CursorInsidePlaybackControls() )
		{
			ShowUI();
			if ( SeekSpeed == 0 )
			{
				Native::PauseMovie( Cinema.app );
				PlaybackPos = Native::GetPosition( Cinema.app );
			}

			SeekSpeed--;
			if ( ( SeekSpeed == 0 ) || ( SeekSpeed < -MaxSeekSpeed ) )
			{
				SeekSpeed = 0;
				Native::ResumeMovie( Cinema.app );
			}

			Cinema.app->PlaySound( "touch_up" );
		}
	}

	if ( vrFrame.Input.buttonPressed & ( BUTTON_DPAD_RIGHT | BUTTON_SWIPE_FORWARD ) )
	{
		if ( ( vrFrame.Input.buttonPressed & BUTTON_DPAD_RIGHT ) || !CursorInsidePlaybackControls() )
		{
			ShowUI();
			if ( SeekSpeed == 0 )
			{
				Native::PauseMovie( Cinema.app );
				PlaybackPos = Native::GetPosition( Cinema.app );
			}

			SeekSpeed++;
			if ( ( SeekSpeed == 0 ) || ( SeekSpeed > MaxSeekSpeed ) )
			{
				SeekSpeed = 0;
				Native::ResumeMovie( Cinema.app );
			}

			Cinema.app->PlaySound( "touch_up" );
		}
	}

	if ( Cinema.SceneMgr.FreeScreenActive )
	{
		const Vector2f screenCursor = GazeCoordinatesOnPanel( Cinema.SceneMgr.Scene.CenterViewMatrix(), Cinema.SceneMgr.FreeScreenMatrix(), Cinema.app->GetActivityPanel().AlternateGazeCheck  );
		if ( !InsideUnit( screenCursor ) && !CursorInsidePlaybackControls() )
		{
			// outside of screen, so show reposition message
			const double now = TimeInSeconds();
			float alpha = MoveScreenAlpha.Value( now );
			if ( alpha > 0.0f )
			{
				MoveScreenObj->RemoveFlags( VRMENUOBJECT_DONT_RENDER );
				MoveScreenObj->SetTextColor( Vector4f( alpha ) );
			}

			if ( vrFrame.Input.buttonPressed & ( BUTTON_A | BUTTON_TOUCH ) )
			{
				RepositionScreen = true;
			}
		}
		else
		{
			// onscreen, so hide message
			const double now = TimeInSeconds();
			MoveScreenAlpha.Set( now, -1.0f, now + 1.0f, 1.0f );
			MoveScreenObj->AddFlags( VRMENUOBJECT_DONT_RENDER );
		}
	}

	// while we're holding down the button or touchpad, reposition screen
	if ( RepositionScreen )
	{
		if ( vrFrame.Input.buttonState & ( BUTTON_A | BUTTON_TOUCH ) )
		{
			Cinema.SceneMgr.PutScreenInFront();
		}
		else
		{
			RepositionScreen = false;
		}
	}

	if ( vrFrame.Input.buttonPressed & BUTTON_START )
	{
		Native::TogglePlaying( Cinema.app );
		SeekSpeed = 0;
	}

	if ( vrFrame.Input.buttonPressed & BUTTON_SELECT )
	{
		// movie select
		Cinema.app->PlaySound( "touch_up" );
		Cinema.MovieSelection( false );
	}

	if ( vrFrame.Input.buttonPressed & BUTTON_B )
	{
		if ( !uiActive )
		{
			BackPressed();
		}
		else
		{
			Cinema.app->PlaySound( "touch_up" );
			HideUI();
			Native::ResumeMovie( Cinema.app );
		}
	}
}