From c3383caa2d7214bfe576e792f1f481ecba5d5102 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Fri, 23 Oct 2015 22:08:46 +0200 Subject: [PATCH] Adding upstream version 0.9.0+20151019. --- .../LXQtPluginTranslationLoader.cpp.in | 23 +++++++++++++++++++ cmake/modules/LXQtTranslationLoader.cmake | 12 ++++++++++ configdialog/lxqtconfigdialog.cpp | 6 +++++ 3 files changed, 41 insertions(+) create mode 100644 cmake/modules/LXQtPluginTranslationLoader.cpp.in diff --git a/cmake/modules/LXQtPluginTranslationLoader.cpp.in b/cmake/modules/LXQtPluginTranslationLoader.cpp.in new file mode 100644 index 0000000..a337eac --- /dev/null +++ b/cmake/modules/LXQtPluginTranslationLoader.cpp.in @@ -0,0 +1,23 @@ +/* This file has been generated by the CMake lxqt_plugin_translation_loader(). + * It loads LXQt plugin translations. + * + * Attention: All changes will be overwritten!!! + */ + +#include +#include + +/* Dummy helper symbol for referencing. + * In case plugin is linked as static (lib*.a) unreferenced objects are stripped in linking time + * => we need to reference some symbol from this file to be not stripped as a whole. + */ +void * loadPluginTranslation_@catalog_name@_helper = nullptr; + +static void loadPluginTranslation() +{ + //XXX: we don't use the QStringLiteral here because it causes SEGFAULT in static finalization time + // (the string is stored in static QHash and it's destructor can reference already deleted static QString (generated by QStringLiteral)) + LXQt::Translator::translatePlugin("@catalog_name@", "@plugin_type@"); +} + +Q_COREAPP_STARTUP_FUNCTION(loadPluginTranslation) diff --git a/cmake/modules/LXQtTranslationLoader.cmake b/cmake/modules/LXQtTranslationLoader.cmake index c619e14..b29bdaf 100644 --- a/cmake/modules/LXQtTranslationLoader.cmake +++ b/cmake/modules/LXQtTranslationLoader.cmake @@ -59,3 +59,15 @@ function(lxqt_lib_translation_loader source_files catalog_name) ) set(${source_files} ${${source_files}} ${CMAKE_CURRENT_BINARY_DIR}/LXQtLibTranslationLoader.cpp PARENT_SCOPE) endfunction() + +# lxqt_plugin_translation_loader( ) +# The generated .cpp file is added to +# Translations catalog to be loaded +# Plugin type. Example: lxqt-panel +function(lxqt_plugin_translation_loader source_files catalog_name plugin_type) + configure_file( + ${LXQT_CMAKE_MODULES_DIR}/LXQtPluginTranslationLoader.cpp.in + LXQtPluginTranslationLoader.cpp @ONLY + ) + set(${source_files} ${${source_files}} ${CMAKE_CURRENT_BINARY_DIR}/LXQtPluginTranslationLoader.cpp PARENT_SCOPE) +endfunction() diff --git a/configdialog/lxqtconfigdialog.cpp b/configdialog/lxqtconfigdialog.cpp index e469d94..6217761 100644 --- a/configdialog/lxqtconfigdialog.cpp +++ b/configdialog/lxqtconfigdialog.cpp @@ -59,6 +59,12 @@ void ConfigDialog::addPage(QWidget* page, const QString& name, const QString& ic void ConfigDialog::addPage(QWidget* page, const QString& name, const QStringList& iconNames) { + Q_ASSERT(page); + if (!page) + { + return; + } + /* We set the layout margin to 0. In the default configuration, one page * only, it aligns buttons with the page. In multi-page it saves a little * bit of space, without clutter.