mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:27:42 +00:00
LibGUI+FileManager: Merge GDirectoryModel into GFileSystemModel
We used to have two different models for displaying file system contents: the FileManager-grade table-like directory model, which exposed rich data (such as file icons with integrated image previews) about contents of a single directory, and the tree-like GFileSystemModel, which only exposed a tree of file names with very basic info about them. This commit unifies the two. The new GFileSystemModel can be used both as a tree-like and as a table-like model, or in fact in both ways simultaneously. It exposes rich data about a file system subtree rooted at the given root. The users of the two previous models are all ported to use this new model.
This commit is contained in:
parent
0f18a16e2c
commit
fdeb91e000
12 changed files with 597 additions and 700 deletions
|
@ -9,7 +9,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
PropertiesDialog::PropertiesDialog(GDirectoryModel& model, String path, bool disable_rename, CObject* parent)
|
||||
PropertiesDialog::PropertiesDialog(GFileSystemModel& model, String path, bool disable_rename, CObject* parent)
|
||||
: GDialog(parent)
|
||||
, m_model(model)
|
||||
{
|
||||
|
@ -92,8 +92,8 @@ PropertiesDialog::PropertiesDialog(GDirectoryModel& model, String path, bool dis
|
|||
properties.append({ "Size:", String::format("%zu bytes", st.st_size) });
|
||||
properties.append({ "Owner:", String::format("%s (%lu)", user_pw->pw_name, static_cast<u32>(user_pw->pw_uid)) });
|
||||
properties.append({ "Group:", String::format("%s (%lu)", group_pw->pw_name, static_cast<u32>(group_pw->pw_uid)) });
|
||||
properties.append({ "Created at:", GDirectoryModel::timestamp_string(st.st_ctime) });
|
||||
properties.append({ "Last modified:", GDirectoryModel::timestamp_string(st.st_mtime) });
|
||||
properties.append({ "Created at:", GFileSystemModel::timestamp_string(st.st_ctime) });
|
||||
properties.append({ "Last modified:", GFileSystemModel::timestamp_string(st.st_mtime) });
|
||||
|
||||
make_property_value_pairs(properties, general_tab);
|
||||
|
||||
|
@ -127,7 +127,6 @@ PropertiesDialog::~PropertiesDialog() {}
|
|||
|
||||
void PropertiesDialog::update()
|
||||
{
|
||||
m_model.update();
|
||||
m_icon->set_icon(const_cast<GraphicsBitmap*>(m_model.icon_for_file(m_mode, m_name).bitmap_for_size(32)));
|
||||
set_title(String::format("Properties of \"%s\"", m_name.characters()));
|
||||
}
|
||||
|
@ -146,7 +145,7 @@ void PropertiesDialog::permission_changed(mode_t mask, bool set)
|
|||
|
||||
String PropertiesDialog::make_full_path(String name)
|
||||
{
|
||||
return String::format("%s/%s", m_model.path().characters(), name.characters());
|
||||
return String::format("%s/%s", m_model.root_path().characters(), name.characters());
|
||||
}
|
||||
|
||||
bool PropertiesDialog::apply_changes()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue