[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bperlqt=5D_qt=3A_Add_control_over_method_access_=28p?=
From: Chris Burel <chrisburel () gmail ! com>
Date: 2011-01-31 22:19:34
Message-ID: 20110131221934.C1F43A60AE () git ! kde ! org
[Download RAW message or body]
Git commit b6e18a620849006698185eee02b55d6c1c8cbf15 by Chris Burel.
Pushed by burel into branch 'master'.
Add control over method access (public/private) for signals and slots.
M +7 -3 qtcore/lib/QtCore4.pm
M +0 -6 qtcore/lib/QtCore4/classinfo.pm
M +7 -0 qtcore/lib/QtCore4/signals.pm
M +8 -0 qtcore/lib/QtCore4/slots.pm
M +1 -0 qtgui/examples/dbus/pingpong/pong.pl
M +2 -0 qtgui/examples/dbus/remotecontrolledcar/car/CarAdaptor.pm \
http://commits.kde.org/perlqt/b6e18a620849006698185eee02b55d6c1c8cbf15
diff --git a/qtcore/lib/QtCore4.pm b/qtcore/lib/QtCore4.pm
index 6649e2b..2fca607 100644
--- a/qtcore/lib/QtCore4.pm
+++ b/qtcore/lib/QtCore4.pm
@@ -1414,7 +1414,6 @@ sub makeMetaData {
my $meta = hashByName($classname . '::META');
my $classinfos = $meta->{classinfos};
- my $dbus = $meta->{dbus};
my $signals = $meta->{signals};
my $slots = $meta->{slots};
@@ -1475,7 +1474,7 @@ sub makeMetaData {
push @$data, $nullposition; #parameter names
push @$data, $nullposition; #return type, void
push @$data, $nullposition; #tag
- if ( $dbus ) {
+ if ( $signal->{public} ) {
push @$data, $MethodScriptable | $MethodSignal | \
$AccessPublic; # flags }
else {
@@ -1501,7 +1500,12 @@ sub makeMetaData {
push @$data, $nullposition; #return type, void
}
push @$data, $nullposition; #tag
- push @$data, $MethodSlot | $AccessPrivate; # flags
+ if ( $slot->{public} ) {
+ push @$data, $MethodScriptable | $MethodSlot | $AccessPublic; \
# flags + }
+ else {
+ push @$data, $MethodSlot | $AccessPrivate; # flags
+ }
}
push @$data, 0; #eod
diff --git a/qtcore/lib/QtCore4/classinfo.pm \
b/qtcore/lib/QtCore4/classinfo.pm index 6544365..8dfd1c7 100644
--- a/qtcore/lib/QtCore4/classinfo.pm
+++ b/qtcore/lib/QtCore4/classinfo.pm
@@ -27,8 +27,6 @@ sub import {
Qt::_internal::installqt_metacall( $caller ) unless defined \
&{$caller."::qt_metacall"};
- $meta->{dbus} = undef;
-
foreach my $key ( keys %classinfos ) {
my $value = $classinfos{$key};
@@ -37,10 +35,6 @@ sub import {
};
push @{$meta->{classinfos}}, $classinfo;
-
- # This affects the way the meta methods are defined. If \
$meta->{dbus}
- # is true, the methods get declared public.
- $meta->{dbus} = 1 if $key eq 'D-Bus Interface';
}
}
diff --git a/qtcore/lib/QtCore4/signals.pm b/qtcore/lib/QtCore4/signals.pm
index aae1e45..979b6a0 100644
--- a/qtcore/lib/QtCore4/signals.pm
+++ b/qtcore/lib/QtCore4/signals.pm
@@ -9,6 +9,7 @@ use strict;
use warnings;
use Carp;
use QtCore4;
+use Scalar::Util qw(looks_like_number);
our $VERSION = 0.60;
@@ -30,6 +31,11 @@ sub import {
# This makes any call to the signal name call XS_SIGNAL
Qt::_internal::installqt_metacall( $caller ) unless defined \
&{$caller."::qt_metacall"};
+ my $public = grep { $signals[$_*2] eq 'public' &&
+ looks_like_number( $signals[$_*2+1] ) &&
+ $signals[$_*2+1] > 0
+ } 0..$#signals/2;
+
for ( my $i = 0; $i < @signals; $i += 2 ) {
my $signalname = $signals[$i];
my $signalargs = $signals[$i+1];
@@ -44,6 +50,7 @@ sub import {
my $signal = {
name => $signalname,
signature => $signature,
+ public => $public,
};
push @{$meta->{signals}}, $signal;
diff --git a/qtcore/lib/QtCore4/slots.pm b/qtcore/lib/QtCore4/slots.pm
index 1143c9f..ae366a1 100644
--- a/qtcore/lib/QtCore4/slots.pm
+++ b/qtcore/lib/QtCore4/slots.pm
@@ -9,6 +9,7 @@ use strict;
use warnings;
use Carp;
use QtCore4;
+use Scalar::Util qw(looks_like_number);
our $VERSION = 0.60;
@@ -28,6 +29,12 @@ sub import {
} unless defined &{ "${caller}::metaObject" };
Qt::_internal::installqt_metacall( $caller ) unless defined \
&{$caller."::qt_metacall"}; +
+ my $public = grep { $slots[$_*2] eq 'public' &&
+ looks_like_number( $slots[$_*2+1] ) &&
+ $slots[$_*2+1] > 0
+ } 0..$#slots/2;
+
for ( my $i = 0; $i < @slots; $i += 2 ) {
my $fullslotname = $slots[$i];
my $slotargs = $slots[$i+1];
@@ -48,6 +55,7 @@ sub import {
name => $slotname,
signature => $signature,
returnType => $returnType,
+ public => $public,
};
push @{$meta->{slots}}, $slot;
diff --git a/qtgui/examples/dbus/pingpong/pong.pl \
b/qtgui/examples/dbus/pingpong/pong.pl index 14e59eb..418afd1 100755
--- a/qtgui/examples/dbus/pingpong/pong.pl
+++ b/qtgui/examples/dbus/pingpong/pong.pl
@@ -10,6 +10,7 @@ use QtGui4;
use QtDBus4;
use QtCore4::isa qw( Qt::Object );
use QtCore4::slots
+ public => 1,
'QString ping' => ['QString'];
sub NEW {
diff --git a/qtgui/examples/dbus/remotecontrolledcar/car/CarAdaptor.pm \
b/qtgui/examples/dbus/remotecontrolledcar/car/CarAdaptor.pm index \
3faedbe..bc19554 100644
--- a/qtgui/examples/dbus/remotecontrolledcar/car/CarAdaptor.pm
+++ b/qtgui/examples/dbus/remotecontrolledcar/car/CarAdaptor.pm
@@ -32,11 +32,13 @@ use QtCore4::classinfo
'';
use QtCore4::slots # METHODS
+ 'public' => 1,
'accelerate' => [],
'decelerate' => [],
'turnLeft' => [],
'turnRight' => [];
use QtCore4::signals # SIGNALS
+ 'public' => 1,
'crashed' => [];
#
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic