Commit a64510b4 authored by Laurent Montel's avatar Laurent Montel 😁

Update to modern method

parent db8d9d8c
......@@ -2,8 +2,8 @@
if test $# != 3; then
echo "Usage : $0 <new log name> <new category name> <debug name file>"
echo "example : convert-qdebug-to-qcdebug.sh log_smtp SMTP_LOG smtp_debug"
exit 1
echo "example : convert-qdebug-to-qcdebug.sh org.kde.smtp SMTP_LOG smtp_debug"
exit 0
fi
......@@ -13,65 +13,6 @@ debugnamefile="$3"
upname=`echo $debugnamefile | tr 'a-z' 'A-Z'`
# create debug.h file
cat > $debugnamefile.h <<EOF
/* This file is part of the KDE project
Copyright (C) 2015 Laurent Montel <montel@kde.org>
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 <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY($newcategoryname)
#endif
EOF
#create debug.cpp file
cat > $debugnamefile.cpp <<EOF
/* This file is part of the KDE project
Copyright (C) 2015 Laurent Montel <montel@kde.org>
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 perl -pi -e "s,qDebug\s*\(\s*\),qCDebug\($newcategoryname\),"
......@@ -92,13 +33,12 @@ find -iname "*.cpp" -o -iname "*.h" | xargs perl -pi -e "s,#include \<KDebug\>,#
find -iname "*.cpp" -o -iname "*.h" | xargs perl -pi -e "s/k_funcinfo/Q_FUNC_INFO/;"
git add $debugnamefile.cpp $debugnamefile.h
echo "add ecm_qt_declare_logging_category(<file>_SRCS HEADER $debugnamefile.h IDENTIFIER $newcategoryname CATEGORY_NAME $newlogname) to CMakeLists.txt";
# end
echo "1) Add $debugnamefile.cpp to CMakeLists.txt"
echo "2) Add #include <QDebug> + #include \"$debugnamefile.h\" to each file which was changed"
echo "3) Adjust name / email in $debugnamefile.cpp and $debugnamefile.h"
echo "4) Verify that it compiles :)"
echo "5) If you find bugs fix them please"
echo "2) Add #include \"$debugnamefile.h\" to each file which was changed"
echo "3) Verify that it compiles :)"
echo "4) If you find bugs fix them please"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment