Commit 87d3bc50 authored by David Faure's avatar David Faure
Browse files

KCommandLineArgs -> QCommandLineParser script

parent 582116a5
#!/usr/bin/perl -w
# David Faure <faure@kde.org>
# KCommandLineArgs -> QCommandLineParser
use strict;
use File::Basename;
use lib dirname($0);
use functionUtilkde;
foreach my $file (@ARGV) {
my $context = "\"main\"";
my $opt;
functionUtilkde::substInFile {
if (/KCmdLineOptions (\w*)/) {
$opt = $1;
s/KCmdLineOptions/QCommandLineParser/;
s/$opt/parser/;
} elsif (defined $opt && /(.*)$opt.add\s*\("([^\"]*)", ki18n\((.*)\)\)/) {
my $prefix = $1; # e.g. indent
my $str = $2;
my $description = $3;
my $trail = "";
if ($str =~ /(\w*) <(.*)>/) { # "stylesheet <xsl>"
$str = $1;
$trail = ", QCommandLineOption::OneValue";
}
$_ = "${prefix}parser.addOption(QCommandLineOption(QStringList() << \"$str\", QCoreApplication::translate($context, $description)$trail));\n";
}
$_;
} $file;
if (`grep QCommand $file | grep -v '#include'`) {
functionUtilkde::removeIncludeInFile($file, "kcmdlineargs.h");
functionUtilkde::addIncludeInFile($file, "qcommandlineparser.h");
functionUtilkde::addIncludeInFile($file, "qcommandlineoption.h");
}
}
functionUtilkde::diffFile( "@ARGV" );
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment