Add support for plymouth

This commit is contained in:
Michael Zanetti 2021-03-18 23:34:07 +01:00
parent 952d37f478
commit b8aba4b4ce
4 changed files with 29 additions and 9 deletions

View File

@ -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
@ -52,6 +54,10 @@ win32 {
QT += webview
}
linux:!android: {
PKGCONFIG += ply-boot-client
}
android {
include(../3rdParty/android/android_openssl/openssl.pri)
@ -182,11 +188,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
}

View File

@ -32,7 +32,11 @@
#include "logging.h"
Q_DECLARE_LOGGING_CATEGORY(dcPlatformIntergration)
extern "C" {
#include <ply-boot-client.h>
}
Q_DECLARE_LOGGING_CATEGORY(dcPlatformIntegration)
PlatformHelperGeneric::PlatformHelperGeneric(QObject *parent) : PlatformHelper(parent)
{
@ -69,3 +73,19 @@ void PlatformHelperGeneric::setScreenBrightness(int percent)
emit screenTimeoutChanged();
}
}
void PlatformHelperGeneric::hideSplashScreen()
{
ply_event_loop_t *loop = ply_event_loop_new();
ply_boot_client_t *client = ply_boot_client_new();
bool status = ply_boot_client_connect(client, [] (void* data, ply_boot_client_t *) -> void {
PlatformHelperGeneric *thiz = reinterpret_cast<PlatformHelperGeneric*>(data);
// ply_event_loop_exit(this.loop, 0);
// ply_boot_client_free(client);
}, this);
if (!status) {
qCCritical(dcPlatformIntegration()) << "Cannot deactivate splash screen";
}
ply_boot_client_attach_to_event_loop(client, loop);
ply_boot_client_tell_daemon_to_deactivate(client, nullptr, nullptr, nullptr);
}

View File

@ -47,6 +47,7 @@ public:
virtual int screenBrightness() const override;
virtual void setScreenBrightness(int percent) override;
virtual void hideSplashScreen() override;
private:
ScreenHelper *m_piHelper = nullptr;
};

View File

@ -17,6 +17,7 @@ Build-Depends: debhelper (>= 9.0.0),
qtconnectivity5-dev,
qtdeclarative5-dev,
qtquickcontrols2-5-dev,
libplymouth-dev,
Package: nymea-app
Architecture: any