summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-25 01:29:45 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-25 01:29:45 +0100
commit43f9027968d73e5884e19352e7d3285329773932 (patch)
treeafdce34c9c1e7a125626fa32189fd1801f8231eb
parentb4da451c9ae4c1c8f8c1d0dc1b32fa3aa96fbdeb (diff)
downloadserenity-43f9027968d73e5884e19352e7d3285329773932.zip
FileManager: Add toolbar buttons for switching the view mode.
-rw-r--r--Applications/FileManager/main.cpp10
-rw-r--r--Base/res/icons/16x16/icon-view.pngbin0 -> 234 bytes
-rw-r--r--Base/res/icons/16x16/table-view.pngbin0 -> 236 bytes
3 files changed, 7 insertions, 3 deletions
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index 73ff945fad..9395ef5b22 100644
--- a/Applications/FileManager/main.cpp
+++ b/Applications/FileManager/main.cpp
@@ -75,11 +75,11 @@ int main(int argc, char** argv)
}
});
- auto view_as_list_action = GAction::create("List view", { Mod_Ctrl, KeyCode::Key_L }, [&] (const GAction&) {
+ auto view_as_table_action = GAction::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/table-view.png"), [&] (const GAction&) {
directory_view->set_view_mode(DirectoryView::ViewMode::List);
});
- auto view_as_icons_action = GAction::create("Icon view", { Mod_Ctrl, KeyCode::Key_I }, [&] (const GAction&) {
+ auto view_as_icons_action = GAction::create("Icon view", { Mod_Ctrl, KeyCode::Key_I }, GraphicsBitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&] (const GAction&) {
directory_view->set_view_mode(DirectoryView::ViewMode::Icon);
});
@@ -108,7 +108,7 @@ int main(int argc, char** argv)
menubar->add_menu(move(file_menu));
auto view_menu = make<GMenu>("View");
- view_menu->add_action(view_as_list_action.copy_ref());
+ view_menu->add_action(view_as_table_action.copy_ref());
view_menu->add_action(view_as_icons_action.copy_ref());
menubar->add_menu(move(view_menu));
@@ -125,6 +125,10 @@ int main(int argc, char** argv)
main_toolbar->add_action(copy_action.copy_ref());
main_toolbar->add_action(delete_action.copy_ref());
+ main_toolbar->add_separator();
+ main_toolbar->add_action(view_as_icons_action.copy_ref());
+ main_toolbar->add_action(view_as_table_action.copy_ref());
+
directory_view->on_path_change = [window, location_textbox] (const String& new_path) {
window->set_title(String::format("FileManager: %s", new_path.characters()));
location_textbox->set_text(new_path);
diff --git a/Base/res/icons/16x16/icon-view.png b/Base/res/icons/16x16/icon-view.png
new file mode 100644
index 0000000000..b3d6cbaea2
--- /dev/null
+++ b/Base/res/icons/16x16/icon-view.png
Binary files differ
diff --git a/Base/res/icons/16x16/table-view.png b/Base/res/icons/16x16/table-view.png
new file mode 100644
index 0000000000..65ffa7bb38
--- /dev/null
+++ b/Base/res/icons/16x16/table-view.png
Binary files differ