mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 09:55:37 -04:00
Move Osprober to PCM and add Osprober roles to PartitionModel.
This commit is contained in:
parent
7b66514bf5
commit
0224811bf6
9 changed files with 63 additions and 23 deletions
|
@ -55,10 +55,11 @@ PartitionModel::PartitionModel( QObject* parent )
|
|||
}
|
||||
|
||||
void
|
||||
PartitionModel::init( Device* device )
|
||||
PartitionModel::init( Device* device , const OsproberEntryList& osproberEntries )
|
||||
{
|
||||
beginResetModel();
|
||||
m_device = device;
|
||||
m_osproberEntries = osproberEntries;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
@ -162,6 +163,30 @@ PartitionModel::data( const QModelIndex& index, int role ) const
|
|||
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
|
||||
case IsFreeSpaceRole:
|
||||
return KPMHelpers::isPartitionFreeSpace( partition );
|
||||
|
||||
// Osprober roles:
|
||||
case OsproberNameRole:
|
||||
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
|
||||
if ( osproberEntry.path == partition->partitionPath() )
|
||||
return osproberEntry.prettyName;
|
||||
return QVariant();
|
||||
case OsproberPathRole:
|
||||
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
|
||||
if ( osproberEntry.path == partition->partitionPath() )
|
||||
return osproberEntry.path;
|
||||
return QVariant();
|
||||
case OsproberCanBeResizedRole:
|
||||
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
|
||||
if ( osproberEntry.path == partition->partitionPath() )
|
||||
return osproberEntry.canBeResized;
|
||||
return QVariant();
|
||||
case OsproberRawLineRole:
|
||||
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
|
||||
if ( osproberEntry.path == partition->partitionPath() )
|
||||
return osproberEntry.line;
|
||||
return QVariant();
|
||||
// end Osprober roles.
|
||||
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue