Commit 66ceee82 authored by Alf Gaida's avatar Alf Gaida

Cherry-picking upstream version 0.11.0.

* Synced from experimental
* Bumped build dependency debhelper (>=10)
* Bump standards to 3.9.8
* Bump years in copyright
* Bumped compat to 10
* Removed --parallel from rules, now standard
* Bumped minimum version libqt5xdg-dev (>= 2.0.0)
* Added build dependency libqt5xdgiconloader-dev (>= 2.0.0)
* Added build dependency libxss-dev
* Added Recommends liblxqt-l10n
* Removed grep patch, merged upstream
* Removed virtual ABI, no longer needed
* Exported LC_ALL=C.UTF-8 - define language settings for reproducible
  builds
* Fixed Format field in copyright
* Fixed VCS fields, use plain /git/
* Fix symbols, only use lxqt-abi-0-11-0
* Added translation handling in rules
* Deleted former patches
* Added DCMAKE_BUILD_TYPE=RelWithDebInfo
parent f5b866e7
*.kdev4*
moc_*.cxx
qrc_*.cxx
cmake_install.cmake
cmake_uninstall.cmake
Makefile
CMakeFiles
CMakeCache.txt
CPackConfig.cmake
CPackSourceConfig.cmake
lib*.so
lib*.so.*
ui_*.h
*.qm
lxqt-appswitcher/lxqt-appswitcher
lxqt-desktop/lxqt-desktop
lxqt-panel/panel/lxqt-panel
*~
*.autosave
*-swp
CMakeLists.txt.user*
/build
nbproject/
build
translations/liblxqt
......@@ -4,7 +4,7 @@ Upstream Authors:
Copyright:
Copyright (c) 2010-2012 Razor team
Copyright (c) 2012-2015 LXQt team
Copyright (c) 2012-2016 LXQt team
License: LGPL-2.1+ and BSD-3-clause
The full text of the LGPL-2.1+ licenses can be found in the 'COPYING' file.
......
This diff is collapsed.
......@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(liblxqt)
set(LXQT_MAJOR_VERSION 0)
set(LXQT_MINOR_VERSION 10)
set(LXQT_MINOR_VERSION 11)
set(LXQT_PATCH_VERSION 0)
include(CMakePackageConfigHelpers)
......@@ -120,9 +120,11 @@ set(FORMS
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/find-modules"
)
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
option(WITH_XDG_DIRS_FALLBACK "Use our XDG_CONFIG_DIRS fallback" ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
......@@ -130,6 +132,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
find_package(X11 REQUIRED QUIET)
find_package(Qt5Widgets REQUIRED QUIET)
find_package(Qt5DBus REQUIRED QUIET)
find_package(Qt5X11Extras REQUIRED QUIET)
......@@ -163,15 +166,16 @@ include(create_portable_headers)
set(LXQT_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PATCH_VERSION})
set(LXQT_LIBRARY_NAME "lxqt" CACHE STRING "lxqt")
set(LXQT_RELATIVE_SHARE_DIR "${LXQT_LIBRARY_NAME}")
set(LXQT_SHARE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/${LXQT_RELATIVE_SHARE_DIR}")
set(LXQT_SHARE_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/${LXQT_RELATIVE_SHARE_DIR}")
set(LXQT_RELATIVE_TRANSLATIONS_DIR "${LXQT_LIBRARY_NAME}/translations")
set(LXQT_TRANSLATIONS_DIR "${LXQT_SHARE_DIR}/translations")
set(LXQT_GRAPHICS_DIR "${LXQT_SHARE_DIR}/graphics")
set(LXQT_INTREE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include")
set(LXQT_INTREE_TARGETS_FILE "${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-targets.cmake")
set(LXQT_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}/${LXQT_LIBRARY_NAME}")
set(LXQT_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/share/cmake")
set(LXQT_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/cmake")
## Translations
......@@ -185,6 +189,14 @@ lxqt_translate_ts(QM_FILES
${FORMS}
INSTALL_DIR
"${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}"
PULL_TRANSLATIONS
${PULL_TRANSLATIONS}
CLEAN_TRANSLATIONS
${CLEAN_TRANSLATIONS}
TRANSLATIONS_REPO
${TRANSLATIONS_REPO}
TRANSLATIONS_REFSPEC
${TRANSLATIONS_REFSPEC}
)
message(STATUS "")
......@@ -207,6 +219,8 @@ check_portable_headers(H_FILES ${PUB_HDRS} LINKS "${INTREE_PORTABLE_HEADERS}")
#************************************************
set(CFG_LXQT_TARGETS_FILE "${LXQT_INTREE_TARGETS_FILE}")
set(CFG_LXQT_CMAKE_MODULES_DIR "${PROJECT_SOURCE_DIR}/cmake/modules")
set(CFG_LXQT_CMAKE_FIND_MODULES_DIR "${PROJECT_SOURCE_DIR}/cmake/find-modules")
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt-config.cmake.in"
......@@ -219,6 +233,7 @@ configure_package_config_file(
#************************************************
set(CFG_LXQT_TARGETS_FILE "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/${LXQT_LIBRARY_NAME}-targets.cmake")
set(CFG_LXQT_CMAKE_MODULES_DIR "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/modules")
set(CFG_LXQT_CMAKE_FIND_MODULES_DIR "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/find-modules")
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt-config.cmake.in"
......@@ -245,6 +260,16 @@ install(EXPORT
COMPONENT Devel
)
file(GLOB toInstallFindModules
"${PROJECT_SOURCE_DIR}/cmake/find-modules/*.cmake"
)
install(
FILES ${toInstallFindModules}
DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/find-modules"
COMPONENT Devel
)
file(GLOB toInstallModules
"${PROJECT_SOURCE_DIR}/cmake/modules/*.cmake"
"${PROJECT_SOURCE_DIR}/cmake/modules/*.in"
......@@ -273,6 +298,9 @@ target_link_libraries(${LXQT_LIBRARY_NAME}
Qt5::DBus
Qt5::X11Extras
Qt5Xdg
PRIVATE
${X11_Xscreensaver_LIB}
${X11_X11_LIB}
)
set_target_properties(${LXQT_LIBRARY_NAME} PROPERTIES
......@@ -285,8 +313,10 @@ target_compile_definitions(${LXQT_LIBRARY_NAME}
PRIVATE "LXQT_SHARE_DIR=\"${LXQT_SHARE_DIR}\""
PRIVATE "LXQT_RELATIVE_SHARE_TRANSLATIONS_DIR=\"${LXQT_RELATIVE_TRANSLATIONS_DIR}\""
PRIVATE "LXQT_SHARE_TRANSLATIONS_DIR=\"${LXQT_TRANSLATIONS_DIR}\""
PRIVATE "LXQT_GRAPHICS_DIR=\"${LXQT_GRAPHICS_DIR}\""
PRIVATE "LXQT_ETC_XDG_DIR=\"${LXQT_ETC_XDG_DIR}\""
PRIVATE "LXQT_DATA_DIR=\"${LXQT_DATA_DIR}\""
PRIVATE "LXQT_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\""
PRIVATE "LXQT_VERSION=\"${LXQT_VERSION}\""
PRIVATE "COMPILE_LIBLXQT"
)
......@@ -296,6 +326,12 @@ target_compile_definitions(${LXQT_LIBRARY_NAME}
PRIVATE "$<$<CONFIG:Release>:QT_NO_WARNING_OUTPUT>"
)
if (WITH_XDG_DIRS_FALLBACK)
target_compile_definitions(${LXQT_LIBRARY_NAME}
PRIVATE "WITH_XDG_DIRS_FALLBACK"
)
endif ()
target_include_directories(${LXQT_LIBRARY_NAME}
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${LXQT_LIBRARY_NAME}>"
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${LXQT_LIBRARY_NAME}/LXQt>"
......
# liblxqt
## Overview
`liblxqt` represents the core library of LXQt providing essential functionality needed by nearly all of its components.
## Installation
### Sources
Its runtime dependencies are libxss, KWindowSystem, qtbase, qtx11extras and [libqtxdg](https://github.com/lxde/libqtxdg).
Additional build dependencies are CMake and optionally Git to pull latest VCS checkouts. The localization files were outsourced to repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n) so the corresponding dependencies are needed, too. Please refer to this repository's `README.md` for further information.
Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX` will normally have to be set to `/usr`, depending on the way library paths are dealt with on 64bit systems variables like `CMAKE_INSTALL_LIBDIR` may have to be set as well.
To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual.
### Binary packages
The library is provided by all major Linux distributions like Arch Linux, Debian, Fedora and openSUSE. Just use your package manager to search for string `liblxqt`.
#=============================================================================
# Copyright 2015 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.
#=============================================================================
# FindXdgUserDirs
#
# Try to find xdg-user-dirs-update.
#
# If the xdg-user-dirs-update executable is not in your PATH, you can provide
# an alternative name or full path location with the
# `XdgUserDirsUpdate_EXECUTABLE` variable.
#
# This will define the following variables:
#
# `XdgUserDirs_FOUND`
# True if xdg-user-dirs-update is available.
#
# `XdgUserDirsUpdate_EXECUTABLE`
# The xdg-user-dirs-update executable.
#
# Find xdg-user-dirs-update
find_program(XdgUserDirsUpdate_EXECUTABLE NAMES xdg-user-dirs-update)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XdgUserDirs
FOUND_VAR
XdgUserDirs_FOUND
REQUIRED_VARS
XdgUserDirsUpdate_EXECUTABLE
)
mark_as_advanced(XdgUserDirsUpdate_EXECUTABLE)
......@@ -23,36 +23,40 @@
@PACKAGE_INIT@
set(LXQT_USEQT@LXQT_QT_VERSION@ ON)
set(LXQT_QT_VERSION @LXQT_QT_VERSION@)
set(LXQT_MAJOR_VERSION @LXQT_MAJOR_VERSION@)
set(LXQT_MINOR_VERSION @LXQT_MINOR_VERSION@)
set(LXQT_PATCH_VERSION @LXQT_PATCH_VERSION@)
set(LXQT_VERSION @LXQT_VERSION@)
set(LXQT_QT_VERSION "@LXQT_QT_VERSION@")
set(LXQT_MAJOR_VERSION "@LXQT_MAJOR_VERSION@")
set(LXQT_MINOR_VERSION "@LXQT_MINOR_VERSION@")
set(LXQT_PATCH_VERSION "@LXQT_PATCH_VERSION@")
set(LXQT_VERSION "@LXQT_VERSION@")
set(LXQT_RELATIVE_SHARE_DIR @LXQT_RELATIVE_SHARE_DIR@)
set(LXQT_SHARE_DIR @LXQT_SHARE_DIR@)
set(LXQT_RELATIVE_TRANSLATIONS_DIR @LXQT_RELATIVE_TRANSLATIONS_DIR@)
set(LXQT_TRANSLATIONS_DIR @LXQT_TRANSLATIONS_DIR@)
set(LXQT_ETC_XDG_DIR @LXQT_ETC_XDG_DIR@)
set(LXQT_DATA_DIR @LXQT_DATA_DIR@)
set(LXQT_CMAKE_MODULES_DIR @CFG_LXQT_CMAKE_MODULES_DIR@)
set(LXQT_RELATIVE_SHARE_DIR "@LXQT_RELATIVE_SHARE_DIR@")
set(LXQT_SHARE_DIR "@LXQT_SHARE_DIR@")
set(LXQT_RELATIVE_TRANSLATIONS_DIR "@LXQT_RELATIVE_TRANSLATIONS_DIR@")
set(LXQT_TRANSLATIONS_DIR "@LXQT_TRANSLATIONS_DIR@")
set(LXQT_GRAPHICS_DIR "@LXQT_GRAPHICS_DIR@")
set(LXQT_ETC_XDG_DIR "@LXQT_ETC_XDG_DIR@")
set(LXQT_DATA_DIR "@LXQT_DATA_DIR@")
set(LXQT_CMAKE_MODULES_DIR "@CFG_LXQT_CMAKE_MODULES_DIR@")
set(LXQT_CMAKE_FIND_MODULES_DIR "@CFG_LXQT_CMAKE_FIND_MODULES_DIR@")
set(LXQT@LXQT_QT_VERSION@_FOUND 1)
include(CMakeFindDependencyMacro)
add_definitions(-DLXQT_RELATIVE_SHARE_DIR=\"${LXQT_RELATIVE_SHARE_DIR}\")
add_definitions(-DLXQT_SHARE_DIR=\"${LXQT_SHARE_DIR}\")
add_definitions(-DLXQT_RELATIVE_SHARE_TRANSLATIONS_DIR=\"${LXQT_RELATIVE_TRANSLATIONS_DIR}\")
add_definitions(-DLXQT_SHARE_TRANSLATIONS_DIR=\"${LXQT_TRANSLATIONS_DIR}\")
add_definitions(-DLXQT_ETC_XDG_DIR=\"${LXQT_ETC_XDG_DIR}\")
add_definitions(-DLXQT_DATA_DIR=\"${LXQT_DATA_DIR}\")
add_definitions(-DLXQT_VERSION=\"${LXQT_VERSION}\")
add_definitions("-DLXQT_RELATIVE_SHARE_DIR=\"${LXQT_RELATIVE_SHARE_DIR}\"")
add_definitions("-DLXQT_SHARE_DIR=\"${LXQT_SHARE_DIR}\"")
add_definitions("-DLXQT_RELATIVE_SHARE_TRANSLATIONS_DIR=\"${LXQT_RELATIVE_TRANSLATIONS_DIR}\"")
add_definitions("-DLXQT_SHARE_TRANSLATIONS_DIR=\"${LXQT_TRANSLATIONS_DIR}\"")
add_definitions("-DLXQT_GRAPHICS_DIR=\"${LXQT_GRAPHICS_DIR}\"")
add_definitions("-DLXQT_ETC_XDG_DIR=\"${LXQT_ETC_XDG_DIR}\"")
add_definitions("-DLXQT_DATA_DIR=\"${LXQT_DATA_DIR}\"")
add_definitions("-DLXQT_VERSION=\"${LXQT_VERSION}\"")
SET_SOURCE_FILES_PROPERTIES(LXQT_LIBRARIES PROPERTIES OBJECT_DEPENDS lxqt${LXQT_QT_VERSION})
list(APPEND CMAKE_MODULE_PATH "${LXQT_CMAKE_MODULES_DIR}")
list(APPEND CMAKE_MODULE_PATH
"${LXQT_CMAKE_MODULES_DIR}"
"${LXQT_CMAKE_FIND_MODULES_DIR}"
)
find_dependency(Qt5Widgets)
find_dependency(Qt5DBus)
......
......@@ -60,6 +60,15 @@ endif()
include(CheckCXXCompilerFlag)
#-----------------------------------------------------------------------------
# Global definitions
#-----------------------------------------------------------------------------
add_definitions(
-DQT_USE_QSTRINGBUILDER
)
#-----------------------------------------------------------------------------
# Detect Clang compiler
#-----------------------------------------------------------------------------
......
......@@ -71,13 +71,13 @@ function(lxqt_translate_desktop _RESULT)
if (_translations)
list(SORT _translations)
add_custom_command(OUTPUT ${_outFile}
COMMAND grep -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
COMMAND grep -h ${_pattern} ${_translations} >> ${_outFile}
COMMAND grep -v -a "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
COMMAND grep -h -a ${_pattern} ${_translations} >> ${_outFile}
COMMENT "Generating ${_fileName}${_fileExt}"
)
else()
add_custom_command(OUTPUT ${_outFile}
COMMAND grep -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
COMMAND grep -v -a "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
COMMENT "Generating ${_fileName}${_fileExt}"
)
endif()
......
......@@ -29,10 +29,16 @@
# [USE_QT5 [Yes | No]]
# [UPDATE_TRANSLATIONS [Yes | No]]
# SOURCES <sources>
# [UPDATE_OPTIONS] update_options
# [TEMPLATE] translation_template
# [TRANSLATION_DIR] translation_directory
# [INSTALL_DIR] install_directory
# [COMPONENT] component
# [PULL_TRANSLATIONS [Yes | No]]
# [CLEAN_TRANSLATIONS [Yes | No]]
# [REPO_SUBDIR] repository_subdirectory
# [TRANSLATIONS_REPO] remote_translation_repo
# [TRANSLATIONS_REFSPEC] translations_remote_branch
# )
# Output:
# qmFiles The generated compiled translations (.qm) files
......@@ -44,6 +50,9 @@
# compiles the translations. Setting it No, only
# compiles them.
#
# UPDATE_OPTIONS Optional options to lupdate when UPDATE_TRANSLATIONS
# is True.
#
# TEMPLATE Optional translations files base name. Defaults to
# ${PROJECT_NAME}. An .ts extensions is added.
#
......@@ -56,6 +65,24 @@
#
# COMPONENT Optional install component. Only effective if INSTALL_DIR
# present. Defaults to "Runtime".
#
# PULL_TRANSLATIONS Optional flag. If set, the translations are pulled
# from external repository in cmake phase (not in build/make time)
# into directory "${TRANSLATION_DIR}/${REPO_SUBDIR}".
#
# CLEAN_TRANSLATIONS Optional flag. If set, the externally pulled
# translations are removed.
#
# REPO_SUBDIR Optional path in the "translations repository" to directory
# with translations. Only effective if PULL_TRANSLATIONS enabled.
# Defaults to "${TEMPLATE}".
#
# TRANSLATIONS_REPO External git repository with translations - only the ${TEMPLATE} directory
# is pulled (using the "sparse checkout").
# Optional (defaults to "https://github.com/lxde/lxqt-l10n.git").
#
# TRANSLATIONS_REFSPEC Optional refspec of external repository. Used in git pull.
# Defaults to "master".
# CMake v2.8.3 needed to use the CMakeParseArguments module
cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
......@@ -63,15 +90,34 @@ cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
# We use our patched version to round a annoying bug.
include(Qt5PatchedLinguistToolsMacros)
option(PULL_TRANSLATIONS "Pull translations" Yes)
option(CLEAN_TRANSLATIONS "Clean translations" No)
function(lxqt_translate_ts qmFiles)
set(oneValueArgs USE_QT5 UPDATE_TRANSLATIONS TEMPLATE TRANSLATION_DIR INSTALL_DIR COMPONENT)
set(multiValueArgs SOURCES)
set(oneValueArgs
USE_QT5
UPDATE_TRANSLATIONS
TEMPLATE
TRANSLATION_DIR
INSTALL_DIR
COMPONENT
PULL_TRANSLATIONS
CLEAN_TRANSLATIONS
REPO_SUBDIR
TRANSLATIONS_REPO
TRANSLATIONS_REFSPEC
)
set(multiValueArgs SOURCES UPDATE_OPTIONS)
cmake_parse_arguments(TR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT DEFINED TR_UPDATE_TRANSLATIONS)
set(TR_UPDATE_TRANSLATIONS "No")
endif()
if (NOT DEFINED TR_UPDATE_OPTIONS)
set(TR_UPDATE_OPTIONS "")
endif()
if (NOT DEFINED TR_USE_QT5)
set(TR_USE_QT5 "Yes")
endif()
......@@ -83,9 +129,104 @@ function(lxqt_translate_ts qmFiles)
if (NOT DEFINED TR_TRANSLATION_DIR)
set(TR_TRANSLATION_DIR "translations")
endif()
get_filename_component(TR_TRANSLATION_DIR "${TR_TRANSLATION_DIR}" ABSOLUTE)
if (NOT DEFINED TR_CLEAN_TRANSLATIONS)
set(TR_CLEAN_TRANSLATIONS "No")
endif()
if (NOT DEFINED TR_PULL_TRANSLATIONS)
set(TR_PULL_TRANSLATIONS "No")
endif()
if (NOT DEFINED TR_REPO_SUBDIR)
set(TR_REPO_SUBDIR "${TR_TEMPLATE}")
endif()
if (NOT DEFINED TR_TRANSLATIONS_REPO)
set(TR_TRANSLATIONS_REPO "https://github.com/lxde/lxqt-l10n.git")
endif()
if (NOT DEFINED TR_TRANSLATIONS_REFSPEC)
set(TR_TRANSLATIONS_REFSPEC "master")
endif()
if (TR_CLEAN_TRANSLATIONS)
message(STATUS "Cleaning translations dir '${TR_TRANSLATION_DIR}' ...")
set(DIR_TO_REMOVE "${TR_TRANSLATION_DIR}/${TR_REPO_SUBDIR}")
get_filename_component(PARENT_DIR "${DIR_TO_REMOVE}" DIRECTORY)
while (NOT "${PARENT_DIR}" STREQAL "${TR_TRANSLATION_DIR}")
set(DIR_TO_REMOVE "${PARENT_DIR}")
get_filename_component(PARENT_DIR "${DIR_TO_REMOVE}" DIRECTORY)
endwhile ()
#TODO: is there a way to check successfulness of file command !?!
file(REMOVE_RECURSE "${TR_TRANSLATION_DIR}/.git" "${DIR_TO_REMOVE}")
endif ()
if (TR_PULL_TRANSLATIONS)
find_package(Git REQUIRED)
if (NOT (GIT_FOUND AND GIT_VERSION_STRING VERSION_GREATER "1.7.0"))
message(FATAL_ERROR "Git > 1.7.0 is needed For pulling translations!")
endif ()
if (NOT EXISTS "${TR_TRANSLATION_DIR}/${TR_REPO_SUBDIR}")
message(STATUS "Setting git repository in the translations dir '${TR_TRANSLATION_DIR}' ...")
if (EXISTS "${TR_TRANSLATION_DIR}/.git")
execute_process(COMMAND rm -Rf .git
WORKING_DIRECTORY "${TR_TRANSLATION_DIR}"
RESULT_VARIABLE ex_result
)
if (NOT "${ex_result}" EQUAL 0)
message(FATAL_ERROR "Initialization(cleanup) of translations dir failed!")
endif ()
endif()
# make sure the dir exist, otherwise git init will fail
file(MAKE_DIRECTORY "${TR_TRANSLATION_DIR}")
execute_process(COMMAND "${GIT_EXECUTABLE}" init
WORKING_DIRECTORY "${TR_TRANSLATION_DIR}"
RESULT_VARIABLE ex_result
)
if (NOT "${ex_result}" EQUAL 0)
message(FATAL_ERROR "Initialization(init) of translations dir failed!")
endif ()
execute_process(COMMAND "${GIT_EXECUTABLE}" remote add origin "${TR_TRANSLATIONS_REPO}"
WORKING_DIRECTORY "${TR_TRANSLATION_DIR}"
RESULT_VARIABLE ex_result
)
if (NOT "${ex_result}" EQUAL 0)
message(FATAL_ERROR "Initialization(remote) of translations dir failed!")
endif ()
execute_process(COMMAND "${GIT_EXECUTABLE}" config core.sparseCheckout true
WORKING_DIRECTORY "${TR_TRANSLATION_DIR}"
RESULT_VARIABLE ex_result
)
if (NOT "${ex_result}" EQUAL 0)
message(FATAL_ERROR "Initialization(config) of translations dir failed!")
endif ()
file(WRITE "${TR_TRANSLATION_DIR}/.git/info/sparse-checkout" "${TR_REPO_SUBDIR}")
endif ()
message(STATUS "Pulling the translations...")
execute_process(COMMAND "${GIT_EXECUTABLE}" pull origin "${TR_TRANSLATIONS_REFSPEC}"
WORKING_DIRECTORY "${TR_TRANSLATION_DIR}"
RESULT_VARIABLE ex_result
)
if (NOT "${ex_result}" EQUAL 0)
message(FATAL_ERROR "Pulling translations failed!")
endif ()
endif ()
file(GLOB tsFiles "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}_*.ts")
set(templateFile "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}.ts")
#project/module can use it's own translations (not from external)
if (EXISTS "${TR_TRANSLATION_DIR}/${TR_REPO_SUBDIR}/")
file(GLOB tsFiles "${TR_TRANSLATION_DIR}/${TR_REPO_SUBDIR}/*_*.ts")
set(templateFile "${TR_TRANSLATION_DIR}/${TR_REPO_SUBDIR}/${TR_TEMPLATE}.ts")
else ()
file(GLOB tsFiles "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}_*.ts")
set(templateFile "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}.ts")
endif ()
if(TR_USE_QT5)
# Qt5
......@@ -93,12 +234,12 @@ function(lxqt_translate_ts qmFiles)
qt5_patched_create_translation(QMS
${TR_SOURCES}
${templateFile}
OPTIONS -locations absolute
OPTIONS ${TR_UPDATE_OPTIONS}
)
qt5_patched_create_translation(QM
${TR_SOURCES}
${tsFiles}
OPTIONS -locations absolute
OPTIONS ${TR_UPDATE_OPTIONS}
)
else()
qt5_patched_add_translation(QM ${tsFiles})
......@@ -109,12 +250,12 @@ function(lxqt_translate_ts qmFiles)
qt4_create_translation(QMS
${TR_SOURCES}
${templateFile}
OPTIONS -locations absolute
OPTIONS ${TR_UPDATE_OPTIONS}
)
qt4_create_translation(QM
${TR_SOURCES}
${tsFiles}
OPTIONS -locations absolute
OPTIONS ${TR_UPDATE_OPTIONS}
)
else()
qt4_add_translation(QM ${tsFiles})
......
......@@ -40,7 +40,6 @@ ConfigDialog::ConfigDialog(const QString& title, Settings* settings, QWidget* pa
setWindowTitle(title);
connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), SLOT(dialogButtonsAction(QAbstractButton*)));
ui->moduleList->setVisible(false);
connect(Settings::globalSettings(), SIGNAL(settingsChanged()), this, SLOT(updateIcons()));
foreach(QPushButton* button, ui->buttons->findChildren<QPushButton*>())
button->setAutoDefault(false);
}
......@@ -104,6 +103,13 @@ void ConfigDialog::showPage(QWidget* page)
ui->moduleList->setCurrentRow(index);
}
bool ConfigDialog::event(QEvent * event)
{
if (QEvent::ThemeChange == event->type())
updateIcons();
return QDialog::event(event);
}
void ConfigDialog::closeEvent(QCloseEvent* event)
{
emit save();
......
......@@ -89,7 +89,8 @@ signals:
protected:
Settings* mSettings;
virtual void closeEvent(QCloseEvent* event);
virtual bool event(QEvent * event) override;
virtual void closeEvent(QCloseEvent* event) override;
private:
SettingsCache* mCache;
......
......@@ -21,6 +21,9 @@
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
</widget>
</item>
<item>
......
......@@ -29,7 +29,9 @@
#include "lxqtpageselectwidget.h"
#include <QDebug>
#include <QStyledItemDelegate>
#include <QEvent>
#include <QScrollBar>
#include <QApplication>
using namespace LXQt;
......@@ -60,7 +62,13 @@ PageSelectWidgetItemDelegate::PageSelectWidgetItemDelegate(PageSelectWidget *par
QSize PageSelectWidgetItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QSize size = QStyledItemDelegate::sizeHint(option, index);
size.setWidth(mView->viewport()->width() - 2*mView->spacing());
//all items should have unified width
QStyle * style = option.widget ? option.widget->style() : QApplication::style();
//Note: this margin logic follows code in QCommonStylePrivate::viewItemLayout()
const int margin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, &option, option.widget) + 1;
//considering the icon size too
size.setWidth(qMax(mView->maxTextWidth(), option.decorationSize.width()));
size.rwidth() += 2 * margin;
return size;
}
......@@ -71,6 +79,7 @@ QSize PageSelectWidgetItemDelegate::sizeHint(const QStyleOptionViewItem &option,
************************************************/
PageSelectWidget::PageSelectWidget(QWidget *parent) :
QListWidget(parent)
, mMaxTextWidth(0)
{
setSelectionRectVisible(false);
setViewMode(IconMode);
......@@ -80,8 +89,12 @@ PageSelectWidget::PageSelectWidget(QWidget *parent) :
setDragEnabled(NoDragDrop);
setEditTriggers(NoEditTriggers);
setTextElideMode(Qt::ElideNone);
setContentsMargins(0, 0, 0, 0);
setItemDelegate(new PageSelectWidgetItemDelegate(this));
connect(model(), &QAbstractItemModel::rowsInserted, this, &PageSelectWidget::updateMaxTextWidth);
connect(model(), &QAbstractItemModel::rowsRemoved, this, &PageSelectWidget::updateMaxTextWidth);
connect(model(), &QAbstractItemModel::dataChanged, this, &PageSelectWidget::updateMaxTextWidth);
}
......@@ -92,22 +105,53 @@ PageSelectWidget::~PageSelectWidget()
{
}
/************************************************
************************************************/
int PageSelectWidget::maxTextWidth() const
{
return mMaxTextWidth;
}
/************************************************
************************************************/
QSize PageSelectWidget::sizeHint() const
QSize PageSelectWidget::viewportSizeHint() const
{
QSize size = QListWidget::sizeHint();
int w = 0;
for(int i=0; i< count(); ++i)
const int spacing2 = spacing() * 2;
QSize size{sizeHintForColumn(0) + spacing2, (sizeHintForRow(0) + spacing2) * count()};
if (verticalScrollBar()->isVisible())
size.rwidth() += verticalScrollBar()->sizeHint().width();
return size;
}
/************************************************
************************************************/
QSize PageSelectWidget::minimumSizeHint() const
{
return QSize{0, 0};
}
/************************************************
************************************************/
void PageSelectWidget::updateMaxTextWidth()
{
for(int i = count() - 1; 0 <= i; --i)
{
QRect rect = fontMetrics().boundingRect(QRect(), Qt::AlignLeft | Qt::TextWordWrap, item(i)->text());
w = qMax(w, rect.width());
const QRect r = fontMetrics().boundingRect(QRect{}, Qt::AlignLeft | Qt::TextWordWrap, item(i)->text());
mMaxTextWidth = qMax(mMaxTextWidth, r.width());
}
}
if (horizontalScrollBar()->isVisible())
w += horizontalScrollBar()->width();
size.setWidth(w + frameWidth() + spacing()*2 + 10);
return size;
/************************************************
************************************************/
bool PageSelectWidget::event(QEvent * event)
{
if (QEvent::StyleChange == event->type())
updateMaxTextWidth();