ModuleRouter::ModuleRouter() : BaseItem("Router"), sourceModule(nullptr), destModule(nullptr), sourceValues("Source Values") { selectAllValues = addTrigger("Select All", "Select all values for routing"); deselectAllValues = addTrigger("Deselect All", "Deselect all values"); }
Button::Button() : m_isPressed(false) { m_drawing.declare("Body", m_body); m_drawing.declare("Text", m_text); m_body.setFillColor(sf::Color(100, 100, 100)); m_body.setOutlineColor(sf::Color::White); m_body.setOutlineThickness(2); m_body.setPosition(sf::Vector2f(2, 2)); m_text.setPosition(sf::Vector2f(7, 0)); addTrigger(MouseButtonPressedTrigger(std::bind(&Button::onPress, this), sf::Mouse::Button::Left, Hovering::Over)); addTrigger(ClickTrigger(std::bind(&Button::onRelease, this), sf::Mouse::Button::Left, Hovering::Over)); }
CCompletion::CCompletion(QObject *p) : QCodeCompletionEngine(p),pPopup(0) { addTrigger("("); QCodeCompletionEngine::triggerAction()->setShortcut(tr("Ctrl+Space")); }
// load this luaconfig from QSettings data void LuaConfig::fromSettings(QSettings &mySettings) { LuaTriggerBase* atrigger; QStringList childGroups; QString childGroup; QString className; // first get description and stuff from ini _description = mySettings.value(INI_KEY_DESC, "").toString(); _enableScript = mySettings.value(INI_KEY_ENABLED, false).toBool(); _lastTriggered = mySettings.value(INI_KEY_LAST_TRIGGERED, QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0))).toDateTime(); _constraint = mySettings.value(INI_KEY_CONSTRAINT_ENABLED, false).toBool(); _constraintFrom = mySettings.value(INI_KEY_CONSTRAINT_FROM, QTime()).toTime(); _constraintTo = mySettings.value(INI_KEY_CONSTRAINT_TO, QTime()).toTime(); // then fetch all groups of ini file childGroups = mySettings.childGroups(); // for all groups of ini file do ... foreach (childGroup, childGroups) { // open current group mySettings.beginGroup(childGroup); // is it a trigger? if (childGroup.startsWith(INI_KEY_TRIGGER)) { className = mySettings.value(INI_KEY_CLASSNAME).toString(); if(className == "") { std::cerr << "[Lua] LuaConfig::fromSettings() : empty trigger classname found in : [" << childGroup.toStdString() << "]" << std::endl; continue; } if ( className == LUA_TRIGGER_TIMER_INTERVAL) { atrigger = new LuaTriggerTimerInterval(); } else if (className == LUA_TRIGGER_STARTUP) { atrigger = new LuaTriggerStartup(); } else if (className == LUA_TRIGGER_SHUTDOWN) { atrigger = new LuaTriggerShutdown(); } else if (className == LUA_TRIGGER_ONCE) { atrigger = new LuaTriggerOnce(); } else if (className == LUA_TRIGGER_EVENT) { atrigger = new LuaTriggerEvent(); } else { std::cerr << "[Lua] LuaConfig::fromSettings() : unknown trigger class : '" << className.toStdString() << "' found in [" << childGroup.toStdString() << "]" << std::endl; atrigger = 0; } // if a trigger has been created, tell him to load his parms // from mySettings now and add him to our trigger list if (atrigger != 0) { std::cerr << "[Lua] LuaConfig::fromSettings() : trigger : '" << className.toStdString() << "' added." << std::endl; atrigger->fromSettings(mySettings); addTrigger(atrigger); } } // close current group mySettings.endGroup(); }
void Creature::addAttack(string& prt, list<Condition>::iterator s1, list<Condition>::iterator e1, list<Action>::iterator s2, list<Action>::iterator e2) { Trigger trig = Trigger("attack",prt,true); list<Condition>::iterator i; for(i=s1; i!=e1; ++i) { trig.addCondition(*i); } list<Action>::iterator t; for(t=s2; t!=e2; ++t) { trig.addAction(*t); } addTrigger(trig); }
void QtPFunctionBase::addUpdateTrigger(QtPBase const & qtP) { addTrigger(qtP, "update()"); }
bool l1menu::TriggerMenu::addTriggerFromOldFormat( const std::vector<std::string>& columns ) { bool successful=false; if( columns.size()<9 ) throw std::runtime_error( "There are not enough columns" ); float prescale=l1menu::tools::convertStringToFloat( columns[2] ); if( prescale!=0 ) { std::string triggerName=columns[0]; try { //std::cout << "Added trigger \"" << columns[0] << "\"" << std::endl; l1menu::ITrigger& newTrigger=addTrigger( triggerName ); // Try and create a trigger with the name supplied successful=true; // Different triggers will have different numbers of thresholds, and even different names. E.g. Single triggers // will have "threshold1" whereas a cross trigger will have "leg1threshold1", "leg2threshold1" etcetera. This // utility function will get the threshold names in the correct order. const auto& thresholdNames=l1menu::tools::getThresholdNames(newTrigger); if( thresholdNames.size()>=1 ) newTrigger.parameter(thresholdNames[0])=l1menu::tools::convertStringToFloat( columns[3] ); if( thresholdNames.size()>=2 ) newTrigger.parameter(thresholdNames[1])=l1menu::tools::convertStringToFloat( columns[4] ); if( thresholdNames.size()>=3 ) newTrigger.parameter(thresholdNames[2])=l1menu::tools::convertStringToFloat( columns[5] ); if( thresholdNames.size()>=4 ) newTrigger.parameter(thresholdNames[3])=l1menu::tools::convertStringToFloat( columns[6] ); float etaOrRegionCut=l1menu::tools::convertStringToFloat( columns[7] ); // For most triggers, I can just try and set both the etaCut and regionCut parameters // with this value. If it doesn't have either of the parameters just catch the exception // and nothing will happen. Some cross triggers however have both, and need to set them // both from this value which requires a conversion. Most cross triggers expect this // value to be the regionCut, except for L1_SingleMu_CJet which expects it as the etaCut. if( triggerName=="L1_SingleMu_CJet" ) { newTrigger.parameter("leg1etaCut")=etaOrRegionCut; newTrigger.parameter("leg2regionCut")=l1menu::tools::convertEtaCutToRegionCut( etaOrRegionCut ); } else if( triggerName=="L1_isoMu_EG" ) { newTrigger.parameter("leg1etaCut")=l1menu::tools::convertRegionCutToEtaCut( etaOrRegionCut ); newTrigger.parameter("leg2regionCut")=etaOrRegionCut; } else if( triggerName=="L1_isoEG_Mu" ) { newTrigger.parameter("leg1regionCut")=etaOrRegionCut; newTrigger.parameter("leg2etaCut")=l1menu::tools::convertRegionCutToEtaCut( etaOrRegionCut ); } else if( triggerName=="L1_isoMu_Tau" ) { newTrigger.parameter("leg1etaCut")=l1menu::tools::convertRegionCutToEtaCut( etaOrRegionCut ); newTrigger.parameter("leg2regionCut")=etaOrRegionCut; } else { // Any remaining triggers should only have one of these parameters and won't // need conversion. I'll just try and set them both, not a problem if one fails. // The cross triggers will have e.g. "leg1" prefixed to the parameter name so I'll // also try for those. try{ newTrigger.parameter("etaCut")=etaOrRegionCut; } catch( std::exception& error ) { } // Do nothing, just try and convert the other parameters try{ newTrigger.parameter("regionCut")=etaOrRegionCut; } catch( std::exception& error ) { } // Do nothing, just try and convert the other parameters try{ newTrigger.parameter("leg1etaCut")=etaOrRegionCut; } catch( std::exception& error ) { } // Do nothing, just try and convert the other parameters try{ newTrigger.parameter("leg1regionCut")=etaOrRegionCut; } catch( std::exception& error ) { } // Do nothing, just try and convert the other parameters try{ newTrigger.parameter("leg2etaCut")=etaOrRegionCut; } catch( std::exception& error ) { } // Do nothing, just try and convert the other parameters try{ newTrigger.parameter("leg2regionCut")=etaOrRegionCut; } catch( std::exception& error ) { } // Do nothing, just try and convert the other parameters } // The trigger may or may not have a muon quality cut. I also don't know if its name // is prefixed with e.g. "leg1". I'll try setting all combinations, but wrap individually // in a try block so that it doesn't matter if it fails. try{ newTrigger.parameter("muonQuality")=l1menu::tools::convertStringToFloat( columns[8] ); } catch( std::exception& error ) { } // Do nothing, just try and convert the other parameters try{ newTrigger.parameter("leg1muonQuality")=l1menu::tools::convertStringToFloat( columns[8] ); } catch( std::exception& error ) { } // Do nothing, just try and convert the other parameters try{ newTrigger.parameter("leg2muonQuality")=l1menu::tools::convertStringToFloat( columns[8] ); } catch( std::exception& error ) { } // Do nothing, just try and convert the other parameters } // end of try block catch( std::exception& error ) { std::cerr << "Unable to add trigger \"" << columns[0] << "\" because: " << error.what() << std::endl; } } // end of "if( prescale!=0 )" return successful; }
SingleIncident::SingleIncident( Trigger* trigger, Action* action, int trigCount ) : Incident( trigCount ), m_bControlDuringAction( false ) { addTrigger( trigger ); addAction( action ); }
Trigger::Trigger(TriggerOwner *own, const std::string &n): _internals(0), name(n), seen(false), owner(own), deleted(false), refs(1), is_active(true) { _internals = new TriggerInternals; addTrigger(this); }