Store current boot loader install path in PartitionCoreModule

This commit is contained in:
Aurélien Gâteau 2014-07-23 18:15:46 +02:00
parent ab4604258c
commit 06a13637b6
4 changed files with 28 additions and 0 deletions

View File

@ -283,3 +283,9 @@ PartitionCoreModule::findPartitionByMountPoint( const QString& mountPoint ) cons
}
return nullptr;
}
void
PartitionCoreModule::setBootLoaderInstallPath( const QString& path )
{
m_bootLoaderInstallPath = path;
}

View File

@ -62,6 +62,8 @@ public:
void formatPartition( Device* device, Partition* partition );
void setBootLoaderInstallPath( const QString& path );
QList< Calamares::job_ptr > jobs() const;
bool hasRootMountPoint() const
@ -93,6 +95,7 @@ private:
DeviceModel* m_deviceModel;
BootLoaderModel* m_bootLoaderModel;
bool m_hasRootMountPoint = false;
QString m_bootLoaderInstallPath;
void listDevices();
void updateHasRootMountPoint();

View File

@ -19,6 +19,7 @@
#include "PartitionPage.h"
// Local
#include <BootLoaderModel.h>
#include <CreatePartitionDialog.h>
#include <EditExistingPartitionDialog.h>
#include <DeviceModel.h>
@ -48,6 +49,7 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
m_ui->deviceComboBox->setModel( m_core->deviceModel() );
m_ui->bootLoaderComboBox->setModel( m_core->bootLoaderModel() );
updateButtons();
updateBootLoaderInstallPath();
connect( m_ui->deviceComboBox, &QComboBox::currentTextChanged,
[ this ]( const QString& /* text */ )
@ -74,6 +76,13 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
connect( model, &QAbstractItemModel::modelReset, this, &PartitionPage::updateButtons );
} );
connect( m_ui->bootLoaderComboBox, &QComboBox::currentTextChanged,
[ this ]( const QString& /* text */ )
{
updateBootLoaderInstallPath();
} );
connect( m_ui->newPartitionTableButton, &QAbstractButton::clicked, this, &PartitionPage::onNewPartitionTableClicked );
connect( m_ui->createButton, &QAbstractButton::clicked, this, &PartitionPage::onCreateClicked );
connect( m_ui->editButton, &QAbstractButton::clicked, this, &PartitionPage::onEditClicked );
@ -203,3 +212,12 @@ PartitionPage::editExistingPartition( Device* device, Partition* partition )
dlg->applyChanges( m_core );
delete dlg;
}
void
PartitionPage::updateBootLoaderInstallPath()
{
QVariant var = m_ui->bootLoaderComboBox->currentData( BootLoaderModel::BootLoaderPathRole );
if ( !var.isValid() )
return;
m_core->setBootLoaderInstallPath( var.toString() );
}

View File

@ -51,6 +51,7 @@ private:
void updatePartitionToCreate( Device*, Partition* );
void editExistingPartition( Device*, Partition* );
void updateBootLoaderInstallPath();
};
#endif // PARTITIONPAGE_H