mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
PartitionEditor: Add size column
This commit is contained in:
parent
ba9f60785b
commit
fadd69263a
2 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/NumberFormat.h>
|
||||||
#include <Applications/PartitionEditor/PartitionModel.h>
|
#include <Applications/PartitionEditor/PartitionModel.h>
|
||||||
#include <LibPartition/EBRPartitionTable.h>
|
#include <LibPartition/EBRPartitionTable.h>
|
||||||
#include <LibPartition/GUIDPartitionTable.h>
|
#include <LibPartition/GUIDPartitionTable.h>
|
||||||
|
@ -22,6 +23,8 @@ String PartitionModel::column_name(int column) const
|
||||||
return "End Block";
|
return "End Block";
|
||||||
case Column::TotalBlocks:
|
case Column::TotalBlocks:
|
||||||
return "Total Blocks";
|
return "Total Blocks";
|
||||||
|
case Column::Size:
|
||||||
|
return "Size";
|
||||||
default:
|
default:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
@ -47,6 +50,8 @@ GUI::Variant PartitionModel::data(GUI::ModelIndex const& index, GUI::ModelRole r
|
||||||
return partition.end_block();
|
return partition.end_block();
|
||||||
case Column::TotalBlocks:
|
case Column::TotalBlocks:
|
||||||
return partition.end_block() - partition.start_block() + 1;
|
return partition.end_block() - partition.start_block() + 1;
|
||||||
|
case Column::Size:
|
||||||
|
return human_readable_size((partition.end_block() - partition.start_block() + 1) * m_partition_table->block_size());
|
||||||
default:
|
default:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ public:
|
||||||
StartBlock,
|
StartBlock,
|
||||||
EndBlock,
|
EndBlock,
|
||||||
TotalBlocks,
|
TotalBlocks,
|
||||||
|
Size,
|
||||||
__Count,
|
__Count,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue