From b209668d3387929cad57b29b35a24a6aa87184f9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 11 Mar 2020 04:37:10 +0100 Subject: [PATCH] [calamares] Fix singleton-ness of the progress view - Create the ViewManager earlier, - Create a ProgressTreeModel here for the view, - Do not weirdly set the model much later. --- src/calamares/CalamaresApplication.cpp | 4 ++-- src/calamares/CalamaresWindow.cpp | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index 234d5d45c..576a7c182 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -339,8 +339,8 @@ CalamaresApplication::initViewSteps() m_mainwindow->show(); } - ProgressTreeModel* m = new ProgressTreeModel( nullptr ); - ProgressTreeView::instance()->setModel( m ); + // ProgressTreeModel* m = new ProgressTreeModel( nullptr ); + // ProgressTreeView::instance()->setModel( m ); cDebug() << "STARTUP: Window now visible and ProgressTreeView populated"; const auto steps = Calamares::ViewManager::instance()->viewSteps(); diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index d1c6f3bba..33e3ff3c5 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -25,6 +25,7 @@ #include "DebugWindow.h" #include "Settings.h" #include "ViewManager.h" +#include "progresstree/ProgressTreeModel.h" #include "progresstree/ProgressTreeView.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" @@ -93,8 +94,9 @@ CalamaresWindow::getWidgetSidebar( int desiredWidth ) logoLayout->addStretch(); ProgressTreeView* tv = new ProgressTreeView( sideBox ); - sideLayout->addWidget( tv ); + tv->setModel( new ProgressTreeModel ); tv->setFocusPolicy( Qt::NoFocus ); + sideLayout->addWidget( tv ); if ( Calamares::Settings::instance()->debugMode() || ( Logger::logLevel() >= Logger::LOGVERBOSE ) ) { @@ -169,6 +171,8 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) cDebug() << Logger::SubEntry << "Proposed window size:" << w << h; resize( w, h ); + m_viewManager = Calamares::ViewManager::instance( this ); + QBoxLayout* mainLayout = new QHBoxLayout; setLayout( mainLayout ); @@ -183,9 +187,6 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) mainLayout->addWidget( sideBox ); } - CalamaresUtils::unmarginLayout( mainLayout ); - - m_viewManager = Calamares::ViewManager::instance( this ); if ( branding->windowExpands() ) { connect( m_viewManager, &Calamares::ViewManager::enlarge, this, &CalamaresWindow::enlarge ); @@ -200,6 +201,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) // event, which is also the ViewManager's responsibility. mainLayout->addWidget( m_viewManager->centralWidget() ); + CalamaresUtils::unmarginLayout( mainLayout ); setStyleSheet( Calamares::Branding::instance()->stylesheet() ); }