File: add-customwidget.pl

package info (click to toggle)
kde-dev-scripts 4%3A18.08.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,496 kB
  • sloc: perl: 15,466; lisp: 5,627; sh: 4,157; python: 3,892; ruby: 2,158; makefile: 16; sed: 9
file content (19 lines) | stat: -rwxr-xr-x 787 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl

# Montel Laurent <montel@kde.org> 
# This program allows to add custom widget to ui files
# for example : add-customwidget.pl OptionsDlgWidget.ui KIntSpinBox knuminput.h

use File::Basename;
use lib dirname( $0 );
use functionUtilkde; 
my $numberArgument = @ARGV;
"@ARGV" =~ /-h/ || ( $numberArgument ne 3 ) and die "usage: add-customwidget.pl <file> <name of custom widget> <include file for custom widget> \n";

my $namecustom=$ARGV[1];
my $nameheader=$ARGV[2];
functionUtilkde::substInFile {
	    s!</includes>!</includes>\n<customwidgets>\n\t<customwidget>\n\t\t<class>$namecustom</class>\n\t\t<header location="global">$nameheader</header>\n\t\t<container>0</container>\n\t</customwidget>\n</customwidgets>\n!;
} $ARGV[0];

functionUtilkde::diffFile( "$ARGV[0]" );