Example #1
0
void ScriptImporter::importSourceCode(const QString &sourceCode, const QString &filePath,
        QScriptValue &targetObject)
{
    Q_ASSERT(targetObject.isObject());
    // The targetObject doesn't get overwritten but enhanced by the contents of the .js file.
    // This is necessary for library imports that consist of multiple js files.

    QString &code = m_sourceCodeCache[filePath];
    if (code.isEmpty()) {
        QbsQmlJS::Engine engine;
        QbsQmlJS::Lexer lexer(&engine);
        lexer.setCode(sourceCode, 1, false);
        QbsQmlJS::Parser parser(&engine);
        if (!parser.parseProgram()) {
            throw ErrorInfo(parser.errorMessage(), CodeLocation(filePath, parser.errorLineNumber(),
                                                                parser.errorColumnNumber()));
        }

        IdentifierExtractor extractor;
        extractor.start(parser.rootNode());
        code = QLatin1String("(function(){\n") + sourceCode + extractor.suffix();
    }

    QScriptValue result = m_engine->evaluate(code, filePath, 0);
    if (m_engine->hasUncaughtException())
        throw errorInfoFromScriptValue(result, filePath);
    copyProperties(result, targetObject);
}
Example #2
0
TStatusTransition& TStatusTransition::operator = (const TStatusTransition& t) {
  if (this != &t) {
    m_status = t.status();
    copyProperties(t);
  }
  return *this;
}
Example #3
0
WordTransition& WordTransition::operator = (const WordTransition& t) {
  if (this != &t) {
    m_word = t.word();
    copyProperties(t);
  }
  return *this;
}
Example #4
0
//override functions.
cocos2d::ui::LayoutParameter* CustomRelativeLayoutParameter::createCloneInstance()
{
    auto ret = new CustomRelativeLayoutParameter();
    ret->copyProperties(this);
    ret->_ui_padding = this->_ui_padding;
    ret->autorelease();
    return ret;
}
Example #5
0
 bool Property<PropertyBag>::copy( const Property<PropertyBag>& orig)
 {
     if ( !ready() )
         return false;
     _name = orig.getName();
     _description = orig.getDescription();
     return copyProperties( this->_value->set(), orig.rvalue() );
 }
Example #6
0
LemmaTransition& LemmaTransition::operator = (const LemmaTransition& t) {
  if (this != &t) {
    m_lemma = t.lemma();
    m_pos = t.partOfSpeech();
    m_macroAccessor = t.m_macroAccessor;
    m_microAccessor = t.m_microAccessor;
    copyProperties(t);
  }
  return *this;
}
Example #7
0
void PropertiesDock::keyPressEvent(QKeyEvent *event)
{
    if (event->matches(QKeySequence::Delete) || event->key() == Qt::Key_Backspace) {
        removeProperties();
    } else if (event->matches(QKeySequence::Cut)) {
        cutProperties();
    } else if (event->matches(QKeySequence::Copy)) {
        copyProperties();
    } else if (event->matches(QKeySequence::Paste)) {
        pasteProperties();
    } else {
        QDockWidget::keyPressEvent(event);
    }
}
Example #8
0
void Client::copyProperties(const AbstractConfiguration& abstractConfigs,const string& root) {
	AbstractConfiguration::Keys keys;
	abstractConfigs.keys(root,keys);
	AbstractConfiguration::Keys::const_iterator it;
	for(it=keys.begin();it!=keys.end();++it) {
		string key(root);
		if(!key.empty())
			key+=".";
		key += (*it);
		if(abstractConfigs.hasOption(key))
			setString(key,abstractConfigs.getString(key));
		else
			copyProperties(abstractConfigs,key);
	}
}
void CtrlrPanelComponentProperties::changeListenerCallback (ChangeBroadcaster* source)
{
    if (owner.getSelection() == nullptr)
        return;

	if (selectedItems != owner.getSelection()->getNumSelected() && owner.getSelection()->getNumSelected() > 1)
	{
		selectedItems = owner.getSelection()->getNumSelected();
		msTree = ValueTree(Ids::modulator);
		msTree.removeListener (this);

		for (int i=0; i<owner.getSelection()->getNumSelected(); i++)
		{
			ValueTree modTree = owner.getSelection()->getSelectedItem(i)->getOwner().getModulatorTree();

			copyProperties (modTree, msTree);

			for (int i=0; i<modTree.getNumChildren(); i++)
			{
				if (!msTree.getChildWithName(modTree.getChild(i).getType()).isValid())
					msTree.addChild (modTree.getChild(i).createCopy(), i, 0);
			}
		}

		if (msTree.getChildWithName(Ids::component).isValid())
		{
			msTree.getChildWithName(Ids::component).setProperty (Ids::uiType, "uiMultipleSelection", 0);
		}

		msTree.addListener (this);
		setTree (msTree);
	}

	if (owner.getSelection()->getNumSelected() == 0)
	{
		setTree (owner.getOwner().getPanelTree());
		propertyPanel->restoreOpennessState(panelPropertyOpennessState);
	}

	if (owner.getSelection()->getNumSelected() == 1)
	{
	    refreshTargetModulationPropertyList(owner.getSelection()->getSelectedItem(0)->getOwner().getModulatorTree());
		refreshDynamicData();
		setTree (owner.getSelection()->getSelectedItem(0)->getOwner().getModulatorTree());
		propertyPanel->restoreOpennessState(modulatorPropertyOpennessState);
	}
}
Example #10
0
void Utility::copyProperties(const Poco::Util::AbstractConfiguration& source, Poco::Util::AbstractConfiguration& target, const std::set<std::string>& excludeSet, const std::string& root)
{
	Poco::Util::AbstractConfiguration::Keys keys;
	source.keys(root, keys);

	if (keys.empty() && source.hasProperty(root))
	{
		target.setString(root, source.getRawString(root));
	}
	else
	{
		for (Poco::Util::AbstractConfiguration::Keys::const_iterator it = keys.begin(); it != keys.end(); ++it)
		{
			std::string fullKey = root;
			if (!fullKey.empty()) fullKey += '.';
			fullKey.append(*it);
			if (excludeSet.find(fullKey) == excludeSet.end())
			{
				copyProperties(source, target, excludeSet, fullKey);
			}
		}
	}
}
Example #11
0
StarTransition& StarTransition::operator = (const StarTransition& t) {   
  if (this != &t) {
    copyProperties(t);
  }
  return *this;
}
Example #12
0
Client::Client(const Client& client) : Entity(client),path(client.path),swfUrl(client.swfUrl),pageUrl(client.pageUrl),_pFlowWriter(client._pFlowWriter) {
	copyProperties(*this);
}
Example #13
0
void PropertiesDock::cutProperties()
{
    if (copyProperties())
        removeProperties();
}