From 0b07b58abc1823b4e0e1ee7b70bf108f9f275ef0 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Wed, 10 Apr 2019 18:10:53 +0300 Subject: [PATCH] support kdeclarative both <5.45 and >=5.45 --- CMakeLists.txt | 6 ++++++ app/config-latte.h.cmake | 2 ++ app/infoview.cpp | 7 ++++++- app/view/settings/primaryconfigview.cpp | 6 +++++- app/view/settings/secondaryconfigview.cpp | 6 +++++- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bb1916c4..41414f9ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,12 @@ if(X11_FOUND AND XCB_XCB_FOUND) set(HAVE_X11 ON) endif() +string(REGEX MATCH "\\.([^]]+)\\." KF5_VERSION_MINOR ${KF5_VERSION}) +string(REGEX REPLACE "\\." "" KF5_VERSION_MINOR ${KF5_VERSION_MINOR}) + +message(STATUS "KF5 VERSION : ${KF5_VERSION}") +message(STATUS "KF5 VERSION MINOR : ${KF5_VERSION_MINOR}") + include(ECMQMLModules) ecm_find_qmlmodule(QtQuick 2.7) ecm_find_qmlmodule(QtQuick.Layouts 1.3) diff --git a/app/config-latte.h.cmake b/app/config-latte.h.cmake index 5fe7f9bf7..ac2d4da14 100644 --- a/app/config-latte.h.cmake +++ b/app/config-latte.h.cmake @@ -3,6 +3,8 @@ #cmakedefine01 HAVE_X11 +#cmakedefine KF5_VERSION_MINOR @KF5_VERSION_MINOR@ + #cmakedefine VERSION "@VERSION@" #cmakedefine WEBSITE "@WEBSITE@" diff --git a/app/infoview.cpp b/app/infoview.cpp index 66c548529..846e3344d 100644 --- a/app/infoview.cpp +++ b/app/infoview.cpp @@ -21,6 +21,7 @@ #include "infoview.h" // local +#include #include "wm/abstractwindowinterface.h" #include "view/panelshadows_p.h" @@ -81,9 +82,13 @@ void InfoView::init() KDeclarative::KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine()); kdeclarative.setTranslationDomain(QStringLiteral("latte-dock")); +#if KF5_VERSION_MINOR >= 45 kdeclarative.setupContext(); kdeclarative.setupEngine(engine()); - // kdeclarative.setupBindings(); +#else + kdeclarative.setupBindings(); +#endif + auto source = QUrl::fromLocalFile(m_corona->kPackage().filePath("infoviewui")); setSource(source); diff --git a/app/view/settings/primaryconfigview.cpp b/app/view/settings/primaryconfigview.cpp index 253c0de36..0f8a16170 100644 --- a/app/view/settings/primaryconfigview.cpp +++ b/app/view/settings/primaryconfigview.cpp @@ -21,6 +21,7 @@ #include "primaryconfigview.h" // local +#include #include "secondaryconfigview.h" #include "../panelshadows_p.h" #include "../view.h" @@ -152,9 +153,12 @@ void PrimaryConfigView::init() KDeclarative::KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine()); kdeclarative.setTranslationDomain(QStringLiteral("latte-dock")); +#if KF5_VERSION_MINOR >= 45 kdeclarative.setupContext(); kdeclarative.setupEngine(engine()); - //kdeclarative.setupBindings(); +#else + kdeclarative.setupBindings(); +#endif QByteArray tempFilePath = "lattedockconfigurationui"; diff --git a/app/view/settings/secondaryconfigview.cpp b/app/view/settings/secondaryconfigview.cpp index ba3e29f03..7c5531693 100644 --- a/app/view/settings/secondaryconfigview.cpp +++ b/app/view/settings/secondaryconfigview.cpp @@ -20,6 +20,7 @@ #include "secondaryconfigview.h" // local +#include #include "primaryconfigview.h" #include "../panelshadows_p.h" #include "../view.h" @@ -121,9 +122,12 @@ void SecondaryConfigView::init() KDeclarative::KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine()); kdeclarative.setTranslationDomain(QStringLiteral("latte-dock")); +#if KF5_VERSION_MINOR >= 45 kdeclarative.setupContext(); kdeclarative.setupEngine(engine()); - //kdeclarative.setupBindings(); +#else + kdeclarative.setupBindings(); +#endif QByteArray tempFilePath = "lattedocksecondaryconfigurationui";