From 4f41cf54a953edddd19f64188f093a74b5806124 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Thu, 23 Jun 2016 10:01:13 +0200 Subject: [PATCH] Hook up PartitionLabelsView to model. --- src/modules/partition/gui/PartitionPage.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index 16dc82a2d..2ba07606d 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -58,6 +58,9 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent ) , m_core( core ) { m_ui->setupUi( this ); + m_ui->partitionLabelsView->setVisible( + Calamares::JobQueue::instance()->globalStorage()-> + value( "alwaysShowPartitionLabels" ).toBool() ); m_ui->deviceComboBox->setModel( m_core->deviceModel() ); m_ui->bootLoaderComboBox->setModel( m_core->bootLoaderModel() ); PartitionBarsView::NestedPartitionsMode mode = Calamares::JobQueue::instance()->globalStorage()-> @@ -306,16 +309,25 @@ PartitionPage::updateFromCurrentDevice() PartitionModel* model = m_core->partitionModelForDevice( device ); m_ui->partitionBarsView->setModel( model ); + m_ui->partitionLabelsView->setModel( model ); m_ui->partitionTreeView->setModel( model ); m_ui->partitionTreeView->expandAll(); - // Make both views use the same selection model. + // Make all views use the same selection model. if ( m_ui->partitionBarsView->selectionModel() != - m_ui->partitionTreeView->selectionModel() ) + m_ui->partitionTreeView->selectionModel() || + m_ui->partitionBarsView->selectionModel() != + m_ui->partitionLabelsView->selectionModel() ) { + // Tree view QItemSelectionModel* selectionModel = m_ui->partitionTreeView->selectionModel(); m_ui->partitionTreeView->setSelectionModel( m_ui->partitionBarsView->selectionModel() ); selectionModel->deleteLater(); + + // Labels view + selectionModel = m_ui->partitionLabelsView->selectionModel(); + m_ui->partitionLabelsView->setSelectionModel( m_ui->partitionBarsView->selectionModel() ); + selectionModel->deleteLater(); } // This is necessary because even with the same selection model it might happen that @@ -327,6 +339,7 @@ PartitionPage::updateFromCurrentDevice() QModelIndex selectedIndex = m_ui->partitionBarsView->selectionModel()->currentIndex(); selectedIndex = selectedIndex.sibling( selectedIndex.row(), 0 ); m_ui->partitionBarsView->setCurrentIndex( selectedIndex ); + m_ui->partitionLabelsView->setCurrentIndex( selectedIndex ); }, Qt::UniqueConnection ); // Must be done here because we need to have a model set to define