Ejemplo n.º 1
0
static string toStr(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBundleRangeHandleRef rangeRef)
{
    if (!rangeRef)
        return "(null)";

    WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);

    JSGlobalContextRef context = WKBundleFrameGetJavaScriptContextForWorld(frame, world);
    JSValueRef rangeValue = WKBundleFrameGetJavaScriptWrapperForRangeForWorld(frame, rangeRef, world);
    ASSERT(JSValueIsObject(context, rangeValue));
    JSObjectRef rangeObject = (JSObjectRef)rangeValue;

    JSValueRef startNodeValue = propertyValue(context, rangeObject, "startContainer");
    ASSERT(JSValueIsObject(context, startNodeValue));
    JSObjectRef startNodeObject = (JSObjectRef)startNodeValue;

    JSValueRef endNodeValue = propertyValue(context, rangeObject, "endContainer");
    ASSERT(JSValueIsObject(context, endNodeValue));
    JSObjectRef endNodeObject = (JSObjectRef)endNodeValue;

    int startOffset = propertyValueInt(context, rangeObject, "startOffset");
    int endOffset = propertyValueInt(context, rangeObject, "endOffset");

    ostringstream out;
    out << "range from " << startOffset << " of " << dumpPath(context, startNodeObject) << " to " << endOffset << " of " << dumpPath(context, endNodeObject);
    return out.str();
}
bool IqOrmSqlManyToOnePropertyDescriptionProcessor::postInsert(IqOrmDataSourceOperationResult *result) const
{
    Q_CHECK_PTR(result);
    Q_CHECK_PTR(propertyDescription());
    Q_CHECK_PTR(object());
    Q_CHECK_PTR(object()->ormMetaModel());

    if (propertyValue().isNull()) {
        result->setError("");
        return true;
    }

    qint64 associatedObjectId = propertyValue().toLongLong();

    if (associatedPropertyDescription()) {
        IqOrmOneToManyPropertyChanges *changes = result->changes(associatedOrmModel(), associatedObjectId)->propertyChanges(associatedPropertyDescription());
        changes->addNewObjectId(object()->objectId());
    }

    IqOrmManyToOnePropertyChanges *changes = result->changes(ormModel(), object()->objectId())->propertyChanges(propertyDescription());
    changes->setOperation(IqOrmManyToOnePropertyChanges::Set);
    changes->setNewObjectId(associatedObjectId);

    result->setError("");
    return true;
}
Ejemplo n.º 3
0
void FontAttribPropItem::setModelData(QWidget *propertyEditor , QAbstractItemModel *model, const QModelIndex &index)
{
    model->setData(index,qobject_cast<CheckBoxEditor*>(propertyEditor)->isChecked());
    QFont font = object()->property(parent()->propertyName().toLatin1()).value<QFont>();
    if (propertyName()=="bold"){
        font.setBold(propertyValue().toBool());
    }
    if (propertyName()=="italic"){
        font.setItalic(propertyValue().toBool());
    }
    if (propertyName()=="underline"){
        font.setUnderline(propertyValue().toBool());
    }
    setValueToObject(parent()->propertyName(),font);
}
Ejemplo n.º 4
0
FontPropItem::FontPropItem(QObject *object, ObjectPropItem::ObjectsList *objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool readonly)
    :ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
{

    m_bold = new FontAttribPropItem(object,objects,"bold",tr("bold"),propertyValue().value<QFont>().bold(),this,false);
    m_italic = new FontAttribPropItem(object,objects,"italic",tr("italic"),propertyValue().value<QFont>().italic(),this,false);
    m_underline = new FontAttribPropItem(object,objects,"underline",tr("underline"),propertyValue().value<QFont>().underline(),this,false);
    m_pointSize = new FontPointSizePropItem(object,0,"pointSize",tr("size"),propertyValue().value<QFont>().pointSize(),this,false);
    m_family = new FontFamilyPropItem(object,0,"family",tr("family"),propertyValue().value<QFont>(),this,false);

    this->appendItem(m_family);
    this->appendItem(m_pointSize);
    this->appendItem(m_bold);
    this->appendItem(m_italic);
    this->appendItem(m_underline);
}
Ejemplo n.º 5
0
void BoolPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
{
    CheckBoxEditor *editor =qobject_cast<CheckBoxEditor *>(propertyEditor);
    editor->setEditing(true);
    editor->setChecked(propertyValue().toBool());
    editor->setEditing(false);
}
Ejemplo n.º 6
0
static double propertyValueDouble(JSContextRef context, JSObjectRef object, const char* propertyName)
{
    JSValueRef value = propertyValue(context, object, propertyName);
    if (!value)
        return 0;
    return JSValueToNumber(context, value, 0);
}
Ejemplo n.º 7
0
bool ChromeProfile::IsAcceptLanguagesOk() 
{
	bool acceptLanguagesFound, bRslt;
	wstring langcode, firstlang;

	bRslt = false;
	acceptLanguagesFound = ReadAcceptLanguages(langcode);

	if (acceptLanguagesFound)
	{
		LanguageList propertyValue(langcode);
		firstlang = propertyValue.GetFirstLanguage();
		std::transform(firstlang.begin(), firstlang.end(), firstlang.begin(), ::tolower);
		
		if (firstlang.compare(CHROME_ACCEPT_LANGUAGECODE_1) == 0
			|| firstlang.compare(CHROME_ACCEPT_LANGUAGECODE_2)  == 0)
		{
			bRslt = true;
		}
	}
	else
	{
		if (IsUiLocaleOk())
		{
			bRslt = true;
		}
	}

	g_log.Log(L"ChromeProfile::IsAcceptLanguagesOk: %u", (wchar_t*) bRslt);
	return bRslt;
}
Ejemplo n.º 8
0
static string dumpPath(JSGlobalContextRef context, JSObjectRef nodeValue)
{
    JSValueRef nodeNameValue = propertyValue(context, nodeValue, "nodeName");
    JSRetainPtr<JSStringRef> jsStringNodeName(Adopt, JSValueToStringCopy(context, nodeNameValue, 0));
    WKRetainPtr<WKStringRef> nodeName = toWK(jsStringNodeName);

    JSValueRef parentNode = propertyValue(context, nodeValue, "parentNode");

    ostringstream out;
    out << nodeName;

    if (parentNode && JSValueIsObject(context, parentNode))
        out << " > " << dumpPath(context, (JSObjectRef)parentNode);

    return out.str();
}
Ejemplo n.º 9
0
static JSObjectRef propertyObject(JSContextRef context, JSObjectRef object, const char* propertyName)
{
    JSValueRef value = propertyValue(context, object, propertyName);
    if (!value || !JSValueIsObject(context, value))
        return 0;
    return const_cast<JSObjectRef>(value);
}
Ejemplo n.º 10
0
void UmlArtifact::genpro() {
  UmlPackage * pack = (UmlPackage *) parent()->parent();
  
  Q3CString path;

  if (! propertyValue("genpro path", path)) {

    path = pack->cppSrcDir();
  
    if (path.isEmpty())
      path = root_dir();
    else if (QDir::isRelativePath(path)) {
      QDir d(root_dir());
      
      d.cd(path);
      path = d.absPath();
    }
  }

  if (stereotype() == "executable") {
    gen_app(path);
  }
  else
    UmlCom::trace(stereotype() + " : not managed");
}
Ejemplo n.º 11
0
void FontPointSizePropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
{
    model->setData(index,qobject_cast<SpinBoxEditor*>(propertyEditor)->value());
    QFont font = object()->property(parent()->propertyName().toLatin1()).value<QFont>();
    font.setPointSize(propertyValue().toInt());
    setValueToObject(parent()->propertyName(),font);
}
Ejemplo n.º 12
0
QWidget *FontFamilyPropItem::createProperyEditor(QWidget *parent) const
{
    FontFamilyEditor* editor = new FontFamilyEditor(parent);
//    QFontComboBox* editor = new QFontComboBox(parent);
    editor->setAutoFillBackground(true);
    editor->setFont(propertyValue().value<QFont>());
    return editor;
}
Ejemplo n.º 13
0
static double numericWindowPropertyValue(WKBundleFrameRef frame, const char* propertyName)
{
    JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
    JSValueRef value = propertyValue(context, JSContextGetGlobalObject(context), propertyName);
    if (!value)
        return 0;
    JSValueRef exception;
    return JSValueToNumber(context, value, &exception);
}
Ejemplo n.º 14
0
IntSetCellRenderer::IntSetCellRenderer() :
    Glib::ObjectBase(typeid(IntSetCellRenderer)),
    Gtk::CellRendererText(),
    m_propertyValue(*this, "stdintset", std::set<int>())
{
    propertyValue().signal_changed().connect(
        sigc::mem_fun(*this, &IntSetCellRenderer::valueChanged)
    );
}
Ejemplo n.º 15
0
JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const
{
    const String property = DumpRenderTreeSupportEfl::pageProperty(browser->mainFrame(), propertyName, pageNumber);
    if (property.isEmpty())
        return 0;

    JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithUTF8CString(property.utf8().data()));
    return propertyValue;
}
Ejemplo n.º 16
0
void IntSetCellRenderer::valueChanged() {
    Glib::ustring s;
    std::set<int> v = propertyValue();
    for (std::set<int>::const_iterator it = v.begin(); it != v.end(); ++it) {
        s += ToString(*it);
        if (*it != *v.rbegin()) s += "|";
    }
    property_text() = s;
    property_foreground() = (v.size() > 1) ? "gray" : "black";
}
Ejemplo n.º 17
0
NS_IMETHODIMP
nsBoxObject::SetProperty(const PRUnichar* aPropertyName, const PRUnichar* aPropertyValue)
{
  if (!mPresState)
    NS_NewPresState(getter_Transfers(mPresState));

  nsDependentString propertyName(aPropertyName);
  nsDependentString propertyValue(aPropertyValue);
  return mPresState->SetStateProperty(propertyName, propertyValue);
}
Ejemplo n.º 18
0
bool ChromeProfile::WriteSpellAndAcceptLanguages()
{
	Json::Value root;
	wstring path = m_installLocation + GetPreferencesRelPathAndFile();
	std::ifstream in(path.c_str());
	Json::Reader reader;
	Json::FastWriter writer;
	string acceptLanguages;
	wstring wLang;
	bool rslt;

	if (in.fail())
	{
		g_log.Log(L"ChromeProfile::WriteSpellAndAcceptLanguages. Cannot open for reading %s", (wchar_t*) path.c_str());
		return false;
	}

	rslt = reader.parse(in, root);
	in.close();

	if (rslt == false)
	{
		g_log.Log(L"ChromeProfile::WriteSpellAndAcceptLanguages. Cannot parse %s", (wchar_t*) path.c_str());
		return false;
	}

	if (m_setCatalanAsAcceptLanguage)
	{	
		acceptLanguages = root["intl"]["accept_languages"].asString();
		StringConversion::ToWideChar(acceptLanguages, wLang);

		LanguageList propertyValue(wLang);
		wLang = propertyValue.GetWithCatalanAdded();
		StringConversion::ToMultiByte(wLang, acceptLanguages);
		root["intl"]["accept_languages"] = acceptLanguages;
	}

	if (m_setCatalanAsSpellLanguage)
	{
		root["spellcheck"]["dictionary"] = CHROME_SPELLCHECKER_LANGUAGECODE_STR;
	}

	std::ofstream out(path.c_str());
	if (out.fail())
	{
		g_log.Log(L"ChromeProfile::WriteAcceptLanguageCode. Cannot open for writing %s", (wchar_t*) path.c_str());
		return false;
	}

	m_prefCacheIsValid = false;
	std::string jsonMessage = writer.write(root);
	out << jsonMessage;
	out.close();
	return true;
}
Ejemplo n.º 19
0
void UmlItem::setUseless()
{
    QByteArray dummy;

    if (propertyValue("STM generated", dummy))
        set_PropertyValue("STM generated", "0");

    const QVector<UmlItem*> v = children();

    for (unsigned index = v.count(); index != 0; index -= 1)
        v[index - 1]->setUseless();
}
Ejemplo n.º 20
0
void UmlItem::loadFromProfile()
{
    WrapperStr id;

    if (propertyValue("xmiId", id) && (All.find(id) == All.end()))
        All.insert(id, this);

    const Q3PtrVector<UmlItem> ch = children();
    unsigned n = ch.size();

    for (unsigned u = 0; u != n; u += 1)
        ch[u]->loadFromProfile();
}
Ejemplo n.º 21
0
void UmlItem::deleteUseless()
{
    QByteArray v;

    if (propertyValue("STM generated", v) && (v == "0"))
        // useless
        deleteIt();
    else {
        const QVector<UmlItem*> v = children();

        for (unsigned index = v.count(); index != 0; index -= 1)
            v[index - 1]->deleteUseless();
    }
}
Ejemplo n.º 22
0
bool BoolPropItem::paint(QPainter *painter, const QStyleOptionViewItemV4 &option, const QModelIndex &index)
{
    if (index.column()==1) {
        QStyleOptionButton so;
        int border = (option.rect.height() - QApplication::style()->pixelMetric(QStyle::PM_IndicatorWidth))/2;
        so.rect = option.rect.adjusted(border,border,0,-border);
        so.rect.setWidth(QApplication::style()->pixelMetric(QStyle::PM_IndicatorWidth));

        if (!isValueReadonly())
            so.state = QStyle::State_Enabled;
        else
            so.state &= ~QStyle::State_Enabled;

        so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off;

        option.widget->style()->drawPrimitive(QStyle::PE_IndicatorCheckBox,&so,painter);

        return true;
    } else return false;
}
Ejemplo n.º 23
0
UmlPackage * UmlPackage::findProfile(WrapperStr xmiId)
{
    if (stereotype() == "profile") {
        WrapperStr id;

        if (propertyValue("xmiId", id) && (id == xmiId))
            return this;
    }

    const Q3PtrVector<UmlItem> ch = children();
    unsigned n = ch.size();
    UmlPackage * r;

    for (unsigned u = 0; u != n; u += 1) {
        if ((ch[u]->kind() == aPackage) &&
            ((r = ((UmlPackage *) ch[u])->findProfile(xmiId)) != 0))
            return r;
    }

    return 0;
}
Ejemplo n.º 24
0
QVariant QgsProperty::value( const QgsExpressionContext &context, const QVariant &defaultValue, bool *ok ) const
{
  if ( ok )
    *ok = false;

  bool valOk = false;
  QVariant val = propertyValue( context, defaultValue, &valOk );
  if ( !d->transformer && !valOk ) // if transformer present, let it handle null values
    return defaultValue;

  if ( d->transformer )
  {
    if ( !valOk )
      val = QVariant();
    val = d->transformer->transform( context, val );
  }

  if ( ok )
    *ok = true;

  return val;
}
Ejemplo n.º 25
0
void UmlClass::write(FileOut & out) {
  QCString st = stereotype();
  
  if (st == "metaclass")
    return;
  
  bool is_actor = (st == "actor");
  bool is_enum = (st == "enum");
  bool is_stereotype =
    (st == "stereotype") && 
    (parent()->parent()->kind() == aPackage) &&
    (parent()->parent()->stereotype() == "profile");
  
  if (!is_actor) {
    switch (_lang) {
    case Cpp:
      if (cppDecl().isEmpty())
	return;
      break;
    case Java:
      if (javaDecl().isEmpty())
	return;
    default:
      break;
    }
  }

  const char * k = (parent()->kind() == aClass)
    ? "nestedClassifier"
    : ((!_uml_20)
       ? "packagedElement"
       : ((is_stereotype) ? "ownedStereotype" : "ownedMember"));
  bool is_assoc_class = (_assoc != 0);
  
  out.indent();
  out << "<" << k << " xmi:type=\"uml:"
    << ((is_actor) 
	? "Actor"
	: ((is_assoc_class)
	   ? "AssociationClass"
	   : ((st == "interface")
	      ? "Interface" 
	      : ((is_enum)
		 ?"Enumeration"
		 : ((is_stereotype) ? "Stereotype" : "Class")))))
    << "\" name=\"";
  out.quote(name());
  out << '"';
  out.id(this);
  write_visibility(out);
  if (isAbstract())
    out << " isAbstract=\"true\"";
  if (isActive())
    out << " isActive=\"true\"";
  out << ">\n";
  
  if (is_assoc_class)
    _assoc->write_ends(out);
    
  out.indent(+1);
  
  write_constraint(out);
  write_annotation(out);
  write_description_properties(out);
  
  if (_gen_extension && (st == "typedef")) {
    const UmlTypeSpec & base = baseType();
    
    if ((base.type != 0) || !base.explicit_type.isEmpty()) {
      out.indent();
      out << "<xmi:Extension extender=\"Bouml\">\n";
      out.indent();
      out << "\t<typedef>\n";
      out.indent(+2);
      UmlItem::write_type(out, base, "base");
      out.indent(-2);
      out.indent();
      out << "\t</typedef>\n";
      out.indent();
      out << "</xmi:Extension>\n";
    }
  }
  
  write_formals(out);
  write_actuals(out);
  
  const QVector<UmlItem> ch = children();
  unsigned n = ch.size();
  unsigned i;
  
  for (i = 0; i != n; i += 1)
    ch[i]->write(out);
  
  if (is_stereotype) {
    QCString path;
    
    if (propertyValue("stereotypeIconPath", path) && !path.isEmpty()) {
      out.indent();
      out << "<icon xmi:type=\"uml:Image\"";
      out.id_prefix(this, "Icon_");
      out << " location=\"" << path << "\"/>\n";
    }
  }
  
  out.indent(-1);
  out.indent();
  out << "</" << k << ">\n";
  
  if (is_stereotype)
    for (i = 0; i != n; i += 1)
      if (ch[i]->kind() == aRelation)
	((UmlRelation *) ch[i])->write_extension(out);
  
  unload();
}
Ejemplo n.º 26
0
 std::string currentLink() const {
     return boost::get<std::string>(propertyValue("CURRENTLINK"));
 }
