[libcalamaresui] Use API version to load slideshow differently
This commit is contained in:
parent
148b829591
commit
15ab98cb26
@ -72,7 +72,11 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
|
||||
innerLayout->addWidget( m_label );
|
||||
|
||||
cDebug() << "QML import paths:" << Logger::DebugList( m_qmlShow->engine()->importPathList() );
|
||||
if ( Branding::instance()->slideshowAPI() == 2 )
|
||||
{
|
||||
cDebug() << "QML load on startup.";
|
||||
loadQml();
|
||||
}
|
||||
|
||||
connect( JobQueue::instance(), &JobQueue::progress, this, &ExecutionViewStep::updateFromJobQueue );
|
||||
}
|
||||
@ -143,7 +147,7 @@ ExecutionViewStep::loadQml()
|
||||
QQmlComponent::CompilationMode::Asynchronous
|
||||
);
|
||||
}
|
||||
if ( m_qmlComponent )
|
||||
if ( m_qmlComponent && !m_qmlObject )
|
||||
{
|
||||
QObject* o = m_qmlComponent->create();
|
||||
m_qmlObject = qobject_cast< QQuickItem* >( o );
|
||||
@ -192,8 +196,16 @@ callQMLFunction( QQuickItem* qmlObject, const char* method )
|
||||
void
|
||||
ExecutionViewStep::onActivate()
|
||||
{
|
||||
loadQml();
|
||||
if ( Branding::instance()->slideshowAPI() == 2 )
|
||||
{
|
||||
// The QML was already loaded in the constructor, need to start it
|
||||
callQMLFunction( m_qmlObject, "onActivate" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// API version 1 assumes onCompleted is the trigger
|
||||
loadQml();
|
||||
}
|
||||
|
||||
JobQueue* queue = JobQueue::instance();
|
||||
foreach ( const QString& instanceKey, m_jobInstanceKeys )
|
||||
@ -238,10 +250,14 @@ ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message )
|
||||
|
||||
void
|
||||
ExecutionViewStep::onLeave()
|
||||
{
|
||||
// API version 2 is explicitly stopped; version 1 keeps running
|
||||
if ( Branding::instance()->slideshowAPI() == 2 )
|
||||
{
|
||||
callQMLFunction( m_qmlObject, "onLeave" );
|
||||
delete m_qmlObject;
|
||||
m_qmlObject = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user