diff --git a/CMakeLists.txt b/CMakeLists.txt index 16e5f4a6f..d06c613ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,132 +13,42 @@ set(KF5_MIN_VERSION "5.26.0") set(KF5_LOCALE_PREFIX "") -include(Definitions.cmake) - find_package(ECM 1.8.0 REQUIRED NO_MODULE) - set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED NO_MODULE COMPONENTS Quick Qml) - find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma PlasmaQuick WindowSystem Declarative Activities I18n CoreAddons XmlGui DBusAddons IconThemes Wayland) find_package(X11 REQUIRED) set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries" - URL "http://www.x.org" - TYPE OPTIONAL - PURPOSE "Required for building the X11 based workspace") + URL "http://www.x.org" + TYPE OPTIONAL + PURPOSE "Required for building the X11 based workspace") if(X11_FOUND) - find_package(XCB MODULE REQUIRED COMPONENTS XCB) - set_package_properties(XCB PROPERTIES TYPE REQUIRED) - find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS X11Extras) + find_package(XCB MODULE REQUIRED COMPONENTS XCB) + set_package_properties(XCB PROPERTIES TYPE REQUIRED) + find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS X11Extras) endif() if(X11_FOUND AND XCB_XCB_FOUND) - set(HAVE_X11 true) + set(HAVE_X11 ON) endif() -FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt) - -IF(NOT GETTEXT_MSGFMT_EXECUTABLE) - MESSAGE( -"------ - NOTE: msgfmt not found. Translations will *not* be installed -------") -ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE) - - #containment translations - SET(catalogname plasma_applet_org.kde.latte.containment) - ADD_CUSTOM_TARGET(translations-containment ALL) - - FILE(GLOB PO_FILES po/containment/*.po) - - FOREACH(_poFile ${PO_FILES}) - GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME) - STRING(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} ) - STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} ) - - IF( _langCode ) - GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/containment/${_lang}.gmo) - - ADD_CUSTOM_COMMAND(TARGET translations-containment - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile} - DEPENDS ${_poFile}) - INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo) - ENDIF( _langCode ) - ENDFOREACH(_poFile ${PO_FILES}) - - #plasmoid translations - SET(catalogname-plasmoid plasma_applet_org.kde.latte.plasmoid) - ADD_CUSTOM_TARGET(translations-plasmoid ALL) - - FILE(GLOB PO_FILES_PLASMOID po/plasmoid/*.po) - - FOREACH(_poFile ${PO_FILES_PLASMOID}) - GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME) - STRING(REGEX REPLACE "^${catalogname-plasmoid}_?" "" _langCode ${_poFileName} ) - STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} ) +include(KDEInstallDirs) +include(KDECMakeSettings) +include(KDECompilerSettings NO_POLICY_SCOPE) +include(CMakePackageConfigHelpers) +include(WriteBasicConfigVersionFile) +include(CheckIncludeFiles) +include(ECMOptionalAddSubdirectory) +include(ECMQtDeclareLoggingCategory) +include(KDEPackageAppTemplates) - IF( _langCode ) - GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/plasmoid/${_lang}.gmo) - - ADD_CUSTOM_COMMAND(TARGET translations-plasmoid - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile} - DEPENDS ${_poFile}) - INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ RENAME ${catalogname-plasmoid}.mo) - ENDIF( _langCode ) - ENDFOREACH(_poFile ${PO_FILES}) - - #shell translations - #SET(catalogname-shell plasma_shell_org.kde.latte.shell) - #ADD_CUSTOM_TARGET(translations-shell ALL) - - #FILE(GLOB PO_FILES_SHELL po/shell/*.po) - - #FOREACH(_poFile ${PO_FILES_SHELL}) - # GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME) - # STRING(REGEX REPLACE "^${catalogname-shell}_?" "" _langCode ${_poFileName} ) - # STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} ) - - # IF( _langCode ) - # GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE) - # SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/shell/${_lang}.gmo) - - # ADD_CUSTOM_COMMAND(TARGET translations-shell - # COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile} - # DEPENDS ${_poFile}) - # INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ RENAME ${catalogname-shell}.mo) - # ENDIF( _langCode ) - #ENDFOREACH(_poFile ${PO_FILES}) - - #app translations - SET(catalogname-app latte-dock) - ADD_CUSTOM_TARGET(translations-app ALL) - - FILE(GLOB PO_FILES_CORONA po/app/*.po) - - FOREACH(_poFile ${PO_FILES_CORONA}) - GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME) - STRING(REGEX REPLACE "^${catalogname-app}_?" "" _langCode ${_poFileName} ) - STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} ) - - IF( _langCode ) - GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/app/${_lang}.gmo) - - ADD_CUSTOM_COMMAND(TARGET translations-app - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile} - DEPENDS ${_poFile}) - INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ RENAME ${catalogname-app}.mo) - ENDIF( _langCode ) - ENDFOREACH(_poFile ${PO_FILES}) - -ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE) +include(Definitions.cmake) +include(Locale.cmake) add_subdirectory(app) add_subdirectory(liblattedock) diff --git a/Definitions.cmake b/Definitions.cmake index 3e79ca112..e75512dc2 100644 --- a/Definitions.cmake +++ b/Definitions.cmake @@ -2,15 +2,8 @@ file(READ TRANSLATORS translators_str) string(REGEX REPLACE "\n" ";" translators_list "${translators_str}") -list(GET translators_list 0 translators) -list(GET translators_list 1 translators_email) - -add_definitions( - -DLATTE_VERSION="${VERSION}" - -DWEBSITE="${WEBSITE}" - -DBUG_ADDRESS="${BUG_ADDRESS}" - -DTRANSLATORS="${translators}" - -DTRANSLATORS_EMAIL="${translators_email}" -) - +list(GET translators_list 0 TRANSLATORS) +list(GET translators_list 1 TRANSLATORS_EMAIL) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/app/config-latte.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/app/config-latte.h) diff --git a/Locale.cmake b/Locale.cmake new file mode 100644 index 000000000..d65855ad7 --- /dev/null +++ b/Locale.cmake @@ -0,0 +1,81 @@ +find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt) + +if(NOT GETTEXT_MSGFMT_EXECUTABLE) + message(WARNING "-- msgfmt: not found. Translations will *not* be installed") + +else() + #containment translations + set(catalogname plasma_applet_org.kde.latte.containment) + add_custom_target(translations-containment ALL) + + file(GLOB PO_FILES po/containment/*.po) + + foreach(_poFile ${PO_FILES}) + get_filename_component(_poFileName ${_poFile} NAME) + string(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName}) + string(REGEX REPLACE "\\.po$" "" _langCode ${_langCode}) + + if(_langCode) + get_filename_component(_lang ${_poFile} NAME_WE) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/containment/${_lang}.gmo) + + add_custom_command(TARGET translations-containment + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile} + DEPENDS ${_poFile}) + + install(FILES ${_gmoFile} + DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ + RENAME ${catalogname}.mo) + endif() + endforeach() + + #plasmoid translations + set(catalogname-plasmoid plasma_applet_org.kde.latte.plasmoid) + add_custom_target(translations-plasmoid ALL) + + file(GLOB PO_FILES_PLASMOID po/plasmoid/*.po) + + foreach(_poFile ${PO_FILES_PLASMOID}) + get_filename_component(_poFileName ${_poFile} NAME) + string(REGEX REPLACE "^${catalogname-plasmoid}_?" "" _langCode ${_poFileName}) + string(REGEX REPLACE "\\.po$" "" _langCode ${_langCode}) + + if(_langCode) + get_filename_component(_lang ${_poFile} NAME_WE) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/plasmoid/${_lang}.gmo) + + add_custom_command(TARGET translations-plasmoid + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile} + DEPENDS ${_poFile}) + + install(FILES ${_gmoFile} + DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ + RENAME ${catalogname-plasmoid}.mo) + endif() + endforeach() + + #app translations + set(catalogname-app latte-dock) + add_custom_target(translations-app ALL) + + file(GLOB PO_FILES_CORONA po/app/*.po) + + foreach(_poFile ${PO_FILES_CORONA}) + get_filename_component(_poFileName ${_poFile} NAME) + string(REGEX REPLACE "^${catalogname-app}_?" "" _langCode ${_poFileName} ) + string(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} ) + + if(_langCode) + get_filename_component(_lang ${_poFile} NAME_WE) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/app/${_lang}.gmo) + + add_custom_command(TARGET translations-app + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile} + DEPENDS ${_poFile}) + + install(FILES ${_gmoFile} + DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ + RENAME ${catalogname-app}.mo) + endif() + endforeach() +endif() diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 7af4717d6..c9cb8ea10 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,16 +1,3 @@ -include(KDEInstallDirs) -include(KDECMakeSettings) -#include(KDECompilerSettings NO_POLICY_SCOPE) -#include(ECMPackageConfigHelpers) -include(CMakePackageConfigHelpers) -include(WriteBasicConfigVersionFile) -include(CheckIncludeFiles) -include(ECMOptionalAddSubdirectory) -include(ECMQtDeclareLoggingCategory) -include(KDEPackageAppTemplates) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-latte.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-latte.h) - set(lattedock-app_SRCS ../liblattedock/dock.cpp ../liblattedock/windowsystem.cpp @@ -32,11 +19,9 @@ add_executable(latte-dock ${lattedock-app_SRCS}) include(FakeTarget.cmake) -target_link_libraries( - latte-dock +target_link_libraries(latte-dock Qt5::Quick Qt5::Qml - Qt5::X11Extras KF5::I18n KF5::Declarative KF5::CoreAddons @@ -45,14 +30,17 @@ target_link_libraries( KF5::PlasmaQuick KF5::Activities KF5::QuickAddons - KF5::WindowSystem KF5::WaylandClient ) if(HAVE_X11) - target_link_libraries(latte-dock ${X11_LIBRARIES} ${XCB_LIBRARIES}) + target_link_libraries(latte-dock + Qt5::X11Extras + KF5::WindowSystem + ${X11_LIBRARIES} + ${XCB_LIBRARIES} + ) endif() install(TARGETS latte-dock ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) -#even if hidden, the desktop file is needed anyways for kdbusservice::unique install(FILES latte-dock.desktop DESTINATION ${KDE_INSTALL_APPDIR}) diff --git a/app/config-latte.h.cmake b/app/config-latte.h.cmake index 89858d17d..6e35b24c2 100644 --- a/app/config-latte.h.cmake +++ b/app/config-latte.h.cmake @@ -1 +1,11 @@ #cmakedefine01 HAVE_X11 + +#cmakedefine VERSION "@VERSION@" + +#cmakedefine WEBSITE "@WEBSITE@" + +#cmakedefine BUG_ADDRESS "@BUG_ADDRESS@" + +#cmakedefine TRANSLATORS "@TRANSLATORS@" + +#cmakedefine TRANSLATORS_EMAIL "@TRANSLATORS_EMAIL@" diff --git a/app/main.cpp b/app/main.cpp index 3e02a33b5..0dbc21c11 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -19,6 +19,7 @@ */ #include "dockcorona.h" +#include "config-latte.h" #include @@ -96,7 +97,7 @@ inline void configureAboutData() { KAboutData about(QStringLiteral("lattedock") , QStringLiteral("Latte Dock") - , QStringLiteral(LATTE_VERSION) + , QStringLiteral(VERSION) , i18n("Latte is a dock based on plasma frameworks that provides an elegant and " "intuitive experience for your tasks and plasmoids. It animates its contents " "by using parabolic zoom effect and trys to be there only when it is needed." diff --git a/containment.metadata.desktop.template b/containment.metadata.desktop.template deleted file mode 100644 index b0535b578..000000000 --- a/containment.metadata.desktop.template +++ /dev/null @@ -1,22 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -_Name=Latte -_Comment=Containment provided for the Latte Dock - -Type=Service -Keywords= -NoDisplay=true - -X-KDE-PluginInfo-Author=@AUTHOR@ -X-KDE-PluginInfo-Email=@EMAIL@ -X-KDE-PluginInfo-Name=org.kde.latte.containment -X-KDE-PluginInfo-Version=@VERSION@ -X-KDE-PluginInfo-Website=@WEBSITE@ -X-KDE-PluginInfo-Category= -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml -X-Plasma-ContainmentType=Panel diff --git a/containment/CMakeLists.txt b/containment/CMakeLists.txt index f650adcaa..b56ef9b91 100644 --- a/containment/CMakeLists.txt +++ b/containment/CMakeLists.txt @@ -1,3 +1,2 @@ file(COPY "contents" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/release) -#update the version number in the configuration window configure_file(metadata.desktop.cmake release/metadata.desktop) diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index 5aa6bd57e..cbc928d4c 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -3,7 +3,7 @@ include(ECMInstallIcons) ecm_install_icons(ICONS 16-apps-latte-dock.svg 22-apps-latte-dock.svg - 24-apps-latte-dock.svg + 24-apps-latte-dock.svg 32-apps-latte-dock.svg 48-apps-latte-dock.svg sc-apps-latte-dock.svg @@ -11,4 +11,3 @@ THEME hicolor DESTINATION ${ICON_INSTALL_DIR}) install(FILES org.kde.latte.plasmoid.svg DESTINATION ${ICON_INSTALL_DIR}/breeze/applets/256) - diff --git a/liblattedock/CMakeLists.txt b/liblattedock/CMakeLists.txt index 64b185222..3d0910afc 100644 --- a/liblattedock/CMakeLists.txt +++ b/liblattedock/CMakeLists.txt @@ -1,38 +1,25 @@ -set (REQUIRED_QT_VERSION "5.6.0") - -find_package(ECM 1.8.0 REQUIRED NO_MODULE) -find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Quick Qml) - -find_package(KF5 REQUIRED COMPONENTS - WindowSystem - CoreAddons - Plasma - PlasmaQuick - IconThemes -) - -set(CMAKE_AUTOMOC ON) - set(lattedock_SRCS lattedockplugin.cpp windowsystem.cpp dock.cpp iconitem.cpp ) - + add_library(lattedockplugin SHARED ${lattedock_SRCS}) target_link_libraries(lattedockplugin - Qt5::Quick - Qt5::Qml - KF5::WindowSystem - KF5::CoreAddons - KF5::Plasma - KF5::PlasmaQuick - KF5::QuickAddons - KF5::IconThemes + Qt5::Quick + Qt5::Qml + KF5::CoreAddons + KF5::Plasma + KF5::PlasmaQuick + KF5::QuickAddons + KF5::IconThemes ) -install(TARGETS lattedockplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte) +if(HAVE_X11) + target_link_libraries(lattedockplugin KF5::WindowSystem) +endif() +install(TARGETS lattedockplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte) install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte) diff --git a/plasmoid.metadata.desktop.template b/plasmoid.metadata.desktop.template deleted file mode 100644 index 6ab029e6e..000000000 --- a/plasmoid.metadata.desktop.template +++ /dev/null @@ -1,23 +0,0 @@ -[Desktop Entry] -_Name=Latte Plasmoid -_Comment=Plasmoid from the Latte Dock - - -Type=Service -Icon=latte-dock -X-KDE-ServiceTypes=Plasma/Applet -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml -X-Plasma-Provides=org.kde.plasma.multitasking -X-KDE-PluginInfo-Author=@AUTHOR@ -X-KDE-PluginInfo-Email=@EMAIL@ -X-KDE-PluginInfo-Name=org.kde.latte.plasmoid -X-KDE-PluginInfo-Version=@VERSION@ -X-KDE-PluginInfo-Website=@WEBSITE@ -X-KDE-PluginInfo-Category=Windows and Tasks -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL v2+ -X-KDE-PluginInfo-EnabledByDefault=true - - - diff --git a/plasmoid/CMakeLists.txt b/plasmoid/CMakeLists.txt index f68a970ff..b56ef9b91 100644 --- a/plasmoid/CMakeLists.txt +++ b/plasmoid/CMakeLists.txt @@ -1,6 +1,2 @@ file(COPY "contents" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/release) -#update the version number in the configuration window -file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/release/contents/ui/ConfigAppearance.qml.cmake) configure_file(metadata.desktop.cmake release/metadata.desktop) -configure_file(contents/ui/ConfigAppearance.qml.cmake release/contents/ui/ConfigAppearance.qml) - diff --git a/shell.metadata.desktop.template b/shell.metadata.desktop.template deleted file mode 100644 index 2b5e85107..000000000 --- a/shell.metadata.desktop.template +++ /dev/null @@ -1,16 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -_Name=Latte Shell -_Comment=Shell provided for the Latte Dock - -Keywords=shell -Type=Service - -X-KDE-ServiceTypes=Plasma/Shell -X-KDE-ParentApp=latte-dock -X-KDE-PluginInfo-Author=@AUTHOR@ -X-KDE-PluginInfo-Email=@EMAIL@ -X-KDE-PluginInfo-License=GPLv3+ -X-KDE-PluginInfo-Name=org.kde.latte.shell -X-KDE-PluginInfo-Version=@VERSION@ -X-KDE-PluginInfo-Website=@WEBSITE@ diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt index 74ad8a49d..ffcbcb6e1 100644 --- a/shell/CMakeLists.txt +++ b/shell/CMakeLists.txt @@ -1,3 +1,3 @@ file(COPY "contents" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/release) -file(COPY "defaults" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/release) configure_file(metadata.desktop.cmake release/metadata.desktop) +