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
This commit is contained in:
Gerald Combs 2021-01-17 10:38:27 -08:00 committed by Wireshark GitLab Utility
parent f504af93f3
commit 85a7938925
5 changed files with 23 additions and 11 deletions

View File

@ -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

View File

@ -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]);

View File

@ -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,

View File

@ -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,

View File

@ -19,6 +19,7 @@
class FilterListModel : public QAbstractListModel
{
Q_OBJECT
public:
enum FilterListType {