File indexing completed on 2024-04-21 05:41:56

0001 #!/usr/bin/perl
0002 
0003 # laurent Montel <montel@kde.org> 2006 GPL
0004 # Reinhold Kainhofer <reinhold@kainhofer.com> 2006 GPL
0005 #
0006 # Call with a file and a line number to change (by grepping compile logs)
0007 
0008 # NOTE: This script assumes that the QGridLayout and Q[HV]BoxLayout constructors
0009 #       are already converted to the new API, except for the possible
0010 #       QLayout*parent first argument. Use the convert-qgridlayout.pl and
0011 #       convert-qboxlayout.pl scripts for this.
0012 
0013 use File::Basename;
0014 use lib dirname( $0 );
0015 use functionUtilkde;
0016 use strict;
0017 
0018 my $file = $ARGV[0];
0019 my $cline = $ARGV[1];
0020 
0021 my $line = 0;
0022 
0023 my $modified;
0024 open(FILE, $file) or warn "We can't open file $file:$!\n";
0025 while ( <FILE> )
0026 {
0027    $line = $line + 1;
0028    if ($line == $cline) {
0029            my ($spaces, $trailer, $object, $call, $ws, $parent );
0030            if ( ($spaces, $trailer, $object, $call, $ws, $parent ) = m!^(\s*)(.*[\s\*]|)([a-zA-Z0-9]+)(\s*=\s*new Q[a-zA-Z0-9]*Layout[^(]*)\((\s*)(.*[^\s])\s*\);$! ) {
0031 #print "Spaces: '$spaces', Trailer: '$trailer', Object: '$object', Call: '$call', WS: '$ws', Parent: '$parent'\n";
0032           $_  = "$spaces$trailer$object$call();\n";
0033           $_ .= "$spaces$parent->addItem($ws$object$ws);\n";
0034       }
0035 
0036    }
0037    print $_;
0038 }
0039