[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/bindings/perlqt4/perl
From:       Chris Michael Burel <chrisburel () gmail ! com>
Date:       2010-04-12 18:45:22
Message-ID: 20100412184522.C3F52AC897 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1114099 by burel:

More ruby->perl translation in puic to get the ui files for the recently added Clock \
plasmoid to compile correctly.


 M  +2 -2      kdeui/src/kperlpluginfactory.cpp  
 A             plasma/examples/applets/analogclock/Makefile  
 M  +47 -17    qtcore/lib/QtCore4.pm  
 M  +1 -1      qtcore/tools/puic/perl/plwritedeclaration.cpp  
 M  +22 -22    qtcore/tools/puic/perl/plwriteinitialization.cpp  


--- trunk/playground/bindings/perlqt4/perl/kdeui/src/kperlpluginfactory.cpp \
#1114098:1114099 @@ -186,7 +186,7 @@
 
     // Load the specified in an eval to trap the error
     QString moduleName = program.baseName().replace(QRegExp("\\.pm$"), \
                "").toLatin1();
-    QString requireModule = QString( "eval{ require %1 } " )
+    QString requireModule = QString( "eval{ require %1 }" )
         .arg( moduleName );
     eval_pv( requireModule.toLatin1().data(), TRUE );
     bool badStatus = show_exception_message();
@@ -194,7 +194,7 @@
         return 0;
     }
     // Now run ModuleName->import
-    QString importModule = QString( "eval{ %1->import } " )
+    QString importModule = QString( "eval{ %1->import }" )
         .arg( moduleName );
     eval_pv( importModule.toLatin1().data(), TRUE );
     badStatus = show_exception_message();
--- trunk/playground/bindings/perlqt4/perl/qtcore/lib/QtCore4.pm #1114098:1114099
@@ -1296,16 +1296,14 @@
 }
 
 sub init_enum {
-    my ( $enums ) = @_;
-    foreach my $enumName (@$enums) {
-        $enumName =~ s/^const //;
-        if(@{arrayByName("${enumName}::ISA")}) {
-            @{arrayByName("${enumName}Enum::ISA")} = ('Qt4::enum::_overload');
-        }
-        else {
-            @{arrayByName("${enumName}::ISA")} = ('Qt4::enum::_overload');
-        }
+    my ( $class, $enumName ) = @_;
+    $enumName =~ s/^const //;
+    if(@{arrayByName("${enumName}::ISA")}) {
+        @{arrayByName("${enumName}Enum::ISA")} = ('Qt4::enum::_overload');
     }
+    else {
+        @{arrayByName("${enumName}::ISA")} = ('Qt4::enum::_overload');
+    }
 }
 
 # Args: none
@@ -1701,35 +1699,67 @@
 });
 
 sub String {
-    return bless \shift, 'Qt4::String';
+    if ( @_ ) {
+        return bless \shift, 'Qt4::String';
+    } else {
+        return bless '', 'Qt4::String';
+    }
 }
 
 sub CString {
-    return bless \shift, 'Qt4::CString';
+    if ( @_ ) {
+        return bless \shift, 'Qt4::CString';
+    } else {
+        return bless '', 'Qt4::CString';
+    }
 }
 
 sub Int {
-    return bless \shift, 'Qt4::Int';
+    if ( @_ ) {
+        return bless \shift, 'Qt4::Int';
+    } else {
+        return bless '', 'Qt4::Int';
+    }
 }
 
 sub Uint {
-    return bless \shift, 'Qt4::Uint';
+    if ( @_ ) {
+        return bless \shift, 'Qt4::Uint';
+    } else {
+        return bless '', 'Qt4::Uint';
+    }
 }
 
 sub Bool {
-    return bless \shift, 'Qt4::Bool';
+    if ( @_ ) {
+        return bless \shift, 'Qt4::Bool';
+    } else {
+        return bless '', 'Qt4::Bool';
+    }
 }
 
 sub Short {
-    return bless \shift, 'Qt4::Short';
+    if ( @_ ) {
+        return bless \shift, 'Qt4::Short';
+    } else {
+        return bless '', 'Qt4::Short';
+    }
 }
 
 sub Ushort {
-    return bless \shift, 'Qt4::Ushort';
+    if ( @_ ) {
+        return bless \shift, 'Qt4::Ushort';
+    } else {
+        return bless '', 'Qt4::Ushort';
+    }
 }
 
 sub Uchar {
-    return bless \shift, 'Qt4::Uchar';
+    if ( @_ ) {
+        return bless \shift, 'Qt4::Uchar';
+    } else {
+        return bless '', 'Qt4::Uchar';
+    }
 }
 
 1;
--- trunk/playground/bindings/perlqt4/perl/qtcore/tools/puic/perl/plwritedeclaration.cpp \
#1114098:1114099 @@ -97,7 +97,7 @@
     m_output << "use strict;\n";
     m_output << "use warnings;\n";
     m_output << "use utf8;\n";
-    m_output << "use Qt4;\n";
+    m_output << "use QtCore4;\n";
     m_output << "\n";
 
     const QStringList connections = m_uic->databaseInfo()->connections();
--- trunk/playground/bindings/perlqt4/perl/qtcore/tools/puic/perl/plwriteinitialization.cpp \
#1114098:1114099 @@ -1475,47 +1475,47 @@
     const QString fontName = QString("$") + m_driver->unique(QLatin1String("font"));
     m_fontPropertiesNameMap.insert(FontHandle(f), fontName);
 
-    m_output << m_option.indent << fontName << " = Qt4::Font.new\n";
+    m_output << m_option.indent << "my " << fontName << " = Qt4::Font();\n";
     if (f->hasElementFamily() && !f->elementFamily().isEmpty()) {
-        m_output << m_option.indent << fontName << ".family = " << \
                fixString(f->elementFamily(), m_option.indent)
-            << "\n";
+        m_output << m_option.indent << fontName << "->setFamily( " << \
fixString(f->elementFamily(), m_option.indent) +            << " );\n";
     }
     if (f->hasElementPointSize() && f->elementPointSize() > 0) {
-         m_output << m_option.indent << fontName << ".pointSize = " << \
                f->elementPointSize()
-             << "\n";
+         m_output << m_option.indent << fontName << "->setPointSize( " << \
f->elementPointSize() +             << " );\n";
     }
 
     if (f->hasElementBold()) {
-        m_output << m_option.indent << fontName << ".bold = "
-            << (f->elementBold() ? "true" : "false") << "\n";
+        m_output << m_option.indent << fontName << "->setBold( "
+            << (f->elementBold() ? "1" : "0") << " );\n";
     }
     if (f->hasElementItalic()) {
-        m_output << m_option.indent << fontName << ".italic = "
-            <<  (f->elementItalic() ? "true" : "false") << "\n";
+        m_output << m_option.indent << fontName << "->setItalic( "
+            <<  (f->elementItalic() ? "1" : "0") << " );\n";
     }
     if (f->hasElementUnderline()) {
-        m_output << m_option.indent << fontName << ".underline = "
-            << (f->elementUnderline() ? "true" : "false") << "\n";
+        m_output << m_option.indent << fontName << "->setUnderline( "
+            << (f->elementUnderline() ? "1" : "0") << " );\n";
     }
     if (f->hasElementWeight() && f->elementWeight() > 0) {
-        m_output << m_option.indent << fontName << ".weight = "
-            << f->elementWeight() << "" << endl;
+        m_output << m_option.indent << fontName << "->setWeight( "
+            << f->elementWeight() << " );" << endl;
     }
     if (f->hasElementStrikeOut()) {
-         m_output << m_option.indent << fontName << ".strikeOut = "
-            << (f->elementStrikeOut() ? "true" : "false") << "\n";
+         m_output << m_option.indent << fontName << "->setStrikeOut( "
+            << (f->elementStrikeOut() ? "1" : "0") << " );\n";
     }
     if (f->hasElementKerning()) {
-        m_output << m_option.indent << fontName << ".kerning = "
-            << (f->elementKerning() ? "true" : "false") << "\n";
+        m_output << m_option.indent << fontName << "->setKerning( "
+            << (f->elementKerning() ? "1" : "0") << " );\n";
     }
     if (f->hasElementAntialiasing()) {
-        m_output << m_option.indent << fontName << ".styleStrategy = "
-            << (f->elementAntialiasing() ? "Qt4::Font::PreferDefault" : \
"Qt4::Font::NoAntialias") << "\n"; +        m_output << m_option.indent << fontName \
<< "->setStyleStrategy( " +            << (f->elementAntialiasing() ? \
"Qt4::Font::PreferDefault()" : "Qt4::Font::NoAntialias()") << " );\n";  }
     if (f->hasElementStyleStrategy()) {
-         m_output << m_option.indent << fontName << ".styleStrategy = Qt4::Font::"
-            << f->elementStyleStrategy() << "\n";
+         m_output << m_option.indent << fontName << "->setStyleStrategy( \
Qt4::Font::" +            << f->elementStyleStrategy() << "() );\n";
     }
     return  fontName;
 }
@@ -2118,7 +2118,7 @@
 
         if (!toString(text->elementString()).isEmpty()) {
             const QString txt = trCall(text->elementString());
-            m_refreshOut << m_option.indent << varName << "->headerItem()->setText(" \
<< i << ", " << txt << ");\n"; +            m_refreshOut << m_option.indent << \
"$self->" << varNameNoSigil << "()->headerItem()->setText(" << i << ", " << txt << \
");\n";  }
 
         if (icon) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic