mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 18:05:36 -04:00
[partition] Refactor setting the flags UI
- Setup the lsit of flags consistently, by providing the available and to-be-checked flags. - In CreatePartitionDialog, assume that ~0 is all the flags.
This commit is contained in:
parent
4f451eece5
commit
ca03dad67b
6 changed files with 25 additions and 47 deletions
|
@ -95,3 +95,24 @@ flagsFromList( const QListWidget& list )
|
|||
return flags;
|
||||
}
|
||||
|
||||
void
|
||||
setFlagList( QListWidget& list, PartitionTable::Flags available, PartitionTable::Flags checked )
|
||||
{
|
||||
int f = 1;
|
||||
QString s;
|
||||
while ( !( s = PartitionTable::flagName( static_cast< PartitionTable::Flag >( f ) ) ).isEmpty() )
|
||||
{
|
||||
if ( available & f )
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem( s );
|
||||
list.addItem( item );
|
||||
item->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled );
|
||||
item->setData( Qt::UserRole, f );
|
||||
item->setCheckState( ( checked & f ) ?
|
||||
Qt::Checked :
|
||||
Qt::Unchecked );
|
||||
}
|
||||
|
||||
f <<= 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue