From bb5daab115dabf550ab11755745e87fa7c7f4286 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
Date: Tue, 22 Mar 2016 15:38:37 +0100
Subject: Fix code generation with "puic4 -x"

---
 ...Fix-problems-with-puic4-x-code-generation.patch | 129 +++++++++++++++++++++
 perl-Qt.spec                                       |   4 +
 2 files changed, 133 insertions(+)
 create mode 100644 Qt-0.96.0-Fix-problems-with-puic4-x-code-generation.patch

diff --git a/Qt-0.96.0-Fix-problems-with-puic4-x-code-generation.patch 
b/Qt-0.96.0-Fix-problems-with-puic4-x-code-generation.patch
new file mode 100644
index 0000000..1d3a9a7
--- /dev/null
+++ b/Qt-0.96.0-Fix-problems-with-puic4-x-code-generation.patch
@@ -0,0 +1,129 @@
+From 94492c83232701ebc95d739f884f6457a96475f5 Mon Sep 17 00:00:00 2001
+From: Olivier Lahaye <olivier.lah...@cea.fr>
+Date: Fri, 19 Jun 2015 08:11:36 -0700
+Subject: [PATCH] Fix problems with puic4 -x code generation.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is a patch submitted for https://github.com/chrisburel/perlqt4/issues/44 
"puic4 -x does not create valid perl code"
+
+Petr Písař: Ported to 0.96.0:
+
+commit e8a30b78f46a376da70fc9cc8f8166b72aea5261
+Author: Olivier Lahaye <olivier.lah...@cea.fr>
+Date:   Fri Jun 19 08:11:36 2015 -0700
+
+    Fix problems with puic4 -x code generation.
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ qtcore/tools/puic/uic.cpp | 74 +++++++++++++++++++++++++----------------------
+ 1 file changed, 39 insertions(+), 35 deletions(-)
+
+diff --git a/qtcore/tools/puic/uic.cpp b/qtcore/tools/puic/uic.cpp
+index 996a7da..edb5538 100644
+--- a/qtcore/tools/puic/uic.cpp
++++ b/qtcore/tools/puic/uic.cpp
+@@ -139,30 +139,34 @@ void Uic::writeCopyrightHeader(DomUI *ui)
+ {
+     QString comment = ui->elementComment();
+     if ( this->option().generator == Option::PerlGenerator ) {
+-        if (comment.size())
+-            out << "/*\n" << comment << "\n*/\n\n";
++        if (comment.size()) {
++            comment.insert( 0, "# " );
++            comment.replace( QRegExp("\n"), "\n# " );
++            out << 
"################################################################################\n"
++                << comment
++                << 
"\n################################################################################\n\n";
++            }
+ 
+-            out << 
"#################################################################################\n";
+-            out << "## Form generated from reading UI file '" << 
QFileInfo(opt.inputFile).fileName() << "'\n";
+-            out << "##\n";
+-            out << "## Created: " << QDateTime::currentDateTime().toString() 
<< "\n";
+-            out << "##      " << QString::fromLatin1("by: Qt User Interface 
Compiler version %1\n").arg(QLatin1String(QT_VERSION_STR));
+-            out << "##\n";
+-            out << "## WARNING! All changes made in this file will be lost 
when recompiling UI file!\n";
+-            out << 
"################################################################################\n\n";
+-    }
+-    else {
++        out << 
"################################################################################\n";
++        out << "## Form generated from reading UI file '" << 
QFileInfo(opt.inputFile).fileName() << "'\n";
++        out << "##\n";
++        out << "## Created: " << QDateTime::currentDateTime().toString() << 
"\n";
++        out << "##      " << QString::fromLatin1("by: Qt User Interface 
Compiler version %1\n").arg(QLatin1String(QT_VERSION_STR));
++        out << "##\n";
++        out << "## WARNING! All changes made in this file will be lost when 
recompiling UI file!\n";
++        out << 
"################################################################################\n\n";
++    } else {
+         if (comment.size())
+             out << "/*\n" << comment << "\n*/\n\n";
+ 
+-            out << 
"/********************************************************************************\n";
+-            out << "** Form generated from reading UI file '" << 
QFileInfo(opt.inputFile).fileName() << "'\n";
+-            out << "**\n";
+-            out << "** Created: " << QDateTime::currentDateTime().toString() 
<< "\n";
+-            out << "**      " << QString::fromLatin1("by: Qt User Interface 
Compiler version %1\n").arg(QLatin1String(QT_VERSION_STR));
+-            out << "**\n";
+-            out << "** WARNING! All changes made in this file will be lost 
when recompiling UI file!\n";
+-            out << 
"********************************************************************************/\n\n";
++        out << 
"/********************************************************************************\n";
++        out << "** Form generated from reading UI file '" << 
QFileInfo(opt.inputFile).fileName() << "'\n";
++        out << "**\n";
++        out << "** Created: " << QDateTime::currentDateTime().toString() << 
"\n";
++        out << "**      " << QString::fromLatin1("by: Qt User Interface 
Compiler version %1\n").arg(QLatin1String(QT_VERSION_STR));
++        out << "**\n";
++        out << "** WARNING! All changes made in this file will be lost when 
recompiling UI file!\n";
++        out << 
"********************************************************************************/\n\n";
+     }
+ }
+ 
+@@ -381,28 +385,28 @@ bool Uic::plwrite(DomUI *ui)
+ 
+       if (option().useKDE) {
+                       out << "\n\nsub main {" << endl;
+-                      out << option().indent << "my $about = 
KDE::AboutData(\"" << className.toLower() << "\", \"" << className << "\", 
KDE.ki18n(\"\"), \"0.1\")" << endl;
+-                      out << option().indent << 
"KDE::CmdLineArgs.init(\\@ARGV, $about)" << endl;
+-                      out << option().indent << "my $a = KDE::Application" << 
endl;
++                      out << option().indent << "my $about = 
KDE::AboutData(\"" << className.toLower() << "\", \"" << className << "\", 
KDE.ki18n(\"\"), \"0.1\");" << endl;
++                      out << option().indent << 
"KDE::CmdLineArgs.init(\\@ARGV, $about);" << endl;
++                      out << option().indent << "my $a = KDE::Application;" 
<< endl;
+                       parentClass.replace(QRegExp("^Q"), "Qt::");
+                       parentClass.replace(QRegExp("^K"), "KDE::");
+-                      out << option().indent << "my $w = " << parentClass << 
endl;
+-                      out << option().indent << option().prefix << className 
<< "setupUi($w)" << endl;
+-                      out << option().indent << "$a->topWidget = $w" << endl;
+-                      out << option().indent << "$w->show()" << endl;
+-                      out << option().indent << "$a->exec()" << endl;
++                      out << option().indent << "my $w = " << parentClass << 
";" << endl;
++                      out << option().indent << option().prefix << className 
<< "setupUi($w);" << endl;
++                      out << option().indent << "$a->topWidget = $w;" << endl;
++                      out << option().indent << "$w->show();" << endl;
++                      out << option().indent << "$a->exec();" << endl;
+                       out << "}" << endl;
+-                      out << "exit main()" << endl;
++                      out << "exit main();" << endl;
+               } else {
+                       out << "\n\nsub main {" << endl;
+-                      out << option().indent << "my $a = 
Qt::Application(\\@ARGV)" << endl;
++                      out << option().indent << "my $a = 
Qt::Application(\\@ARGV);" << endl;
+                       parentClass.replace(QRegExp("^Q"), "Qt::");
+-                      out << option().indent << "my $w = " << parentClass << 
endl;
+-                      out << option().indent << "my $u = " << option().prefix 
<< className << endl;
+-                      out << option().indent << "$w->show()" << endl;
+-                      out << option().indent << "$a->exec()" << endl;
++                      out << option().indent << "my $w = " << parentClass << 
";" << endl;
++                      out << option().indent << "my $u = " << option().prefix 
<< className << ";" << endl;
++                      out << option().indent << "$w->show();" << endl;
++                      out << option().indent << "$a->exec();" << endl;
+                       out << "}" << endl;
+-                      out << "exit main()" << endl;
++                      out << "exit main();" << endl;
+               }
+     }
+ 
+-- 
+2.5.5
+
diff --git a/perl-Qt.spec b/perl-Qt.spec
index e722f29..6c9e6ef 100644
--- a/perl-Qt.spec
+++ b/perl-Qt.spec
@@ -21,6 +21,8 @@ Patch3:         
Qt-0.96.0-Bundle-Devel-Peel-SvREFCNT_inc-removed-from-perl-5.2.p
 Patch4:         
perlqt-4.14.2-Use-a-copy-of-the-Qt-AutoLoad-AUTOLOAD-variable.patch
 # Adjust to smokeqt's QChar, in upstream after 4.8.0
 Patch5:         Qt-0.96.0-Fix-uchar-test.patch
+# Fix code generation with "puic4 -x", bug #1118240, in upstream after 4.14.3
+Patch6:         Qt-0.96.0-Fix-problems-with-puic4-x-code-generation.patch
 BuildRequires:  coreutils
 BuildRequires:  cmake
 # gcc for C standard library headers
@@ -92,6 +94,7 @@ Development files for perl-Qt.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 mkdir build
 
@@ -167,6 +170,7 @@ export PERL5LIB="$PWD/blib/lib:$PWD/blib/arch"
 - Specify more dependencies
 - Modernize spec file
 - Run X11 tests
+- Fix code generation with "puic4 -x" (bug #1118240)
 
 * Mon Nov 03 2014 Petr Pisar <ppi...@redhat.com> - 0.96.0-13
 - Adjust to perl-5.20.0 (bug #1136340)
-- 
cgit v0.12


        
http://pkgs.fedoraproject.org/cgit/perl-Qt.git/commit/?h=f22&id=bb5daab115dabf550ab11755745e87fa7c7f4286
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/perl-devel@lists.fedoraproject.org

Reply via email to