void KWidgetStreamer::propertyToStream( const QObject* from, QDataStream& stream )
{
  // Only handle widgets. Alternatives to widgets are layouts, validators, timers, etc.
  if ( ! from->inherits("QWidget") )
    return;

  // Serializing all the children (if any).
  const QObjectList* children = from->children();
  if ( children ) {
    stream <<  children->count();
    for ( QObjectListIt it = QObjectListIt(*children); *it; ++it ) {
      toStream( *it, stream );
    }
  }
  else {
    stream << (unsigned int) 0;
  }

  // Now stream out properties
  for ( PropertyMapIt mapIt = _map.begin(); mapIt != _map.end(); mapIt++ ) {
    QString tp = mapIt.key();
    PropertyList list = mapIt.data();
    if ( from->inherits( tp.latin1() ) ) {
      for ( PropertyListIt it = list.begin(); it != list.end(); ++it ) {
        QVariant prop = from->property( (*it).latin1() );
        if ( ! prop.isValid() )
          qWarning("Invalid property: %s:%s", tp.latin1(), (*it).latin1() );

        stream <<  prop ;
      }
    }
  }
}
void KWidgetStreamer::propertyFromStream( QDataStream& stream, QObject* to )
{
  // Only handle widgets. Alternatives to widgets are layouts, validators, timers, etc.
  if ( ! to->inherits("QWidget") )
    return;

  // Stream in all the children (if any)
  const QObjectList* children = to->children();
  unsigned int count;

  stream >> count;
  if ( children ) {
    Q_ASSERT( count == children->count() );
    for ( QObjectListIt it = QObjectListIt(*children); *it; ++it )
      fromStream( stream, *it );
  }
  else {
    Q_ASSERT( count == 0 );
  }

  // Now stream in properties
  for ( PropertyMapIt mapIt = _map.begin(); mapIt != _map.end(); mapIt++ ) {
    QString tp = mapIt.key();
    PropertyList list = mapIt.data();
    if ( to->inherits( tp.latin1() ) ) {
      for ( PropertyListIt it = list.begin(); it != list.end(); ++it ) {
         QVariant value;
        stream >> value;
        to->setProperty((*it).latin1(), value);
      }
    }
  }
}
Example #3
0
// Get XML for a new form from the widget box. Change objectName/geometry
// properties to be suitable for new forms
static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const QString &className, const QString &objectName)
{
    typedef QList<DomProperty*> PropertyList;

    QDesignerWidgetBoxInterface::Widget widget;
    const bool found = QDesignerWidgetBox::findWidget(core->widgetBox(), className, QString(), &widget);
    if (!found)
        return QString();
    QScopedPointer<DomUI> domUI(QDesignerWidgetBox::xmlToUi(className, widget.domXml(), false));
    if (domUI.isNull())
        return QString();
    domUI->setAttributeVersion(QLatin1String("4.0"));
    DomWidget *domWidget = domUI->elementWidget();
    if (!domWidget)
        return QString();
    // Properties: Remove the "objectName" property in favour of the name attribute and check geometry.
    domWidget->setAttributeName(objectName);
    const QString geometryProperty = QLatin1String("geometry");
    const QString objectNameProperty  = QLatin1String("objectName");
    PropertyList properties = domWidget->elementProperty();
    for (PropertyList::iterator it = properties.begin(); it != properties.end(); ) {
        DomProperty *property = *it;
        if (property->attributeName() == objectNameProperty) { // remove  "objectName"
            it = properties.erase(it);
            delete property;
        } else {
            if (property->attributeName() == geometryProperty) { // Make sure form is at least 400, 300
                if (DomRect *geom = property->elementRect()) {
                    if (geom->elementWidth() < NewFormWidth)
                        geom->setElementWidth(NewFormWidth);
                    if (geom->elementHeight() < NewFormHeight)
                        geom->setElementHeight(NewFormHeight);
                }
            }
            ++it;
        }
    }
    // Add a window title property
    DomString *windowTitleString = new DomString;
    windowTitleString->setText(objectName);
    DomProperty *windowTitleProperty = new DomProperty;
    windowTitleProperty->setAttributeName(QLatin1String("windowTitle"));
    windowTitleProperty->setElementString(windowTitleString);
    properties.push_back(windowTitleProperty);
    // ------
    domWidget->setElementProperty(properties);
    // Embed in in DomUI and get string. Omit the version number.
    domUI->setElementClass(objectName);

    QString rc;
    { // Serialize domUI
        QXmlStreamWriter writer(&rc);
        writer.setAutoFormatting(true);
        writer.setAutoFormattingIndent(1);
        writer.writeStartDocument();
        domUI->write(writer);
        writer.writeEndDocument();
    }
    return rc;
}
Example #4
0
void ModelerUserInterface::populateList(GroupProperty* group, Fl_Tree_Item* parent) {
	// Create a tree node for this group.
	Fl_Tree_Item* item;
	if (parent == NULL) {
		// HACK: We have to add and remove a fake list item so that the tree
		// control will create a root node to put it under.
		m_controlsTree->remove(m_controlsTree->add("You shouldn't see this."));

		item = m_controlsTree->root();
		item->label(group->getName());
	} else {
		item = m_controlsTree->add(parent, group->getName());
	}
	item->user_data(group);

	// Examine the group's property list for group properties.
	PropertyList* controls = group->getProperties();
	for (PropertyList::iterator iter = controls->begin();
		 iter != controls->end();
		 iter++) {
	    // See if it's a GroupProperty by attempting to cast it
		GroupProperty* childGroup = dynamic_cast<GroupProperty*>(*iter);

		// If it is, add it to the list.
		if (childGroup) {
			ModelerUserInterface::populateList(childGroup, item);
		}
	}
}
Example #5
0
//////////////////////////////////////////////////////////////////////////
// Page 2
//////////////////////////////////////////////////////////////////////////
LRESULT CDiskPropertyPage2::OnInitDialog(HWND /*hWndFocus*/, LPARAM /*lParam*/)
{
	WTL::CString strCaption;
	strCaption.LoadString(IDS_DISKPROPERTYPAGE_CAPTION);
	GetParentSheet()->SetWindowText(strCaption);

	CDiskObjectPtr disk = GetParentSheet()->GetDiskObject();

	m_listProperty.SubclassWindow( GetDlgItem(IDC_LIST_PROPERTY) );
	DWORD dwStyle = LVS_EX_FULLROWSELECT; 
	//| LVS_EX_GRIDLINES 
	//| LVS_EX_INFOTIP 
	m_listProperty.SetExtendedListViewStyle( dwStyle, dwStyle );

	WTL::CString strCol[2];
	strCol[0].LoadString( IDS_DISKPROPERTYPAGE_LIST_COL_NAME );
	strCol[1].LoadString( IDS_DISKPROPERTYPAGE_LIST_COL_VALUE );
	m_listProperty.InsertColumn( 0, strCol[0], LVCFMT_LEFT, 130, -1 );
	m_listProperty.InsertColumn( 1, strCol[1], LVCFMT_LEFT, 200, -1 );

	const CObjectUIHandler *phandler = CObjectUIHandler::GetUIHandler( disk );

	PropertyList propList = phandler->GetPropertyList( disk );
	PropertyList::iterator itr;
	for ( itr = propList.begin(); itr != propList.end(); ++itr )
	{
		m_listProperty.InsertItem( itr->strName, itr->strValue, itr->strToolTip );
	}

	return 0;
}
Example #6
0
QString Mapping::selectAllQuery() const {
    Q_CHECK_PTR(table());
    PropertyList pl = properties();
    QStringList cn;
    for (PropertyList::const_iterator it = pl.begin(); it != pl.end(); it++) {
        cn << (*it)->tableColumn()->name();
    }
    return QString("SELECT %1 FROM %2").arg(cn.join(", ")).arg(table()->qualifiedName());
}
Example #7
0
 void Entity::setProperties(const PropertyList& properties, bool replace) {
     if (replace) {
         m_propertyStore.clear();
         setProperty(SpawnFlagsKey, "0");
     }
     PropertyList::const_iterator it, end;
     for (it = properties.begin(), end = properties.end(); it != end; ++it)
         setProperty(it->key(), it->value());
 }
