swapDevice in BootLoaderModel.

This commit is contained in:
Teo Mrnjavac 2015-12-17 17:32:46 +01:00
parent b767f0b18f
commit cbbaa8b592
2 changed files with 17 additions and 0 deletions

View File

@ -129,3 +129,18 @@ BootLoaderModel::data( const QModelIndex& index, int role ) const
return QStandardItemModel::data( index, role );
}
void
BootLoaderModel::swapDevice( Device* oldDevice, Device* newDevice )
{
Q_ASSERT( oldDevice );
Q_ASSERT( newDevice );
Q_ASSERT( oldDevice->deviceNode() == newDevice->deviceNode() );
int indexOfOldDevice = m_devices.indexOf( oldDevice );
if ( indexOfOldDevice < 0 )
return;
m_devices[ indexOfOldDevice ] = newDevice;
}

View File

@ -51,6 +51,8 @@ public:
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
void swapDevice( Device* oldDevice, Device* newDevice );
private:
QList< Device* > m_devices;