From d7520dece5bb387102edc6eb0fff419866b2a70f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 29 Apr 2020 13:40:05 +0200 Subject: CMake build/Linux: Install desktop and appstream files Fixes: QTCREATORBUG-23906 Change-Id: I9d796c8826dbb4beb980aa29b75526fe96093921 Reviewed-by: Cristian Adam --- share/CMakeLists.txt | 10 ++++++++ .../applications/org.qt-project.qtcreator.desktop | 12 +++++++++ .../metainfo/org.qt-project.qtcreator.appdata.xml | 29 ++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 share/applications/org.qt-project.qtcreator.desktop create mode 100644 share/metainfo/org.qt-project.qtcreator.appdata.xml (limited to 'share') diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 471053adec..eb3c779b40 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -1 +1,11 @@ add_subdirectory(qtcreator) + +if (NOT APPLE AND NOT WIN32) + install( + DIRECTORY + applications + metainfo + DESTINATION + share + ) +endif() diff --git a/share/applications/org.qt-project.qtcreator.desktop b/share/applications/org.qt-project.qtcreator.desktop new file mode 100644 index 0000000000..034721891d --- /dev/null +++ b/share/applications/org.qt-project.qtcreator.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Exec=qtcreator %F +Name=Qt Creator +GenericName=C++ IDE for developing Qt applications +X-KDE-StartupNotify=true +Icon=QtProject-qtcreator +StartupWMClass=qtcreator +Terminal=false +Categories=Development;IDE;Qt; +MimeType= text/x-c++src;text/x-c++hdr;text/x-xsrc;application/x-designer;application/vnd.qt.qmakeprofile;application/vnd.qt.xml.resource; + diff --git a/share/metainfo/org.qt-project.qtcreator.appdata.xml b/share/metainfo/org.qt-project.qtcreator.appdata.xml new file mode 100644 index 0000000000..4706e69b22 --- /dev/null +++ b/share/metainfo/org.qt-project.qtcreator.appdata.xml @@ -0,0 +1,29 @@ + + + + org.qt-project.qtcreator.desktop + Qt Creator + Provides a cross-platform, complete integrated development environment (IDE) for application developers to create applications for multiple platforms and devices + CC0-1.0 + GPL-3.0 + +

+ Qt Creator provides a cross-platform, complete integrated development + environment (IDE) for application developers to create applications for + multiple desktop and mobile device platforms, such as Android and iOS. +

+

+ Qt Creator enables a team of developers to share a project across different + development platforms with a common tool for development and debugging. +

+

+ The main goal for Qt Creator is meeting the development needs of Qt + developers who are looking for simplicity, usability, productivity, + extendibility and openness, while aiming to lower the barrier of entry for + newcomers to Qt. +

+
+ + https://www.qt.io/ide/ + Qt +
-- cgit v1.2.3 From 96cd1bffaeeb6ab5e04ab4fde6e755edd842e35e Mon Sep 17 00:00:00 2001 From: Brook Cronin Date: Thu, 16 Apr 2020 17:09:59 +0200 Subject: Theme: add controls theme to creator themes and map to controls theme values Change-Id: Iec6f217e8d3ae6e7f72fdf86c282e1b11b225626 Reviewed-by: Alessandro Portale --- .../imports/StudioTheme/Values.qml | 80 +++++++++------------- share/qtcreator/themes/dark.creatortheme | 37 ++++++++++ share/qtcreator/themes/default.creatortheme | 37 ++++++++++ share/qtcreator/themes/flat-dark.creatortheme | 39 ++++++++++- share/qtcreator/themes/flat-light.creatortheme | 37 ++++++++++ share/qtcreator/themes/flat.creatortheme | 37 ++++++++++ 6 files changed, 220 insertions(+), 47 deletions(-) (limited to 'share') diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml index 3f432d4080..cc8c4b4f8f 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml @@ -80,54 +80,42 @@ QtObject { // Theme Colors - // Dark Theme Defaults - property string themeControlBackground: "#242424" - property string themeControlOutline: "#404040" - property string themeTextColor: "#ffffff" - property string themeDisabledTextColor: "#909090" - - property string themePanelBackground: "#2a2a2a" - property string themeHoverHighlight: "#313131" - property string themeColumnBackground: "#363636" - property string themeFocusEdit: "#444444" - property string themeFocusDrag: "#565656" - - property string themeControlBackgroundPressed: "#606060" - property string themeControlBackgroundChecked: "#565656" - - property string themeInteraction: "#029de0" - - property string themeSliderActiveTrack: "#606060" - property string themeSliderInactiveTrack: "#404040" - property string themeSliderHandle: "#505050" - - property string themeSliderActiveTrackHover: "#7f7f7f" - property string themeSliderInactiveTrackHover: "#505050" - property string themeSliderHandleHover: "#606060" - - property string themeSliderActiveTrackFocus: "#aaaaaa" - property string themeSliderInactiveTrackFocus: "#606060" - property string themeSliderHandleFocus: values.themeInteraction - - property string themeErrorColor: "#df3a3a" + // COLORS NOW COME FROM THE THEME FILES + property string themeControlBackground: Theme.color(Theme.DScontrolBackground) + property string themeControlOutline: Theme.color(Theme.DScontrolOutline) + property string themeTextColor: Theme.color(Theme.DStextColor) + property string themeDisabledTextColor: Theme.color(Theme.DSdisabledTextColor) + property string themePanelBackground: Theme.color(Theme.DSpanelBackground) + property string themeHoverHighlight: Theme.color(Theme.DShoverHighlight) + property string themeColumnBackground: Theme.color(Theme.DScolumnBackground) + property string themeFocusEdit: Theme.color(Theme.DSfocusEdit) + property string themeFocusDrag: Theme.color(Theme.DSfocusDrag) + property string themeControlBackgroundPressed: Theme.color(Theme.DScontrolBackgroundPressed) + property string themeControlBackgroundChecked: Theme.color(Theme.DScontrolBackgroundChecked) + property string themeInteraction: Theme.color(Theme.DSinteraction) + property string themeSliderActiveTrack: Theme.color(Theme.DSsliderActiveTrack) + property string themeSliderInactiveTrack: Theme.color(Theme.DSsliderInactiveTrack) + property string themeSliderHandle: Theme.color(Theme.DSsliderHandle) + property string themeSliderActiveTrackHover: Theme.color(Theme.DSactiveTrackHover) + property string themeSliderInactiveTrackHover: Theme.color(Theme.DSsliderInactiveTrackHover) + property string themeSliderHandleHover: Theme.color(Theme.DSsliderHandleHover) + property string themeSliderActiveTrackFocus: Theme.color(Theme.DSsliderActiveTrackFocus) + property string themeSliderInactiveTrackFocus:Theme.color(Theme.DSsliderInactiveTrackFocus) + property string themeSliderHandleFocus: Theme.color(Theme.DSsliderHandleFocus) + property string themeErrorColor: Theme.color(Theme.DSerrorColor) // NEW NEW NEW NEW NEW - property string themeControlBackgroundDisabled: "#363636" - property string themeControlOutlineDisabled: "#404040" - property string themeTextColorDisabled: "#606060" - - property string themeTextSelectionColor: "#029de0" - property string themeTextSelectedTextColor: "#ffffff" - - property string themeScrollBarTrack: "#404040" - property string themeScrollBarHandle: "#505050" - - property string themeControlBackgroundInteraction: "#404040" // TODO Name. Right now themeFocusEdit is used for all 'edit' states. Is that correct? Different color! - - property string themeTranslationIndicatorBorder: "#7f7f7f" - - property string themeSectionHeadBackground: "#191919" + property string themeControlBackgroundDisabled: Theme.color(Theme.DScontrolBackgroundDisabled) + property string themeControlOutlineDisabled: Theme.color(Theme.DScontrolOutlineDisabled) + property string themeTextColorDisabled: Theme.color(Theme.DStextColorDisabled) + property string themeTextSelectionColor: Theme.color(Theme.DStextSelectionColor) + property string themeTextSelectedTextColor:Theme.color(Theme.DStextSelectedTextColor) + property string themeScrollBarTrack: Theme.color(Theme.DSscrollBarTrack) + property string themeScrollBarHandle: Theme.color(Theme.DSscrollBarHandle) + property string themeControlBackgroundInteraction: Theme.color(Theme.DScontrolBackgroundInteraction) // TODO Name. Right now themeFocusEdit is used for all 'edit' states. Is that correct? Different color! + property string themeTranslationIndicatorBorder: Theme.color(Theme.DStranlsationIndicatorBorder) + property string themeSectionHeadBackground: Theme.color(Theme.DSsectionHeadBackground) // Taken out of Constants.js - property string themeChangedStateText: "#99ccff" + property string themeChangedStateText: Theme.color(Theme.DSchangedStateText) } diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme index 41439ff22a..fa4a6ab330 100644 --- a/share/qtcreator/themes/dark.creatortheme +++ b/share/qtcreator/themes/dark.creatortheme @@ -22,6 +22,43 @@ backgroundColorDisabled=ff444444 qmlDesignerButtonColor=ff3c3e40 [Colors] + +;DS controls theme START +DScontrolBackground=ff404040 +DScontrolOutline=ff595959 +DStextColor=ffffffff +DSdisabledTextColor=ff909090 +DSpanelBackground=ff454444 +DShoverHighlight=ff313131 +DScolumnBackground=ff363636 +DSfocusEdit=ff444444 +DSfocusDrag=ff565656 +DScontrolBackgroundPressed=ff7a7a7a +DScontrolBackgroundChecked=ff565656 +DSinteraction=ff3f91c4 +DSsliderActiveTrack=ff7a7a7a +DSsliderInactiveTrack=ff4d4d4d +DSsliderHandle=ff505050 +DSsliderActiveTrackHover=ff7f7f7f +DSsliderInactiveTrackHover=ff505050 +DSsliderHandleHover=ff7a7a7a +DSsliderActiveTrackFocus=ffaaaaaa +DSsliderInactiveTrackFocus=ff7a7a7a +DSsliderHandleFocus=ff3f91c4 +DSerrorColor=ffdf3a3a +DScontrolBackgroundDisabled=ff363636 +DScontrolOutlineDisabled=ff4d4d4d +DStextColorDisabled=ff7a7a7a +DStextSelectionColor=ff3f91c4 +DStextSelectedTextColor=ffffffff +DSscrollBarTrack=ff4d4d4d +DSscrollBarHandle=ff505050 +DScontrolBackgroundInteraction=ff4d4d4d +DStranslationIndicatorBorder=ff7f7f7f +DSsectionHeadBackground=ff424242 +DSchangedStateText=ff99ccff +;DS controls theme END + BackgroundColorAlternate=alternateBackground BackgroundColorDark=shadowBackground BackgroundColorHover=hoverBackground diff --git a/share/qtcreator/themes/default.creatortheme b/share/qtcreator/themes/default.creatortheme index 08890a7c2f..8686733ab4 100644 --- a/share/qtcreator/themes/default.creatortheme +++ b/share/qtcreator/themes/default.creatortheme @@ -13,6 +13,43 @@ splitterColor=ff151515 qmlDesignerButtonColor=ff4c4e50 [Colors] + +;DS controls theme START +DScontrolBackground=ff404040 +DScontrolOutline=ff595959 +DStextColor=ffffffff +DSdisabledTextColor=ff909090 +DSpanelBackground=ff454444 +DShoverHighlight=ff313131 +DScolumnBackground=ff363636 +DSfocusEdit=ff444444 +DSfocusDrag=ff565656 +DScontrolBackgroundPressed=ff7a7a7a +DScontrolBackgroundChecked=ff565656 +DSinteraction=ff3f91c4 +DSsliderActiveTrack=ff7a7a7a +DSsliderInactiveTrack=ff4d4d4d +DSsliderHandle=ff505050 +DSsliderActiveTrackHover=ff7f7f7f +DSsliderInactiveTrackHover=ff505050 +DSsliderHandleHover=ff7a7a7a +DSsliderActiveTrackFocus=ffaaaaaa +DSsliderInactiveTrackFocus=ff7a7a7a +DSsliderHandleFocus=ff3f91c4 +DSerrorColor=ffdf3a3a +DScontrolBackgroundDisabled=ff363636 +DScontrolOutlineDisabled=ff4d4d4d +DStextColorDisabled=ff7a7a7a +DStextSelectionColor=ff3f91c4 +DStextSelectedTextColor=ffffffff +DSscrollBarTrack=ff4d4d4d +DSscrollBarHandle=ff505050 +DScontrolBackgroundInteraction=ff4d4d4d +DStranslationIndicatorBorder=ff7f7f7f +DSsectionHeadBackground=ff424242 +DSchangedStateText=ff99ccff +;DS controls theme END + BackgroundColorAlternate=ff3d3d3d BackgroundColorDark=shadowBackground BackgroundColorHover=ff515151 diff --git a/share/qtcreator/themes/flat-dark.creatortheme b/share/qtcreator/themes/flat-dark.creatortheme index e281f189aa..1df02cd463 100644 --- a/share/qtcreator/themes/flat-dark.creatortheme +++ b/share/qtcreator/themes/flat-dark.creatortheme @@ -26,6 +26,43 @@ backgroundColorDisabled=ff444444 qmlDesignerButtonColor=ff4c4e50 [Colors] + +;DS controls theme START +DScontrolBackground=ff404040 +DScontrolOutline=ff595959 +DStextColor=ffffffff +DSdisabledTextColor=ff909090 +DSpanelBackground=ff454444 +DShoverHighlight=ff313131 +DScolumnBackground=ff363636 +DSfocusEdit=ff444444 +DSfocusDrag=ff565656 +DScontrolBackgroundPressed=ff7a7a7a +DScontrolBackgroundChecked=ff565656 +DSinteraction=ff1d545c +DSsliderActiveTrack=ff7a7a7a +DSsliderInactiveTrack=ff4d4d4d +DSsliderHandle=ff505050 +DSsliderActiveTrackHover=ff7f7f7f +DSsliderInactiveTrackHover=ff505050 +DSsliderHandleHover=ff7a7a7a +DSsliderActiveTrackFocus=ffaaaaaa +DSsliderInactiveTrackFocus=ff7a7a7a +DSsliderHandleFocus=ff1d545c +DSerrorColor=ffdf3a3a +DScontrolBackgroundDisabled=ff363636 +DScontrolOutlineDisabled=ff4d4d4d +DStextColorDisabled=ff7a7a7a +DStextSelectionColor=ff1d545c +DStextSelectedTextColor=ffffffff +DSscrollBarTrack=ff4d4d4d +DSscrollBarHandle=ff505050 +DScontrolBackgroundInteraction=ff4d4d4d +DStranslationIndicatorBorder=ff7f7f7f +DSsectionHeadBackground=ff424242 +DSchangedStateText=ff99ccff +;DS controls theme END + BackgroundColorAlternate=alternateBackground BackgroundColorDark=shadowBackground BackgroundColorHover=hoverBackground @@ -202,7 +239,7 @@ CodeModel_Error_TextMarkColor=error CodeModel_Warning_TextMarkColor=warning QmlDesigner_BackgroundColor=qmlDesignerButtonColor -QmlDesigner_HighlightColor=ff3f91c4 +QmlDesigner_HighlightColor=ff1d545c QmlDesigner_FormEditorSelectionColor=ff4ba2ff QmlDesigner_FormEditorForegroundColor=ffffffff QmlDesigner_BackgroundColorDarkAlternate=qmlDesignerButtonColor diff --git a/share/qtcreator/themes/flat-light.creatortheme b/share/qtcreator/themes/flat-light.creatortheme index f6b726762c..b8b4e7eabd 100644 --- a/share/qtcreator/themes/flat-light.creatortheme +++ b/share/qtcreator/themes/flat-light.creatortheme @@ -22,6 +22,43 @@ warning=ffecbc1c qmlDesignerButtonColor=fff8f8f8 [Colors] + +;DS controls theme START +DScontrolBackground=ffffffff +DScontrolOutline=ff777777 +DStextColor=ff242424 +DSdisabledTextColor=ff505050 +DSpanelBackground=fff2f2f2 +DShoverHighlight=ffe6e6e6 +DScolumnBackground=ffaaaaaa +DSfocusEdit=ffeaeaea +DSfocusDrag=ffd1d1d1 +DScontrolBackgroundPressed=ff505050 +DScontrolBackgroundChecked=ff5e5e5e +DSinteraction=ff0492c9 +DSsliderActiveTrack=ff363636 +DSsliderInactiveTrack=ffe6e6e6 +DSsliderHandle=ff777777 +DSsliderActiveTrackHover=ff7f7f7f +DSsliderInactiveTrackHover=ff5e5e5e +DSsliderHandleHover=ff505050 +DSsliderActiveTrackFocus=ff363636 +DSsliderInactiveTrackFocus=ff505050 +DSsliderHandleFocus=ff0492c9 +DSerrorColor=ffdf3a3a +DScontrolBackgroundDisabled=ffaaaaaa +DScontrolOutlineDisabled=ff777777 +DStextColorDisabled=ff505050 +DStextSelectionColor=ff0492c9 +DStextSelectedTextColor=ffffffff +DSscrollBarTrack=ff777777 +DSscrollBarHandle=ff505050 +DScontrolBackgroundInteraction=ff777777 +DStranslationIndicatorBorder=ffebebeb +DSsectionHeadBackground=ffebebeb +DSchangedStateText=ff99ccff +;DS controls theme END + BackgroundColorAlternate=alternateBackground BackgroundColorDark=shadowBackground BackgroundColorHover=hoverBackground diff --git a/share/qtcreator/themes/flat.creatortheme b/share/qtcreator/themes/flat.creatortheme index 0f057d80c0..e80a8d85f1 100644 --- a/share/qtcreator/themes/flat.creatortheme +++ b/share/qtcreator/themes/flat.creatortheme @@ -20,6 +20,43 @@ splitter=ff313131 qmlDesignerButtonColor=ff4c4e50 [Colors] + +;DS controls theme START +DScontrolBackground=ff404040 +DScontrolOutline=ff595959 +DStextColor=ffffffff +DSdisabledTextColor=ff909090 +DSpanelBackground=ff454444 +DShoverHighlight=ff313131 +DScolumnBackground=ff363636 +DSfocusEdit=ff444444 +DSfocusDrag=ff565656 +DScontrolBackgroundPressed=ff7a7a7a +DScontrolBackgroundChecked=ff565656 +DSinteraction=ff3f91c4 +DSsliderActiveTrack=ff7a7a7a +DSsliderInactiveTrack=ff4d4d4d +DSsliderHandle=ff505050 +DSsliderActiveTrackHover=ff7f7f7f +DSsliderInactiveTrackHover=ff505050 +DSsliderHandleHover=ff7a7a7a +DSsliderActiveTrackFocus=ffaaaaaa +DSsliderInactiveTrackFocus=ff7a7a7a +DSsliderHandleFocus=ff3f91c4 +DSerrorColor=ffdf3a3a +DScontrolBackgroundDisabled=ff363636 +DScontrolOutlineDisabled=ff4d4d4d +DStextColorDisabled=ff7a7a7a +DStextSelectionColor=ff3f91c4 +DStextSelectedTextColor=ffffffff +DSscrollBarTrack=ff4d4d4d +DSscrollBarHandle=ff505050 +DScontrolBackgroundInteraction=ff4d4d4d +DStranslationIndicatorBorder=ff7f7f7f +DSsectionHeadBackground=ff424242 +DSchangedStateText=ff99ccff +;DS controls theme END + BackgroundColorAlternate=alternateBackground BackgroundColorDark=shadowBackground BackgroundColorHover=hoverBackground -- cgit v1.2.3 From 67828b4fe5bf0b2e548b5641b28473f64744ea9b Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 5 May 2020 08:30:08 +0200 Subject: QmlDesigner: Add a missing import to the PropertyEditor Theme Change-Id: I4b6151b1e12311334a0c32e2fa6f7c30db150c92 Reviewed-by: Brook Cronin Reviewed-by: Thomas Hartmann --- .../qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml | 1 + 1 file changed, 1 insertion(+) (limited to 'share') diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml index cc8c4b4f8f..9f04812af9 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml @@ -25,6 +25,7 @@ pragma Singleton import QtQuick 2.12 +import QtQuickDesignerTheme 1.0 QtObject { id: values -- cgit v1.2.3 From cc04c8d8e42b8187e8289c8e2e4fdcf5fce8c11a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 29 Apr 2020 15:08:17 +0200 Subject: CMake build: Make translation function available to external plugins And fix that the "ts_all" target did not get the custom target prefix. Change-Id: Iff6a5e328456f3d949c31f2e41b48c400fad773c Reviewed-by: Tobias Hunger --- share/qtcreator/translations/CMakeLists.txt | 162 ---------------------------- 1 file changed, 162 deletions(-) (limited to 'share') diff --git a/share/qtcreator/translations/CMakeLists.txt b/share/qtcreator/translations/CMakeLists.txt index 7b4d29bd77..d8ade110bc 100644 --- a/share/qtcreator/translations/CMakeLists.txt +++ b/share/qtcreator/translations/CMakeLists.txt @@ -44,168 +44,6 @@ else() VERBATIM) endif() -function(_extract_ts_data_from_targets outprefix) - set(_sources "") - set(_includes "") - - set(_targets "${ARGN}") - list(REMOVE_DUPLICATES _targets) - - foreach(t IN ITEMS ${_targets}) - if (TARGET "${t}") - get_target_property(_skip_translation "${t}" QT_SKIP_TRANSLATION) - get_target_property(_source_dir "${t}" SOURCE_DIR) - get_target_property(_interface_include_dirs "${t}" INTERFACE_INCLUDE_DIRECTORIES) - get_target_property(_include_dirs "${t}" INCLUDE_DIRECTORIES) - get_target_property(_source_files "${t}" SOURCES) - get_target_property(_extra_translations "${t}" QT_EXTRA_TRANSLATIONS) - - if (NOT _skip_translation) - if(_include_dirs) - list(APPEND _includes ${_include_dirs}) - endif() - - if(_interface_include_dirs) - list(APPEND _interface_includes ${_include_dirs}) - endif() - - set(_target_sources "") - if(_source_files) - list(APPEND _target_sources ${_source_files}) - endif() - if(_extra_translations) - list(APPEND _target_sources ${_extra_translations}) - endif() - foreach(s IN ITEMS ${_target_sources}) - get_filename_component(_abs_source "${s}" ABSOLUTE BASE_DIR "${_source_dir}") - list(APPEND _sources "${_abs_source}") - endforeach() - endif() - endif() - endforeach() - - set("${outprefix}_sources" "${_sources}" PARENT_SCOPE) - set("${outprefix}_includes" "${_includes}" PARENT_SCOPE) -endfunction() - -function(_create_ts_custom_target name) - cmake_parse_arguments(_arg "" "FILE_PREFIX;TS_TARGET_PREFIX" "LANGUAGES;SOURCES;INCLUDES" ${ARGN}) - if (_arg_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "Invalid parameters to _create_ts_custom_target: ${_arg_UNPARSED_ARGUMENTS}.") - endif() - - if (NOT _arg_TS_TARGET_PREFIX) - set(_arg_TS_TARGET_PREFIX "ts_") - endif() - - set(ts_languages ${_arg_LANGUAGES}) - if (NOT ts_languages) - set(ts_languages "${name}") - endif() - - foreach(l IN ITEMS ${ts_languages}) - list(APPEND ts_files "${CMAKE_CURRENT_SOURCE_DIR}/${_arg_FILE_PREFIX}_${l}.ts") - endforeach() - - set(_sources "${_arg_SOURCES}") - list(SORT _sources) - - set(_includes "${_arg_INCLUDES}") - - list(REMOVE_DUPLICATES _sources) - list(REMOVE_DUPLICATES _includes) - - list(REMOVE_ITEM _sources "") - list(REMOVE_ITEM _includes "") - - set(_prepended_includes) - foreach(include IN LISTS _includes) - list(APPEND _prepended_includes "-I${include}") - endforeach() - set(_includes "${_prepended_includes}") - - string(REPLACE ";" "\n" _sources_str "${_sources}") - string(REPLACE ";" "\n" _includes_str "${_includes}") - - set(ts_file_list "${CMAKE_CURRENT_BINARY_DIR}/ts_${name}.lst") - file(WRITE "${ts_file_list}" "${_sources_str}\n${_includes_str}\n") - - add_custom_target("${_arg_TS_TARGET_PREFIX}${name}" - COMMAND Qt5::lupdate -locations relative -no-ui-lines -no-sort "@${ts_file_list}" -ts ${ts_files} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Generate .ts files" - DEPENDS ${_sources} - VERBATIM) -endfunction() - -function(add_translation_targets file_prefix) - if (NOT TARGET Qt5::lrelease) - # No Qt translation tools were found: Skip this directory - message(WARNING "No Qt translation tools found, skipping translation targets. Add find_package(Qt5 COMPONENTS LinguistTools) to CMake to enable.") - return() - endif() - - cmake_parse_arguments(_arg "" - "OUTPUT_DIRECTORY;INSTALL_DESTINATION;TS_TARGET_PREFIX;QM_TARGET_PREFIX;ALL_QM_TARGET" - "LANGUAGES;TARGETS;SOURCES;INCLUDES" ${ARGN}) - if (_arg_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "Invalid parameters to add_translation_targets: ${_arg_UNPARSED_ARGUMENTS}.") - endif() - - if (NOT _arg_TS_TARGET_PREFIX) - set(_arg_TS_TARGET_PREFIX "ts_") - endif() - - if (NOT _arg_QM_TARGET_PREFIX) - set(_arg_QM_TARGET_PREFIX "generate_qm_file_") - endif() - - if (NOT _arg_ALL_QM_TARGET) - set(_arg_ALL_QM_TARGET "generate_qm_files") - endif() - - if (NOT _arg_OUTPUT_DIRECTORY) - set(_arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endif() - - if (NOT _arg_INSTALL_DESTINATION) - message(FATAL_ERROR "Please provide a INSTALL_DESTINATION to add_translation_targets") - endif() - - _extract_ts_data_from_targets(_to_process "${_arg_TARGETS}") - - _create_ts_custom_target(untranslated - FILE_PREFIX "${file_prefix}" TS_TARGET_PREFIX "${_arg_TS_TARGET_PREFIX}" - SOURCES ${_to_process_sources} ${_arg_SOURCES} INCLUDES ${_to_process_includes} ${_arg_INCLUDES}) - - if (NOT TARGET "${_arg_ALL_QM_TARGET}") - add_custom_target("${_arg_ALL_QM_TARGET}" ALL COMMENT "Generate .qm-files") - endif() - - foreach(l IN ITEMS ${_arg_LANGUAGES}) - set(_ts_file "${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}_${l}.ts") - set(_qm_file "${_arg_OUTPUT_DIRECTORY}/${file_prefix}_${l}.qm") - - _create_ts_custom_target("${l}" FILE_PREFIX "${file_prefix}" TS_TARGET_PREFIX "${_arg_TS_TARGET_PREFIX}" - SOURCES ${_to_process_sources} ${_arg_SOURCES} INCLUDES ${_to_process_includes} ${_arg_INCLUDES}) - - add_custom_command(OUTPUT "${_qm_file}" - COMMAND Qt5::lrelease "${_ts_file}" -qm "${_qm_file}" - MAIN_DEPENDENCY "${_ts_file}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Generate .qm file" - VERBATIM) - add_custom_target("${_arg_QM_TARGET_PREFIX}${l}" DEPENDS "${_qm_file}") - install(FILES "${_qm_file}" DESTINATION ${_arg_INSTALL_DESTINATION}) - - add_dependencies("${_arg_ALL_QM_TARGET}" "${_arg_QM_TARGET_PREFIX}${l}") - endforeach() - - _create_ts_custom_target(all LANGUAGES ${_arg_LANGUAGES} FILE_PREFIX "${file_prefix}" - SOURCES ${_to_process_sources} ${_arg_SOURCES} INCLUDES ${_to_process_includes} ${_arg_INCLUDES}) -endfunction() - -### collect targets to include in documentation: add_translation_targets(qtcreator LANGUAGES ${languages} OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${IDE_DATA_PATH}/translations" -- cgit v1.2.3