void Core::updateSupported(PropertyList added, PropertyList removed)
{
	
	/// add the newly supported to master list
	
	for(PropertyList::iterator itr = added.begin(); itr != added.end(); itr++)
	{
		if(ListPlusPlus<VehicleProperty::Property>(&added).contains(*itr))
		{
			mMasterPropertyList.push_back(*itr);
		}
	}
	
	/// removed no longer supported properties from master list.
	
	for(PropertyList::iterator itr = removed.begin(); itr != removed.end(); itr++)
	{
		ListPlusPlus<VehicleProperty::Property>(&mMasterPropertyList).removeOne(*itr);
	}
	
	/// tell all new sinks about the newly supported properties.
	
	for(SinkList::iterator itr = mSinks.begin(); itr != mSinks.end(); itr++)
	{
		(*itr)->supportedChanged(mMasterPropertyList);
	}
	
	/// iterate through subscribed properties and resubscribe.  This catches newly supported properties in the process.
	
	for(map<VehicleProperty::Property, SinkList>::iterator itr = propertySinkMap.begin(); itr != propertySinkMap.end(); itr++)
	{
		VehicleProperty::Property  property = (*itr).first;
		
		for(SourceList::iterator source = mSources.begin(); source != mSources.end(); source++)
		{
			PropertyList properties = (*source)->supported();
			
			if(ListPlusPlus<VehicleProperty::Property>(&properties).contains(property))
			{
				(*source)->subscribeToPropertyChanges(property);
			}
		}
	}
}
 bool ModelDefinitionFlagEvaluator::evaluate(const PropertyList& properties) const {
     PropertyList::const_iterator it, end;
     for (it = properties.begin(), end = properties.end(); it != end; ++it) {
         const Property& property = *it;
         if (property.key() == m_propertyKey) {
             if ((std::atoi(property.value().c_str()) & m_flagValue) != 0)
                 return true;
             break;
         }
     }
     return false;
 }
