From 85a793892520c0f2152bc26c1287236762c69e85 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Sun, 17 Jan 2021 10:38:27 -0800 Subject: [PATCH] Qt+tools: Fix most of our lupdate warnings. Fix various warnings with the following changes: Pass a list of include directories to lupdate. Fixes: ui/qt/proto_tree.cpp:57: Qualifying with unknown namespace/class ::ProtoTree and similar warnings. Use QT_TRANSLATE_NOOP instead of QT_TR_NOOP. Fixes: ui/qt/lte_rlc_statistics_dialog.cpp:993: tr() cannot be called without context ui/qt/lte_mac_statistics_dialog.cpp:911: tr() cannot be called without context ui/qt/font_color_preferences_frame.cpp:28: tr() cannot be called without context ui/qt/font_color_preferences_frame.cpp:29: tr() cannot be called without context ui/qt/font_color_preferences_frame.cpp:30: Discarding unconsumed meta data Add Q_OBJECT to the class definition. Fixes: ui/qt/models/filter_list_model.cpp:120: Class 'FilterListModel' lacks Q_OBJECT macro The following warnings were not fixed. This might require moving IOGraph to its own file: ui/qt/io_graph_dialog.cpp:320: Qualifying with unknown namespace/class ::IOGraphDialog ui/qt/io_graph_dialog.cpp:555: Qualifying with unknown namespace/class ::IOGraphDialog ui/qt/io_graph_dialog.cpp:1059: Qualifying with unknown namespace/class ::IOGraphDialog ui/qt/io_graph_dialog.cpp:1485: Qualifying with unknown namespace/class ::IOGraphDialog --- tools/update-tx | 25 ++++++++++++++++++------- ui/qt/font_color_preferences_frame.cpp | 4 ++-- ui/qt/lte_mac_statistics_dialog.cpp | 2 +- ui/qt/lte_rlc_statistics_dialog.cpp | 2 +- ui/qt/models/filter_list_model.h | 1 + 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/tools/update-tx b/tools/update-tx index 2406ebddff..b91bcfa5f2 100755 --- a/tools/update-tx +++ b/tools/update-tx @@ -12,13 +12,26 @@ while getopts "n" OPTCHAR ; do done shift $((OPTIND - 1)) +TOP_LEVEL=$(git rev-parse --show-toplevel) +if ! cd "$TOP_LEVEL" ; then + echo "Can't change to the top-level source directory." + exit 1 +fi + +LUPDATE_INCLUDES=(-I .) +while read -r ; do + LUPDATE_INCLUDES+=(-I "$REPLY") +done < <(find "$TOP_LEVEL/ui/qt" -type d) + # All .cpp, .h, and .ui files under ui/qt -LUPDATE_FILES=$(find ui/qt -name '*.cpp' -o -name '*.h' -o -name '*.ui') +LUPDATE_FILES=() +while read -r ; do + LUPDATE_FILES+=("$REPLY") +done < <(find ui/qt -name '*.cpp' -o -name '*.h' -o -name '*.ui') # Add line numbers for i in ui/qt/*.ts ; do - # shellcheck disable=SC2086 - lupdate -locations absolute ${LUPDATE_FILES} -ts "$i" + lupdate -locations absolute "${LUPDATE_INCLUDES[@]}" "${LUPDATE_FILES[@]}" -ts "$i" done # Get last translation for Transifex @@ -26,8 +39,7 @@ tx pull -f # Regenerate last translation for repo for i in ui/qt/*.ts ; do - # shellcheck disable=SC2086 - lupdate -locations absolute ${LUPDATE_FILES} -ts "$i" + lupdate -locations absolute "${LUPDATE_INCLUDES[@]}" "${LUPDATE_FILES[@]}" -ts "$i" done # Push last change tranlastion on Transifex @@ -37,8 +49,7 @@ fi # Remove line numbers for i in ui/qt/*.ts ; do - # shellcheck disable=SC2086 - lupdate -locations none -no-ui-lines ${LUPDATE_FILES} -ts "$i" + lupdate -locations none -no-ui-lines "${LUPDATE_INCLUDES[@]}" "${LUPDATE_FILES[@]}" -ts "$i" done #Add new commit with last translation update diff --git a/ui/qt/font_color_preferences_frame.cpp b/ui/qt/font_color_preferences_frame.cpp index 5ec6af15d0..b691a83cbd 100644 --- a/ui/qt/font_color_preferences_frame.cpp +++ b/ui/qt/font_color_preferences_frame.cpp @@ -25,8 +25,8 @@ //: These are pangrams. Feel free to replace with nonsense text that spans your alphabet. //: https://en.wikipedia.org/wiki/Pangram static const char *font_pangrams_[] = { - QT_TR_NOOP("Example GIF query packets have jumbo window sizes"), - QT_TR_NOOP("Lazy badgers move unique waxy jellyfish packets") + QT_TRANSLATE_NOOP("FontColorPreferencesFrame", "Example GIF query packets have jumbo window sizes"), + QT_TRANSLATE_NOOP("FontColorPreferencesFrame", "Lazy badgers move unique waxy jellyfish packets") }; const int num_font_pangrams_ = (sizeof font_pangrams_ / sizeof font_pangrams_[0]); diff --git a/ui/qt/lte_mac_statistics_dialog.cpp b/ui/qt/lte_mac_statistics_dialog.cpp index 73087dbb5d..84452e7a36 100644 --- a/ui/qt/lte_mac_statistics_dialog.cpp +++ b/ui/qt/lte_mac_statistics_dialog.cpp @@ -908,7 +908,7 @@ lte_mac_statistics_init(const char *args, void*) { static stat_tap_ui lte_mac_statistics_ui = { REGISTER_STAT_GROUP_TELEPHONY_LTE, - QT_TR_NOOP("MAC Statistics"), + QT_TRANSLATE_NOOP("LteMacStatisticsDialog", "MAC Statistics"), "mac-lte,stat", lte_mac_statistics_init, 0, diff --git a/ui/qt/lte_rlc_statistics_dialog.cpp b/ui/qt/lte_rlc_statistics_dialog.cpp index 7325137824..89912844ce 100644 --- a/ui/qt/lte_rlc_statistics_dialog.cpp +++ b/ui/qt/lte_rlc_statistics_dialog.cpp @@ -990,7 +990,7 @@ lte_rlc_statistics_init(const char *args, void*) { static stat_tap_ui lte_rlc_statistics_ui = { REGISTER_STAT_GROUP_TELEPHONY_LTE, - QT_TR_NOOP("RLC Statistics"), + QT_TRANSLATE_NOOP("LteRlcStatisticsDialog", "RLC Statistics"), "rlc-lte,stat", lte_rlc_statistics_init, 0, diff --git a/ui/qt/models/filter_list_model.h b/ui/qt/models/filter_list_model.h index 9f9acafec3..a5b716e119 100644 --- a/ui/qt/models/filter_list_model.h +++ b/ui/qt/models/filter_list_model.h @@ -19,6 +19,7 @@ class FilterListModel : public QAbstractListModel { + Q_OBJECT public: enum FilterListType {