File indexing completed on 2025-03-23 08:20:37
0001 #!/usr/bin/perl 0002 0003 # laurent Montel <montel@kde.org> 2005 0004 # This script will remove some QT3_SUPPORT into qstring/qdir/qtimer/qglobal 0005 0006 use File::Basename; 0007 use lib dirname( $0 ); 0008 use functionUtilkde; 0009 use strict; 0010 0011 open(my $F, "-|", qw(find . -type f)); 0012 my $file; 0013 while ($file = <$F>) { 0014 chomp $file; 0015 next if functionUtilkde::excludeFile( $file); 0016 open(my $FILE, $file) or warn "We can't open file $file:$!\n"; 0017 my $modified; 0018 my @l = map { 0019 my $orig = $_; 0020 if ( $_ =~ /lastIndexOf/ ) { 0021 # three argument 0022 my ($before, $prefix, $contenu) = m!^(\s*.*)(lastIndexOf.*)\((.*)\s*\);$!; 0023 if ( my ($firstelement, $secondelement, $thirdelement) = m!.*?\(\s*(.*),\s*(.*),\s*(.*)\);\s*$!) { 0024 $thirdelement =~ s/ //g; 0025 if ( $thirdelement =~ /true/ ) { 0026 $_ = $before . "lastIndexOf( $firstelement, $secondelement, Qt::CaseSensitive );\n"; 0027 } 0028 elsif ( $thirdelement =~ /false/ ) { 0029 $_ = $before . "lastIndexOf( $firstelement, $secondelement, Qt::CaseInsensitive );\n"; 0030 } 0031 else { 0032 s/lastIndexOf/lastIndexOf/; 0033 } 0034 } 0035 else { 0036 s/lastIndexOf/lastIndexOf/; 0037 } 0038 } 0039 s!toLocal8Bit!toLocal8Bit!g; 0040 if( $_ =~ /\.toUtf8/ ) { 0041 s!\.toUtf8!\.toUtf8!g; 0042 } 0043 if( $_ =~ /\.hasMirrored/ ) { 0044 s!mirrored!hasMirrored!g; 0045 } 0046 if( $_ =~ /absPath\s*\(\s*\)/ ) { 0047 s!absPath!absolutePath!; 0048 } 0049 if ( $_ =~ /\.latin1\s*\(\s*\)/ ) { 0050 s!\.latin1!\.toLatin1!g; 0051 } 0052 if ( $_ =~ /\.xForm\s*\(/ ) { 0053 s!\.xForm!\.transformed!; 0054 } 0055 if ( $_ =~ /->xForm\s*\(/ ) { 0056 s!\->xForm!\->transformed!; 0057 } 0058 s!writeBlock!write!; 0059 s!readBlock!read!; 0060 s!isSequentialAccess!isSequential!; 0061 0062 s!QComboBox::Policy!QComboBox::InsertPolicy!g; 0063 s!insertionPolicy!insertPolicy!; 0064 s!setInsertionPolicy!setInsertPolicy!; 0065 s!NoInsertion!NoInsert!; 0066 0067 if ( $_ =~ /\.lower\s*\(\s*\)/ ) { 0068 s!\.lower!\.toLower!g; 0069 } 0070 if ( $_ =~ /\.upper\s*\(\s*\)/ ) { 0071 s!\.upper!\.toUpper!g; 0072 } 0073 if( $_ =~ /dirPath/ ) { 0074 if( my ($before, $prefix, $contenu, $after ) = m!^(\s*.*)(dirPath.*?\()(.*?\))(.*)$!) { 0075 $contenu =~ s/ //g; 0076 $contenu =~ s/\)//; 0077 if( $contenu =~ /true|TRUE/ ) { 0078 $_ = $before . "absolutePath()" . $after . "\n"; 0079 } 0080 elsif ( $contenu =~ /false|FALSE/ ) { 0081 $_ = $before . "path()" . $after . "\n"; 0082 } 0083 elsif ($contenu eq "" ) { 0084 $_ = $before . "path()" . $after . "\n"; 0085 } 0086 else { 0087 warn "Verify if we can port or not : <$contenu> \n"; 0088 } 0089 } 0090 } 0091 0092 s!QApplication::reverseLayout!QApplication::isRightToLeft!; 0093 0094 s!Qt::ShiftButton!Qt::ShiftModifier!; 0095 s!Qt::ControlButton!Qt::ControlModifier!; 0096 s!Qt::AltButton!Qt::AltModifier!; 0097 s!Qt::MetaButton!Qt::MetaModifier!; 0098 s!Qt::Keypad\b!Qt::KeypadModifier!; 0099 s!Qt::KeyButtonMask!Qt::KeyboardModifierMask!; 0100 s!convertToAbs!makeAbsolute!; 0101 s!currentDirPath!currentPath!; 0102 s!homeDirPath!homePath!; 0103 s!rootDirPath!rootPath!; 0104 s!cleanDirPath!cleanPath!; 0105 s!absFilePath!absoluteFilePath!; 0106 s!\bQDir::All\b!QDir::TypeMask!; 0107 s!QDir::DefaultFilter!QDir::NoFilter!; 0108 s!QDir::DefaultSort!QDir::NoSort!; 0109 s!simplifyWhiteSpace!simplified!g; 0110 s!stripWhiteSpace!trimmed!g; 0111 s!ucs2!utf16!g; 0112 s!leftJustify!leftJustified!g; 0113 s!rightJustify!rightJustified!g; 0114 s!fromUcs2!fromUtf16!g; 0115 s!constref!at!g; 0116 s!changeInterval!start!g; 0117 0118 0119 s!Q_INT8!qint8!g; 0120 s!Q_UINT8!quint8!g; 0121 s!Q_INT16!qint16!g; 0122 s!Q_UINT16!quint16!g; 0123 s!Q_INT32!qint32!g; 0124 s!Q_UINT32!quint32!g; 0125 s!Q_INT64!qint64!g; 0126 s!Q_UINT64!quint64!g; 0127 s!Q_LLONG!qint64!g; 0128 s!Q_ULLONG!quint64!g; 0129 s!\bQMAX\b!qMax!g; 0130 s!\bQMIN\b!qMin!g; 0131 s!Qt::ScaleMin!Qt::KeepAspectRatio!g; 0132 s!Qt::ScaleMax!Qt::KeepAspectRatioByExpanding!g; 0133 s!Qt::ScaleFree!Qt::IgnoreAspectRatio!g; 0134 s!Qt::AlignAuto!Qt::AlignLeft!g; 0135 s!Qt::CustomPattern!Qt::TexturePattern!g; 0136 if( $_ =~ /Qt::TopLeft/ ) { 0137 s!Qt::TopLeft!Qt::TopLeftCorner!g if( $_ !~ /Qt::TopLeftCorner/ ); 0138 } 0139 if( $_ =~ /Qt::TopRight/ ) { 0140 s/Qt::TopRight/Qt::TopRightCorner/g if( $_ !~ /Qt::TopRightCorner/ ); 0141 } 0142 if( $_ =~ /Qt::BottomLeft/ ) { 0143 s/Qt::BottomLeft/Qt::BottomLeftCorner/g if( $_ !~ /Qt::BottomLeftCorner/); 0144 } 0145 if( $_ =~ /Qt::BottomRight/ ) { 0146 s/Qt::BottomRight/Qt::BottomRightCorner/g if( $_ !~ /Qt::BottomRightCorner/ ); 0147 } 0148 0149 0150 #qcolor.h 0151 s!setRgba!setRgb!; 0152 s!getRgba!getRgb!; 0153 0154 #qscrollbar.h 0155 s!draggingSlider!isSliderDown!; 0156 #qtabwidget.h 0157 s!setTabIconSet!setTabIcon!; 0158 s!tabIconSet!tabIcon!; 0159 s!smoothScale!scaled!; 0160 s!mirror!mirrored!; 0161 s!setMaxValue!setMaximum!; 0162 s!setLineStep!setSingleStep!; 0163 s!convertToImage!toImage!; 0164 s!QCheckBox::Off!Qt::Unchecked!; 0165 s!QCheckBox::NoChange!Qt::PartiallyChecked!; 0166 s!QCheckBox::On!Qt::Checked!; 0167 0168 $modified ||= $orig ne $_; 0169 $_; 0170 } <$FILE>; 0171 if ($modified) { 0172 open (my $OUT, ">", $file); 0173 print $OUT @l; 0174 } 0175 0176 } 0177 functionUtilkde::diffFile( @ARGV ); 0178