Ejemplo n.º 27
0
PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpecificKeyframe(CSSPropertyID property) const
{
    return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset(), easing(), propertyValue(property), composite()));
}
Ejemplo n.º 28
0
JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const
{
    JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithUTF8CString(DumpRenderTreeSupportGtk::pageSizeAndMarginsInPixels(mainFrame, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft).data()));
    return propertyValue;
}
Ejemplo n.º 29
0
JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const
{
    JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithUTF8CString(DumpRenderTreeSupportGtk::pageProperty(mainFrame, propertyName, pageNumber).data()));
    return propertyValue;
}
Ejemplo n.º 30
0
void UmlPackage::packageImport(FileIn & in, Token & tk)
{
    if (! tk.closed()) {
        WrapperStr id = tk.xmiId();
        WrapperStr k = tk.what();
        const char * kstr = k;

        while (in.read(), !tk.close(kstr)) {
            if (tk.what() == "importedpackage") {
                if (tk.xmiType() == "uml:Model") {
                    WrapperStr v;

                    if (propertyValue("metamodelReference", v) && (v == id)) {
                        WrapperStr href = tk.valueOf("href");
                        int index = href.find('#');

                        set_PropertyValue("metamodelReference",
                                          (index == -1)
                                          ? href : href.left(index));
                    }
                }
                else if (tk.xmiType() == "uml:Profile") {
                    WrapperStr s = tk.xmiIdref();
                    UmlPackage * pf = 0;

                    if (!s.isEmpty()) {
                        QMap<WrapperStr, UmlItem *>::Iterator it = All.find(s);

                        if (it == All.end())
                            UnresolvedRelation::add(4, this->id(), s, "", "");
                        else if ((*it)->kind() == aPackage)
                            pf = (UmlPackage *) *it;
                    }
                    else
                        pf = importProfile(in, tk.valueOf("href"));

                    if (pf != 0) {
                        UmlNcRelation * ncr = UmlNcRelation::create(aDependency, this, pf);

                        if (ncr != 0)
                            ncr->set_Stereotype("import");
                    }
                }
            }
            else if (tk.what() == "importedelement") {
                WrapperStr v;

                if (propertyValue("metaclassReference", v) && (v == id)) {
                    WrapperStr href = tk.valueOf("href");
                    int index = href.find('#');

                    set_PropertyValue("metaclassReference",
                                      (index == -1)
                                      ? href : href.left(index));
                }
            }

            if (! tk.closed())
                in.finish(tk.what());
        }
    }
}