ScriptItem::ScriptItem(const openstudio::path& path, OSItem::Type type, QWidget * parent) : OSItem(scriptToItemId(path), type, parent), m_removed(false), m_scriptInfo(path, true, false) { setText(openstudio::toQString(path.filename())); setLeftPixmap(QPixmap(":/images/icon_scripts.png")); if (boost::regex_search(toString(itemId().sourceId()),boost::regex("resource"))) { m_scriptInfo.isUserScript = false; } else { try { m_scriptInfo = runmanager::RubyJobBuilder::updateArgumentsFromDb(m_scriptInfo); } catch (const runmanager::ScriptDetectionError &e) { // Nothing to display here in the constructor m_scriptInfo = e.scriptInfo; } } boost::shared_ptr<OSDocument> osDoc = OSAppBase::instance()->currentDocument(); connect(this,SIGNAL(argChanged()),osDoc.get(),SLOT(markAsModified())); }
void SyncObject::setArgument(int argNum,QVariant* arg) { try { if(arg->type() == QVariant::Int) { args.value(argNum)->setValue(arg->toInt()); } else if(arg->type() == QVariant::Double) { args.value(argNum)->setValue((float)arg->toDouble()); } else if(arg->type() == QVariant::String) { args.value(argNum)->setValue(arg->toString()); } else { args.value(argNum)->setValue((float)arg->toDouble()); } emit argChanged(name, argNum,args.at(argNum)); } catch(...) { qCritical() << "Error attempting to set a syncArg in SyncObject"; } }
void ScriptItem::setOSArgument(const ruleset::OSArgument& arg) { m_scriptInfo.arguments[arg.name()] = arg; m_scriptInfo.argsChanged = true; emit argChanged(); }