You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
507 lines
21 KiB
507 lines
21 KiB
2 years ago
|
From d90ddc71623dd961a022f03426fbd067f835d18a Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Lu=C3=ADs=20Pereira?= <luis.artur.pereira@gmail.com>
|
||
|
Date: Tue, 29 Dec 2020 16:03:29 +0000
|
||
|
Subject: [PATCH 1/2] Qt6 Port
|
||
|
|
||
|
---
|
||
|
CMakeLists.txt | 2 +-
|
||
|
cmake/FindInstallConfigPath.cmake | 24 ++++++++++-----
|
||
|
cmake/modules/LXQtTranslateTs.cmake.in | 30 +++++++++----------
|
||
|
cmake/modules/LXQtTranslationLoader.cmake | 2 +-
|
||
|
...oader.cmake => Qt6TranslationLoader.cmake} | 12 ++++----
|
||
|
...der.cpp.in => Qt6TranslationLoader.cpp.in} | 0
|
||
|
lxqt-transupdate | 2 +-
|
||
|
7 files changed, 40 insertions(+), 32 deletions(-)
|
||
|
rename cmake/modules/{Qt5TranslationLoader.cmake => Qt6TranslationLoader.cmake} (85%)
|
||
|
rename cmake/modules/{Qt5TranslationLoader.cpp.in => Qt6TranslationLoader.cpp.in} (100%)
|
||
|
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -1,18 +1,18 @@
|
||
|
-cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||
|
+cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)
|
||
|
# CMP0000: Call the cmake_minimum_required() command at the beginning of the top-level
|
||
|
# CMakeLists.txt file even before calling the project() command.
|
||
|
# The cmake_minimum_required(VERSION) command implicitly invokes the cmake_policy(VERSION)
|
||
|
# command to specify that the current project code is written for the given range of CMake
|
||
|
# versions.
|
||
|
-project(lxqt-build-tools)
|
||
|
+project(lxqt2-build-tools)
|
||
|
|
||
|
option(WITH_XDG_DIRS_FALLBACK "Use our XDG_CONFIG_DIRS fallback" ON)
|
||
|
|
||
|
-set(LXQT_BUILD_TOOLS_MAJOR_VERSION 0)
|
||
|
-set(LXQT_BUILD_TOOLS_MINOR_VERSION 13)
|
||
|
+set(LXQT_BUILD_TOOLS_MAJOR_VERSION 2)
|
||
|
+set(LXQT_BUILD_TOOLS_MINOR_VERSION 0)
|
||
|
set(LXQT_BUILD_TOOLS_PATCH_VERSION 0)
|
||
|
set(LXQT_BUILD_TOOLS_VERSION ${LXQT_BUILD_TOOLS_MAJOR_VERSION}.${LXQT_BUILD_TOOLS_MINOR_VERSION}.${LXQT_BUILD_TOOLS_PATCH_VERSION})
|
||
|
-set(LXQT_MIN_LINGUIST_VERSION "5.15.0")
|
||
|
+set(LXQT_MIN_LINGUIST_VERSION "6.2")
|
||
|
|
||
|
include(CMakePackageConfigHelpers)
|
||
|
include(GNUInstallDirs) # Standard directories for installation
|
||
|
@@ -21,7 +21,7 @@ include(cmake/modules/LXQtPreventInSourc
|
||
|
|
||
|
#-----------------------------------------------------------------------------
|
||
|
# LXQT_DATA_DIR defaults to CMAKE_INSTALL_FULL_DATADIR. It's added to
|
||
|
-# XDG_DATA_DIRS by the startlxqt script
|
||
|
+# XDG_DATA_DIRS by the startlxqt2 script
|
||
|
# Warning: Setting LXQT_DATA_DIR must be done after including GNUInstallDirs
|
||
|
#-----------------------------------------------------------------------------
|
||
|
if (NOT DEFINED LXQT_DATA_DIR)
|
||
|
@@ -30,7 +30,7 @@ if (NOT DEFINED LXQT_DATA_DIR)
|
||
|
)
|
||
|
endif()
|
||
|
|
||
|
-set(LXQT_LIBRARY_NAME "lxqt" CACHE STRING "lxqt")
|
||
|
+set(LXQT_LIBRARY_NAME "lxqt2" CACHE STRING "lxqt2")
|
||
|
set(LXQT_RELATIVE_SHARE_DIR "${LXQT_LIBRARY_NAME}")
|
||
|
set(LXQT_SHARE_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/${LXQT_RELATIVE_SHARE_DIR}")
|
||
|
set(LXQT_RELATIVE_TRANSLATIONS_DIR "${LXQT_LIBRARY_NAME}/translations")
|
||
|
@@ -54,8 +54,8 @@ file(GLOB toInstallModulesHelpers
|
||
|
#-----------------------------------------------------------------------------
|
||
|
# Superbuild mode
|
||
|
#-----------------------------------------------------------------------------
|
||
|
-set(FIND_MODULES_INSTALL_DIR "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/lxqt-build-tools/cmake/find-modules/")
|
||
|
-set(MODULES_INSTALL_DIR "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/lxqt-build-tools/cmake/modules/")
|
||
|
+set(FIND_MODULES_INSTALL_DIR "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LXQT_LIBRARY_NAME}-build-tools/cmake/find-modules/")
|
||
|
+set(MODULES_INSTALL_DIR "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LXQT_LIBRARY_NAME}-build-tools/cmake/modules/")
|
||
|
|
||
|
file(COPY
|
||
|
${toInstallFindModules}
|
||
|
@@ -70,7 +70,7 @@ file(COPY
|
||
|
|
||
|
configure_package_config_file(
|
||
|
"${CMAKE_CURRENT_SOURCE_DIR}/lxqt-build-tools-config.cmake.in"
|
||
|
- "${CMAKE_BINARY_DIR}/lxqt-build-tools-config.cmake"
|
||
|
+ "${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-build-tools-config.cmake"
|
||
|
INSTALL_DESTINATION "neverland" # required, altough we don't install it
|
||
|
PATH_VARS
|
||
|
MODULES_INSTALL_DIR
|
||
|
@@ -93,13 +93,13 @@ configure_file(
|
||
|
#-----------------------------------------------------------------------------
|
||
|
# Installable mode
|
||
|
#-----------------------------------------------------------------------------
|
||
|
-set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/lxqt-build-tools/")
|
||
|
-set(FIND_MODULES_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/lxqt-build-tools/find-modules/")
|
||
|
-set(MODULES_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/lxqt-build-tools/modules/")
|
||
|
+set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${LXQT_LIBRARY_NAME}-build-tools/")
|
||
|
+set(FIND_MODULES_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${LXQT_LIBRARY_NAME}-build-tools/find-modules/")
|
||
|
+set(MODULES_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${LXQT_LIBRARY_NAME}-build-tools/modules/")
|
||
|
|
||
|
configure_package_config_file(
|
||
|
"${CMAKE_CURRENT_SOURCE_DIR}/lxqt-build-tools-config.cmake.in"
|
||
|
- "${CMAKE_CURRENT_BINARY_DIR}/install/lxqt-build-tools-config.cmake"
|
||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}-build-tools-config.cmake"
|
||
|
INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||
|
PATH_VARS
|
||
|
MODULES_INSTALL_DIR
|
||
|
@@ -121,13 +121,13 @@ configure_file(
|
||
|
# The package version file is common to superbuild and installable mode
|
||
|
configure_file(
|
||
|
"${CMAKE_CURRENT_SOURCE_DIR}/lxqt-build-tools-config-version.cmake.in"
|
||
|
- "${CMAKE_BINARY_DIR}/lxqt-build-tools-config-version.cmake"
|
||
|
+ "${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-build-tools-config-version.cmake"
|
||
|
@ONLY
|
||
|
)
|
||
|
|
||
|
install(FILES
|
||
|
- "${CMAKE_CURRENT_BINARY_DIR}/install/lxqt-build-tools-config.cmake"
|
||
|
- "${CMAKE_BINARY_DIR}/lxqt-build-tools-config-version.cmake"
|
||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}-build-tools-config.cmake"
|
||
|
+ "${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-build-tools-config-version.cmake"
|
||
|
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||
|
)
|
||
|
|
||
|
@@ -151,4 +151,7 @@ install(
|
||
|
PROGRAMS
|
||
|
"lxqt-transupdate"
|
||
|
DESTINATION
|
||
|
- "${CMAKE_INSTALL_BINDIR}")
|
||
|
+ "${CMAKE_INSTALL_BINDIR}"
|
||
|
+ RENAME
|
||
|
+ "${LXQT_LIBRARY_NAME}-transupdate"
|
||
|
+)
|
||
|
--- a/cmake/FindInstallConfigPath.cmake
|
||
|
+++ b/cmake/FindInstallConfigPath.cmake
|
||
|
@@ -1,26 +1,42 @@
|
||
|
# XDG standards expects system-wide configuration files in the /etc/xdg/lxqt location.
|
||
|
# Unfortunately QSettings we are using internally can be overriden in the Qt compilation
|
||
|
# time to use different path for system-wide configs. (for example configure ... -sysconfdir /etc/settings ...)
|
||
|
-# This path can be found calling Qt4's qmake:
|
||
|
+# This path can be found calling Qt qmake:
|
||
|
# qmake -query QT_INSTALL_CONFIGURATION
|
||
|
#
|
||
|
|
||
|
-find_package(Qt5Core REQUIRED)
|
||
|
+find_package(Qt6 COMPONENTS BuildInternals Core CoreTools REQUIRED)
|
||
|
|
||
|
-if(NOT DEFINED LXQT_ETC_XDG_DIR)
|
||
|
- get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
|
||
|
- message(STATUS "${QT_QMAKE_EXECUTABLE}")
|
||
|
+message(STATUS "QT6_INSTALL_CONFIGURATION: ${QT6_INSTALL_CONFIGURATION}")
|
||
|
+message(STATUS "QT_INSTALL_DIR: ${QT_INSTALL_DIR}")
|
||
|
+message(STATUS "QT6_INSTALL_PLUGINS: ${QT6_INSTALL_PLUGINS}")
|
||
|
+message(STATUS "QT_INSTALL_PLUGINS: ${QT_INSTALL_PLUGINS}")
|
||
|
+message(STATUS "QT_SYS_CONF_DIR" "${QT_SYS_CONF_DIR}")
|
||
|
+message(STATUS "INSTALL_SYSCONFDIR: ${INSTALL_SYSCONFDIR}")
|
||
|
+message(STATUS "INSTALL_PLUGINSDIR: ${INSTALL_PLUGINSDIR}")
|
||
|
+
|
||
|
+if(NOT DEFINED LXQT2_ETC_XDG_DIR)
|
||
|
+ if (TARGET Qt6::qmake)
|
||
|
+ get_target_property(_qt_qmake_executable Qt6::qmake IMPORTED_LOCATION)
|
||
|
+ endif()
|
||
|
|
||
|
- if(NOT QT_QMAKE_EXECUTABLE)
|
||
|
- message(FATAL_ERROR "LXQT_ETC_XDG_DIR: qmake executable not found (included before qt was configured?)")
|
||
|
+ if(NOT _qt_qmake_executable)
|
||
|
+ message(FATAL_ERROR
|
||
|
+ "LXQT2_ETC_XDG_DIR: qmake executable not found (included before qt was configured?)")
|
||
|
endif()
|
||
|
|
||
|
- execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_CONFIGURATION
|
||
|
- OUTPUT_VARIABLE LXQT_ETC_XDG_DIR
|
||
|
+ execute_process(COMMAND ${_qt_qmake_executable} -query QT_INSTALL_CONFIGURATION
|
||
|
+ OUTPUT_VARIABLE _lxqt_etc_xdg_dir
|
||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||
|
|
||
|
- message(STATUS "LXQT_ETC_XDG_DIR autodetected as '${LXQT_ETC_XDG_DIR}'")
|
||
|
- message(STATUS "You can set it manually with -DLXQT_ETC_XDG_DIR=<value>")
|
||
|
+ set(QT_QMAKE_EXECUTABLE ${_qt_qmake_executable}
|
||
|
+ CACHE FILEPATH "Location of the Qt6 qmake executable")
|
||
|
+
|
||
|
+ set(LXQT2_ETC_XDG_DIR ${_lxqt_etc_xdg_dir}
|
||
|
+ CACHE FILEPATH "Location of the LXQt XDG system-wide configuration files")
|
||
|
+
|
||
|
+ message(STATUS "LXQT2_ETC_XDG_DIR autodetected as '${LXQT2_ETC_XDG_DIR}'")
|
||
|
+ message(STATUS "You can set it manually with -DLXQT2_ETC_XDG_DIR=<value>")
|
||
|
message(STATUS "")
|
||
|
endif ()
|
||
|
|
||
|
--- a/cmake/modules/LXQtTranslateTs.cmake.in
|
||
|
+++ b/cmake/modules/LXQtTranslateTs.cmake.in
|
||
|
@@ -26,7 +26,7 @@
|
||
|
#=============================================================================
|
||
|
#
|
||
|
# funtion lxqt_translate_ts(qmFiles
|
||
|
-# [USE_QT5 [Yes | No]]
|
||
|
+# [USE_QT6 [Yes | No]]
|
||
|
# [UPDATE_TRANSLATIONS [Yes | No]]
|
||
|
# SOURCES <sources>
|
||
|
# [UPDATE_OPTIONS] update_options
|
||
|
@@ -39,7 +39,7 @@
|
||
|
# qmFiles The generated compiled translations (.qm) files
|
||
|
#
|
||
|
# Input:
|
||
|
-# USE_QT5 Optional flag to choose between Qt4 and Qt5. Defaults to Qt5
|
||
|
+# USE_QT6 Optional flag to choose between Qt5 and Qt6. Defaults to Qt6
|
||
|
#
|
||
|
# UPDATE_TRANSLATIONS Optional flag. Setting it to Yes, extracts and
|
||
|
# compiles the translations. Setting it No, only
|
||
|
@@ -62,11 +62,11 @@
|
||
|
# present. Defaults to "Runtime".
|
||
|
#
|
||
|
|
||
|
-find_package(Qt5LinguistTools "@LXQT_MIN_LINGUIST_VERSION@" REQUIRED)
|
||
|
+find_package(Qt6LinguistTools "@LXQT_MIN_LINGUIST_VERSION@" REQUIRED)
|
||
|
|
||
|
function(lxqt_translate_ts qmFiles)
|
||
|
set(oneValueArgs
|
||
|
- USE_QT5
|
||
|
+ USE_QT6
|
||
|
UPDATE_TRANSLATIONS
|
||
|
TEMPLATE
|
||
|
TRANSLATION_DIR
|
||
|
@@ -84,8 +84,8 @@ function(lxqt_translate_ts qmFiles)
|
||
|
set(TR_UPDATE_OPTIONS "")
|
||
|
endif()
|
||
|
|
||
|
- if (NOT DEFINED TR_USE_QT5)
|
||
|
- set(TR_USE_QT5 "Yes")
|
||
|
+ if (NOT DEFINED TR_USE_QT6)
|
||
|
+ set(TR_USE_QT6 "Yes")
|
||
|
endif()
|
||
|
|
||
|
if(NOT DEFINED TR_TEMPLATE)
|
||
|
@@ -102,37 +102,37 @@ function(lxqt_translate_ts qmFiles)
|
||
|
set(templateFile "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}.ts")
|
||
|
endif ()
|
||
|
|
||
|
- if(TR_USE_QT5)
|
||
|
- # Qt5
|
||
|
+ if(TR_USE_QT6)
|
||
|
+ # Qt6
|
||
|
if (TR_UPDATE_TRANSLATIONS)
|
||
|
- qt5_create_translation(QMS
|
||
|
+ qt6_create_translation(QMS
|
||
|
${TR_SOURCES}
|
||
|
${templateFile}
|
||
|
OPTIONS ${TR_UPDATE_OPTIONS}
|
||
|
)
|
||
|
- qt5_create_translation(QM
|
||
|
+ qt6_create_translation(QM
|
||
|
${TR_SOURCES}
|
||
|
${tsFiles}
|
||
|
OPTIONS ${TR_UPDATE_OPTIONS}
|
||
|
)
|
||
|
else()
|
||
|
- qt5_add_translation(QM ${tsFiles})
|
||
|
+ qt6_add_translation(QM ${tsFiles})
|
||
|
endif()
|
||
|
else()
|
||
|
- # Qt4
|
||
|
+ # Qt5
|
||
|
if(TR_UPDATE_TRANSLATIONS)
|
||
|
- qt4_create_translation(QMS
|
||
|
+ qt5_create_translation(QMS
|
||
|
${TR_SOURCES}
|
||
|
${templateFile}
|
||
|
OPTIONS ${TR_UPDATE_OPTIONS}
|
||
|
)
|
||
|
- qt4_create_translation(QM
|
||
|
+ qt5_create_translation(QM
|
||
|
${TR_SOURCES}
|
||
|
${tsFiles}
|
||
|
OPTIONS ${TR_UPDATE_OPTIONS}
|
||
|
)
|
||
|
else()
|
||
|
- qt4_add_translation(QM ${tsFiles})
|
||
|
+ qt5_add_translation(QM ${tsFiles})
|
||
|
endif()
|
||
|
endif()
|
||
|
|
||
|
--- a/cmake/modules/LXQtTranslationLoader.cmake
|
||
|
+++ b/cmake/modules/LXQtTranslationLoader.cmake
|
||
|
@@ -25,7 +25,7 @@
|
||
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
#=============================================================================
|
||
|
#
|
||
|
-# These functions enables "automatic" translation loading in LXQt Qt5 apps
|
||
|
+# These functions enables "automatic" translation loading in LXQt Qt6 apps
|
||
|
# and libs. They generate a .cpp file that takes care of everything. The
|
||
|
# user doesn't have to do anything in the source code.
|
||
|
#
|
||
|
--- a/cmake/modules/Qt5TranslationLoader.cmake
|
||
|
+++ /dev/null
|
||
|
@@ -1,47 +0,0 @@
|
||
|
-#=============================================================================
|
||
|
-# Copyright 2014 Luís Pereira <luis.artur.pereira@gmail.com>
|
||
|
-#
|
||
|
-# Redistribution and use in source and binary forms, with or without
|
||
|
-# modification, are permitted provided that the following conditions
|
||
|
-# are met:
|
||
|
-#
|
||
|
-# 1. Redistributions of source code must retain the copyright
|
||
|
-# notice, this list of conditions and the following disclaimer.
|
||
|
-# 2. Redistributions in binary form must reproduce the copyright
|
||
|
-# notice, this list of conditions and the following disclaimer in the
|
||
|
-# documentation and/or other materials provided with the distribution.
|
||
|
-# 3. The name of the author may not be used to endorse or promote products
|
||
|
-# derived from this software without specific prior written permission.
|
||
|
-#
|
||
|
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||
|
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||
|
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||
|
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||
|
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||
|
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||
|
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||
|
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
|
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||
|
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
-#=============================================================================
|
||
|
-#
|
||
|
-# These functions enables "automatic" translation loading in Qt5 apps
|
||
|
-# and libs. They generate a .cpp file that takes care of everything. The
|
||
|
-# user doesn't have to do anything in the source code.
|
||
|
-#
|
||
|
-# qt5_translation_loader(<source_files> <translations_dir> <catalog_name>)
|
||
|
-#
|
||
|
-# Output:
|
||
|
-# <source_files> Appends the generated file to this variable.
|
||
|
-#
|
||
|
-# Input:
|
||
|
-# <translations_dir> Full path name to the translations dir.
|
||
|
-# <catalog_name> Translation catalog to be loaded.
|
||
|
-
|
||
|
-function(qt5_translation_loader source_files translations_dir catalog_name)
|
||
|
- configure_file(
|
||
|
- ${LXQT_CMAKE_MODULES_DIR}/Qt5TranslationLoader.cpp.in
|
||
|
- Qt5TranslationLoader.cpp @ONLY
|
||
|
- )
|
||
|
- set(${source_files} ${${source_files}} ${CMAKE_CURRENT_BINARY_DIR}/Qt5TranslationLoader.cpp PARENT_SCOPE)
|
||
|
-endfunction()
|
||
|
--- /dev/null
|
||
|
+++ b/cmake/modules/Qt6TranslationLoader.cmake
|
||
|
@@ -0,0 +1,47 @@
|
||
|
+#=============================================================================
|
||
|
+# Copyright 2014 Luís Pereira <luis.artur.pereira@gmail.com>
|
||
|
+#
|
||
|
+# Redistribution and use in source and binary forms, with or without
|
||
|
+# modification, are permitted provided that the following conditions
|
||
|
+# are met:
|
||
|
+#
|
||
|
+# 1. Redistributions of source code must retain the copyright
|
||
|
+# notice, this list of conditions and the following disclaimer.
|
||
|
+# 2. Redistributions in binary form must reproduce the copyright
|
||
|
+# notice, this list of conditions and the following disclaimer in the
|
||
|
+# documentation and/or other materials provided with the distribution.
|
||
|
+# 3. The name of the author may not be used to endorse or promote products
|
||
|
+# derived from this software without specific prior written permission.
|
||
|
+#
|
||
|
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||
|
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||
|
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||
|
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||
|
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||
|
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||
|
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||
|
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
|
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||
|
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
+#=============================================================================
|
||
|
+#
|
||
|
+# These functions enables "automatic" translation loading in Qt6 apps
|
||
|
+# and libs. They generate a .cpp file that takes care of everything. The
|
||
|
+# user doesn't have to do anything in the source code.
|
||
|
+#
|
||
|
+# qt6_translation_loader(<source_files> <translations_dir> <catalog_name>)
|
||
|
+#
|
||
|
+# Output:
|
||
|
+# <source_files> Appends the generated file to this variable.
|
||
|
+#
|
||
|
+# Input:
|
||
|
+# <translations_dir> Full path name to the translations dir.
|
||
|
+# <catalog_name> Translation catalog to be loaded.
|
||
|
+
|
||
|
+function(qt6_translation_loader source_files translations_dir catalog_name)
|
||
|
+ configure_file(
|
||
|
+ ${LXQT_CMAKE_MODULES_DIR}/Qt6TranslationLoader.cpp.in
|
||
|
+ Qt6TranslationLoader.cpp @ONLY
|
||
|
+ )
|
||
|
+ set(${source_files} ${${source_files}} ${CMAKE_CURRENT_BINARY_DIR}/Qt6TranslationLoader.cpp PARENT_SCOPE)
|
||
|
+endfunction()
|
||
|
--- a/lxqt-transupdate
|
||
|
+++ b/lxqt-transupdate
|
||
|
@@ -32,7 +32,7 @@
|
||
|
|
||
|
# just to be sure - for distributions that user qtchooser
|
||
|
# Debian and derivatives, Fedora, FreeBSD, Mageia, OpenMandriva, PCLinuxOS
|
||
|
-export QT_SELECT=5
|
||
|
+export QT_SELECT=6
|
||
|
|
||
|
TEMPLATES=$(find . -name \*.ts | grep -v '_')
|
||
|
for i in $TEMPLATES; do
|
||
|
--- /dev/null
|
||
|
+++ b/cmake/modules/LXQtQMake.cmake
|
||
|
@@ -0,0 +1,34 @@
|
||
|
+find_package(Qt6Core REQUIRED QUIET)
|
||
|
+
|
||
|
+if (TARGET Qt6::qmake)
|
||
|
+ get_target_property(_qmake_executable_default Qt6::qmake LOCATION)
|
||
|
+endif()
|
||
|
+
|
||
|
+set(QMAKE_EXECUTABLE ${_qmake_executable}
|
||
|
+ CACHE FILEPATH "Location of the Qt6 qmake executable")
|
||
|
+
|
||
|
+function(query_qmake result_variable qt_variable)
|
||
|
+ set(options )
|
||
|
+ set(oneValueArgs )
|
||
|
+ set(multiValueArgs )
|
||
|
+
|
||
|
+ cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||
|
+
|
||
|
+ if(NOT QMAKE_EXECUTABLE)
|
||
|
+ message(FATAL_ERROR "No qmake Qt6 binary found. Can't check ${qt_variable} as required")
|
||
|
+ endif()
|
||
|
+ execute_process(
|
||
|
+ COMMAND ${QMAKE_EXECUTABLE} -query "${qt_variable}"
|
||
|
+ RESULT_VARIABLE return_code
|
||
|
+ OUTPUT_VARIABLE output
|
||
|
+ )
|
||
|
+ if(return_code EQUAL 0)
|
||
|
+ string(STRIP "${output}" output)
|
||
|
+ file(TO_CMAKE_PATH "${output}" output_path)
|
||
|
+ set(${result_variable} "${output_path}" PARENT_SCOPE)
|
||
|
+ else()
|
||
|
+ message(WARNING "Failed call: ${QMAKE_EXECUTABLE} -query \"${qt_variable}\"")
|
||
|
+ message(FATAL_ERROR "QMake call failed: ${return_code}")
|
||
|
+ endif()
|
||
|
+endfunction()
|
||
|
+
|
||
|
--- a/cmake/modules/Qt5TranslationLoader.cpp.in
|
||
|
+++ /dev/null
|
||
|
@@ -1,34 +0,0 @@
|
||
|
-/* This file has been generated by the CMake qt_translation_loader().
|
||
|
- * It loads Qt application translations.
|
||
|
- *
|
||
|
- * Attention: All changes will be overwritten!!!
|
||
|
- */
|
||
|
-
|
||
|
-#include <QCoreApplication>
|
||
|
-#include <QLocale>
|
||
|
-#include <QLatin1String>
|
||
|
-#include <QTranslator>
|
||
|
-#include <QLibraryInfo>
|
||
|
-
|
||
|
-static void loadQtTranslation()
|
||
|
-{
|
||
|
- QString locale = QLocale::system().name();
|
||
|
- QTranslator *qtTranslator = new QTranslator(qApp);
|
||
|
-
|
||
|
- if (qtTranslator->load(QLatin1String("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
|
||
|
- qApp->installTranslator(qtTranslator);
|
||
|
- } else {
|
||
|
- delete qtTranslator;
|
||
|
- }
|
||
|
-
|
||
|
- QTranslator *appTranslator = new QTranslator(qApp);
|
||
|
- if (appTranslator->load(QString::fromLocal8Bit("@translations_dir@/@catalog_name@_%1.qm").arg(locale))) {
|
||
|
- QCoreApplication::installTranslator(appTranslator);
|
||
|
- } else if (locale == QLatin1String("C") ||
|
||
|
- locale.startsWith(QLatin1String("en"))) {
|
||
|
- // English is the default. It's translated anyway.
|
||
|
- delete appTranslator;
|
||
|
- }
|
||
|
-}
|
||
|
-
|
||
|
-Q_COREAPP_STARTUP_FUNCTION(loadQtTranslation)
|
||
|
--- /dev/null
|
||
|
+++ b/cmake/modules/Qt6TranslationLoader.cpp.in
|
||
|
@@ -0,0 +1,34 @@
|
||
|
+/* This file has been generated by the CMake qt_translation_loader().
|
||
|
+ * It loads Qt application translations.
|
||
|
+ *
|
||
|
+ * Attention: All changes will be overwritten!!!
|
||
|
+ */
|
||
|
+
|
||
|
+#include <QCoreApplication>
|
||
|
+#include <QLocale>
|
||
|
+#include <QLatin1String>
|
||
|
+#include <QTranslator>
|
||
|
+#include <QLibraryInfo>
|
||
|
+
|
||
|
+static void loadQtTranslation()
|
||
|
+{
|
||
|
+ QString locale = QLocale::system().name();
|
||
|
+ QTranslator *qtTranslator = new QTranslator(qApp);
|
||
|
+
|
||
|
+ if (qtTranslator->load(QLatin1String("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
|
||
|
+ qApp->installTranslator(qtTranslator);
|
||
|
+ } else {
|
||
|
+ delete qtTranslator;
|
||
|
+ }
|
||
|
+
|
||
|
+ QTranslator *appTranslator = new QTranslator(qApp);
|
||
|
+ if (appTranslator->load(QString::fromLocal8Bit("@translations_dir@/@catalog_name@_%1.qm").arg(locale))) {
|
||
|
+ QCoreApplication::installTranslator(appTranslator);
|
||
|
+ } else if (locale == QLatin1String("C") ||
|
||
|
+ locale.startsWith(QLatin1String("en"))) {
|
||
|
+ // English is the default. It's translated anyway.
|
||
|
+ delete appTranslator;
|
||
|
+ }
|
||
|
+}
|
||
|
+
|
||
|
+Q_COREAPP_STARTUP_FUNCTION(loadQtTranslation)
|