File indexing completed on 2024-04-21 05:41:57

0001 #!/bin/sh
0002 
0003 # trivial script to replace add(Row|Col)Spacing with the new Qt4 idioms (addItem( new QSpacerItem(.,.), .,. )).
0004 # If the arguments to addRowSpacing are complex expressions, this script fails (and replaces a mess). So you better look at the diff that is generated by this script!
0005 # CAUTION: Use at your own risk.
0006 # I do not assert any rights on these few trivial lines of code, Reinhold Kainhofer
0007 
0008 for i in `grep -le addRowSpacing -e addColSpacing -R [ac-z]* | grep -v '\.svn'`; do
0009   sed "
0010       s/addRowSpacing\ *(\ *\([^,]*\),\(.*\));/addItem( new QSpacerItem( 0,\2), \1, 0 );/g;
0011       s/addColSpacing\ *(\ *\([^,]*\),\(.*[^ ]\)\ *);/addItem( new QSpacerItem(\2, 0 ), 0, \1 );/g" "$i" > "$i.new";
0012         echo "$i"
0013         diff "$i" "$i.new"
0014         mv "$i.new" "$i"
0015 done