Add freeSetors for partitionTable
This commit is contained in:
parent
7851d9e93b
commit
0ab8227d94
|
@ -89,6 +89,17 @@ qint64 PartitionTable::freeSectorsAfter(const Partition& p) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint64 PartitionTable::freeSectors() const
|
||||||
|
{
|
||||||
|
qint64 sectors = 0;
|
||||||
|
foreach(const Partition * p, children())
|
||||||
|
if (p->roles().has(PartitionRole::Unallocated)) {
|
||||||
|
sectors += p->length();
|
||||||
|
}
|
||||||
|
|
||||||
|
return sectors;
|
||||||
|
}
|
||||||
|
|
||||||
/** @return true if the PartitionTable has an extended Partition */
|
/** @return true if the PartitionTable has an extended Partition */
|
||||||
bool PartitionTable::hasExtended() const
|
bool PartitionTable::hasExtended() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,6 +126,7 @@ public:
|
||||||
|
|
||||||
qint64 freeSectorsBefore(const Partition& p) const;
|
qint64 freeSectorsBefore(const Partition& p) const;
|
||||||
qint64 freeSectorsAfter(const Partition& p) const;
|
qint64 freeSectorsAfter(const Partition& p) const;
|
||||||
|
qint64 freeSectors() const;
|
||||||
|
|
||||||
bool hasExtended() const;
|
bool hasExtended() const;
|
||||||
Partition* extended() const;
|
Partition* extended() const;
|
||||||
|
|
|
@ -135,6 +135,7 @@ qint32 PartResizerWidget::handleWidth() const
|
||||||
|
|
||||||
qint64 PartResizerWidget::sectorsPerPixel() const
|
qint64 PartResizerWidget::sectorsPerPixel() const
|
||||||
{
|
{
|
||||||
|
//FIXME: Make sure that this function never return 0
|
||||||
return totalSectors() / (width() - 2 * handleWidth());
|
return totalSectors() / (width() - 2 * handleWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue