Qt: Generate .qm files during build

Change-Id: Ia2ee723227e1b331eeec0f0463654f35a4c9f37b
Reviewed-on: https://code.wireshark.org/review/14508
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
João Valverde 2016-03-15 03:06:21 +00:00 committed by Martin Kaiser
parent fff248bb84
commit 5c03bda31a
14 changed files with 43 additions and 38 deletions

2
.gitignore vendored
View File

@ -186,7 +186,7 @@ qtshark
/ui/qt/__/
/ui/qt/*.qrc.depends
/ui/qt/*.pro.user
#/ui/qt/*.qm
/ui/qt/*.qm
/ui/qt/moc_*.cpp
/ui/qt/moc_*.cpp_parameters
/ui/qt/*.moc.cpp

View File

@ -1302,6 +1302,8 @@ if test "x$enable_wireshark" = "xyes"; then
AC_SUBST(MOC)
AC_WIRESHARK_QT_TOOL_CHECK(RCC, rcc, "$qt_version")
AC_SUBST(RCC)
AC_WIRESHARK_QT_TOOL_CHECK(LRELEASE, lrelease, "$qt_version")
AC_SUBST(LRELEASE)
#
# On Darwin, find where the Qt frameworks are

View File

@ -450,7 +450,7 @@ set(WIRESHARK_QT_QRC
../../image/layout.qrc
../../image/toolbar.qrc
../../image/wsicon.qrc
i18n.qrc
${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc
)
set(WIRESHARK_QT_TS
@ -469,7 +469,7 @@ include_directories(
)
if (QT_VERSION EQUAL 5)
QT5_ADD_TRANSLATION(WIRESHARK_QT_TS_QM ${WIRESHARK_QT_TS})
QT5_ADD_TRANSLATION(WIRESHARK_QT_QM ${WIRESHARK_QT_TS})
QT5_ADD_RESOURCES(WIRESHARK_QT_QRC_SRC ${WIRESHARK_QT_QRC})
QT5_WRAP_UI(WIRESHARK_QT_UI_SRC ${WIRESHARK_QT_UI})
# For now, do the moc stuff manually
@ -480,7 +480,7 @@ if (QT_VERSION EQUAL 5)
# or
# set_target_properties(${some-source-files} PROPERTIES AUTOMOC TRUE)
else()
QT4_ADD_TRANSLATION(WIRESHARK_QT_TS_QM ${WIRESHARK_QT_TS})
QT4_ADD_TRANSLATION(WIRESHARK_QT_QM ${WIRESHARK_QT_TS})
QT4_ADD_RESOURCES(WIRESHARK_QT_QRC_SRC ${WIRESHARK_QT_QRC})
QT4_WRAP_UI(WIRESHARK_QT_UI_SRC ${WIRESHARK_QT_UI})
# For now, do the moc stuff manually
@ -492,6 +492,20 @@ else()
# set_target_properties(${some-source-files} PROPERTIES AUTOMOC TRUE)
endif()
foreach(_file ${WIRESHARK_QT_QM})
get_filename_component(_qresource ${_file} NAME)
set(i18n_qresource "${i18n_qresource}\n <file>${_qresource}</file>")
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc PROPERTIES OBJECT_DEPENDS ${_file})
endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/i18n.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc)
add_custom_target(
translations ALL
DEPENDS
${WIRESHARK_QT_QM}
)
set_target_properties(translations PROPERTIES FOLDER "UI")
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${WIRESHARK_QT_FILES}
@ -513,9 +527,9 @@ add_library(qtui STATIC
${WIRESHARK_QT_UI_SRC}
${WIRESHARK_QT_MOC_SRC}
${WIRESHARK_QT_QRC_SRC}
${WIRESHARK_QT_TS_QM}
wireshark-tap-register.c
)
add_dependencies(qtui translations)
set_target_properties(qtui PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(qtui PROPERTIES FOLDER "UI")

View File

@ -40,7 +40,9 @@ CLEANFILES = \
*~
DISTCLEANFILES = \
$(NODIST_GENERATED_FILES)
$(NODIST_GENERATED_FILES) \
$(QM_FILES) \
i18n.qrc
MAINTAINERCLEANFILES = \
$(GENERATED_FILES) \
@ -112,6 +114,10 @@ AM_V_UIC = $(am__v_UIC_@AM_V@)
am__v_UIC_ = $(am__v_UIC_@AM_DEFAULT_V@)
am__v_UIC_0 = @echo " UIC " $@;
AM_V_LRELEASE = $(am__v_LRELEASE_@AM_V@)
am__v_LRELEASE_ = $(am__v_LRELEASE_@AM_DEFAULT_V@)
am__v_LRELEASE_0 = @echo " LRELEASE " $@;
#
# For building .moc.cpp files from .h files by running moc,
# building .rcc.cpp files from .qrc files by running rcc,
@ -148,6 +154,17 @@ qrc_wsicon.cpp: ../../image/wsicon.qrc
ui_%.h: %.ui
$(AM_V_UIC)$(UIC) $< -o $@
wireshark_%.qm: wireshark_%.ts
$(AM_V_LRELEASE)$(LRELEASE) -silent $< -qm $@
i18n_qresource := $(foreach qm, $(QM_FILES),<file>$(qm)</file>)
i18n.qrc: i18n.qrc.in $(QM_FILES)
$(AM_V_SED)$(SED) \
-e 's,@i18n_qresource\@,$(i18n_qresource),' \
-e 's,> *<file>,>\n <file>,g' \
< $< > $@
#
# Explicit dependencies to force the ui_ headers to be built.
# See "Recording Dependencies manually" in the "Built Sources"
@ -331,7 +348,6 @@ EXTRA_DIST = \
$(UI_FILES) \
$(QRC_FILES) \
$(TS_FILES) \
$(QM_FILES) \
CMakeLists.txt \
doxygen.cfg.in \
Makefile.common \

View File

@ -414,7 +414,6 @@ TS_FILES = \
#
# .qm files.
#
# Should they be auto-generated ?
QM_FILES = $(TS_FILES:.ts=.qm)
WIRESHARK_QT_SRC = \

View File

@ -1,30 +0,0 @@
<!--
Wireshark - Network traffic analyzer
By Gerald Combs <gerald@wireshark.org>
Copyright 1998 Gerald Combs
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-->
<RCC>
<qresource prefix="/i18n">
<file>wireshark_de.qm</file>
<file>wireshark_en.qm</file>
<file>wireshark_fr.qm</file>
<file>wireshark_it.qm</file>
<file>wireshark_ja_JP.qm</file>
<file>wireshark_pl.qm</file>
<file>wireshark_zh_CN.qm</file>
</qresource>
</RCC>

4
ui/qt/i18n.qrc.in Normal file
View File

@ -0,0 +1,4 @@
<RCC>
<qresource prefix="/i18n">@i18n_qresource@
</qresource>
</RCC>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.