File indexing completed on 2024-03-03 05:56:14

0001 #!/bin/sh
0002 
0003 if test $# != 4; then
0004   echo "Usage : $0 <old category number> <new log name> <new category name> <debug name file>"
0005   echo "example : convert-kdebug-with-argument.sh 7112 log_smtp SMTP_LOG smtp_debug"
0006   exit 1
0007 fi
0008 
0009 
0010 oldcategorynumber="$1"
0011 newlogname="$2"
0012 newcategoryname="$3"
0013 debugnamefile="$4"
0014 
0015 upname=`echo $debugnamefile | tr 'a-z' 'A-Z'`
0016 
0017 #convert debug to new qCDebug/qCWarning/qCCritical
0018 
0019 find -iname "*.cpp" -o -iname "*.h" | xargs sed -ri \
0020                 -e "s|^(\s*#include\s+)<KDebug>|\1<QDebug>\n\1\"${debugnamefile}.h\"|" \
0021                 -e "s,k(Debug|Warning)\s*\(\s*$oldcategorynumber\s*\),qC\1\($newcategoryname\)," \
0022                 -e "s,k(Fatal|Error)\s*\(\s*$oldcategorynumber\s*\),qCCritical\($newcategoryname\),"
0023 
0024 
0025 # end
0026 echo "1) add ecm_qt_declare_logging_category(<file>_SRCS HEADER $debugnamefile.h IDENTIFIER $newcategoryname CATEGORY_NAME $newlogname) to CMakeLists.txt";
0027 echo "2) #include \"${debugnamefile}.h\" to each file which was changed and where it is missing"
0028 echo "3) Verify that it compiles :)"
0029 echo "4) If you find bugs fix them please"
0030