diff --git a/kf5/convert-kdebug-with-argument.sh b/kf5/convert-kdebug-with-argument.sh index 0f77633..da8403e 100755 --- a/kf5/convert-kdebug-with-argument.sh +++ b/kf5/convert-kdebug-with-argument.sh @@ -1,88 +1,30 @@ #!/bin/sh if test $# != 4; then echo "Usage : $0 " echo "example : convert-kdebug-with-argument.sh 7112 log_smtp SMTP_LOG smtp_debug" exit 1 fi oldcategorynumber="$1" newlogname="$2" newcategoryname="$3" debugnamefile="$4" upname=`echo $debugnamefile | tr 'a-z' 'A-Z'` -# create debug.h file -cat > $debugnamefile.h < - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef ${upname}_H -#define ${upname}_H - -#include -Q_DECLARE_LOGGING_CATEGORY($newcategoryname) - -#endif -EOF - - -#create debug.cpp file -cat > $debugnamefile.cpp < - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "$debugnamefile.h" -Q_LOGGING_CATEGORY($newcategoryname, "$newlogname") -EOF - #convert debug to new qCDebug/qCWarning/qCCritical find -iname "*.cpp" -o -iname "*.h" | xargs sed -ri \ -e "s|^(\s*#include\s+)|\1\n\1\"${debugnamefile}.h\"|" \ -e "s,k(Debug|Warning)\s*\(\s*$oldcategorynumber\s*\),qC\1\($newcategoryname\)," \ -e "s,k(Fatal|Error)\s*\(\s*$oldcategorynumber\s*\),qCCritical\($newcategoryname\)," -git add $debugnamefile.cpp $debugnamefile.h - # end -echo "1) Add $debugnamefile.cpp to CMakeLists.txt" -echo "2) Add #include + #include \"${debugnamefile}.h\" to each file which was changed and where it is missing" +echo "1) add ecm_qt_declare_logging_category(_SRCS HEADER $debugnamefile.h IDENTIFIER $newcategoryname CATEGORY_NAME $newlogname) to CMakeLists.txt"; +echo "2) #include \"${debugnamefile}.h\" to each file which was changed and where it is missing" echo "3) Verify that it compiles :)" echo "4) If you find bugs fix them please"