Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SDK
KDE Development Scripts
Commits
87d3bc50
Commit
87d3bc50
authored
May 17, 2013
by
David Faure
Browse files
KCommandLineArgs -> QCommandLineParser script
parent
582116a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
kf5/convert-kcmdlineargs.pl
0 → 100755
View file @
87d3bc50
#!/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
"
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment