summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-05-01 02:09:04 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-02 14:12:36 +0200
commitef433cb367d1b94002f799a5a7b9019ac04b1ee7 (patch)
tree5fd9de94e946920f89ab8f670492da9dc3252846
parent8e01356b2f16393932f62354b1564e6676cbe791 (diff)
downloadserenity-ef433cb367d1b94002f799a5a7b9019ac04b1ee7.zip
LibGUI: The UI calls it 'Icon view', fix the name in the code
-rw-r--r--Applications/FileManager/DirectoryView.cpp28
-rw-r--r--Applications/FileManager/DirectoryView.h12
-rw-r--r--Applications/FileManager/main.cpp24
-rw-r--r--Libraries/LibGUI/Forward.h2
-rw-r--r--Libraries/LibGUI/IconView.cpp (renamed from Libraries/LibGUI/ItemView.cpp)42
-rw-r--r--Libraries/LibGUI/IconView.h (renamed from Libraries/LibGUI/ItemView.h)8
-rw-r--r--Libraries/LibGUI/Makefile2
-rw-r--r--Libraries/LibGUI/MultiView.cpp18
-rw-r--r--Libraries/LibGUI/MultiView.h12
9 files changed, 74 insertions, 74 deletions
diff --git a/Applications/FileManager/DirectoryView.cpp b/Applications/FileManager/DirectoryView.cpp
index dea62c68f1..247554bdd8 100644
--- a/Applications/FileManager/DirectoryView.cpp
+++ b/Applications/FileManager/DirectoryView.cpp
@@ -78,8 +78,8 @@ DirectoryView::DirectoryView()
{
set_active_widget(nullptr);
set_content_margins({ 2, 2, 2, 2 });
- m_item_view = add<GUI::ItemView>();
- m_item_view->set_model(model());
+ m_icon_view = add<GUI::IconView>();
+ m_icon_view->set_model(model());
m_columns_view = add<GUI::ColumnsView>();
m_columns_view->set_model(model());
@@ -89,7 +89,7 @@ DirectoryView::DirectoryView()
m_table_view->model()->set_key_column_and_sort_order(GUI::FileSystemModel::Column::Name, GUI::SortOrder::Ascending);
- m_item_view->set_model_column(GUI::FileSystemModel::Column::Name);
+ m_icon_view->set_model_column(GUI::FileSystemModel::Column::Name);
m_columns_view->set_model_column(GUI::FileSystemModel::Column::Name);
m_model->on_error = [this](int error, const char* error_string) {
@@ -105,7 +105,7 @@ DirectoryView::DirectoryView()
m_model->on_complete = [this] {
m_table_view->selection().clear();
- m_item_view->selection().clear();
+ m_icon_view->selection().clear();
add_path_to_history(model().root_path());
@@ -129,7 +129,7 @@ DirectoryView::DirectoryView()
on_thumbnail_progress(done, total);
};
- m_item_view->on_activation = [&](const GUI::ModelIndex& index) {
+ m_icon_view->on_activation = [&](const GUI::ModelIndex& index) {
handle_activation(index);
};
m_columns_view->on_activation = [&](const GUI::ModelIndex& index) {
@@ -145,10 +145,10 @@ DirectoryView::DirectoryView()
if (on_selection_change)
on_selection_change(*m_table_view);
};
- m_item_view->on_selection_change = [this] {
+ m_icon_view->on_selection_change = [this] {
update_statusbar();
if (on_selection_change)
- on_selection_change(*m_item_view);
+ on_selection_change(*m_icon_view);
};
m_columns_view->on_selection_change = [this] {
update_statusbar();
@@ -160,9 +160,9 @@ DirectoryView::DirectoryView()
if (on_context_menu_request)
on_context_menu_request(*m_table_view, index, event);
};
- m_item_view->on_context_menu_request = [this](auto& index, auto& event) {
+ m_icon_view->on_context_menu_request = [this](auto& index, auto& event) {
if (on_context_menu_request)
- on_context_menu_request(*m_item_view, index, event);
+ on_context_menu_request(*m_icon_view, index, event);
};
m_columns_view->on_context_menu_request = [this](auto& index, auto& event) {
if (on_context_menu_request)
@@ -173,9 +173,9 @@ DirectoryView::DirectoryView()
if (on_drop)
on_drop(*m_table_view, index, event);
};
- m_item_view->on_drop = [this](auto& index, auto& event) {
+ m_icon_view->on_drop = [this](auto& index, auto& event) {
if (on_drop)
- on_drop(*m_item_view, index, event);
+ on_drop(*m_icon_view, index, event);
};
m_columns_view->on_drop = [this](auto& index, auto& event) {
if (on_drop)
@@ -195,7 +195,7 @@ void DirectoryView::set_view_mode(ViewMode mode)
return;
m_view_mode = mode;
update();
- if (mode == ViewMode::List) {
+ if (mode == ViewMode::Table) {
set_active_widget(m_table_view);
return;
}
@@ -204,7 +204,7 @@ void DirectoryView::set_view_mode(ViewMode mode)
return;
}
if (mode == ViewMode::Icon) {
- set_active_widget(m_item_view);
+ set_active_widget(m_icon_view);
return;
}
ASSERT_NOT_REACHED();
@@ -297,7 +297,7 @@ void DirectoryView::update_statusbar()
auto index = current_view().selection().first();
// FIXME: This is disgusting. This code should not even be aware that there is a GUI::SortingProxyModel in the table view.
- if (m_view_mode == ViewMode::List) {
+ if (m_view_mode == ViewMode::Table) {
auto& filter_model = (GUI::SortingProxyModel&)*m_table_view->model();
index = filter_model.map_to_target(index);
}
diff --git a/Applications/FileManager/DirectoryView.h b/Applications/FileManager/DirectoryView.h
index ddbf0325ce..b0c8efe3e4 100644
--- a/Applications/FileManager/DirectoryView.h
+++ b/Applications/FileManager/DirectoryView.h
@@ -29,7 +29,7 @@
#include <AK/Vector.h>
#include <LibGUI/ColumnsView.h>
#include <LibGUI/FileSystemModel.h>
-#include <LibGUI/ItemView.h>
+#include <LibGUI/IconView.h>
#include <LibGUI/StackWidget.h>
#include <LibGUI/TableView.h>
#include <sys/stat.h>
@@ -59,7 +59,7 @@ public:
enum ViewMode {
Invalid,
- List,
+ Table,
Columns,
Icon
};
@@ -69,12 +69,12 @@ public:
GUI::AbstractView& current_view()
{
switch (m_view_mode) {
- case ViewMode::List:
+ case ViewMode::Table:
return *m_table_view;
case ViewMode::Columns:
return *m_columns_view;
case ViewMode::Icon:
- return *m_item_view;
+ return *m_icon_view;
default:
ASSERT_NOT_REACHED();
}
@@ -84,7 +84,7 @@ public:
void for_each_view_implementation(Callback callback)
{
callback(*m_table_view);
- callback(*m_item_view);
+ callback(*m_icon_view);
callback(*m_columns_view);
}
@@ -107,6 +107,6 @@ private:
void add_path_to_history(const StringView& path);
RefPtr<GUI::TableView> m_table_view;
- RefPtr<GUI::ItemView> m_item_view;
+ RefPtr<GUI::IconView> m_icon_view;
RefPtr<GUI::ColumnsView> m_columns_view;
};
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index 39647ea6f1..93b1df906c 100644
--- a/Applications/FileManager/main.cpp
+++ b/Applications/FileManager/main.cpp
@@ -144,16 +144,16 @@ int run_in_desktop_mode(RefPtr<Core::ConfigFile> config, String initial_location
auto& desktop_widget = window->set_main_widget<DesktopWidget>();
desktop_widget.set_layout<GUI::VerticalBoxLayout>();
- auto& item_view = desktop_widget.add<GUI::ItemView>();
- item_view.set_frame_thickness(0);
- item_view.set_scrollbars_enabled(false);
- item_view.set_fill_with_background_color(false);
+ auto& icon_view = desktop_widget.add<GUI::IconView>();
+ icon_view.set_frame_thickness(0);
+ icon_view.set_scrollbars_enabled(false);
+ icon_view.set_fill_with_background_color(false);
auto model = GUI::FileSystemModel::create(initial_location);
- item_view.set_model(model);
- item_view.set_model_column(GUI::FileSystemModel::Column::Name);
+ icon_view.set_model(model);
+ icon_view.set_model_column(GUI::FileSystemModel::Column::Name);
- item_view.on_activation = [&](auto& index) {
+ icon_view.on_activation = [&](auto& index) {
if (!index.is_valid())
return;
auto& node = model->node(index);
@@ -219,7 +219,7 @@ int run_in_desktop_mode(RefPtr<Core::ConfigFile> config, String initial_location
desktop_view_context_menu->add_separator();
desktop_view_context_menu->add_action(display_properties_action);
- item_view.on_context_menu_request = [&](const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) {
+ icon_view.on_context_menu_request = [&](const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) {
if (!index.is_valid())
desktop_view_context_menu->popup(event.screen_position());
};
@@ -354,8 +354,8 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
view_as_table_action = GUI::Action::create_checkable(
"Table view", { Mod_Ctrl, KeyCode::Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) {
- directory_view.set_view_mode(DirectoryView::ViewMode::List);
- config->write_entry("DirectoryView", "ViewMode", "List");
+ directory_view.set_view_mode(DirectoryView::ViewMode::Table);
+ config->write_entry("DirectoryView", "ViewMode", "Table");
config->sync();
},
window);
@@ -832,8 +832,8 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
// Read direcory read mode from config.
auto dir_view_mode = config->read_entry("DirectoryView", "ViewMode", "Icon");
- if (dir_view_mode.contains("List")) {
- directory_view.set_view_mode(DirectoryView::ViewMode::List);
+ if (dir_view_mode.contains("Table")) {
+ directory_view.set_view_mode(DirectoryView::ViewMode::Table);
view_as_table_action->set_checked(true);
} else if (dir_view_mode.contains("Columns")) {
directory_view.set_view_mode(DirectoryView::ViewMode::Columns);
diff --git a/Libraries/LibGUI/Forward.h b/Libraries/LibGUI/Forward.h
index bae4920421..45e14fc302 100644
--- a/Libraries/LibGUI/Forward.h
+++ b/Libraries/LibGUI/Forward.h
@@ -40,7 +40,7 @@ class FileSystemModel;
class Frame;
class GroupBox;
class HorizontalBoxLayout;
-class ItemView;
+class IconView;
class JsonArrayModel;
class KeyEvent;
class Label;
diff --git a/Libraries/LibGUI/ItemView.cpp b/Libraries/LibGUI/IconView.cpp
index 37f2e19d28..71f826074c 100644
--- a/Libraries/LibGUI/ItemView.cpp
+++ b/Libraries/LibGUI/IconView.cpp
@@ -27,7 +27,7 @@
#include <AK/StringBuilder.h>
#include <Kernel/KeyCode.h>
#include <LibGUI/DragOperation.h>
-#include <LibGUI/ItemView.h>
+#include <LibGUI/IconView.h>
#include <LibGUI/Model.h>
#include <LibGUI/Painter.h>
#include <LibGUI/ScrollBar.h>
@@ -37,7 +37,7 @@
namespace GUI {
-ItemView::ItemView()
+IconView::IconView()
{
set_fill_with_background_color(true);
set_background_role(ColorRole::Base);
@@ -45,11 +45,11 @@ ItemView::ItemView()
horizontal_scrollbar().set_visible(false);
}
-ItemView::~ItemView()
+IconView::~IconView()
{
}
-void ItemView::select_all()
+void IconView::select_all()
{
selection().clear();
for (int item_index = 0; item_index < item_count(); ++item_index) {
@@ -58,25 +58,25 @@ void ItemView::select_all()
}
}
-void ItemView::scroll_into_view(const ModelIndex& index, Orientation orientation)
+void IconView::scroll_into_view(const ModelIndex& index, Orientation orientation)
{
ScrollableWidget::scroll_into_view(item_rect(index.row()), orientation);
}
-void ItemView::resize_event(ResizeEvent& event)
+void IconView::resize_event(ResizeEvent& event)
{
AbstractView::resize_event(event);
update_content_size();
}
-void ItemView::did_update_model(unsigned flags)
+void IconView::did_update_model(unsigned flags)
{
AbstractView::did_update_model(flags);
update_content_size();
update();
}
-void ItemView::update_content_size()
+void IconView::update_content_size()
{
if (!model())
return set_content_size({});
@@ -93,7 +93,7 @@ void ItemView::update_content_size()
set_content_size({ content_width, content_height });
}
-Gfx::Rect ItemView::item_rect(int item_index) const
+Gfx::Rect IconView::item_rect(int item_index) const
{
if (!m_visual_row_count || !m_visual_column_count)
return {};
@@ -107,7 +107,7 @@ Gfx::Rect ItemView::item_rect(int item_index) const
};
}
-Vector<int> ItemView::items_intersecting_rect(const Gfx::Rect& rect) const
+Vector<int> IconView::items_intersecting_rect(const Gfx::Rect& rect) const
{
ASSERT(model());
const auto& column_metadata = model()->column_metadata(model_column());
@@ -125,7 +125,7 @@ Vector<int> ItemView::items_intersecting_rect(const Gfx::Rect& rect) const
return item_indexes;
}
-ModelIndex ItemView::index_at_event_position(const Gfx::Point& position) const
+ModelIndex IconView::index_at_event_position(const Gfx::Point& position) const
{
ASSERT(model());
// FIXME: Since all items are the same size, just compute the clicked item index
@@ -146,12 +146,12 @@ ModelIndex ItemView::index_at_event_position(const Gfx::Point& position) const
return {};
}
-Gfx::Point ItemView::adjusted_position(const Gfx::Point& position) const
+Gfx::Point IconView::adjusted_position(const Gfx::Point& position) const
{
return position.translated(0, vertical_scrollbar().value());
}
-void ItemView::mousedown_event(MouseEvent& event)
+void IconView::mousedown_event(MouseEvent& event)
{
if (!model())
return AbstractView::mousedown_event(event);
@@ -183,7 +183,7 @@ void ItemView::mousedown_event(MouseEvent& event)
m_rubber_band_current = adjusted_position;
}
-void ItemView::mouseup_event(MouseEvent& event)
+void IconView::mouseup_event(MouseEvent& event)
{
if (m_rubber_banding && event.button() == MouseButton::Left) {
m_rubber_banding = false;
@@ -193,7 +193,7 @@ void ItemView::mouseup_event(MouseEvent& event)
AbstractView::mouseup_event(event);
}
-void ItemView::drag_move_event(DragEvent& event)
+void IconView::drag_move_event(DragEvent& event)
{
auto index = index_at_event_position(event.position());
ModelIndex new_drop_candidate_index;
@@ -212,7 +212,7 @@ void ItemView::drag_move_event(DragEvent& event)
event.accept();
}
-void ItemView::mousemove_event(MouseEvent& event)
+void IconView::mousemove_event(MouseEvent& event)
{
if (!model())
return AbstractView::mousemove_event(event);
@@ -239,7 +239,7 @@ void ItemView::mousemove_event(MouseEvent& event)
AbstractView::mousemove_event(event);
}
-void ItemView::get_item_rects(int item_index, const Gfx::Font& font, const Variant& item_text, Gfx::Rect& item_rect, Gfx::Rect& icon_rect, Gfx::Rect& text_rect) const
+void IconView::get_item_rects(int item_index, const Gfx::Font& font, const Variant& item_text, Gfx::Rect& item_rect, Gfx::Rect& icon_rect, Gfx::Rect& text_rect) const
{
item_rect = this->item_rect(item_index);
icon_rect = { 0, 0, 32, 32 };
@@ -251,7 +251,7 @@ void ItemView::get_item_rects(int item_index, const Gfx::Font& font, const Varia
text_rect.intersect(item_rect);
}
-void ItemView::second_paint_event(PaintEvent& event)
+void IconView::second_paint_event(PaintEvent& event)
{
if (!m_rubber_banding)
return;
@@ -266,7 +266,7 @@ void ItemView::second_paint_event(PaintEvent& event)
painter.draw_rect(rubber_band_rect, palette().rubber_band_border());
}
-void ItemView::paint_event(PaintEvent& event)
+void IconView::paint_event(PaintEvent& event)
{
Color widget_background_color = palette().color(background_role());
Frame::paint_event(event);
@@ -328,14 +328,14 @@ void ItemView::paint_event(PaintEvent& event)
};
}
-int ItemView::item_count() const
+int IconView::item_count() const
{
if (!model())
return 0;
return model()->row_count();
}
-void ItemView::keydown_event(KeyEvent& event)
+void IconView::keydown_event(KeyEvent& event)
{
if (!model())
return;
diff --git a/Libraries/LibGUI/ItemView.h b/Libraries/LibGUI/IconView.h
index 32cdb6540f..210602caac 100644
--- a/Libraries/LibGUI/ItemView.h
+++ b/Libraries/LibGUI/IconView.h
@@ -31,10 +31,10 @@
namespace GUI {
-class ItemView : public AbstractView {
- C_OBJECT(ItemView)
+class IconView : public AbstractView {
+ C_OBJECT(IconView)
public:
- virtual ~ItemView() override;
+ virtual ~IconView() override;
int content_width() const;
int horizontal_padding() const { return m_horizontal_padding; }
@@ -50,7 +50,7 @@ public:
virtual void select_all() override;
private:
- ItemView();
+ IconView();
virtual void did_update_model(unsigned flags) override;
virtual void paint_event(PaintEvent&) override;
diff --git a/Libraries/LibGUI/Makefile b/Libraries/LibGUI/Makefile
index c02572d276..2535132435 100644
--- a/Libraries/LibGUI/Makefile
+++ b/Libraries/LibGUI/Makefile
@@ -28,8 +28,8 @@ OBJS = \
Frame.o \
GroupBox.o \
Icon.o \
+ IconView.o \
InputBox.o \
- ItemView.o \
INILexer.o \
INISyntaxHighlighter.o \
JsonArrayModel.o \
diff --git a/Libraries/LibGUI/MultiView.cpp b/Libraries/LibGUI/MultiView.cpp
index d80536804b..ff96cb9c44 100644
--- a/Libraries/LibGUI/MultiView.cpp
+++ b/Libraries/LibGUI/MultiView.cpp
@@ -40,14 +40,14 @@ MultiView::MultiView()
{
set_active_widget(nullptr);
set_content_margins({ 2, 2, 2, 2 });
- m_item_view = add<ItemView>();
+ m_icon_view = add<IconView>();
m_table_view = add<TableView>();
#ifdef MULTIVIEW_WITH_COLUMNSVIEW
m_columns_view = add<ColumnsView>();
#endif
- m_item_view->on_activation = [&](auto& index) {
+ m_icon_view->on_activation = [&](auto& index) {
if (on_activation)
on_activation(index);
};
@@ -66,7 +66,7 @@ MultiView::MultiView()
if (on_selection_change)
on_selection_change();
};
- m_item_view->on_selection_change = [this] {
+ m_icon_view->on_selection_change = [this] {
if (on_selection_change)
on_selection_change();
};
@@ -81,7 +81,7 @@ MultiView::MultiView()
if (on_context_menu_request)
on_context_menu_request(index, event);
};
- m_item_view->on_context_menu_request = [this](auto& index, auto& event) {
+ m_icon_view->on_context_menu_request = [this](auto& index, auto& event) {
if (on_context_menu_request)
on_context_menu_request(index, event);
};
@@ -96,7 +96,7 @@ MultiView::MultiView()
if (on_drop)
on_drop(index, event);
};
- m_item_view->on_drop = [this](auto& index, auto& event) {
+ m_icon_view->on_drop = [this](auto& index, auto& event) {
if (on_drop)
on_drop(index, event);
};
@@ -121,7 +121,7 @@ void MultiView::set_view_mode(ViewMode mode)
return;
m_view_mode = mode;
update();
- if (mode == ViewMode::List) {
+ if (mode == ViewMode::Table) {
set_active_widget(m_table_view);
return;
}
@@ -132,7 +132,7 @@ void MultiView::set_view_mode(ViewMode mode)
}
#endif
if (mode == ViewMode::Icon) {
- set_active_widget(m_item_view);
+ set_active_widget(m_icon_view);
return;
}
ASSERT_NOT_REACHED();
@@ -153,7 +153,7 @@ void MultiView::set_model_column(int column)
if (m_model_column == column)
return;
m_model_column = column;
- m_item_view->set_model_column(column);
+ m_icon_view->set_model_column(column);
#ifdef MULTIVIEW_WITH_COLUMNSVIEW
m_columns_view->set_model_column(column);
#endif
@@ -168,7 +168,7 @@ void MultiView::build_actions()
{
m_view_as_table_action = Action::create_checkable(
"Table view", Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"), [this](auto&) {
- set_view_mode(ViewMode::List);
+ set_view_mode(ViewMode::Table);
});
m_view_as_icons_action = Action::create_checkable(
diff --git a/Libraries/LibGUI/MultiView.h b/Libraries/LibGUI/MultiView.h
index 98abc88b9b..33e1a3409b 100644
--- a/Libraries/LibGUI/MultiView.h
+++ b/Libraries/LibGUI/MultiView.h
@@ -28,7 +28,7 @@
#include <LibGUI/Action.h>
#include <LibGUI/ColumnsView.h>
-#include <LibGUI/ItemView.h>
+#include <LibGUI/IconView.h>
#include <LibGUI/StackWidget.h>
#include <LibGUI/TableView.h>
@@ -50,7 +50,7 @@ public:
Function<void(const ModelIndex&, const DropEvent&)> on_drop;
enum ViewMode {
- List,
+ Table,
Columns,
Icon
};
@@ -65,14 +65,14 @@ public:
GUI::AbstractView& current_view()
{
switch (m_view_mode) {
- case ViewMode::List:
+ case ViewMode::Table:
return *m_table_view;
#ifdef MULTIVIEW_WITH_COLUMNSVIEW
case ViewMode::Columns:
return *m_columns_view;
#endif
case ViewMode::Icon:
- return *m_item_view;
+ return *m_icon_view;
default:
ASSERT_NOT_REACHED();
}
@@ -85,7 +85,7 @@ public:
void for_each_view_implementation(Callback callback)
{
callback(*m_table_view);
- callback(*m_item_view);
+ callback(*m_icon_view);
#ifdef MULTIVIEW_WITH_COLUMNSVIEW
callback(*m_columns_view);
#endif
@@ -113,7 +113,7 @@ private:
RefPtr<Model> m_model;
RefPtr<TableView> m_table_view;
- RefPtr<ItemView> m_item_view;
+ RefPtr<IconView> m_icon_view;
#ifdef MULTIVIEW_WITH_COLUMNSVIEW
RefPtr<ColumnsView> m_columns_view;
#endif