@ -36,6 +36,7 @@
# include <QDir>
# include <QDir>
# include <QLabel>
# include <QLabel>
# include <QProgressBar>
# include <QProgressBar>
# include <QQmlComponent>
# include <QQmlEngine>
# include <QQmlEngine>
# include <QQuickWidget>
# include <QQuickWidget>
# include <QVBoxLayout>
# include <QVBoxLayout>
@ -49,7 +50,8 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
, m_progressBar ( new QProgressBar )
, m_progressBar ( new QProgressBar )
, m_label ( new QLabel )
, m_label ( new QLabel )
, m_qmlShow ( new QQuickWidget )
, m_qmlShow ( new QQuickWidget )
, m_qmlShowLoaded ( false )
, m_qmlComponent ( nullptr )
, m_qmlObject ( nullptr )
{
{
QVBoxLayout * layout = new QVBoxLayout ( m_widget ) ;
QVBoxLayout * layout = new QVBoxLayout ( m_widget ) ;
QVBoxLayout * innerLayout = new QVBoxLayout ;
QVBoxLayout * innerLayout = new QVBoxLayout ;
@ -72,11 +74,6 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
loadQml ( ) ;
loadQml ( ) ;
connect ( JobQueue : : instance ( ) , & JobQueue : : progress , this , & ExecutionViewStep : : updateFromJobQueue ) ;
connect ( JobQueue : : instance ( ) , & JobQueue : : progress , this , & ExecutionViewStep : : updateFromJobQueue ) ;
CALAMARES_RETRANSLATE_WIDGET ( m_widget ,
if ( m_qmlShowLoaded )
m_qmlShow - > setSource ( QUrl : : fromLocalFile ( Calamares : : Branding : : instance ( ) - > slideshowPath ( ) ) ) ;
)
}
}
@ -138,10 +135,12 @@ ExecutionViewStep::isAtEnd() const
void
void
ExecutionViewStep : : loadQml ( )
ExecutionViewStep : : loadQml ( )
{
{
if ( ! m_qml ShowLoaded & & ! Calamares : : Branding : : instance ( ) - > slideshowPath ( ) . isEmpty ( ) )
if ( ! m_qml Component & & ! Calamares : : Branding : : instance ( ) - > slideshowPath ( ) . isEmpty ( ) )
{
{
m_qmlShow - > setSource ( QUrl : : fromLocalFile ( Calamares : : Branding : : instance ( ) - > slideshowPath ( ) ) ) ;
m_qmlComponent = new QQmlComponent ( m_qmlShow - > engine ( ) ,
m_qmlShowLoaded = true ;
QUrl : : fromLocalFile ( Calamares : : Branding : : instance ( ) - > slideshowPath ( ) ) ,
QQmlComponent : : CompilationMode : : Asynchronous
) ;
}
}
}
}
@ -149,6 +148,12 @@ void
ExecutionViewStep : : onActivate ( )
ExecutionViewStep : : onActivate ( )
{
{
loadQml ( ) ;
loadQml ( ) ;
if ( m_qmlComponent )
{
m_qmlObject = m_qmlComponent - > create ( ) ;
cDebug ( ) < < " Created QML object " < < ( void * ) m_qmlObject < < m_qmlObject - > objectName ( ) ;
cDebug ( ) < < " Show root " < < m_qmlShow - > rootObject ( ) < < " context " < < m_qmlShow - > rootContext ( ) ;
}
JobQueue * queue = JobQueue : : instance ( ) ;
JobQueue * queue = JobQueue : : instance ( ) ;
foreach ( const QString & instanceKey , m_jobInstanceKeys )
foreach ( const QString & instanceKey , m_jobInstanceKeys )
@ -191,4 +196,11 @@ ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message )
m_label - > setText ( message ) ;
m_label - > setText ( message ) ;
}
}
void
ExecutionViewStep : : onLeave ( )
{
delete m_qmlObject ;
m_qmlObject = nullptr ;
}
} // namespace
} // namespace