Move code cloning the partition for PartResizerWidget to PMUtils
This commit is contained in:
parent
c109059eb7
commit
38c685dc10
@ -44,19 +44,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
||||
|
||||
// Create a partition for partResizerWidget because it alters the first and
|
||||
// last sectors when used
|
||||
FileSystem* fs = FileSystemFactory::create(
|
||||
m_partition->fileSystem().type(),
|
||||
m_partition->firstSector(),
|
||||
m_partition->lastSector()
|
||||
);
|
||||
m_partResizerWidgetPartition.reset( new Partition(
|
||||
m_partition->parent(),
|
||||
*m_device,
|
||||
m_partition->roles(),
|
||||
fs, fs->firstSector(), fs->lastSector(),
|
||||
m_partition->partitionPath()
|
||||
)
|
||||
);
|
||||
m_partResizerWidgetPartition.reset( PMUtils::clonePartition( m_device, m_partition ) );
|
||||
|
||||
m_partitionSizeController->init( m_device, m_partResizerWidgetPartition.data() );
|
||||
m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox );
|
||||
|
@ -66,4 +66,21 @@ createNewPartition( PartitionNode* parent, const Device& device, const Partition
|
||||
);
|
||||
}
|
||||
|
||||
Partition*
|
||||
clonePartition( Device* device, Partition* partition )
|
||||
{
|
||||
FileSystem* fs = FileSystemFactory::create(
|
||||
partition->fileSystem().type(),
|
||||
partition->firstSector(),
|
||||
partition->lastSector()
|
||||
);
|
||||
return new Partition(
|
||||
partition->parent(),
|
||||
*device,
|
||||
partition->roles(),
|
||||
fs, fs->firstSector(), fs->lastSector(),
|
||||
partition->partitionPath()
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -40,6 +40,7 @@ Partition* findPartitionByMountPoint( const QList< Device* >& devices, const QSt
|
||||
|
||||
Partition* createNewPartition( PartitionNode* parent, const Device& device, const PartitionRole& role, FileSystem::Type fsType, qint64 firstSector, qint64 lastSector );
|
||||
|
||||
Partition* clonePartition( Device* device, Partition* partition );
|
||||
}
|
||||
|
||||
#endif /* PMUTILS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user