summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-08-01 13:42:42 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2011-08-01 15:58:01 -0300
commit74754b1e137933263ff018a930f55a27c4cf2db2 (patch)
treeffa3c4902fdc87686b0b5d7922069e9fd4210d0b
parent12fe2a44f83ddd3ddf1d2978a406c9881b890b9f (diff)
downloadpyside-74754b1e137933263ff018a930f55a27c4cf2db2.tar.gz
pyside-74754b1e137933263ff018a930f55a27c4cf2db2.tar.xz
pyside-74754b1e137933263ff018a930f55a27c4cf2db2.zip
Created template code for added QObject's trUtf8 methods.
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org> Reviewed by Renato Ara├║jo <renato.filho@openbossa.org>
-rw-r--r--PySide/QtCore/typesystem_core.xml41
1 files changed, 20 insertions, 21 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 2f553d6..9fc073b 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -1438,6 +1438,18 @@
</inject-code>
</add-function>
+ <template name="translate_utf8">
+ if (QCoreApplication::instance()) {
+ Shiboken::AutoDecRef klass(PyObject_GetAttrString(%PYSELF, "__class__"));
+ Shiboken::AutoDecRef cname(PyObject_GetAttrString(klass, "__name__"));
+ $DEFINE_SECOND_VAR
+ QString result = QCoreApplication::instance()->translate(PyString_AS_STRING(cname.object()), $SECOND_VAR, %2, QCoreApplication::UnicodeUTF8, %3);
+ %PYARG_0 = %CONVERTTOPYTHON[QString](result);
+ } else {
+ Py_INCREF(%PYARG_1);
+ %PYARG_0 = %PYARG_1;
+ }
+ </template>
<add-function signature="trUtf8(const char *, const char *, int)" return-type="QString">
<modify-argument index="2">
<replace-default-expression with="0"/>
@@ -1446,18 +1458,12 @@
<replace-default-expression with="-1"/>
</modify-argument>
<inject-code class="target" position="beginning">
- if (QCoreApplication::instance()) {
- Shiboken::AutoDecRef klass(PyObject_GetAttrString(%PYSELF, "__class__"));
- Shiboken::AutoDecRef cname(PyObject_GetAttrString(klass, "__name__"));
- QString result = QCoreApplication::instance()->translate(PyString_AS_STRING(cname.object()), %1, %2, QCoreApplication::UnicodeUTF8, %3);
- %PYARG_0 = %CONVERTTOPYTHON[QString](result);
- } else {
- Py_INCREF(%PYARG_1);
- %PYARG_0 = %PYARG_1;
- }
+ <insert-template name="translate_utf8">
+ <replace from="$DEFINE_SECOND_VAR" to="" />
+ <replace from="$SECOND_VAR" to="%1" />
+ </insert-template>
</inject-code>
</add-function>
-
<add-function signature="trUtf8(PyUnicode, const char *, int)" return-type="QString">
<modify-argument index="2">
<replace-default-expression with="0"/>
@@ -1466,20 +1472,13 @@
<replace-default-expression with="-1"/>
</modify-argument>
<inject-code class="target" position="beginning">
- if (QCoreApplication::instance()) {
- Shiboken::AutoDecRef klass(PyObject_GetAttrString(%PYSELF, "__class__"));
- Shiboken::AutoDecRef cname(PyObject_GetAttrString(klass, "__name__"));
- Shiboken::AutoDecRef str(PyUnicode_AsUTF8String(%1));
- QString result = QCoreApplication::instance()->translate(PyString_AS_STRING(cname.object()), PyString_AS_STRING(str.object()), %2, QCoreApplication::UnicodeUTF8, %3);
- %PYARG_0 = %CONVERTTOPYTHON[QString](result);
- } else {
- Py_INCREF(%PYARG_1);
- %PYARG_0 = %PYARG_1;
- }
+ <insert-template name="translate_utf8">
+ <replace from="$DEFINE_SECOND_VAR" to="Shiboken::AutoDecRef str(PyUnicode_AsUTF8String(%1));" />
+ <replace from="$SECOND_VAR" to="PyString_AS_STRING(str.object())" />
+ </insert-template>
</inject-code>
</add-function>
-
<modify-function signature="receivers(const char*) const">
<inject-code class="target" position="beginning">
// Avoid return +1 because SignalManager connect to "destroyed()" signal to control object timelife