[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.
This commit is contained in:
Adriaan de Groot 2020-03-11 04:37:10 +01:00
parent 290a708e56
commit b209668d33
2 changed files with 8 additions and 6 deletions

View File

@ -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();

View File

@ -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() );
}