Make the bars/labels views members in ChoicePage.
This commit is contained in:
parent
b663ce5f74
commit
2258c806ae
@ -67,6 +67,8 @@ ChoicePage::ChoicePage( QWidget* parent )
|
|||||||
, m_deviceInfoWidget( nullptr )
|
, m_deviceInfoWidget( nullptr )
|
||||||
, m_lastSelectedDeviceIndex( -1 )
|
, m_lastSelectedDeviceIndex( -1 )
|
||||||
, m_isEfi( false )
|
, m_isEfi( false )
|
||||||
|
, m_beforePartitionBarsView( nullptr )
|
||||||
|
, m_beforePartitionLabelsView( nullptr )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
|
||||||
@ -430,6 +432,16 @@ ChoicePage::applyActionChoice( Device* currentDevice, ChoicePage::Choice choice
|
|||||||
PartitionActions::doAutopartition( m_core, selectedDevice() );
|
PartitionActions::doAutopartition( m_core, selectedDevice() );
|
||||||
break;
|
break;
|
||||||
case Replace:
|
case Replace:
|
||||||
|
connect( m_beforePartitionBarsView->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
||||||
|
this, [ this ]( const QModelIndex& current, const QModelIndex& previous )
|
||||||
|
{
|
||||||
|
if ( m_core->isDirty() )
|
||||||
|
m_core->clearJobs();
|
||||||
|
|
||||||
|
PartitionActions::doReplacePartition( m_core,
|
||||||
|
selectedDevice(),
|
||||||
|
( Partition* )( current.data( PartitionModel::PartitionPtrRole ).value< void* >() ) );
|
||||||
|
} );
|
||||||
|
|
||||||
case NoChoice:
|
case NoChoice:
|
||||||
case Manual:
|
case Manual:
|
||||||
@ -461,41 +473,41 @@ ChoicePage::updateDeviceStatePreview( Device* currentDevice )
|
|||||||
CalamaresUtils::unmarginLayout( layout );
|
CalamaresUtils::unmarginLayout( layout );
|
||||||
layout->setSpacing( 6 );
|
layout->setSpacing( 6 );
|
||||||
|
|
||||||
PartitionBarsView* preview = new PartitionBarsView( m_previewBeforeFrame );
|
m_beforePartitionBarsView = new PartitionBarsView( m_previewBeforeFrame );
|
||||||
PartitionLabelsView* previewLabels = new PartitionLabelsView( m_previewBeforeFrame );
|
m_beforePartitionLabelsView = new PartitionLabelsView( m_previewBeforeFrame );
|
||||||
|
|
||||||
Device* deviceBefore = m_core->createImmutableDeviceCopy( currentDevice );
|
Device* deviceBefore = m_core->createImmutableDeviceCopy( currentDevice );
|
||||||
|
|
||||||
PartitionModel* model = new PartitionModel( preview );
|
PartitionModel* model = new PartitionModel( m_beforePartitionBarsView );
|
||||||
model->init( deviceBefore, m_core->osproberEntries() );
|
model->init( deviceBefore, m_core->osproberEntries() );
|
||||||
|
|
||||||
// The QObject parents tree is meaningful for memory management here,
|
// The QObject parents tree is meaningful for memory management here,
|
||||||
// see qDeleteAll above.
|
// see qDeleteAll above.
|
||||||
deviceBefore->setParent( model );
|
deviceBefore->setParent( model );
|
||||||
model->setParent( preview );
|
model->setParent( m_beforePartitionBarsView );
|
||||||
|
|
||||||
preview->setModel( model );
|
m_beforePartitionBarsView->setModel( model );
|
||||||
previewLabels->setModel( model );
|
m_beforePartitionLabelsView->setModel( model );
|
||||||
|
|
||||||
// Make the bars and labels view use the same selectionModel.
|
// Make the bars and labels view use the same selectionModel.
|
||||||
auto sm = previewLabels->selectionModel();
|
auto sm = m_beforePartitionLabelsView->selectionModel();
|
||||||
previewLabels->setSelectionModel( preview->selectionModel() );
|
m_beforePartitionLabelsView->setSelectionModel( m_beforePartitionBarsView->selectionModel() );
|
||||||
sm->deleteLater();
|
sm->deleteLater();
|
||||||
|
|
||||||
switch ( m_choice )
|
switch ( m_choice )
|
||||||
{
|
{
|
||||||
case Replace:
|
case Replace:
|
||||||
case Alongside:
|
case Alongside:
|
||||||
preview->setSelectionMode( QAbstractItemView::SingleSelection );
|
m_beforePartitionBarsView->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||||
previewLabels->setSelectionMode( QAbstractItemView::SingleSelection );
|
m_beforePartitionLabelsView->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
preview->setSelectionMode( QAbstractItemView::NoSelection );
|
m_beforePartitionBarsView->setSelectionMode( QAbstractItemView::NoSelection );
|
||||||
previewLabels->setSelectionMode( QAbstractItemView::NoSelection );
|
m_beforePartitionLabelsView->setSelectionMode( QAbstractItemView::NoSelection );
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->addWidget( preview );
|
layout->addWidget( m_beforePartitionBarsView );
|
||||||
layout->addWidget( previewLabels );
|
layout->addWidget( m_beforePartitionLabelsView );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "core/OsproberEntry.h"
|
#include "core/OsproberEntry.h"
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
class QBoxLayout;
|
class QBoxLayout;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
@ -33,6 +34,8 @@ class QLabel;
|
|||||||
class QListView;
|
class QListView;
|
||||||
|
|
||||||
class ExpandableRadioButton;
|
class ExpandableRadioButton;
|
||||||
|
class PartitionBarsView;
|
||||||
|
class PartitionLabelsView;
|
||||||
class PartitionCoreModule;
|
class PartitionCoreModule;
|
||||||
class PrettyRadioButton;
|
class PrettyRadioButton;
|
||||||
class DeviceInfoWidget;
|
class DeviceInfoWidget;
|
||||||
@ -97,6 +100,9 @@ private:
|
|||||||
|
|
||||||
DeviceInfoWidget* m_deviceInfoWidget;
|
DeviceInfoWidget* m_deviceInfoWidget;
|
||||||
|
|
||||||
|
QPointer< PartitionBarsView > m_beforePartitionBarsView;
|
||||||
|
QPointer< PartitionLabelsView > m_beforePartitionLabelsView;
|
||||||
|
|
||||||
int m_lastSelectedDeviceIndex;
|
int m_lastSelectedDeviceIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user