mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 15:27:42 +00:00
FileManager: Run clang-format on main.cpp
This commit is contained in:
parent
2c14e46b96
commit
95fe78667f
1 changed files with 115 additions and 93 deletions
|
@ -187,31 +187,37 @@ int main(int argc, char** argv)
|
|||
RefPtr<GUI::Action> view_as_icons_action;
|
||||
RefPtr<GUI::Action> view_as_columns_action;
|
||||
|
||||
view_as_table_action = GUI::Action::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) {
|
||||
view_as_table_action = GUI::Action::create(
|
||||
"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);
|
||||
view_as_table_action->set_checked(true);
|
||||
|
||||
config->write_entry("DirectoryView", "ViewMode", "List");
|
||||
config->sync();
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
view_as_table_action->set_checkable(true);
|
||||
|
||||
view_as_icons_action = GUI::Action::create("Icon view", { Mod_Ctrl, KeyCode::Key_I }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) {
|
||||
view_as_icons_action = GUI::Action::create(
|
||||
"Icon view", { Mod_Ctrl, KeyCode::Key_I }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) {
|
||||
directory_view->set_view_mode(DirectoryView::ViewMode::Icon);
|
||||
view_as_icons_action->set_checked(true);
|
||||
|
||||
config->write_entry("DirectoryView", "ViewMode", "Icon");
|
||||
config->sync();
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
view_as_icons_action->set_checkable(true);
|
||||
|
||||
view_as_columns_action = GUI::Action::create("Columns view", Gfx::Bitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) {
|
||||
view_as_columns_action = GUI::Action::create(
|
||||
"Columns view", Gfx::Bitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) {
|
||||
directory_view->set_view_mode(DirectoryView::ViewMode::Columns);
|
||||
view_as_columns_action->set_checked(true);
|
||||
|
||||
config->write_entry("DirectoryView", "ViewMode", "Columns");
|
||||
config->sync();
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
view_as_columns_action->set_checkable(true);
|
||||
|
||||
auto view_type_action_group = make<GUI::ActionGroup>();
|
||||
|
@ -246,7 +252,8 @@ int main(int argc, char** argv)
|
|||
directory_view->current_view().select_all();
|
||||
});
|
||||
|
||||
auto copy_action = GUI::CommonActions::make_copy_action([&](const GUI::Action& action) {
|
||||
auto copy_action = GUI::CommonActions::make_copy_action(
|
||||
[&](const GUI::Action& action) {
|
||||
Vector<String> paths;
|
||||
if (action.activator() == directory_context_menu || directory_view->active_widget()->is_focused()) {
|
||||
paths = selected_file_paths();
|
||||
|
@ -260,10 +267,12 @@ int main(int argc, char** argv)
|
|||
copy_text.appendf("%s\n", path.characters());
|
||||
}
|
||||
GUI::Clipboard::the().set_data(copy_text.build(), "file-list");
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
copy_action->set_enabled(false);
|
||||
|
||||
auto paste_action = GUI::CommonActions::make_paste_action([&](const GUI::Action&) {
|
||||
auto paste_action = GUI::CommonActions::make_paste_action(
|
||||
[&](const GUI::Action&) {
|
||||
auto data_and_type = GUI::Clipboard::the().data_and_type();
|
||||
if (data_and_type.type != "file-list") {
|
||||
dbg() << "Cannot paste clipboard type " << data_and_type.type;
|
||||
|
@ -289,7 +298,8 @@ int main(int argc, char** argv)
|
|||
refresh_tree_view();
|
||||
}
|
||||
}
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
paste_action->set_enabled(GUI::Clipboard::the().type() == "file-list");
|
||||
|
||||
GUI::Clipboard::the().on_content_change = [&](const String& data_type) {
|
||||
|
@ -297,7 +307,8 @@ int main(int argc, char** argv)
|
|||
};
|
||||
|
||||
auto properties_action
|
||||
= GUI::Action::create("Properties...", { Mod_Alt, Key_Return }, Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"), [&](const GUI::Action& action) {
|
||||
= GUI::Action::create(
|
||||
"Properties...", { Mod_Alt, Key_Return }, Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"), [&](const GUI::Action& action) {
|
||||
auto& model = directory_view->model();
|
||||
String path;
|
||||
Vector<String> selected;
|
||||
|
@ -317,7 +328,8 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
properties->exec();
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
|
||||
enum class ConfirmBeforeDelete {
|
||||
No,
|
||||
|
@ -395,26 +407,36 @@ int main(int argc, char** argv)
|
|||
}
|
||||
};
|
||||
|
||||
auto force_delete_action = GUI::Action::create("Delete without confirmation", { Mod_Shift, Key_Delete }, [&](const GUI::Action& action) {
|
||||
auto force_delete_action = GUI::Action::create(
|
||||
"Delete without confirmation", { Mod_Shift, Key_Delete }, [&](const GUI::Action& action) {
|
||||
do_delete(ConfirmBeforeDelete::No, action);
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
|
||||
auto delete_action = GUI::CommonActions::make_delete_action([&](const GUI::Action& action) {
|
||||
auto delete_action = GUI::CommonActions::make_delete_action(
|
||||
[&](const GUI::Action& action) {
|
||||
do_delete(ConfirmBeforeDelete::Yes, action);
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
delete_action->set_enabled(false);
|
||||
|
||||
auto go_back_action = GUI::CommonActions::make_go_back_action([&](auto&) {
|
||||
auto go_back_action = GUI::CommonActions::make_go_back_action(
|
||||
[&](auto&) {
|
||||
directory_view->open_previous_directory();
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
|
||||
auto go_forward_action = GUI::CommonActions::make_go_forward_action([&](auto&) {
|
||||
auto go_forward_action = GUI::CommonActions::make_go_forward_action(
|
||||
[&](auto&) {
|
||||
directory_view->open_next_directory();
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
|
||||
auto go_home_action = GUI::CommonActions::make_go_home_action([&](auto&) {
|
||||
auto go_home_action = GUI::CommonActions::make_go_home_action(
|
||||
[&](auto&) {
|
||||
directory_view->open(get_current_user_home_path());
|
||||
}, window);
|
||||
},
|
||||
window);
|
||||
|
||||
auto menubar = make<GUI::MenuBar>();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue