mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-05 16:14:38 +00:00
LibGUI: Add Model::Role::TextAlignment and remove from ColumnMetadata
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user