mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 01:54:57 +00:00
LibGUI: Add Model::Role::TextAlignment and remove from ColumnMetadata
This commit is contained in:
parent
3c819b8ff4
commit
2e03bded43
19 changed files with 211 additions and 100 deletions
|
@ -345,6 +345,26 @@ ModelIndex FileSystemModel::parent_index(const ModelIndex& index) const
|
|||
Variant FileSystemModel::data(const ModelIndex& index, Role role) const
|
||||
{
|
||||
ASSERT(index.is_valid());
|
||||
|
||||
if (role == Role::TextAlignment) {
|
||||
switch (index.column()) {
|
||||
case Column::Icon:
|
||||
return Gfx::TextAlignment::Center;
|
||||
case Column::Size:
|
||||
case Column::Inode:
|
||||
return Gfx::TextAlignment::CenterRight;
|
||||
case Column::Name:
|
||||
case Column::Owner:
|
||||
case Column::Group:
|
||||
case Column::ModificationTime:
|
||||
case Column::Permissions:
|
||||
case Column::SymlinkTarget:
|
||||
return Gfx::TextAlignment::CenterLeft;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
auto& node = this->node(index);
|
||||
|
||||
if (role == Role::Custom) {
|
||||
|
@ -552,23 +572,23 @@ Model::ColumnMetadata FileSystemModel::column_metadata(int column) const
|
|||
{
|
||||
switch (column) {
|
||||
case Column::Icon:
|
||||
return { 16, Gfx::TextAlignment::Center, Model::ColumnMetadata::Sortable::False };
|
||||
return { 16, Model::ColumnMetadata::Sortable::False };
|
||||
case Column::Name:
|
||||
return { 120, Gfx::TextAlignment::CenterLeft };
|
||||
return { 120 };
|
||||
case Column::Size:
|
||||
return { 80, Gfx::TextAlignment::CenterRight };
|
||||
return { 80 };
|
||||
case Column::Owner:
|
||||
return { 50, Gfx::TextAlignment::CenterLeft };
|
||||
return { 50 };
|
||||
case Column::Group:
|
||||
return { 50, Gfx::TextAlignment::CenterLeft };
|
||||
return { 50 };
|
||||
case Column::ModificationTime:
|
||||
return { 110, Gfx::TextAlignment::CenterLeft };
|
||||
return { 110 };
|
||||
case Column::Permissions:
|
||||
return { 65, Gfx::TextAlignment::CenterLeft };
|
||||
return { 65 };
|
||||
case Column::Inode:
|
||||
return { 60, Gfx::TextAlignment::CenterRight };
|
||||
return { 60 };
|
||||
case Column::SymlinkTarget:
|
||||
return { 120, Gfx::TextAlignment::CenterLeft };
|
||||
return { 120 };
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue