1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 19:44:58 +00:00

LibGUI: Put all classes in the GUI namespace and remove the leading G

This took me a moment. Welcome to the new world of GUI::Widget! :^)
This commit is contained in:
Andreas Kling 2020-02-02 15:07:41 +01:00
parent 2d39da5405
commit c5bd9d4ed1
337 changed files with 5400 additions and 4816 deletions

View file

@ -28,7 +28,9 @@
#include <LibCore/CFile.h>
#include <LibGUI/GJsonArrayModel.h>
void GJsonArrayModel::update()
namespace GUI {
void JsonArrayModel::update()
{
auto file = Core::File::construct(m_json_path);
if (!file->open(Core::IODevice::ReadOnly)) {
@ -46,18 +48,18 @@ void GJsonArrayModel::update()
did_update();
}
GModel::ColumnMetadata GJsonArrayModel::column_metadata(int column) const
Model::ColumnMetadata JsonArrayModel::column_metadata(int column) const
{
ASSERT(column < m_fields.size());
return { 100, m_fields[column].text_alignment };
}
GVariant GJsonArrayModel::data(const GModelIndex& index, Role role) const
Variant JsonArrayModel::data(const ModelIndex& index, Role role) const
{
auto& field_spec = m_fields[index.column()];
auto& object = m_array.at(index.row()).as_object();
if (role == GModel::Role::Display) {
if (role == Model::Role::Display) {
auto& json_field_name = field_spec.json_field_name;
auto data = object.get(json_field_name);
if (field_spec.massage_for_display)
@ -67,13 +69,13 @@ GVariant GJsonArrayModel::data(const GModelIndex& index, Role role) const
return object.get(json_field_name).to_string();
}
if (role == GModel::Role::Sort) {
if (role == Model::Role::Sort) {
if (field_spec.massage_for_sort)
return field_spec.massage_for_sort(object);
return data(index, Role::Display);
}
if (role == GModel::Role::Custom) {
if (role == Model::Role::Custom) {
if (field_spec.massage_for_custom)
return field_spec.massage_for_custom(object);
return {};
@ -82,7 +84,7 @@ GVariant GJsonArrayModel::data(const GModelIndex& index, Role role) const
return {};
}
void GJsonArrayModel::set_json_path(const String& json_path)
void JsonArrayModel::set_json_path(const String& json_path)
{
if (m_json_path == json_path)
return;
@ -90,3 +92,5 @@ void GJsonArrayModel::set_json_path(const String& json_path)
m_json_path = json_path;
update();
}
}