mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
Add flags setting support when creating a partition.
This commit is contained in:
parent
b83e91b951
commit
ada0a080fc
3 changed files with 66 additions and 5 deletions
|
@ -39,6 +39,7 @@
|
|||
#include <QComboBox>
|
||||
#include <QDir>
|
||||
#include <QSet>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
static QSet< FileSystem::Type > s_unmountableFS(
|
||||
{
|
||||
|
@ -83,11 +84,46 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
|||
// Connections
|
||||
connect( m_ui->fsComboBox, SIGNAL( activated( int ) ), SLOT( updateMountPointUi() ) );
|
||||
connect( m_ui->extendedRadioButton, SIGNAL( toggled( bool ) ), SLOT( updateMountPointUi() ) );
|
||||
|
||||
setupFlagsList();
|
||||
}
|
||||
|
||||
CreatePartitionDialog::~CreatePartitionDialog()
|
||||
{}
|
||||
|
||||
|
||||
PartitionTable::Flags
|
||||
CreatePartitionDialog::newFlags() const
|
||||
{
|
||||
PartitionTable::Flags flags;
|
||||
|
||||
for ( int i = 0; i < m_ui->m_listFlags->count(); i++ )
|
||||
if ( m_ui->m_listFlags->item( i )->checkState() == Qt::Checked )
|
||||
flags |= static_cast< PartitionTable::Flag >(
|
||||
m_ui->m_listFlags->item( i )->data( Qt::UserRole ).toInt() );
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CreatePartitionDialog::setupFlagsList()
|
||||
{
|
||||
int f = 1;
|
||||
QString s;
|
||||
while ( !( s = PartitionTable::flagName( static_cast< PartitionTable::Flag >( f ) ) ).isEmpty() )
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem( s );
|
||||
m_ui->m_listFlags->addItem( item );
|
||||
item->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled );
|
||||
item->setData( Qt::UserRole, f );
|
||||
item->setCheckState( Qt::Unchecked );
|
||||
|
||||
f <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CreatePartitionDialog::initMbrPartitionTypeUi()
|
||||
{
|
||||
|
@ -145,10 +181,11 @@ CreatePartitionDialog::createPartition()
|
|||
m_parent,
|
||||
*m_device,
|
||||
m_role,
|
||||
fsType, first, last );
|
||||
fsType, first, last, newFlags() );
|
||||
|
||||
PartitionInfo::setMountPoint( partition, m_ui->mountPointComboBox->currentText() );
|
||||
PartitionInfo::setFormat( partition, true );
|
||||
|
||||
return partition;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
// KPMcore
|
||||
#include <kpmcore/core/partitionrole.h>
|
||||
#include <kpmcore/core/partitiontable.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QScopedPointer>
|
||||
|
@ -55,10 +56,13 @@ public:
|
|||
void initFromPartitionToCreate( Partition* partition );
|
||||
Partition* createPartition();
|
||||
|
||||
PartitionTable::Flags newFlags() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateMountPointUi();
|
||||
|
||||
private:
|
||||
void setupFlagsList();
|
||||
QScopedPointer< Ui_CreatePartitionDialog > m_ui;
|
||||
PartitionSizeController* m_partitionSizeController;
|
||||
Device* m_device;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>425</width>
|
||||
<height>208</height>
|
||||
<width>642</width>
|
||||
<height>489</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -86,7 +86,7 @@
|
|||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>F&ile System:</string>
|
||||
<string>Fi&le System:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fsComboBox</cstring>
|
||||
|
@ -132,7 +132,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -175,6 +175,26 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Flags:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QListWidget" name="m_listFlags">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Loading…
Add table
Reference in a new issue