diff --git a/nymea-app/images.qrc b/nymea-app/images.qrc index 0ccb1f66..dabaebe0 100644 --- a/nymea-app/images.qrc +++ b/nymea-app/images.qrc @@ -256,5 +256,6 @@ ui/images/sensors/water.svg ui/images/zigbee/deCONZ.svg ui/images/zigbee/NXP.svg + ui/images/nymea-splash-horizontal.svg diff --git a/nymea-app/main.cpp b/nymea-app/main.cpp index fd342d19..377210aa 100644 --- a/nymea-app/main.cpp +++ b/nymea-app/main.cpp @@ -88,6 +88,8 @@ int main(int argc, char *argv[]) parser.addOption(defaultViewsOption); QCommandLineOption kioskOption = QCommandLineOption({"k", "kiosk"}, "Start the application in kiosk mode."); parser.addOption(kioskOption); + QCommandLineOption splashOption = QCommandLineOption({"p", "splash"}, "Show a splash screen on startup."); + parser.addOption(splashOption); parser.process(application); // Initialize app log controller as early as possible, but after setting app name etc @@ -152,6 +154,7 @@ int main(int argc, char *argv[]) engine->rootContext()->setContextProperty("defaultMainViewFilter", parser.value(defaultViewsOption)); engine->rootContext()->setContextProperty("kioskMode", parser.isSet(kioskOption)); + engine->rootContext()->setContextProperty("showSplash", parser.isSet(splashOption)); engine->rootContext()->setContextProperty("autoConnectHost", parser.value(connectOption)); engine->rootContext()->setContextProperty("systemProductType", QSysInfo::productType()); diff --git a/nymea-app/nymea-app.pro b/nymea-app/nymea-app.pro index cd98c169..50757505 100644 --- a/nymea-app/nymea-app.pro +++ b/nymea-app/nymea-app.pro @@ -2,6 +2,8 @@ TEMPLATE=app TARGET=nymea-app include(../config.pri) +CONFIG += link_pkgconfig + QT += network qml quick quickcontrols2 svg websockets bluetooth charts gui-private nfc INCLUDEPATH += $$top_srcdir/libnymea-app @@ -53,6 +55,10 @@ win32 { QT += webview } +linux:!android: { + PKGCONFIG += ply-boot-client +} + android { include(../3rdParty/android/android_openssl/openssl.pri) @@ -184,11 +190,3 @@ BR=$$BRANDING target.path = /usr/bin INSTALLS += target -ANDROID_ABIS = armeabi-v7a arm64-v8a - -contains(ANDROID_TARGET_ARCH,) { - ANDROID_ABIS = \ - armeabi-v7a \ - arm64-v8a -} - diff --git a/nymea-app/platformhelper.cpp b/nymea-app/platformhelper.cpp index 584f4e2f..fcf84a4b 100644 --- a/nymea-app/platformhelper.cpp +++ b/nymea-app/platformhelper.cpp @@ -84,7 +84,7 @@ void PlatformHelper::requestPermissions() void PlatformHelper::hideSplashScreen() { - // No splash screen by default... + setSplashVisible(false); } @@ -173,6 +173,19 @@ void PlatformHelper::setBottomPanelColor(const QColor &color) } } +bool PlatformHelper::splashVisible() const +{ + return m_splashVisible; +} + +void PlatformHelper::setSplashVisible(bool splashVisible) +{ + if (m_splashVisible != splashVisible) { + m_splashVisible = splashVisible; + emit splashVisibleChanged(); + } +} + void PlatformHelper::vibrate(PlatformHelper::HapticsFeedback feedbackType) { Q_UNUSED(feedbackType) diff --git a/nymea-app/platformhelper.h b/nymea-app/platformhelper.h index 90bfc9bf..f3ad8edb 100644 --- a/nymea-app/platformhelper.h +++ b/nymea-app/platformhelper.h @@ -47,6 +47,7 @@ class PlatformHelper : public QObject Q_PROPERTY(QString deviceModel READ deviceModel CONSTANT) Q_PROPERTY(QString deviceManufacturer READ deviceManufacturer CONSTANT) Q_PROPERTY(QString machineHostname READ machineHostname CONSTANT) + Q_PROPERTY(bool splashVisible READ splashVisible WRITE setSplashVisible NOTIFY splashVisibleChanged) Q_PROPERTY(bool canControlScreen READ canControlScreen CONSTANT) Q_PROPERTY(int screenTimeout READ screenTimeout WRITE setScreenTimeout NOTIFY screenTimeoutChanged) Q_PROPERTY(int screenBrightness READ screenBrightness WRITE setScreenBrightness NOTIFY screenBrightnessChanged) @@ -85,7 +86,11 @@ public: virtual QColor bottomPanelColor() const; virtual void setBottomPanelColor(const QColor &color); + virtual bool splashVisible() const; + virtual void setSplashVisible(bool splashVisible); Q_INVOKABLE virtual void hideSplashScreen(); + + Q_INVOKABLE virtual void vibrate(HapticsFeedback feedbackType); Q_INVOKABLE virtual void toClipBoard(const QString &text); @@ -100,6 +105,7 @@ signals: void screenBrightnessChanged(); void topPanelColorChanged(); void bottomPanelColorChanged(); + void splashVisibleChanged(); protected: explicit PlatformHelper(QObject *parent = nullptr); @@ -109,6 +115,8 @@ private: QColor m_topPanelColor = QColor("black"); QColor m_bottomPanelColor = QColor("black"); + + bool m_splashVisible = true; }; #endif // PLATFORMHELPER_H diff --git a/nymea-app/platformintegration/generic/platformhelpergeneric.cpp b/nymea-app/platformintegration/generic/platformhelpergeneric.cpp index 93e7e717..6284e033 100644 --- a/nymea-app/platformintegration/generic/platformhelpergeneric.cpp +++ b/nymea-app/platformintegration/generic/platformhelpergeneric.cpp @@ -32,40 +32,43 @@ #include "logging.h" -Q_DECLARE_LOGGING_CATEGORY(dcPlatformIntergration) + +Q_DECLARE_LOGGING_CATEGORY(dcPlatformIntegration) + +#include PlatformHelperGeneric::PlatformHelperGeneric(QObject *parent) : PlatformHelper(parent) { - m_piHelper = new ScreenHelper(this); + m_screenHelper = new ScreenHelper(this); } bool PlatformHelperGeneric::canControlScreen() const { - return m_piHelper->active(); + return m_screenHelper->active(); } int PlatformHelperGeneric::screenTimeout() const { - return m_piHelper->screenTimeout(); + return m_screenHelper->screenTimeout(); } void PlatformHelperGeneric::setScreenTimeout(int timeout) { - if (m_piHelper->screenTimeout() != timeout) { - m_piHelper->setScreenTimeout(timeout); + if (m_screenHelper->screenTimeout() != timeout) { + m_screenHelper->setScreenTimeout(timeout); emit screenTimeoutChanged(); } } int PlatformHelperGeneric::screenBrightness() const { - return m_piHelper->screenBrightness(); + return m_screenHelper->screenBrightness(); } void PlatformHelperGeneric::setScreenBrightness(int percent) { - if (m_piHelper->screenBrightness() != percent) { - m_piHelper->setScreenBrightness(percent); + if (m_screenHelper->screenBrightness() != percent) { + m_screenHelper->setScreenBrightness(percent); emit screenTimeoutChanged(); } } diff --git a/nymea-app/platformintegration/generic/platformhelpergeneric.h b/nymea-app/platformintegration/generic/platformhelpergeneric.h index 46ade2ef..98e5d3f5 100644 --- a/nymea-app/platformintegration/generic/platformhelpergeneric.h +++ b/nymea-app/platformintegration/generic/platformhelpergeneric.h @@ -46,9 +46,8 @@ public: virtual void setScreenTimeout(int timeout) override; virtual int screenBrightness() const override; virtual void setScreenBrightness(int percent) override; - private: - ScreenHelper *m_piHelper = nullptr; + ScreenHelper *m_screenHelper = nullptr; }; #endif // PLATFORMHELPERGENERIC_H diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml index e5be9b25..57541941 100644 --- a/nymea-app/ui/Nymea.qml +++ b/nymea-app/ui/Nymea.qml @@ -556,4 +556,19 @@ ApplicationWindow { z: 1 anchors { left: parent.left; bottom: parent.bottom; right: parent.right } } + + Image { + id: splashScreen + parent: overlay + source: "/ui/images/nymea-splash-horizontal.svg" + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + opacity: PlatformHelper.splashVisible ? 1 : 0 + Behavior on opacity { NumberAnimation {duration: 300 }} + visible: showSplash && opacity > 0 + antialiasing: true + smooth: true + sourceSize.width: Math.max(width, height) + sourceSize.height: sourceSize.width + } } diff --git a/nymea-app/ui/RootItem.qml b/nymea-app/ui/RootItem.qml index 044bc324..24821a5a 100644 --- a/nymea-app/ui/RootItem.qml +++ b/nymea-app/ui/RootItem.qml @@ -236,7 +236,6 @@ Item { if (engine.jsonRpcClient.connected) { pageStack.push(Qt.resolvedUrl("MainPage.qml")) - PlatformHelper.hideSplashScreen(); return; } @@ -414,6 +413,7 @@ Item { if (!engine.thingManager.fetchingData) { updatePushNotificationThings() } + PlatformHelper.hideSplashScreen(); } } diff --git a/nymea-app/ui/images/nymea-splash-horizontal.svg b/nymea-app/ui/images/nymea-splash-horizontal.svg new file mode 100644 index 00000000..8df2c405 --- /dev/null +++ b/nymea-app/ui/images/nymea-splash-horizontal.svg @@ -0,0 +1,821 @@ + + + + + + image/svg+xml + + Artboard 1 copy 5 Kopie 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Artboard 1 copy 5 Kopie 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/android/res/drawable/splash.xml b/packaging/android/res/drawable/splash.xml index 4d0cdae0..e155ae71 100644 --- a/packaging/android/res/drawable/splash.xml +++ b/packaging/android/res/drawable/splash.xml @@ -2,11 +2,9 @@ - + - - - diff --git a/packaging/android/res/mipmap-anydpi/nymea_splash_horizontal.xml b/packaging/android/res/mipmap-anydpi/nymea_splash_horizontal.xml new file mode 100644 index 00000000..2f251e9a --- /dev/null +++ b/packaging/android/res/mipmap-anydpi/nymea_splash_horizontal.xml @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/ios/LaunchImage-iOS7@2x.png b/packaging/ios/LaunchImage-iOS7@2x.png index 1922b2ce..0f37e19d 100644 Binary files a/packaging/ios/LaunchImage-iOS7@2x.png and b/packaging/ios/LaunchImage-iOS7@2x.png differ diff --git a/packaging/linux-common/nymea-app-kiosk-wrapper b/packaging/linux-common/nymea-app-kiosk-wrapper index 793cb88c..6258b82c 100755 --- a/packaging/linux-common/nymea-app-kiosk-wrapper +++ b/packaging/linux-common/nymea-app-kiosk-wrapper @@ -1,5 +1,5 @@ #!/bin/sh export QT_IM_MODULE=qtvirtualkeyboard while [ true ]; do - /usr/bin/nymea-app --kiosk --connect nymeas://127.0.0.1:2222 + /usr/bin/nymea-app --kiosk --splash --connect nymeas://127.0.0.1:2222 done diff --git a/packaging/linux-common/nymea-app-kiosk.service b/packaging/linux-common/nymea-app-kiosk.service new file mode 100644 index 00000000..1cacb133 --- /dev/null +++ b/packaging/linux-common/nymea-app-kiosk.service @@ -0,0 +1,21 @@ +[Unit] +Description=nymea app kiosk +After=systemd-user-sessions.service + +# replaces plymouth-quit since lightdm quits plymouth on its own +Conflicts=plymouth-quit.service +After=plymouth-quit.service + +# nymea-app takes responsibility for stopping plymouth, so if it fails +# for any reason, make sure plymouth still stops +OnFailure=plymouth-quit.service + +[Service] +Environment=QT_QPA_EGLFS_ALWAYS_SET_MODE=1 QT_QPA_PLATFORM=eglfs QT_IM_MODULE=qtvirtualkeyboard +ExecStart=/usr/bin/nymea-app --kiosk --splash --connect nymeas://127.0.0.1:2222 +Restart=always +User=nymea +Group=nymea + +[Install] +WantedBy=multi-user.target diff --git a/packaging/linux-common/nymea-splash-horizontal.jpg b/packaging/linux-common/nymea-splash-horizontal.jpg new file mode 100755 index 00000000..d4dddd4d Binary files /dev/null and b/packaging/linux-common/nymea-splash-horizontal.jpg differ diff --git a/packaging/linux-common/nymea-splashscreen.service b/packaging/linux-common/nymea-splashscreen.service new file mode 100644 index 00000000..d6908d8f --- /dev/null +++ b/packaging/linux-common/nymea-splashscreen.service @@ -0,0 +1,13 @@ +[Unit] +Description=nymea sSplash screen +DefaultDependencies=no +After=local-fs.target + +[Service] +ExecStart=/usr/bin/fbi --noverbose -d /dev/fb0 -a /usr/share/nymea-splashscreen/nymea-splash-horizontal.jpg -fitwidth +StandardInput=tty +StandardOutput=tty +#TTYPath=/dev/tty1 + +[Install] +WantedBy=sysinit.target diff --git a/packaging/ubuntu/debian/control b/packaging/ubuntu/debian/control index 683c8511..2b4b441f 100644 --- a/packaging/ubuntu/debian/control +++ b/packaging/ubuntu/debian/control @@ -17,6 +17,7 @@ Build-Depends: debhelper (>= 9.0.0), qtconnectivity5-dev, qtdeclarative5-dev, qtquickcontrols2-5-dev, + libplymouth-dev, Package: nymea-app Architecture: any @@ -44,7 +45,7 @@ Description: A client app for nymea This package will install nymea:app, the client app and main user interface for nymea:core. -Package: nymea-app-kiosk +Package: nymea-app-kiosk-x11 Architecture: any Section: shells Multi-Arch: same @@ -54,5 +55,29 @@ Depends: nymea-app, qtvirtualkeyboard-plugin, xinit, Provides: lightdm-greeter +Conflicts: nymea-app-kiosk-wayland Description: Run nymea:app in kiosk mode - This package will install nymea:app in kiosk mode on your machine. + This package will install nymea:app in kiosk mode on your machine (using X11 and lightdm). + +Package: nymea-app-kiosk-wayland +Architecture: any +Section: shells +Multi-Arch: same +Depends: nymea-app, + qtvirtualkeyboard-plugin, +Conflicts: nymea-app-kiosk-x11, + lightdm +Replaces: nymea-app-kiosk +Provides: nymea-app-kiosk +Description: Run nymea:app in kiosk mode + This package will install nymea:app in kiosk mode on your machine (using wayland). + + +Package: nymea-splashscreen +Architecture: any +Section: shells +Multi-Arch: same +Depends: plymouth, +Description: A nymea branded fbi splash theme + This package will install a nymea branded boot splash using fbi. + diff --git a/packaging/ubuntu/debian/nymea-app-kiosk-wayland.install b/packaging/ubuntu/debian/nymea-app-kiosk-wayland.install new file mode 100644 index 00000000..2b84dd7c --- /dev/null +++ b/packaging/ubuntu/debian/nymea-app-kiosk-wayland.install @@ -0,0 +1,2 @@ +packaging/linux-common/nymea-app-kiosk.service /lib/systemd/system/ +packaging/linux-common/udev/90-pi-backlight.rules /lib/udev/rules.d/ diff --git a/packaging/ubuntu/debian/nymea-app-kiosk.install b/packaging/ubuntu/debian/nymea-app-kiosk-x11.install similarity index 100% rename from packaging/ubuntu/debian/nymea-app-kiosk.install rename to packaging/ubuntu/debian/nymea-app-kiosk-x11.install diff --git a/packaging/ubuntu/debian/nymea-splashscreen.install b/packaging/ubuntu/debian/nymea-splashscreen.install new file mode 100644 index 00000000..1acca22a --- /dev/null +++ b/packaging/ubuntu/debian/nymea-splashscreen.install @@ -0,0 +1,2 @@ +packaging/linux-common/nymea-splashscreen.service /lib/systemd/system/ +packaging/linux-common/nymea-splash-horizontal.jpg /usr/share/nymea-splashscreen/ diff --git a/packaging/ubuntu/debian/rules b/packaging/ubuntu/debian/rules index 41d42f22..71262a39 100755 --- a/packaging/ubuntu/debian/rules +++ b/packaging/ubuntu/debian/rules @@ -7,4 +7,4 @@ override_dh_missing: dh_missing --fail-missing %: - dh $@ --buildsystem=qmake --parallel + dh $@ --buildsystem=qmake --parallel --with systemd