Example #10
0
void dumpToLog(vmime::ref<vmime::net::session> session)
{
    typedef std::vector<vmime::ref<vmime::propertySet::property> >
        PropertyList;
    PropertyList list = session->getProperties().getPropertyList();
    PropertyList::const_iterator end = list.end();
    for(PropertyList::const_iterator it = list.begin(); it != end; ++it) {
        qLog() << QString("%1 %2").arg(
            (*it)->getName().c_str()).arg((*it)->getValue().c_str());
    }

}
void Core::setSupported(PropertyList supported, AbstractSource* source)
{
	mSources.push_back(source);
		
	for(PropertyList::iterator itr = supported.begin(); itr != supported.end(); itr++)
	{
		if(!ListPlusPlus<VehicleProperty::Property>(&mMasterPropertyList).contains((*itr)))
		{
			DebugOut()<<__FUNCTION__<<"() adding suport for property "<<VehicleProperty::name((*itr))<<endl;
			mMasterPropertyList.push_back((*itr));
		}
	}	
}
Example #12
0
void ResourceNode::Load(int startID, ResourceType newType, PropertyList properties)
{
    ID = startID;
    type = newType;

    //make sure the new ID generator wont overlap
    RegisterID(ID);

    PropertyList::iterator i;
    for(i = properties.begin(); i != properties.end(); ++i)
    {
        if(i.value().isValid())
            SetProperty(i.key(), i.value());
    }
}
// TODO: populate the curve list once we actually have a list of curves.
void ModelerUserInterface::populateCurveList(Property* prop, Fl_Tree_Item* parent) {
	// Create a tree node for this property
	Fl_Tree_Item* item;
	if (parent == NULL) {
		// HACK: We have to add and remove a fake list item so that the tree
		// control will create a root node to put it under.
		curvesTree->remove(curvesTree->add("You shouldn't see this."));

		item = curvesTree->root();
		item->label(prop->getName());
	} else {
		item = curvesTree->add(parent, prop->getName());
	}
	item->labelfont(FL_HELVETICA_BOLD);
	if (GroupProperty* g = dynamic_cast<GroupProperty*>(prop)) {
		if (g->getCollapsed()) {
			item->close();
		}
	} else if (dynamic_cast<RGBProperty*>(prop)) {
		item->close();
	}

	// Examine the list of properties.
	PropertyList* controls = prop->getProperties();
	for (PropertyList::iterator iter = controls->begin();
		 iter != controls->end();
		 iter++) {
        // For now, only RangeProperty is supported by the Curve interface.
		// The RGBProperty is also indirectly supported because it can provide
	    // RangeProperties when its getProperties() method is called.
		// TODO: make this work with more property types (using a new
		// plotting widget?)
		if (RangeProperty* range = dynamic_cast<RangeProperty*>(*iter)) {
			// TODO: connect to Curve object instead of Property object.
			Fl_Tree_Item* childNode = curvesTree->add(item, range->getName());
			curveProps.push_back(range);
			childNode->user_data((void*)(curveProps.size() - 1));
			range->setCurveIndex(curveProps.size() - 1);
			graph->addCurve(range->getValue(), range->getMin(),
				range->getMax());
		} else if ((*iter)->getProperties() != NULL) {
			// Try to get a list of GroupProperties out of it.
			populateCurveList(*iter, item);
		}
	}
}
Example #14
0
static void slot_register_properties(const PropertyList& props)
{
    // save props to panel_props
    panel_props = props;

    // logo prop
    std::vector<String> list;
    list.push_back(Property2String(logo_prop));

    // panel props
    {
        PropertyList::const_iterator it = props.begin();
        PropertyList::const_iterator end = props.end();
        PropertyList::const_iterator next = it;
        while (it != end) {
            ++next;
            if (next == end || !next->is_a_leaf_of(*it)) {
                list.push_back(Property2String(*it));
                it = next;
            }
        }
    }

    // helper props
    {
        std::map<int, PropertyList>::iterator it = helper_props_map.begin();
        for (; it != helper_props_map.end(); ++it) {
            const PropertyList& helper_props = it->second;
            PropertyList::const_iterator it = helper_props.begin();
            PropertyList::const_iterator end = helper_props.end();
            PropertyList::const_iterator next = it;
            while (it != end) {
                ++next;
                if (next == end || !next->is_a_leaf_of(*it)) {
                    list.push_back(Property2String(*it));
                    it = next;
                }
            }
        }
    }

    // show help prop
    list.push_back(Property2String(show_help_prop));

    panel->RegisterProperties(list);
}
AbstractDBusInterface::~AbstractDBusInterface()
{
	unregisterObject();

	PropertyList impl = implementedProperties();

	for(auto itr = impl.begin(); itr != impl.end(); itr++)
	{
		if(properties.find(*itr) != properties.end())
		{
			// Deleted in ~DBusSink()
			//delete properties[*itr];
			properties.erase(*itr);
		}
	}

	objectMap.erase(mObjectPath);
}
Example #16
0
static void slot_register_helper_properties(int id, const PropertyList &props)
{
    std::cerr << "slot_register_helper_properties\n";
    // save helper props
    helper_props_map[id] = props;

    std::vector<String> list;
    PropertyList::const_iterator it = props.begin();
    PropertyList::const_iterator end = props.end();
    PropertyList::const_iterator next = it;
    while (it != end) {
        ++next;
        if (next == end || !next->is_a_leaf_of(*it)) {
            list.push_back(Property2String(*it));
            it = next;
        }
    }
    panel->RegisterProperties(list);
}
const PropertyHolder::PropertyList PropertyHolder::PropertiesMatching(const IRI& iri, bool lookupParents) const
{
    PropertyList output;
    BuildPropertyList(output, iri);

    if (lookupParents)
    {
        auto parent = _parent.lock();
        if ( parent )
        {
            //parent->BuildPropertyList(output, iri);

            PropertyHolder::PropertyList pList = parent->PropertiesMatching(iri, lookupParents);
            output.insert(output.end(), pList.begin(), pList.end());
        }
    }

    return output;
}
Example #18
0
void SimpleCameraModel::plotKeyframe(float t) {
	// Iterate over list of model properties
	PropertyList* props = properties.getProperties();
	for (PropertyList::iterator iter = props->begin();
		iter != props->end();
		iter++) {

		// Cast property to a range property
		RangeProperty* rp = dynamic_cast<RangeProperty*>(*iter);
		if (!rp) { continue; }

		// Get the curve, and add a control point
		Curve* pCurve = ModelerUserInterface::getInstance()->
			graph->curve(rp->getCurveIndex());
        pCurve->addControlPoint( Animator::Point(t, rp->getValue()) );
	}

	// Redraw the curves
	ModelerUserInterface::getInstance()->graph->redraw();
}
Example #19
0
void SimpleCameraModel::clearKeyframe(float t) {
	// Iterate over list of model properties
	PropertyList* props = properties.getProperties();
	for (PropertyList::iterator iter = props->begin();
		iter != props->end();
		iter++) {

		// Attempt to cast property to a range property
		RangeProperty* rp = dynamic_cast<RangeProperty*>(*iter);
		if (!rp) { continue; }

		// Get the curve
		Curve* pCurve = ModelerUserInterface::getInstance()->
			graph->curve(rp->getCurveIndex());

		// Remove all control points in a small range around the current time.
		pCurve->removeControlPointsInRange(
			t-REMOVE_KEYFRAME_RANGE/2, t+REMOVE_KEYFRAME_RANGE/2 );
	}

	// Redraw the curves
	ModelerUserInterface::getInstance()->graph->redraw();
}
Example #20
0
void ModelerUserInterface::pickGroupProperty(GroupProperty* group) {
	// Remove the event listeners for old controls
	// TODO: we really need to have a PropertyEditor class that handles this
	// automatically...
	if (currentGroup) {
		PropertyList* props = currentGroup->getProperties();
		for (PropertyList::iterator iter = props->begin();
			 iter != props->end();
			 iter++)
		{
			if (RangeProperty* prop = dynamic_cast<RangeProperty*>(*iter)) {
				prop->unlisten((SignalListener)updateRangeSlider);
			} else if (RGBProperty* prop = dynamic_cast<RGBProperty*>(*iter)) {
				prop->unlisten((SignalListener)updateColorChooser);
			} else if (BooleanProperty* prop = dynamic_cast<BooleanProperty*>(*iter)) {
				prop->unlisten((SignalListener)updateCheckbox);
			} else if (ChoiceProperty* prop = dynamic_cast<ChoiceProperty*>(*iter)) {
				prop->unlisten((SignalListener)updateChoice);
			}
		}

		// Clear out the old controls
		m_controlsPack->clear();

		currentGroup = NULL;
	}

	// Reset the scrollbar
	m_controlsScroll->position(0, 0);

	// If there's no group, exit
	if (!group) {
		m_controlsScroll->redraw();
		return;
	}

	// Constants for slider dimensions
	const int packWidth = m_controlsPack->w();
	const int textHeight = 20;
	const int sliderHeight = 20;
	const int chooserHeight = 100;
	const int buttonHeight = 20;

	// Show them
	// For each control, add appropriate objects to the user interface
	currentGroup = group;
	PropertyList* props = group->getProperties();
	for (PropertyList::iterator iter = props->begin();
		 iter != props->end();
		 iter++)
    {
		// Ignore it if it's a group property (those belong in the tree).
		if (dynamic_cast<GroupProperty*>(*iter))
			continue;

		// And now we'll create a UI element for the property.
		// The big if-statement below uses dynamic_cast<PropertyType*>(ptr),
		// to see if a property has a given type.  dynamic_cast will
		// return 0 if ptr is not of type PropertyType.

		// Add a slider if the property is a RangeProperty
		if (RangeProperty* prop = dynamic_cast<RangeProperty*>(*iter)) {
			// Add the label
			Fl_Box *box = new Fl_Box(0, 0, packWidth, textHeight, (*iter)->getName());
			box->labelsize(14);
			box->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
			box->box(FL_FLAT_BOX); // otherwise, Fl_Scroll messes up (ehsu)
			m_controlsPack->add(box);

			// Add the slider
			Fl_Value_Slider *slider = new Fl_Value_Slider(0, 0, packWidth, sliderHeight);
			slider->type(1);
			slider->range(prop->getMin(), prop->getMax());
			slider->step(prop->getStep());
			slider->value(prop->getValue());
			m_controlsPack->add(slider);

			// Use the step size to determine the number of decimal places
			// shown in the slider's label.
			if (prop->getStep() > 0) {
			  slider->precision((int)-log(prop->getStep()));
			}

			// Have the slider notify the program when it changes
			slider->callback((Fl_Callback*)SliderCallback, (void*) prop);

			

			// Have the property notify the slider when it changes
			prop->listen((SignalListener)updateRangeSlider, (void*) slider);

		// Add a color picker if the property is an RGB property
		} else if (RGBProperty* prop = dynamic_cast<RGBProperty*>(*iter)) {
			// Add the label
			Fl_Box *box = new Fl_Box(0, 0, packWidth, textHeight, (*iter)->getName());
			box->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
			box->labelsize(14);
			box->box(FL_FLAT_BOX); // otherwise, Fl_Scroll messes up (ehsu)
			m_controlsPack->add(box);

			// Add a color chooser
			Fl_Color_Chooser* chooser = new Fl_Color_Chooser(0, 0, packWidth,
				chooserHeight);
			chooser->rgb(prop->getRed(), prop->getGreen(), prop->getBlue());
			m_controlsPack->add(chooser);

			// Have the chooser notify the program when it changes
			chooser->callback((Fl_Callback*)ColorPickerCallback, (void*) prop);

			// Remove any existing color chooser listeners on the property
			prop->unlisten((SignalListener)updateColorChooser);

			// Have the property notify the chooser when it changes
			prop->listen((SignalListener)updateColorChooser, (void*) chooser);

		// Add a checkbox if the property is a boolean property
		} else if (BooleanProperty* prop = dynamic_cast<BooleanProperty*>(*iter)) {
			// Add the checkbox -- no label needed!
			Fl_Check_Button* btn = new Fl_Check_Button(0, 0, packWidth, buttonHeight,
				prop->getName());
			btn->labelsize(14);
			btn->type(FL_TOGGLE_BUTTON);
			btn->value(prop->getValue());
			m_controlsPack->add(btn);

			// Have the button notify the program when it changes
			btn->callback((Fl_Callback*)ButtonCallback, (void*) prop);

			// Remove any existing color chooser listeners on the property
			prop->unlisten((SignalListener)updateCheckbox);

			// Have the property notify the chooser when it changes
			prop->listen((SignalListener)updateCheckbox, (void*) btn);

		// Add radio buttons if the property is a choice property
		} else if (ChoiceProperty* prop = dynamic_cast<ChoiceProperty*>(*iter)) {
			// Add the label
			Fl_Box *box = new Fl_Box(0, 0, packWidth, textHeight, (*iter)->getName());
			box->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
			box->labelsize(14);
			box->box(FL_FLAT_BOX); // otherwise, Fl_Scroll messes up (ehsu)
			m_controlsPack->add(box);

			// Add a group
			Fl_Pack* pack = new Fl_Pack(0, 0, packWidth, buttonHeight);
			pack->type(Fl_Pack::VERTICAL);
			pack->box(FL_THIN_DOWN_FRAME);
			pack->user_data((void*) prop);

			// Add the radio buttons
			const char* choices = prop->getLabels();
			int start = 0, end = -1, index = 0;
			do {
				end++;
				if (choices[end] == 0 || choices[end] == '|') {
					string str(choices, start, end - start);
					Fl_Button* btn = new Fl_Round_Button(0, 0, packWidth, buttonHeight,
						prop->getName());
					btn->type(FL_RADIO_BUTTON);
					btn->copy_label(str.c_str());
					btn->value(prop->getValue() == index);

					// Have the button notify the program when it changes
					btn->callback((Fl_Callback*)ChoiceCallback, (void*)index);

					index++;
					start = end + 1;
				}
			} while (choices[end] != 0);

			pack->end();
			m_controlsPack->add(pack);

			// Remove any existing choce listeners on the property
			prop->unlisten((SignalListener)updateChoice);

			// Have the property update the choices when it changes
			prop->listen((SignalListener)updateChoice, (void*) pack);
		}
    }
	m_controlsScroll->redraw();
}
void DBusInterfaceManager::registerTypes()
{
	/// properties:
	auto re = routingEngine;

	auto exporter = amb::Exporter::instance();

	exporter->connection = connection;

	exporter->exportProperty<AccelerationProperty>(re);
	exporter->exportProperty<VehicleSpeedProperty>(re);
	exporter->exportProperty<TireProperty>(re);
	exporter->exportProperty<EngineSpeedProperty>(re);
	exporter->exportProperty<VehiclePowerModeProperty>(re);
	exporter->exportProperty<TripMeterProperty>(re);
	exporter->exportProperty<TransmissionProperty>(re);
	exporter->exportProperty<CruiseControlProperty>(re);
	exporter->exportProperty<BrakeOperation>(re);
	exporter->exportProperty<LightStatusProperty>(re);
	exporter->exportProperty<HornProperty>(re);
	exporter->exportProperty<FuelProperty>(re);
	exporter->exportProperty<EngineOilProperty>(re);
	exporter->exportProperty<ExteriorBrightnessProperty>(re);
	exporter->exportProperty<Temperature>(re);
	exporter->exportProperty<RainSensor>(re);
	exporter->exportProperty<ClimateControlProperty>(re);
	exporter->exportProperty<WindowStatusProperty>(re);
	exporter->exportProperty<DefrostProperty>(re);
	exporter->exportProperty<Sunroof>(re);
	exporter->exportProperty<ConvertibleRoof>(re);
	exporter->exportProperty<VehicleId>(re);
	exporter->exportProperty<VehicleTypeProperty>(re);
	exporter->exportProperty<FuelInfoProperty>(re);
	exporter->exportProperty<SizeProperty>(re);
	exporter->exportProperty<DoorsProperty>(re);
	exporter->exportProperty<WheelInformationProperty>(re);
	exporter->exportProperty<OdometerProperty>(re);
	exporter->exportProperty<FluidProperty>(re);
	exporter->exportProperty<BatteryStatusProperty>(re);
	exporter->exportProperty<ParkingBrakeProperty>(re);
	exporter->exportProperty<HazardLightProperty>(re);
	exporter->exportProperty<LocationProperty>(re);
	exporter->exportProperty<AntilockBrakingSystemProperty>(re);
	exporter->exportProperty<TractionControlSystemProperty>(re);
	exporter->exportProperty<VehicleTopSpeedLimitProperty>(re);
	exporter->exportProperty<AirbagStatusProperty>(re);
	exporter->exportProperty<DoorStatusProperty>(re);
	exporter->exportProperty<SeatBeltStatusProperty>(re);
	exporter->exportProperty<OccupantStatusProperty>(re);
	exporter->exportProperty<ObstacleDistanceProperty>(re);
	exporter->exportProperty<SteeringWheelPositionProperty>(re);
	exporter->exportProperty<SteeringWheel>(re);
	exporter->exportProperty<ThrottlePosition>(re);
	exporter->exportProperty<EngineCoolant>(re);
	exporter->exportProperty<NightMode>(re);
	exporter->exportProperty<DrivingMode>(re);
	exporter->exportProperty<PowertrainTorque>(re);
	exporter->exportProperty<AcceleratorPedalPosition>(re);
	exporter->exportProperty<Chime>(re);
	exporter->exportProperty<WheelTick>(re);
	exporter->exportProperty<IgnitionTime>(re);
	exporter->exportProperty<YawRate>(re);
	exporter->exportProperty<TransmissionClutch>(re);
	exporter->exportProperty<TransmissionOil>(re);
	exporter->exportProperty<BrakeMaintenance>(re);
	exporter->exportProperty<WasherFluid>(re);
	exporter->exportProperty<MalfunctionIndicator>(re);
	exporter->exportProperty<Diagnostics>(re);
	exporter->exportProperty<MirrorProperty>(re);
	exporter->exportProperty<SeatAdjustment>(re);
	exporter->exportProperty<DriveMode>(re);
	exporter->exportProperty<VehicleSound>(re);
	exporter->exportProperty<ElectronicStabilityControl>(re);
	exporter->exportProperty<ChildSafetyLock>(re);
	exporter->exportProperty<SeatProperty>(re);
	exporter->exportProperty<DoorProperty>(re);
	exporter->exportProperty<WindshieldWiperStatus>(re);
	exporter->exportProperty<SideWindowStatusProperty>(re);
	exporter->exportProperty<AtmosphericPressure>(re);
	exporter->exportProperty<LaneDepartureStatus>(re);
	exporter->exportProperty<AlarmStatus>(re);

	PropertyList list = VehicleProperty::customProperties();
	PropertyList implemented = AbstractDBusInterface::implementedProperties();

	for (auto prop : list)
	{
		if(!contains(implemented, prop))
		{
			exporter->exportProperty<CustomPropertyInterface>(prop, re);
		}
	}

	/// Create objects for unimplemented properties:

	implemented = AbstractDBusInterface::implementedProperties();

	PropertyList capabilitiesList = VehicleProperty::capabilities();

	for (auto itr = capabilitiesList.begin(); itr != capabilitiesList.end(); itr++)
	{
		VehicleProperty::Property prop = *itr;

		if(!contains(implemented, prop))
		{
			exporter->exportProperty<UncategorizedPropertyInterface>(prop, re);
		}
	}
}
Example #22
0
bool
SocketInstance::do_transaction (Transaction &trans, bool &ret)
{
    int cmd = -1;
    bool cont = false;

    ret = false;

    SCIM_DEBUG_IMENGINE(2) << " Do transaction:\n";

    if (trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY) {
        while (trans.get_command (cmd)) {
            switch (cmd) {
                case SCIM_TRANS_CMD_SHOW_PREEDIT_STRING:
                {
                    SCIM_DEBUG_IMENGINE(3) << "  show_preedit_string ()\n";
                    show_preedit_string ();
                    break;
                }
                case SCIM_TRANS_CMD_SHOW_AUX_STRING:
                {
                    SCIM_DEBUG_IMENGINE(3) << "  show_aux_string ()\n";
                    show_aux_string ();
                    break;
                }
                case SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE:
                {
                    SCIM_DEBUG_IMENGINE(3) << "  show_lookup_table ()\n";
                    show_lookup_table ();
                    break;
                }
                case SCIM_TRANS_CMD_HIDE_PREEDIT_STRING:
                {
                    SCIM_DEBUG_IMENGINE(3) << "  hide_preedit_string ()\n";
                    hide_preedit_string ();
                    break;
                }
                case SCIM_TRANS_CMD_HIDE_AUX_STRING:
                {
                    SCIM_DEBUG_IMENGINE(3) << "  hide_aux_string ()\n";
                    hide_aux_string ();
                    break;
                }
                case SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE:
                {
                    SCIM_DEBUG_IMENGINE(3) << "  hide_lookup_table ()\n";
                    hide_lookup_table ();
                    break;
                }
                case SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET:
                {
                    uint32 caret;
                    if (trans.get_data (caret)) {
                        SCIM_DEBUG_IMENGINE(3) << "  update_preedit_caret (" << caret << ")\n";
                        update_preedit_caret (caret);
                    }
                    break;
                }
                case SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING:
                {
                    WideString str;
                    AttributeList attrs;
                    if (trans.get_data (str) && trans.get_data (attrs)) {
                        SCIM_DEBUG_IMENGINE(3) << "  update_preedit_string ()\n";
                        update_preedit_string (str, attrs);
                    }
                    break;
                }
                case SCIM_TRANS_CMD_UPDATE_AUX_STRING:
                {
                    WideString str;
                    AttributeList attrs;
                    if (trans.get_data (str) && trans.get_data (attrs)) {
                        SCIM_DEBUG_IMENGINE(3) << "  update_aux_string ()\n";
                        update_aux_string (str, attrs);
                    }
                    break;
                }
                case SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE:
                {
                    CommonLookupTable table;
                    if (trans.get_data (table)) {
                        SCIM_DEBUG_IMENGINE(3) << "  update_lookup_table ()\n";
                        update_lookup_table (table);
                    }
                    break;
                }
                case SCIM_TRANS_CMD_COMMIT_STRING:
                {
                    WideString str;
                    if (trans.get_data (str)) {
                        SCIM_DEBUG_IMENGINE(3) << "  commit_string ()\n";
                        commit_string (str);
                    }
                    break;
                }
                case SCIM_TRANS_CMD_FORWARD_KEY_EVENT:
                {
                    KeyEvent key;
                    if (trans.get_data (key)) {
                        SCIM_DEBUG_IMENGINE(3) << "  forward_key_event ()\n";
                        forward_key_event (key);
                    }
                    break;
                }
                case SCIM_TRANS_CMD_REGISTER_PROPERTIES:
                {
                    PropertyList proplist;
                    if (trans.get_data (proplist)) {
                        SCIM_DEBUG_IMENGINE(3) << "  register_properties ()\n";

                        // Load icon files of these properties from remote SocketFrontEnd.
                        for (PropertyList::iterator it = proplist.begin (); it != proplist.end (); ++it)
                            it->set_icon (global->load_icon (it->get_icon ()));

                        register_properties (proplist);
                    }
                    break;
                }
                case SCIM_TRANS_CMD_UPDATE_PROPERTY:
                {
                    Property prop;
                    if (trans.get_data (prop)) {
                        SCIM_DEBUG_IMENGINE(3) << "  update_property ()\n";

                        // Load the icon file of this property from remote SocketFrontEnd.
                        prop.set_icon (global->load_icon (prop.get_icon ()));

                        update_property (prop);
                    }
                    break;
                }
                case SCIM_TRANS_CMD_BEEP:
                {
                    SCIM_DEBUG_IMENGINE(3) << "  beep ()\n";
                    beep ();
                    break;
                }
                case SCIM_TRANS_CMD_START_HELPER:
                {
                    String helper_uuid;
                    if (trans.get_data (helper_uuid)) {
                        SCIM_DEBUG_IMENGINE(3) << "  start_helper (" << helper_uuid << ")\n";
                        start_helper (helper_uuid);
                    }
                    break; 
                }
                case SCIM_TRANS_CMD_STOP_HELPER:
                {
                    String helper_uuid;
                    if (trans.get_data (helper_uuid)) {
                        SCIM_DEBUG_IMENGINE(3) << "  stop_helper (" << helper_uuid << ")\n";
                        stop_helper (helper_uuid);
                    }
                    break; 
                }
                case SCIM_TRANS_CMD_SEND_HELPER_EVENT:
                {
                    String helper_uuid;
                    Transaction temp_trans;
                    if (trans.get_data (helper_uuid) && trans.get_data (temp_trans)) {
                        SCIM_DEBUG_IMENGINE(3) << "  send_helper_event (" << helper_uuid << ")\n";
                        send_helper_event (helper_uuid, temp_trans);
                    }
                    break; 
                }
                case SCIM_TRANS_CMD_OK:
                {
                    SCIM_DEBUG_IMENGINE(3) << "  ret = true\n";
                    ret = true;
                    break;
                }
                case SCIM_TRANS_CMD_GET_SURROUNDING_TEXT:
                {
                    WideString text;
                    int cursor;
                    uint32 maxlen_before;
                    uint32 maxlen_after;
                    Transaction temp_trans;
                    if (trans.get_data (maxlen_before) && trans.get_data (maxlen_after)) {
                        global->init_transaction (temp_trans);
                        if (get_surrounding_text (text, cursor, (int) maxlen_before, (int) maxlen_after)) {
                            temp_trans.put_command (SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
                            temp_trans.put_data (text);
                            temp_trans.put_data ((uint32) cursor);
                        } else {
                            temp_trans.put_command (SCIM_TRANS_CMD_FAIL);
                        }
                        global->send_transaction (temp_trans);
                    }
                    cont = true;
                    break;
                }
                case SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT:
                {
                    uint32 offset;
                    uint32 len;
                    Transaction temp_trans;
                    if (trans.get_data (offset) && trans.get_data (len)) {
                        global->init_transaction (temp_trans);
                        if (delete_surrounding_text ((int) offset, (int) len)) {
                            temp_trans.put_command (SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT);
                            temp_trans.put_command (SCIM_TRANS_CMD_OK);
                        } else {
                            temp_trans.put_command (SCIM_TRANS_CMD_FAIL);
                        }
                        global->send_transaction (temp_trans);
                    }
                    cont = true;
                    break;
                }
                default:
                    SCIM_DEBUG_IMENGINE(3) << "  Strange cmd: " << cmd << "\n";;
            }
        }
    } else {
        SCIM_DEBUG_IMENGINE(3) << "  Failed to get cmd: " << cmd << "\n";
    }

    SCIM_DEBUG_IMENGINE(2) << " End of Do transaction\n";

    return cont;
}