~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to scripts/qt4/remove-qt3-support.pl

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
# laurent Montel <montel@kde.org> 2005
 
4
# This script will remove some QT3_SUPPORT into qstring/qdir/qtimer/qglobal
 
5
 
 
6
use File::Basename;
 
7
use lib dirname( $0 );
 
8
use functionUtilkde;
 
9
use strict;
 
10
 
 
11
open(my $F, q(find -name "*" |));
 
12
my $file;
 
13
while ($file = <$F>) {
 
14
        chomp $file;
 
15
        next if functionUtilkde::excludeFile( $file);
 
16
        open(my $FILE, $file) or warn "We can't open file $file:$!\n";
 
17
        my $modified;
 
18
        my @l = map {
 
19
            my $orig = $_;
 
20
            if ( $_ =~ /lastIndexOf/ ) {
 
21
                # three argument
 
22
                my ($before, $prefix, $contenu) = m!^(\s*.*)(lastIndexOf.*)\((.*)\s*\);$!;
 
23
                if ( my ($firstelement, $secondelement, $thirdelement) = m!.*?\(\s*(.*),\s*(.*),\s*(.*)\);\s*$!) {
 
24
                    $thirdelement =~ s/ //g;
 
25
                    if ( $thirdelement =~ /true/ ) {
 
26
                        $_ = $before . "lastIndexOf( $firstelement, $secondelement, Qt::CaseSensitive );\n";
 
27
                    }
 
28
                    elsif ( $thirdelement =~ /false/ ) {
 
29
                        $_ = $before . "lastIndexOf( $firstelement, $secondelement, Qt::CaseInsensitive );\n";
 
30
                    }
 
31
                    else {
 
32
                        s/lastIndexOf/lastIndexOf/;
 
33
                    }
 
34
                }
 
35
                else {
 
36
                    s/lastIndexOf/lastIndexOf/; 
 
37
                }
 
38
            }   
 
39
            s!toLocal8Bit!toLocal8Bit!g;
 
40
            if( $_ =~ /\.toUtf8/ ) {
 
41
                s!\.toUtf8!\.toUtf8!g;
 
42
            }   
 
43
            if( $_ =~ /\.hasMirrored/ ) {
 
44
                s!mirrored!hasMirrored!g;
 
45
            }
 
46
            if( $_ =~ /absPath\s*\(\s*\)/ ) {
 
47
                s!absPath!absolutePath!;
 
48
            }
 
49
        if ( $_ =~ /\.latin1\s*\(\s*\)/ ) {
 
50
                s!\.latin1!\.toLatin1!g;
 
51
        }
 
52
                if ( $_ =~ /\.xForm\s*\(/ ) {
 
53
                        s!\.xForm!\.transformed!;
 
54
                }
 
55
        if ( $_ =~ /->xForm\s*\(/ ) {
 
56
            s!\->xForm!\->transformed!;
 
57
        }
 
58
                s!writeBlock!write!;
 
59
                s!readBlock!read!;
 
60
                s!isSequentialAccess!isSequential!;
 
61
 
 
62
                s!QComboBox::Policy!QComboBox::InsertPolicy!g;
 
63
                s!insertionPolicy!insertPolicy!;
 
64
                s!setInsertionPolicy!setInsertPolicy!;
 
65
                s!NoInsertion!NoInsert!;
 
66
                
 
67
                if ( $_ =~ /\.lower\s*\(\s*\)/ ) {
 
68
                                s!\.lower!\.toLower!g;
 
69
            }
 
70
            if ( $_ =~ /\.upper\s*\(\s*\)/ ) {
 
71
                s!\.upper!\.toUpper!g;
 
72
            }                   
 
73
            if( $_ =~ /dirPath/ ) {
 
74
                if( my ($before, $prefix, $contenu, $after ) = m!^(\s*.*)(dirPath.*?\()(.*?\))(.*)$!) {
 
75
                    $contenu =~ s/ //g;
 
76
                    $contenu =~ s/\)//;
 
77
                    if( $contenu =~ /true|TRUE/ ) {
 
78
                        $_ = $before . "absolutePath()" . $after . "\n";
 
79
                    }
 
80
                    elsif ( $contenu =~ /false|FALSE/ ) {
 
81
                        $_ = $before . "path()" . $after . "\n";
 
82
                    }
 
83
                    elsif ($contenu eq "" ) {
 
84
                        $_ = $before . "path()" . $after . "\n";
 
85
                    }
 
86
                    else {
 
87
                        warn "Verify if we can port or not : <$contenu> \n";
 
88
                    }
 
89
                }       
 
90
            }
 
91
 
 
92
        s!QApplication::reverseLayout!QApplication::isRightToLeft!;
 
93
                
 
94
                s!Qt::ShiftButton!Qt::ShiftModifier!;
 
95
        s!Qt::ControlButton!Qt::ControlModifier!;
 
96
        s!Qt::AltButton!Qt::AltModifier!;
 
97
        s!Qt::MetaButton!Qt::MetaModifier!;
 
98
        s!Qt::Keypad!Qt::KeypadModifier!;
 
99
        s!Qt::KeyButtonMask!Qt::KeyboardModifierMask!;
 
100
        s!convertToAbs!makeAbsolute!;
 
101
        s!currentDirPath!currentPath!;
 
102
        s!homeDirPath!homePath!;
 
103
        s!rootDirPath!rootPath!;
 
104
        s!cleanDirPath!cleanPath!;
 
105
        s!absFilePath!absoluteFilePath!;
 
106
        s!QDir::All!QDir::TypeMask!;
 
107
        s!QDir::DefaultFilter!QDir::NoFilter!;
 
108
        s!QDir::DefaultSort!QDir::NoSort!;
 
109
        s!simplifyWhiteSpace!simplified!g;
 
110
        s!stripWhiteSpace!trimmed!g;
 
111
        s!ucs2!utf16!g;
 
112
        s!leftJustify!leftJustified!g;
 
113
        s!rightJustify!rightJustified!g;
 
114
        s!fromUcs2!fromUtf16!g;
 
115
        s!constref!at!g;
 
116
        s!changeInterval!start!g;           
 
117
 
 
118
 
 
119
                s!Q_INT8!qint8!g;
 
120
                s!Q_UINT8!quint8!g;
 
121
                s!Q_INT16!qint16!g;
 
122
                s!Q_UINT16!quint16!g;
 
123
        s!Q_INT32!qint32!g;
 
124
        s!Q_UINT32!quint32!g;   
 
125
        s!Q_INT64!qint64!g;
 
126
        s!Q_UINT64!quint64!g;
 
127
                s!Q_LLONG!qint64!g;
 
128
                s!Q_ULLONG!quint64!g;
 
129
                s!QMAX!qMax!g;
 
130
                s!QMIN!qMin!g;
 
131
                s!Qt::ScaleMin!Qt::KeepAspectRatio!g;
 
132
                s!Qt::ScaleMax!Qt::KeepAspectRatioByExpanding!g;
 
133
                s!Qt::ScaleFree!Qt::IgnoreAspectRatio!g;
 
134
                s!Qt::AlignAuto!Qt::AlignLeft!g;
 
135
                s!Qt::CustomPattern!Qt::TexturePattern!g;
 
136
        if( $_ =~ /Qt::TopLeft/ ) {
 
137
            s!Qt::TopLeft!Qt::TopLeftCorner!g if( $_ !~ /Qt::TopLeftCorner/ );
 
138
        }
 
139
        if( $_ =~ /Qt::TopRight/ ) {
 
140
            s/Qt::TopRight/Qt::TopRightCorner/g if( $_ !~ /Qt::TopRightCorner/ );
 
141
        }
 
142
        if( $_ =~ /Qt::BottomLeft/ ) {
 
143
            s/Qt::BottomLeft/Qt::BottomLeftCorner/g if( $_ !~ /Qt::BottomLeftCorner/);
 
144
        }
 
145
        if( $_ =~ /Qt::BottomRight/ ) {
 
146
            s/Qt::BottomRight/Qt::BottomRightCorner/g if( $_ !~ /Qt::BottomRightCorner/ );
 
147
        }
 
148
 
 
149
                
 
150
                #qcolor.h
 
151
                s!setRgba!setRgb!;
 
152
                s!getRgba!getRgb!;
 
153
 
 
154
                #qscrollbar.h
 
155
                s!draggingSlider!isSliderDown!;
 
156
                #qtabwidget.h
 
157
                s!setTabIconSet!setTabIcon!;
 
158
                s!tabIconSet!tabIcon!;
 
159
 
 
160
            $modified ||= $orig ne $_;
 
161
            $_;
 
162
        } <$FILE>;
 
163
        if ($modified) {
 
164
            open (my $OUT, ">$file");
 
165
            print $OUT @l;
 
166
        }
 
167
 
 
168
    }
 
169
functionUtilkde::diffFile( "@ARGV" );
 
170