Browse Source

Adjusted to use new TQStringVariantMap type.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/4/head
Michele Calgaro 3 years ago
parent
commit
245d13f9d1
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF
  1. 6
      kjsembed/docs/ChangeLog
  2. 6
      kjsembed/docs/embedding/simple-embed/embedviewimp.cpp
  3. 10
      kjsembed/jsbinding.cpp
  4. 2
      kjsembed/jsbinding.h
  5. 2
      qtjava/javalib/org/trinitydesktop/qt/TQSqlCursor.java
  6. 2
      qtjava/javalib/org/trinitydesktop/qt/TQSqlQuery.java
  7. 12
      qtjava/javalib/org/trinitydesktop/qt/TQVariant.java
  8. 4
      qtruby/ChangeLog
  9. 2
      qtruby/rubylib/qtruby/Qt.cpp
  10. 10
      qtruby/rubylib/qtruby/handlers.cpp

6
kjsembed/docs/ChangeLog

@ -78,7 +78,7 @@
in C++. Conversions break down as follows:
TQStringList -> Array of javascript strings.
TQValueList<TQVariant> -> Array of Javascript values.
TQMap<TQString,TQVariant> -> Object/Array that has each TQString key as
TQStringVariantMap -> Object/Array that has each TQString key as
a property, and the TQVariant is mapped to a Javascript value.
From Javascript the conversions are a little different.
@ -91,10 +91,10 @@
= convertToVariant( exec, someArrayValue).toList();
Now if the Javascript value is a Javascript object or a map then
the conversion will go to a TQMap<TQString,TQVariant>. An example of
the conversion will go to a TQStringVariantMap. An example of
this would be like:
KJS::Value someJSObject;
TQMap<TQString,TQVariant> map = convertToVariant(exec,someJSObject)
TQStringVariantMap map = convertToVariant(exec,someJSObject)
.toMap();
TQString someVal = map["someProp"].toString();

6
kjsembed/docs/embedding/simple-embed/embedviewimp.cpp

@ -30,7 +30,7 @@ void EmbedViewImp::okClicked()
{
KJS::List args;
KJS::Value val = m_part->callMethod("handleOk", args);
TQMap<TQString, TQVariant> personalData = KJSEmbed::convertToVariant(m_part->globalExec(), val).toMap();
TQStringVariantMap personalData = KJSEmbed::convertToVariant(m_part->globalExec(), val).toMap();
TQDate birthday = personalData["birthday"].toDate();
TQColor eyecolor = personalData["eyeColor"].toColor();
TQString notes = personalData["notes"].toString();
@ -60,7 +60,7 @@ bool EmbedViewImp::runScript( const TQString &file )
TQVariant EmbedViewImp::someValue() const
{
TQMap<TQString,TQVariant> returnMap;
TQStringVariantMap returnMap;
returnMap["name"] = m_name->text();
returnMap["title"] = m_title->text();
returnMap["dept"] = m_dept->text();
@ -69,7 +69,7 @@ TQVariant EmbedViewImp::someValue() const
void EmbedViewImp::setSomeValue( const TQVariant &val )
{
TQMap<TQString,TQVariant> map = val.toMap();
TQStringVariantMap map = val.toMap();
m_name->setText(map["name"].toString());
m_title->setText(map["title"].toString());
m_dept->setText(map["dept"].toString());

10
kjsembed/jsbinding.cpp

@ -138,8 +138,8 @@ namespace KJSEmbed {
}
case TQVariant::Map:
{
TQMap<TQString,TQVariant> map = val.toMap();
TQMap<TQString,TQVariant>::Iterator idx = map.begin();
TQStringVariantMap map = val.toMap();
TQStringVariantMap::Iterator idx = map.begin();
KJS::Object array( exec->interpreter() ->builtinArray().construct( exec, 0 ) );
for ( ; idx != map.end(); ++idx )
array.put(exec, KJS::Identifier(idx.key().latin1()), convertToValue( exec, idx.data() ) );
@ -267,7 +267,7 @@ namespace KJSEmbed {
/* kdDebug( 80001 ) << "convertToVariant() got a JSProxy" << endl;
val = prxy->typeName();
*/
} else { // Last resort map the object to a TQMap<TQString,TQVariant>
} else { // Last resort map the object to a TQStringVariantMap
kdDebug( 80001 ) << "convertToVariant() map to struct." << endl;
val = convertArrayToMap(exec, v);
}
@ -628,8 +628,8 @@ namespace KJSEmbed {
return None;
}
TQMap<TQString, TQVariant> convertArrayToMap( KJS::ExecState *exec, const KJS::Value &value ) {
TQMap<TQString, TQVariant> returnMap;
TQStringVariantMap convertArrayToMap( KJS::ExecState *exec, const KJS::Value &value ) {
TQStringVariantMap returnMap;
KJS::Object obj = value.toObject(exec);
// if( obj.className().qstring() == "Array" ) {
KJS::ReferenceList lst = obj.propList(exec,false);

2
kjsembed/jsbinding.h

@ -122,7 +122,7 @@ namespace KJSEmbed {
KJSEMBED_EXPORT TQStringList convertArrayToStringList( KJS::ExecState *exec, const KJS::Value &value);
KJSEMBED_EXPORT TQDateTime convertDateToDateTime(KJS::ExecState *exec, const KJS::Value &value);
KJSEMBED_EXPORT TQValueList<TQVariant> convertArrayToList( KJS::ExecState *exec, const KJS::Value &value );
KJSEMBED_EXPORT TQMap<TQString, TQVariant> convertArrayToMap( KJS::ExecState *exec, const KJS::Value &value );
KJSEMBED_EXPORT TQStringVariantMap convertArrayToMap( KJS::ExecState *exec, const KJS::Value &value );
/**
* This will throw an exception with the error string.

2
qtjava/javalib/org/trinitydesktop/qt/TQSqlCursor.java

@ -133,7 +133,7 @@ public class TQSqlCursor extends TQSqlRecord implements TQSqlQueryInterface {
public native void addBindValue(TQVariant val, int type);
public native TQVariant boundValue(String placeholder);
public native TQVariant boundValue(int pos);
// TQMap<TQString, TQVariant> boundValues(); >>>> NOT CONVERTED
// TQStringVariantMap boundValues(); >>>> NOT CONVERTED
public native String executedQuery();
protected native void beforeSeek();
}

2
qtjava/javalib/org/trinitydesktop/qt/TQSqlQuery.java

@ -63,7 +63,7 @@ public class TQSqlQuery implements QtSupport, TQSqlQueryInterface {
public native void addBindValue(TQVariant val, int type);
public native TQVariant boundValue(String placeholder);
public native TQVariant boundValue(int pos);
// TQMap<TQString, TQVariant> boundValues(); >>>> NOT CONVERTED
// TQStringVariantMap boundValues(); >>>> NOT CONVERTED
public native String executedQuery();
protected native void beforeSeek();
protected native void afterSeek();

12
qtjava/javalib/org/trinitydesktop/qt/TQVariant.java

@ -149,7 +149,7 @@ public class TQVariant implements QtSupport {
}
private native void newTQVariant(TQPen arg1);
// TQVariant* TQVariant(const TQValueList<TQVariant>& arg1); >>>> NOT CONVERTED
// TQVariant* TQVariant(const TQMap<TQString, TQVariant>& arg1); >>>> NOT CONVERTED
// TQVariant* TQVariant(const TQStringVariantMap& arg1); >>>> NOT CONVERTED
public TQVariant(int arg1) {
newTQVariant(arg1);
}
@ -216,15 +216,15 @@ public class TQVariant implements QtSupport {
public native double toDouble(boolean[] ok);
public native double toDouble();
// const TQValueList<TQVariant> toList(); >>>> NOT CONVERTED
// const TQMap<TQString, TQVariant> toMap(); >>>> NOT CONVERTED
// const TQStringVariantMap toMap(); >>>> NOT CONVERTED
public native TQSizePolicy toSizePolicy();
// TQValueListConstIterator<TQString> stringListBegin(); >>>> NOT CONVERTED
// TQValueListConstIterator<TQString> stringListEnd(); >>>> NOT CONVERTED
// TQValueListConstIterator<TQVariant> listBegin(); >>>> NOT CONVERTED
// TQValueListConstIterator<TQVariant> listEnd(); >>>> NOT CONVERTED
// TQMapConstIterator<TQString, TQVariant> mapBegin(); >>>> NOT CONVERTED
// TQMapConstIterator<TQString, TQVariant> mapEnd(); >>>> NOT CONVERTED
// TQMapConstIterator<TQString, TQVariant> mapFind(const TQString& arg1); >>>> NOT CONVERTED
// TQStringVariantMapConstIterator mapBegin(); >>>> NOT CONVERTED
// TQStringVariantMapConstIterator mapEnd(); >>>> NOT CONVERTED
// TQStringVariantMapConstIterator mapFind(const TQString& arg1); >>>> NOT CONVERTED
public native String asString();
public native String asCString();
public native ArrayList asStringList();
@ -257,7 +257,7 @@ public class TQVariant implements QtSupport {
public native boolean asBool();
public native double asDouble();
// TQValueList<TQVariant>& asList(); >>>> NOT CONVERTED
// TQMap<TQString, TQVariant>& asMap(); >>>> NOT CONVERTED
// TQStringVariantMap& asMap(); >>>> NOT CONVERTED
public native TQSizePolicy asSizePolicy();
public native void load(TQDataStream arg1);
public native void save(TQDataStream arg1);

4
qtruby/ChangeLog

@ -1047,12 +1047,12 @@
* The parsing of types passed to slots, (or returned from dcop slots) didn't
work with template types containing commas such as 'TQMap<TQString,TQString>'.
* Added 'TQMap<TQString,TQString>&' and 'TQMap<TQString,TQVariant>&' to the
* Added 'TQMap<TQString,TQString>&' and 'TQStringVariantMap&' to the
handlers.cpp string to marshaller lookup table.
2004-07-26 Richard Dale <Richard_Dale@tipitina.demon.co.uk>
* Added marshallers for TQMap<TQString,TQString> and TQMap<TQString,TQVariant> to and from ruby hashes
* Added marshallers for TQMap<TQString,TQString> and TQStringVariantMap to and from ruby hashes
2004-07-26 Richard Dale <Richard_Dale@tipitina.demon.co.uk>

2
qtruby/rubylib/qtruby/Qt.cpp

@ -1377,7 +1377,7 @@ static Smoke::Index new_qvariant_qmap = 0;
if (tqstrcmp(argType, "const TQValueList<TQVariant>&" ) == 0) {
new_qvariant_qlist = qt_Smoke->ambiguousMethodList[i];
} else if (tqstrcmp(argType, "const TQMap<TQString,TQVariant>&" ) == 0) {
} else if (tqstrcmp(argType, "const TQStringVariantMap&" ) == 0) {
new_qvariant_qmap = qt_Smoke->ambiguousMethodList[i];
}

10
qtruby/rubylib/qtruby/handlers.cpp

@ -1574,7 +1574,7 @@ void marshall_TQMapTQStringTQVariant(Marshall *m) {
break;
}
TQMap<TQString,TQVariant> * map = new TQMap<TQString,TQVariant>;
TQStringVariantMap * map = new TQStringVariantMap;
// Convert the ruby hash to an array of key/value arrays
VALUE temp = rb_funcall(hash, rb_intern("to_a"), 0);
@ -1609,7 +1609,7 @@ void marshall_TQMapTQStringTQVariant(Marshall *m) {
break;
case Marshall::ToVALUE:
{
TQMap<TQString,TQVariant> *map = (TQMap<TQString,TQVariant>*)m->item().s_voidp;
TQStringVariantMap *map = (TQStringVariantMap*)m->item().s_voidp;
if(!map) {
*(m->var()) = Qnil;
break;
@ -1617,7 +1617,7 @@ void marshall_TQMapTQStringTQVariant(Marshall *m) {
VALUE hv = rb_hash_new();
TQMap<TQString,TQVariant>::Iterator it;
TQStringVariantMap::Iterator it;
for (it = map->begin(); it != map->end(); ++it) {
void *p = new TQVariant(it.data());
VALUE obj = getPointerObject(p);
@ -1942,8 +1942,8 @@ TypeHandler Qt_handlers[] = {
{ "TQCanvasItemList", marshall_TQCanvasItemList },
{ "TQMap<TQString,TQString>", marshall_TQMapTQStringTQString },
{ "TQMap<TQString,TQString>&", marshall_TQMapTQStringTQString },
{ "TQMap<TQString,TQVariant>", marshall_TQMapTQStringTQVariant },
{ "TQMap<TQString,TQVariant>&", marshall_TQMapTQStringTQVariant },
{ "TQStringVariantMap", marshall_TQMapTQStringTQVariant },
{ "TQStringVariantMap&", marshall_TQMapTQStringTQVariant },
#if TQT_VERSION >= 0x030200
{ "TQWidgetList", marshall_TQWidgetList },
{ "TQWidgetList*", marshall_TQWidgetList },

Loading…
Cancel
Save