bool MCOPDCOPObject::processDynamic(const TQCString &fun, const TQByteArray &data, TQCString &replyType, TQByteArray &replyData) { TQMap<TQCString, MCOPEntryInfo *>::iterator it; for(it = d->dynamicFunctions.begin(); it != d->dynamicFunctions.end(); ++it) { MCOPEntryInfo *entry = it.data(); if((entry->functionName() + entry->signature()) == fun) { TQCString type = entry->functionType(); if(type == "void") { replyType = type; Arts::Buffer *result = callFunction(entry, objId(), data); if(result != 0) delete result; } else if(type == "string") { replyType = "TQCString"; TQDataStream reply(replyData, IO_WriteOnly); reply << "fooo!"; } else if(type == "long") { replyType = type; long returnCode = -1; Arts::Buffer *result = callFunction(entry, objId(), data); if(result != 0) { returnCode = result->readLong(); delete result; } TQDataStream reply(replyData, IO_WriteOnly); reply << returnCode; } return true; } } return false; }
void PropertyPanel::rereadPortProperties() { //kdDebug() << QString("PropertyPanel::rereadPortProperties") << endl; if(!port) return; // sanity check std::string dataType = port->PortDesc.type().dataType; if(isEnum(dataType)) { constantValueEdit->hide(); constantValueComboBox->show(); fillEnumChoices(dataType); } else { constantValueEdit->show(); constantValueComboBox->hide(); } if( port->PortDesc.hasValue() ) { pvConstantButton->setChecked( true ); QString constValue; Arts::Any value = port->PortDesc.value(); Arts::Buffer b; b.write(value.value); if(isEnum(value.type)) { long v = b.readLong(); constantValueComboBox->setCurrentItem(findEnumIndex(value.type,v)); } else { if(value.type == "float") constValue.sprintf("%2.4f", b.readFloat()); else if(value.type == "long") constValue.sprintf("%ld", b.readLong()); else if(value.type == "string") { std::string s; b.readString(s); constValue = s.c_str(); } else if(value.type == "boolean") { if(b.readBool()) constValue = "true"; else constValue = "false"; } else constValue = ("*unknown type* " + value.type).c_str(); constantValueEdit->setText( constValue ); } } else if( port->PortDesc.isConnected() ) pvConnectionButton->setChecked( true ); else { pvNotSetButton->setChecked( true ); constantValueEdit->clear(); } pvConnectionButton->setEnabled( port->PortDesc.isConnected() ); }