void AutoScrollPlugin::init(InitState state, const QString &settingsPath) { Q_UNUSED(state) m_settingsPath = settingsPath; updateScript(); }
void ScriptManager::updateAllScripts() // SLOT { // note: we can't update scripts without the QtCryptoArchitecture, so don't even try #ifdef QCA2_FOUND DEBUG_BLOCK // find all scripts (both in $KDEHOME and /usr) QStringList foundScripts = KGlobal::dirs()->findAllResources( "data", "amarok/scripts/*/main.js", KStandardDirs::Recursive | KStandardDirs::NoDuplicates ); m_nScripts = foundScripts.count(); // get timestamp of the last update check KConfigGroup config = Amarok::config( "ScriptManager" ); const uint lastCheck = config.readEntry( "LastUpdateCheck", QVariant( 0 ) ).toUInt(); const uint now = QDateTime::currentDateTime().toTime_t(); // last update was at least 7 days ago -> check now if auto update is enabled if( AmarokConfig::autoUpdateScripts() && (now - lastCheck > 7*24*60*60) ) { debug() << "ScriptUpdater: Performing script update check now!"; for( int i = 0; i < m_nScripts; ++i ) { ScriptUpdater *updater = new ScriptUpdater( this ); // all the ScriptUpdaters are now started in parallel. // tell them which script to work on updater->setScriptPath( foundScripts.at( i ) ); // tell them whom to signal when they're finished connect( updater, SIGNAL(finished(QString)), SLOT(updaterFinished(QString)) ); // and finally tell them to get to work QTimer::singleShot( 0, updater, SLOT(updateScript()) ); } // store current timestamp config.writeEntry( "LastUpdateCheck", QVariant( now ) ); config.sync(); } // last update was pretty recent, don't check again else { debug() << "ScriptUpdater: Skipping update check"; for ( int i = 0; i < m_nScripts; i++ ) { loadScript( foundScripts.at( i ) ); } configChanged( true ); } #endif }
void CConflictResolution::SaveData(int nProjID) { if(m_nID < 0) { SqlInsertScriptMaker insertScript(TB_CONFLICTRESOLUTION); insertScript.AddColumn(COL_PROJID, nProjID); insertScript.AddColumn(COL_RADIUSOFCONCERN, m_nRadiusOfConcern); insertScript.AddColumn(COL_ENUMATINTERSECTIONONRIGHT, (int)m_enumAtIntersectionOnRight); insertScript.AddColumn(COL_ENUMFIRSTINATAXIWAY, (int)m_enumFirstInATaxiway); insertScript.AddColumn(COL_ENUMONSPECIFICTAXIWAYS, (int)m_enumOnSpecificTaxiways); insertScript.AddColumn(COL_RUNWAYCROSSBUFFERTIME, m_nRunwayCrossBuffer); insertScript.AddColumn(COL_RUNAYASTAXIWAY_NOAPPROACHTIME, m_tRunwayAsTaxiwayNoApporachTime.getPrecisely() ); insertScript.AddColumn(COL_RUNAYASTAXIWAY_NOAPPROACHDIST, m_dRunwayAsTaxiwayNoApporachDistance ); insertScript.AddColumn(COL_RUNWAYASTAXIWAY_NOTAKEOFFTIME, m_tRuwnayAsTaxiwayNoTakeoffTime.getPrecisely() ); m_nID = CADODatabase::ExecuteSQLStatementAndReturnScopeID(insertScript.GetScript()); } else { SqlUpdateScriptMaker updateScript(TB_CONFLICTRESOLUTION); updateScript.AddColumn(COL_RADIUSOFCONCERN, m_nRadiusOfConcern); updateScript.AddColumn(COL_ENUMATINTERSECTIONONRIGHT, (int)m_enumAtIntersectionOnRight); updateScript.AddColumn(COL_ENUMFIRSTINATAXIWAY, (int)m_enumFirstInATaxiway); updateScript.AddColumn(COL_ENUMONSPECIFICTAXIWAYS, (int)m_enumOnSpecificTaxiways); updateScript.AddColumn(COL_RUNWAYCROSSBUFFERTIME, m_nRunwayCrossBuffer); updateScript.AddColumn(COL_RUNAYASTAXIWAY_NOAPPROACHTIME, m_tRunwayAsTaxiwayNoApporachTime.getPrecisely() ); updateScript.AddColumn(COL_RUNAYASTAXIWAY_NOAPPROACHDIST, m_dRunwayAsTaxiwayNoApporachDistance ); updateScript.AddColumn(COL_RUNWAYASTAXIWAY_NOTAKEOFFTIME, m_tRuwnayAsTaxiwayNoTakeoffTime.getPrecisely() ); CString strCond = SqlScriptColumn(COL_ID, m_nID).EqualCondition(); updateScript.SetCondition(strCond); CADODatabase::ExecuteSQLStatement(updateScript.GetScript()); } m_pAtIntersectionOnRightList->SaveData(m_nID); m_pFirstInATaxiwayList->SaveData(m_nID); m_pOnSpecificTaxiwaysList->SaveData(m_nID); m_vCrossBuffers.SaveData(m_nID); }
void ResourceWindow::updateGUI() { SmartBody::SBScene* scene = SmartBody::SBScene::getScene(); SmartBody::SBAssetManager* assetManager = scene->getAssetManager(); resourceTree->sortorder(FL_TREE_SORT_ASCENDING); // update path tree updatePath(getTreeFromName("script path"), SmartBody::SBScene::getScene()->getAssetPaths("script")); updatePath(getTreeFromName("motion path"), SmartBody::SBScene::getScene()->getAssetPaths("motion")); updatePath(getTreeFromName("audio path"), SmartBody::SBScene::getScene()->getAssetPaths("audio")); updatePath(getTreeFromName("mesh path"), SmartBody::SBScene::getScene()->getAssetPaths("mesh")); // update sequence file list const std::vector<std::string> scriptPaths = SmartBody::SBScene::getScene()->getAssetPaths("script"); resourceTree->clear_children(getTreeFromName("scriptfiles")); for (size_t p = 0; p < scriptPaths.size(); p++) { updateScriptFiles(getTreeFromName("scriptfiles"), scriptPaths[p]); } // update runtime scripts resourceTree->clear_children(getTreeFromName("script")); std::vector<std::string> scriptName = scene->getScriptNames(); for (size_t i = 0; i < scriptName.size(); i++) { SmartBody::SBScript* script = scene->getScript(scriptName[i]); updateScript(getTreeFromName("script"), script); } // update skeleton resourceTree->clear_children(getTreeFromName("skeleton")); std::vector<std::string> skeletons = scene->getSkeletonNames(); for (size_t c = 0; c < skeletons.size(); c++) { SmartBody::SBSkeleton * skel = scene->getSkeleton(skeletons[c]); updateSkeleton(getTreeFromName("skeleton"), skel); } // update joint maps resourceTree->clear_children(getTreeFromName("jointmap")); SmartBody::SBJointMapManager* jointMapManager = scene->getJointMapManager(); std::vector<std::string> jointMapNames = jointMapManager->getJointMapNames(); for (std::vector<std::string>::iterator iter = jointMapNames.begin(); iter != jointMapNames.end(); iter++) { Fl_Tree_Item* boneMapItem = resourceTree->add(getTreeFromName("jointmap"), (*iter).c_str()); updateJointMap(boneMapItem, jointMapManager->getJointMap((*iter))); } // update gesture maps resourceTree->clear_children(getTreeFromName("gesturemap")); SmartBody::SBGestureMapManager* gestureMapManager = scene->getGestureMapManager(); std::vector<std::string> gestureMapNames = gestureMapManager->getGestureMapNames(); for (std::vector<std::string>::iterator iter = gestureMapNames.begin(); iter != gestureMapNames.end(); iter++) { Fl_Tree_Item* gestureMapItem = resourceTree->add(getTreeFromName("gesturemap"), (*iter).c_str()); updateGestureMap(gestureMapItem, gestureMapManager->getGestureMap((*iter))); } // update motion map resourceTree->clear_children(getTreeFromName("motion")); std::vector<std::string> motionNames = scene->getMotionNames(); for (size_t i = 0; i < motionNames.size(); i++) { //resourceTree->add(treeItemList[ITEM_MOTION],mi->first.c_str()); SmartBody::SBMotion * motion = scene->getMotion(motionNames[i]); updateMotion(getTreeFromName("motion"), motion); } SmartBody::SBAnimationBlendManager* blendManager = scene->getBlendManager(); // update animation blend map resourceTree->clear_children(getTreeFromName("blend")); std::vector<std::string> blendNames = blendManager->getBlendNames(); for (size_t i = 0; i < blendNames.size(); i++) { //resourceTree->add(treeItemList[ITEM_MOTION],mi->first.c_str()); SmartBody::SBAnimationBlend * blend = blendManager->getBlend(blendNames[i]); updateAnimationBlend(getTreeFromName("blend"), blend); } // update blend transition map resourceTree->clear_children(getTreeFromName("transition")); std::vector<std::string> transitionNames = blendManager->getTransitionNames(); for (size_t i = 0; i < transitionNames.size(); i++) { //resourceTree->add(treeItemList[ITEM_MOTION],mi->first.c_str()); SmartBody::SBAnimationTransition * transition = blendManager->getTransitionByName(transitionNames[i]); updateBlendTransition(getTreeFromName("transition"), transition); } // update mesh map resourceTree->clear_children(getTreeFromName("mesh")); std::vector<std::string> meshNames = assetManager->getDeformableMeshNames(); for (size_t i = 0; i < meshNames.size(); i++) { DeformableMesh* mesh = assetManager->getDeformableMesh(meshNames[i]); Fl_Tree_Item* meshItem = resourceTree->add(getTreeFromName("mesh"), mesh->getName().c_str()); updateMesh(meshItem, mesh); } // update face definition map resourceTree->clear_children(getTreeFromName("facedefinition")); std::vector<std::string> faceNames = scene->getFaceDefinitionNames(); for (size_t i = 0; i < faceNames.size(); i++) { //resourceTree->add(treeItemList[ITEM_MOTION],mi->first.c_str()); SmartBody::SBFaceDefinition * face = scene->getFaceDefinition(faceNames[i]); if (!face) continue; Fl_Tree_Item* faceTree = resourceTree->add(getTreeFromName("facedefinition"), face->getName().c_str()); updateFaceDefinition(faceTree, face); } // update event handler list SmartBody::SBEventManager* eventManager = SmartBody::SBScene::getScene()->getEventManager(); std::map<std::string, SmartBody::SBEventHandler*>& eventMap = eventManager->getEventHandlers(); std::map<std::string, SmartBody::SBEventHandler*>::iterator ei; resourceTree->clear_children(getTreeFromName("eventhandler")); for ( ei = eventMap.begin(); ei != eventMap.end(); ei++) { updateEventHandler(getTreeFromName("eventhandler"), ei->second); } // Below are instance objects : // update pawn objects resourceTree->clear_children(getTreeFromName("pawn")); const std::vector<std::string>& pawnNames = scene->getPawnNames(); for (size_t i = 0; i < pawnNames.size(); i++) { SmartBody::SBPawn* pawn = scene->getPawn(pawnNames[i]); updatePawn(getTreeFromName("pawn"), pawn); } // update characters resourceTree->clear_children(getTreeFromName("character")); const std::vector<std::string>& charNames = scene->getCharacterNames(); for (size_t i = 0; i < charNames.size(); i++) { SmartBody::SBCharacter* character = scene->getCharacter(charNames[i]); resourceTree->sortorder(FL_TREE_SORT_ASCENDING); updateCharacter(getTreeFromName("character"), character); } // for (SBPhysicsObjMap::iterator iter = phySim->getPhysicsObjMap().begin(); // iter != phySim->getPhysicsObjMap().end(); // iter++) // { // SBPhysicsObj* obj = (*iter).second; // if (dynamic_cast<SbmJointObj*>(obj) == NULL) // { // // } // } // update services SmartBody::SBServiceManager* serviceManager = scene->getServiceManager(); std::map<std::string, SmartBody::SBService*>& serviceMap = serviceManager->getServices(); resourceTree->clear_children(getTreeFromName("service")); for (std::map<std::string, SmartBody::SBService*>::iterator iter = serviceMap.begin(); iter != serviceMap.end(); iter++) { SmartBody::SBService* service = (*iter).second; resourceTree->sortorder(FL_TREE_SORT_ASCENDING); SmartBody::SBPhysicsManager* phyManager = dynamic_cast<SmartBody::SBPhysicsManager*>(service); if (phyManager) updatePhysicsManager(getTreeFromName("service"),phyManager); else updateService(getTreeFromName("service"), service); } // update behavior sets resourceTree->clear_children(getTreeFromName("behaviorset")); std::map<std::string, SmartBody::SBBehaviorSet*>& behaviorSets = scene->getBehaviorSetManager()->getBehaviorSets(); for (std::map<std::string, SmartBody::SBBehaviorSet*>::iterator iter = behaviorSets.begin(); iter != behaviorSets.end(); iter++) { SmartBody::SBBehaviorSet* behaviorSet = (*iter).second; updateBehaviorSet(getTreeFromName("behaviorset"), behaviorSet); } _dirty = false; if (_firstTime) { hideTree(); _firstTime = false; } }