From 148b829591e9af7f281b159ddfe3f6ae27c58fcc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 17 Jun 2019 10:58:14 +0200 Subject: [PATCH] [libcalamares] Introduce slideshowAPI setting --- src/branding/default/branding.desc | 11 +++++++++++ src/libcalamaresui/Branding.cpp | 9 +++++++++ src/libcalamaresui/Branding.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc index 1dd4de03a..1bd76cd29 100644 --- a/src/branding/default/branding.desc +++ b/src/branding/default/branding.desc @@ -93,6 +93,17 @@ images: # The slideshow is displayed during execution steps (e.g. when the # installer is actually writing to disk and doing other slow things). slideshow: "show.qml" +# There are two available APIs for the slideshow: +# - 1 (the default) loads the entire slideshow when the installation- +# slideshow page is shown and starts the QML then. The QML +# is never stopped (after installation is done, times etc. +# continue to fire). +# - 2 loads the slideshow on startup and calls onActivate() and +# onLeave() in the root object. After the installation is done, +# the show is stopped (first by calling onLeave(), then destroying +# the QML components). +slideshowAPI: 2 + # Colors for text and background components. # diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 48917f1ba..876fdfa80 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -127,6 +127,7 @@ Branding::Branding( const QString& brandingFilePath, , m_descriptorPath( brandingFilePath ) , m_welcomeStyleCalamares( false ) , m_welcomeExpandingLogo( true ) + , m_slideshowAPI( 1 ) { cDebug() << "Using Calamares branding file at" << brandingFilePath; @@ -234,6 +235,14 @@ Branding::Branding( const QString& brandingFilePath, } else bail( "Syntax error in slideshow sequence." ); + + int api = doc[ "slideshowAPI" ].IsScalar() ? doc[ "slideshowAPI" ].as() : -1; + if ( ( api < 1 ) || ( api > 2 ) ) + { + cWarning() << "Invalid or missing *slideshowAPI* in branding file."; + api = 1; + } + m_slideshowAPI = api; } catch ( YAML::Exception& e ) { diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index 23a7a7a49..a3909bc00 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -118,6 +118,7 @@ public: /** @brief Path to the slideshow QML file, if any. */ QString slideshowPath() const { return m_slideshowPath; } + int slideshowAPI() const { return m_slideshowAPI; } QString string( Branding::StringEntry stringEntry ) const; QString styleString( Branding::StyleEntry styleEntry ) const; @@ -172,6 +173,7 @@ private: QMap< QString, QString > m_images; QMap< QString, QString > m_style; QString m_slideshowPath; + int m_slideshowAPI; QString m_translationsPathPrefix; /** @brief Initialize the simple settings below */