void SettingsToolbarSnippet::setAction(ChromeSnippet * s) { ToolbarSnippet::setAction(s); ActionButtonSnippet * button = static_cast<ActionButtonSnippet*> (s); int index = getIndex(s); if (index != -1 ) { ToolbarActions_t * t = m_actionInfo.at(index); QAction * action = button->getDefaultAction(); if (t->actionId == SETTINGS_VIEW_ACTION_BACK ) { if( !action ) { action = new QAction(0); button->setDefaultAction(action); m_action1 = action; } connect(action, SIGNAL(triggered()), this, SLOT(handleBackButton())); } else if (t->actionId == SETTINGS_VIEW_ACTION_FEEDBACK) { if( !action ) { action = new QAction(0); button->setDefaultAction(action); m_action2 = action; } connect(action, SIGNAL(triggered()), this, SLOT(handleFeedbackButton())); } } }
void CCEngine::updateEngineThread() { // Update our system time updateTime(); time.lifetime += time.real; #if LOG_FPS static uint loggedUpdates = 0; static float loggedDelta = 0.0f; loggedUpdates++; loggedDelta += time.real; if( loggedDelta > 1.0f ) { #if !defined WP8 && !defined WIN8 const float averageFPS = 1.0f / ( loggedDelta / loggedUpdates ); DEBUGLOG( "Average FPS: %f \n", averageFPS ); #endif loggedUpdates = 0; loggedDelta = 0.0f; } #endif if( backButtonPressed ) { backButtonPressed = false; handleBackButton(); } // Run callbacks if( engineThreadCallbacks.length > 0 ) { CCNativeThreadLock(); CCJobsThreadLock(); while( engineThreadCallbacks.length > 0 ) { CCLambdaCallback *callback = engineThreadCallbacks.pop(); if( callback != NULL ) { callback->safeRun(); delete callback; } } CCNativeThreadUnlock(); CCJobsThreadUnlock(); } finishJobs(); updateLoop(); if( paused == false && pauseRendering == false ) { CCAppManager::UpdateOrientation( time.delta ); renderLoop(); } #if defined DEBUGON && TARGET_IPHONE_SIMULATOR // 66 frames a second in debug //usleep( 15000 ); usleep( 0 ); #endif }
void CCEngine::updateEngineThread() { // Update our system time updateTime(); time.lifetime += time.real; #if LOG_FPS static uint loggedUpdates = 0; static float loggedDelta = 0.0f; loggedUpdates++; loggedDelta += time.real; if( loggedDelta > 1.0f ) { #if !defined WP8 && !defined WIN8 const float averageFPS = 1.0f / ( loggedDelta / loggedUpdates ); DEBUGLOG( "Average FPS: %f \n", averageFPS ); #endif loggedUpdates = 0; loggedDelta = 0.0f; } #endif if( backButtonActionPending ) { backButtonActionPending = false; handleBackButton(); } // Run callbacks if( engineThreadCallbacks.length > 0 ) { int jobsProcessed = 0; const double startTime = CCEngine::GetSystemTime(); const double finishTime = startTime + 0.002f; // Spend a max of 2ms on this task double currentTime = startTime; while( engineThreadCallbacks.length > 0 ) { CCNativeThreadLock(); CCJobsThreadLock(); CCLambdaCallback *callback = engineThreadCallbacks.pop(); if( callback != NULL ) { callback->safeRun(); } CCNativeThreadUnlock(); CCJobsThreadUnlock(); if( callback != NULL ) { delete callback; } jobsProcessed++; if( textureManager != NULL && textureManager->isReady() ) { currentTime = CCEngine::GetSystemTime(); if( currentTime > finishTime ) { DEBUGLOG( "Max engineThreadCallbacks processed in time %i, %i\n", jobsProcessed, engineThreadCallbacks.length ); break; } } } } finishJobs(); updateLoop(); if( paused == false ) { CCAppManager::UpdateOrientation( time.delta ); } renderLoop(); #if defined DEBUGON && TARGET_IPHONE_SIMULATOR // 66 frames a second in debug //usleep( 15000 ); usleep( 0 ); #endif }