[Kde-bindings] KDE/kdebindings
Chris Michael Burel
chrisburel at gmail.com
Tue Oct 12 21:41:53 UTC 2010
SVN commit 1185302 by burel:
Add qthelp smoke module.
Add qthelp perl module.
Add QMap<QString,QUrl> marshaller.
Get the help/contextsensitivehelp example to work.
CCMAIL: kde-bindings at kde.org
M +1 -0 perl/CMakeLists.txt
M +1 -1 perl/qtcore/lib/QtCore4.pm
M +96 -6 perl/qtcore/src/handlers.cpp
M +0 -1 perl/qtcore/tools/puic/perl/plwriteincludes.cpp
M +3 -3 perl/qtgui/examples/help/contextsensitivehelp/HelpBrowser.pm
M +1 -1 perl/qtgui/examples/help/contextsensitivehelp/WateringConfigDialog.pm
M +0 -1 perl/qtgui/examples/help/contextsensitivehelp/contextsensitivehelp.pl
M +1 -1 perl/qtgui/examples/help/contextsensitivehelp/wateringconfigdialog.ui
A perl/qthelp (directory)
A perl/qthelp/CMakeLists.txt
A perl/qthelp/lib (directory)
A perl/qthelp/lib/CMakeLists.txt
A perl/qthelp/lib/QtHelp4.pm
A perl/qthelp/src (directory)
A perl/qthelp/src/CMakeLists.txt
A perl/qthelp/src/QtHelp4.xs
A perl/qthelp/src/qthelp4handlers.cpp [License: GPL]
M +1 -0 smoke/CMakeLists.txt
A smoke/qthelp (directory)
A smoke/qthelp/CMakeLists.txt
A smoke/qthelp/config.xml.cmake
A smoke/qthelp/qthelp_includes.h [License: Trivial file.]
A smoke/qthelp/smokeconfig.xml
A smoke/qthelp_smoke.h [License: UNKNOWN]
--- trunk/KDE/kdebindings/perl/CMakeLists.txt #1185301:1185302
@@ -17,6 +17,7 @@
macro_optional_add_bindings(QT_QTDBUS_FOUND "QtDBus" qtdbus)
macro_optional_add_bindings(QT_QTDECLARATIVE_FOUND "QtDeclarative" qtdeclarative)
macro_optional_add_bindings(QT_QTGUI_FOUND "QtGui" qtgui)
+macro_optional_add_bindings(QT_QTHELP_FOUND "QtHelp" qthelp)
macro_optional_add_bindings(QT_QTMULTIMEDIA_FOUND "QtMultimedia" qtmultimedia)
macro_optional_add_bindings(QT_QTNETWORK_FOUND "QtNetwork" qtnetwork)
macro_optional_add_bindings(QT_QTOPENGL_FOUND "QtOpenGL" qtopengl)
--- trunk/KDE/kdebindings/perl/qtcore/lib/QtCore4.pm #1185301:1185302
@@ -1070,7 +1070,7 @@
}
else {
my $noMethodFound = reportNoMethodFound( $classname, $methodname, @_ );
- $noMethodFound .= "'use QtCore4::debug qw(ambiguous)' for more information.";
+ $noMethodFound .= "'use QtCore4::debug qw(ambiguous)' for more information.\n";
die $noMethodFound;
}
}
--- trunk/KDE/kdebindings/perl/qtcore/src/handlers.cpp #1185301:1185302
@@ -378,11 +378,15 @@
// different smoke object. So we need to find out which
// smoke object to put into the resulting perl object.
Smoke::Index returnCId = m->type().classId();
+ Smoke::Class returnClass = m->smoke()->classes[returnCId];
+ Smoke::ModuleIndex returnMId;
+ if ( returnClass.external ) {
const char* returnCxxClassname = m->smoke()->classes[returnCId].className;
- Smoke* returnSmoke =
- Smoke::classMap[returnCxxClassname].smoke;
- // Now translate the classId to that smoke;
- returnCId = returnSmoke->idClass(returnCxxClassname).index;
+ returnMId = Smoke::classMap[returnCxxClassname];
+ }
+ else {
+ returnMId = Smoke::ModuleIndex( m->smoke(), returnCId );
+ }
// See if we already made a perl object for this pointer
SV* var = getPointerObject(cxxptr);
@@ -392,7 +396,7 @@
// valid. This shouldn't be necessary, but it seems
// that some things bypass the Binding::deleted code.
smokeperl_object* o = sv_obj_info(var);
- if ( Smoke::isDerivedFrom( o->smoke, o->classId, returnSmoke, returnCId ) ) {
+ if ( Smoke::isDerivedFrom( o->smoke, o->classId, returnMId.smoke, returnMId.index ) ) {
SvSetMagicSV(m->var(), var);
break;
}
@@ -406,7 +410,7 @@
// The smokeperl_object contains all the info we need to
// know about this object
smokeperl_object* o = alloc_smokeperl_object(
- false, returnSmoke, returnCId, cxxptr );
+ false, returnMId.smoke, returnMId.index, cxxptr );
// Try to create a copy (using the copy constructor) if
// it's a const ref
@@ -1426,6 +1430,91 @@
}
}
+void marshall_QMapQStringQUrl(Marshall *m) {
+ switch(m->action()) {
+ case Marshall::FromSV: {
+ SV *hashref = m->var();
+ if( !SvROK(hashref) && (SvTYPE(SvRV(hashref)) != SVt_PVHV) ) {
+ m->item().s_voidp = 0;
+ break;
+ }
+
+ HV *hash = (HV*)SvRV(hashref);
+ QMap<QString,QUrl> * map = new QMap<QString,QUrl>;
+
+ char* key;
+ SV* value;
+ I32* keylen = new I32;
+ while( ( value = hv_iternextsv( hash, &key, keylen ) ) ) {
+ smokeperl_object *o = sv_obj_info(value);
+ if (!o || !o->ptr || o->classId != o->smoke->findClass("QVariant").index) {
+ continue;
+ // If the value isn't a Qt::Variant, then try and construct
+ // a Qt::Variant from it
+ // TODO: I have no idea how to do this.
+ /*
+ value = rb_funcall(qvariant_class, rb_intern("fromValue"), 1, value);
+ if (value == Qnil) {
+ continue;
+ }
+ o = value_obj_info(value);
+ */
+ }
+
+ (*map)[QString(key)] = (QUrl)*(QUrl*)o->ptr;
+ }
+ delete keylen;
+
+ m->item().s_voidp = map;
+ m->next();
+
+ if(m->cleanup())
+ delete map;
+ }
+ break;
+ case Marshall::ToSV: {
+ QMap<QString,QUrl> *map = (QMap<QString,QUrl>*)m->item().s_voidp;
+ if(!map) {
+ sv_setsv(m->var(), &PL_sv_undef);
+ break;
+ }
+
+ HV *hv = newHV();
+ SV *sv = newRV_noinc( (SV*)hv );
+
+ QMap<QString,QUrl>::Iterator it;
+ for (it = map->begin(); it != map->end(); ++it) {
+ void *p = new QUrl(it.value());
+ SV *obj = getPointerObject(p);
+
+ if ( !obj || !SvOK(obj) ) {
+ Smoke::ModuleIndex returnMId = Smoke::classMap["QUrl"];
+ smokeperl_object * o = alloc_smokeperl_object(
+ true,
+ returnMId.smoke,
+ returnMId.index,
+ p );
+ obj = set_obj_info(" Qt::Url", o);
+ }
+
+ SV *key = perlstringFromQString((QString*)&(it.key()));
+ STRLEN keylen = it.key().size();
+ hv_store( hv, SvPV_nolen(key), keylen, obj, 0 );
+ }
+
+ sv_setsv(m->var(), sv);
+ m->next();
+
+ if(m->cleanup())
+ delete map;
+ }
+ break;
+ default:
+ m->unsupported();
+ break;
+ }
+}
+
void marshall_QMapQStringQVariant(Marshall *m) {
switch(m->action()) {
case Marshall::FromSV: {
@@ -2224,6 +2313,7 @@
{ "QMap<int,QVariant>&", marshall_QMapIntQVariant },
{ "QMap<QString,QString>", marshall_QMapQStringQString },
{ "QMap<QString,QString>&", marshall_QMapQStringQString },
+ { "QMap<QString,QUrl>", marshall_QMapQStringQUrl },
{ "QMap<QString,QVariant>", marshall_QMapQStringQVariant },
{ "QMap<QString,QVariant>&", marshall_QMapQStringQVariant },
{ "QVariantMap", marshall_QMapQStringQVariant },
--- trunk/KDE/kdebindings/perl/qtcore/tools/puic/perl/plwriteincludes.cpp #1185301:1185302
@@ -206,7 +206,6 @@
}
if (!header.isEmpty()) {
- fprintf( stderr, "Header is %s\n", qPrintable(header) );
break;
}
--- trunk/KDE/kdebindings/perl/qtgui/examples/help/contextsensitivehelp/HelpBrowser.pm #1185301:1185302
@@ -4,6 +4,7 @@
use warnings;
use QtCore4;
use QtGui4;
+use QtHelp4;
use QtCore4::isa qw( Qt::TextBrowser );
@@ -25,10 +26,9 @@
{
my ($id) = @_;
if (this->{m_helpEngine}) {
- #Qt::Map<Qt::String, Qt::Url> links = this->{m_helpEngine}->linksForIdentifier(id);
my $links = this->{m_helpEngine}->linksForIdentifier($id);
- if ($links && ref $links eq 'ARRAY') {
- this->setSource($links->[0]->value());
+ if ($links && ref $links eq 'HASH') {
+ this->setSource((values %{$links})[0]);
}
}
}
--- trunk/KDE/kdebindings/perl/qtgui/examples/help/contextsensitivehelp/WateringConfigDialog.pm #1185301:1185302
@@ -35,7 +35,7 @@
sub focusChanged
{
my $now = $_[1];
- if (defined this->{m_widgetInfo}->{$now}) {
+ if (defined $now && defined this->{m_widgetInfo}->{$now}) {
this->{m_ui}->helpLabel->setText(sprintf this->tr('Information about %s:'), this->{m_widgetInfo}->{$now});
my @lst = split ' ', this->{m_widgetInfo}->{$now};
this->{m_ui}->helpBrowser->showHelpForKeyword($lst[-1]);
--- trunk/KDE/kdebindings/perl/qtgui/examples/help/contextsensitivehelp/contextsensitivehelp.pl #1185301:1185302
@@ -9,7 +9,6 @@
sub main
{
- die "This example does not yet work. The bindings do not provide support for QHelpEngineCore.\n";
my $a = Qt::Application(\@ARGV);
my $dia = WateringConfigDialog();
return $dia->exec();
--- trunk/KDE/kdebindings/perl/qtgui/examples/help/contextsensitivehelp/wateringconfigdialog.ui #1185301:1185302
@@ -258,7 +258,7 @@
<widget class="QComboBox" name="sourceComboBox" >
<item>
<property name="text" >
- <string>Foundain</string>
+ <string>Fountain</string>
</property>
</item>
<item>
--- trunk/KDE/kdebindings/smoke/CMakeLists.txt #1185301:1185302
@@ -21,6 +21,7 @@
macro_optional_add_bindings(QT_QTUITOOLS_FOUND "QtUiTools" qtuitools)
macro_optional_add_bindings(QT_QTTEST_FOUND "QtTest" qttest)
macro_optional_add_bindings(QT_QTMULTIMEDIA_FOUND "QtMultimedia" qtmultimedia)
+macro_optional_add_bindings(QT_QTHELP_FOUND "QtHelp" qthelp)
macro_optional_add_bindings(PHONON_FOUND "Phonon" phonon)
More information about the Kde-bindings
mailing list