1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-09 17:18:11 +03:00

support kdeclarative both <5.45 and >=5.45

This commit is contained in:
Michail Vourlakos 2019-04-10 18:10:53 +03:00
parent 86a7eddba5
commit 0b07b58abc
5 changed files with 24 additions and 3 deletions

View File

@ -44,6 +44,12 @@ if(X11_FOUND AND XCB_XCB_FOUND)
set(HAVE_X11 ON) set(HAVE_X11 ON)
endif() 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) include(ECMQMLModules)
ecm_find_qmlmodule(QtQuick 2.7) ecm_find_qmlmodule(QtQuick 2.7)
ecm_find_qmlmodule(QtQuick.Layouts 1.3) ecm_find_qmlmodule(QtQuick.Layouts 1.3)

View File

@ -3,6 +3,8 @@
#cmakedefine01 HAVE_X11 #cmakedefine01 HAVE_X11
#cmakedefine KF5_VERSION_MINOR @KF5_VERSION_MINOR@
#cmakedefine VERSION "@VERSION@" #cmakedefine VERSION "@VERSION@"
#cmakedefine WEBSITE "@WEBSITE@" #cmakedefine WEBSITE "@WEBSITE@"

View File

@ -21,6 +21,7 @@
#include "infoview.h" #include "infoview.h"
// local // local
#include <config-latte.h>
#include "wm/abstractwindowinterface.h" #include "wm/abstractwindowinterface.h"
#include "view/panelshadows_p.h" #include "view/panelshadows_p.h"
@ -81,9 +82,13 @@ void InfoView::init()
KDeclarative::KDeclarative kdeclarative; KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine()); kdeclarative.setDeclarativeEngine(engine());
kdeclarative.setTranslationDomain(QStringLiteral("latte-dock")); kdeclarative.setTranslationDomain(QStringLiteral("latte-dock"));
#if KF5_VERSION_MINOR >= 45
kdeclarative.setupContext(); kdeclarative.setupContext();
kdeclarative.setupEngine(engine()); kdeclarative.setupEngine(engine());
// kdeclarative.setupBindings(); #else
kdeclarative.setupBindings();
#endif
auto source = QUrl::fromLocalFile(m_corona->kPackage().filePath("infoviewui")); auto source = QUrl::fromLocalFile(m_corona->kPackage().filePath("infoviewui"));
setSource(source); setSource(source);

View File

@ -21,6 +21,7 @@
#include "primaryconfigview.h" #include "primaryconfigview.h"
// local // local
#include <config-latte.h>
#include "secondaryconfigview.h" #include "secondaryconfigview.h"
#include "../panelshadows_p.h" #include "../panelshadows_p.h"
#include "../view.h" #include "../view.h"
@ -152,9 +153,12 @@ void PrimaryConfigView::init()
KDeclarative::KDeclarative kdeclarative; KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine()); kdeclarative.setDeclarativeEngine(engine());
kdeclarative.setTranslationDomain(QStringLiteral("latte-dock")); kdeclarative.setTranslationDomain(QStringLiteral("latte-dock"));
#if KF5_VERSION_MINOR >= 45
kdeclarative.setupContext(); kdeclarative.setupContext();
kdeclarative.setupEngine(engine()); kdeclarative.setupEngine(engine());
//kdeclarative.setupBindings(); #else
kdeclarative.setupBindings();
#endif
QByteArray tempFilePath = "lattedockconfigurationui"; QByteArray tempFilePath = "lattedockconfigurationui";

View File

@ -20,6 +20,7 @@
#include "secondaryconfigview.h" #include "secondaryconfigview.h"
// local // local
#include <config-latte.h>
#include "primaryconfigview.h" #include "primaryconfigview.h"
#include "../panelshadows_p.h" #include "../panelshadows_p.h"
#include "../view.h" #include "../view.h"
@ -121,9 +122,12 @@ void SecondaryConfigView::init()
KDeclarative::KDeclarative kdeclarative; KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine()); kdeclarative.setDeclarativeEngine(engine());
kdeclarative.setTranslationDomain(QStringLiteral("latte-dock")); kdeclarative.setTranslationDomain(QStringLiteral("latte-dock"));
#if KF5_VERSION_MINOR >= 45
kdeclarative.setupContext(); kdeclarative.setupContext();
kdeclarative.setupEngine(engine()); kdeclarative.setupEngine(engine());
//kdeclarative.setupBindings(); #else
kdeclarative.setupBindings();
#endif
QByteArray tempFilePath = "lattedocksecondaryconfigurationui"; QByteArray tempFilePath = "lattedocksecondaryconfigurationui";