From 357f6a2fda0d881d3adcca0c85b084682d8d3cfb Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 6 Jul 2021 15:10:10 +0200 Subject: [PATCH] Make the webview work in the snap package --- clickable.json | 22 +------------- nymea-app/nymea-app.pro | 30 ++++++++++++------- .../generic/platformhelpergeneric.cpp | 2 ++ packaging/ubuntu/click/clickable.json | 21 +++++++++++++ packaging/ubuntu/click/manifest.json | 2 +- packaging/ubuntu/debian/control | 1 + packaging/ubuntu/snap/snapcraft.yaml | 6 ++++ 7 files changed, 51 insertions(+), 33 deletions(-) mode change 100644 => 120000 clickable.json create mode 100644 packaging/ubuntu/click/clickable.json diff --git a/clickable.json b/clickable.json deleted file mode 100644 index 1f45bd8e..00000000 --- a/clickable.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "builder": "qmake", - "kill": "nymea-app", - "build_args": "CONFIG+=ubports", - "dependencies_target": [ - "libavahi-client-dev", - "libavahi-common-dev", - "libqt5charts5-dev", - "qt5-default", - "qml-module-qtcharts", - "qml-module-qt-labs-calendar", - "libconnectivity-qt1-dev", - "libunity-api-dev" - ], - "install_lib": [ - "/usr/lib/${ARCH_TRIPLET}/libQt5Nfc.so*" - ], - "install_qml": [ - "/usr/lib/${ARCH_TRIPLET}/qt5/qml/Qt/labs/calendar/" - ] -} diff --git a/clickable.json b/clickable.json new file mode 120000 index 00000000..c75b255c --- /dev/null +++ b/clickable.json @@ -0,0 +1 @@ +packaging/ubuntu/click/clickable.json \ No newline at end of file diff --git a/nymea-app/nymea-app.pro b/nymea-app/nymea-app.pro index 0bbb7c8e..f28d65bf 100644 --- a/nymea-app/nymea-app.pro +++ b/nymea-app/nymea-app.pro @@ -6,6 +6,7 @@ TARGET=$${APPLICATION_NAME} CONFIG += link_pkgconfig QT += network qml quick quickcontrols2 svg websockets bluetooth charts gui-private nfc +!ubports: QT += webview INCLUDEPATH += $$top_srcdir/libnymea-app LIBS += -L$$top_builddir/libnymea-app/ -lnymea-app @@ -26,11 +27,9 @@ HEADERS += \ nfchelper.h \ nfcthingactionwriter.h \ platformintegration/generic/screenhelper.h \ - platformintegration/ubports/platformhelperubports.h \ stylecontroller.h \ pushnotifications.h \ platformhelper.h \ - platformintegration/generic/platformhelpergeneric.h \ ruletemplates/messages.h SOURCES += main.cpp \ @@ -40,18 +39,22 @@ SOURCES += main.cpp \ mouseobserver.cpp \ nfchelper.cpp \ nfcthingactionwriter.cpp \ - platformintegration/generic/screenhelper.cpp \ - platformintegration/ubports/platformhelperubports.cpp \ stylecontroller.cpp \ pushnotifications.cpp \ platformhelper.cpp \ - platformintegration/generic/platformhelpergeneric.cpp \ + platformintegration/generic/screenhelper.cpp RESOURCES += resources.qrc \ ruletemplates.qrc \ images.qrc \ translations.qrc \ +linux:!android:!ubports: { + HEADERS += platformintegration/generic/platformhelpergeneric.h + SOURCES += platformintegration/generic/platformhelpergeneric.cpp +} + + !equals(OVERLAY_PATH, "") { message("Resource overlay enabled. Will be using overlay from $${OVERLAY_PATH}") RESOURCES += $${OVERLAY_PATH}/overlay.qrc @@ -68,7 +71,7 @@ RESOURCES += resources.qrc \ android { include(../3rdParty/android/android_openssl/openssl.pri) - QT += androidextras webview + QT += androidextras HEADERS += platformintegration/android/platformhelperandroid.h SOURCES += platformintegration/android/platformhelperandroid.cpp @@ -98,7 +101,9 @@ android { } macx: { - QT += webview + HEADERS += platformintegration/generic/platformhelpergeneric.h + SOURCES += platformintegration/generic/platformhelpergeneric.cpp + PRODUCT_NAME=$$TARGET QMAKE_TARGET_BUNDLE_PREFIX = io.nymea @@ -120,7 +125,6 @@ macx: { ios: { message("iOS build") - QT += webview HEADERS += platformintegration/ios/platformhelperios.h SOURCES += platformintegration/ios/platformhelperios.cpp OBJECTIVE_SOURCES += $${IOS_PACKAGE_DIR}/platformhelperios.mm \ @@ -175,13 +179,17 @@ ubports: { CONFIG += link_pkgconfig PKGCONFIG += connectivity-qt1 - HEADERS += platformintegration/ubports/pushclient.h + HEADERS += platformintegration/ubports/pushclient.h \ + platformintegration/ubports/platformhelperubports.h \ - SOURCES += platformintegration/ubports/pushclient.cpp + SOURCES += platformintegration/ubports/pushclient.cpp \ + platformintegration/ubports/platformhelperubports.cpp \ } win32 { - QT += webview + HEADERS += platformintegration/generic/platformhelpergeneric.h + SOURCES += platformintegration/generic/platformhelpergeneric.cpp + equals(OVERLAY_PATH, "") { win32:RCC_ICONS += ../packaging/windows/packages/io.nymea.nymeaapp/meta/logo.ico } else { diff --git a/nymea-app/platformintegration/generic/platformhelpergeneric.cpp b/nymea-app/platformintegration/generic/platformhelpergeneric.cpp index 6284e033..c1709689 100644 --- a/nymea-app/platformintegration/generic/platformhelpergeneric.cpp +++ b/nymea-app/platformintegration/generic/platformhelpergeneric.cpp @@ -36,9 +36,11 @@ Q_DECLARE_LOGGING_CATEGORY(dcPlatformIntegration) #include +#include PlatformHelperGeneric::PlatformHelperGeneric(QObject *parent) : PlatformHelper(parent) { + QtWebView::initialize(); m_screenHelper = new ScreenHelper(this); } diff --git a/packaging/ubuntu/click/clickable.json b/packaging/ubuntu/click/clickable.json new file mode 100644 index 00000000..1f45bd8e --- /dev/null +++ b/packaging/ubuntu/click/clickable.json @@ -0,0 +1,21 @@ +{ + "builder": "qmake", + "kill": "nymea-app", + "build_args": "CONFIG+=ubports", + "dependencies_target": [ + "libavahi-client-dev", + "libavahi-common-dev", + "libqt5charts5-dev", + "qt5-default", + "qml-module-qtcharts", + "qml-module-qt-labs-calendar", + "libconnectivity-qt1-dev", + "libunity-api-dev" + ], + "install_lib": [ + "/usr/lib/${ARCH_TRIPLET}/libQt5Nfc.so*" + ], + "install_qml": [ + "/usr/lib/${ARCH_TRIPLET}/qt5/qml/Qt/labs/calendar/" + ] +} diff --git a/packaging/ubuntu/click/manifest.json b/packaging/ubuntu/click/manifest.json index 651a1226..ada061e7 100644 --- a/packaging/ubuntu/click/manifest.json +++ b/packaging/ubuntu/click/manifest.json @@ -15,5 +15,5 @@ }, "version": "1.0.100", "maintainer": "Michael Zanetti ", - "framework" : "ubuntu-sdk-16.04" + "framework" : "ubuntu-sdk-16.04.5" } diff --git a/packaging/ubuntu/debian/control b/packaging/ubuntu/debian/control index 9b9e8d17..0cefe19b 100644 --- a/packaging/ubuntu/debian/control +++ b/packaging/ubuntu/debian/control @@ -12,6 +12,7 @@ Build-Depends: debhelper (>= 9.0.0), libqt5charts5-dev, libqt5svg5-dev, libqt5websockets5-dev, + libqt5webview5-dev, qt5-default, qtbase5-dev, qtconnectivity5-dev, diff --git a/packaging/ubuntu/snap/snapcraft.yaml b/packaging/ubuntu/snap/snapcraft.yaml index 7d21cc10..9967586c 100644 --- a/packaging/ubuntu/snap/snapcraft.yaml +++ b/packaging/ubuntu/snap/snapcraft.yaml @@ -17,6 +17,11 @@ architectures: - build-on: arm64 - build-on: armhf +# Required for QtWebEngine +layout: + /usr/share/qt5: + bind: $SNAP/usr/share/qt5 + apps: daemon: daemon: simple @@ -113,6 +118,7 @@ parts: - qml-module-qtquick-controls2 - qml-module-qtquick-layouts - qml-module-qtquick-window2 + - qml-module-qtwebview - qml-module-qt-labs-calendar - qml-module-qt-labs-settings - qml-module-qt-labs-folderlistmodel