Prechádzať zdrojové kódy

Applications: Run clang-format on everything.

Andreas Kling 6 rokov pred
rodič
commit
fd604a7c68

+ 4 - 4
Applications/About/main.cpp

@@ -1,9 +1,9 @@
 #include <LibGUI/GApplication.h>
-#include <LibGUI/GWindow.h>
-#include <LibGUI/GLabel.h>
-#include <LibGUI/GButton.h>
 #include <LibGUI/GBoxLayout.h>
+#include <LibGUI/GButton.h>
 #include <LibGUI/GDesktop.h>
+#include <LibGUI/GLabel.h>
+#include <LibGUI/GWindow.h>
 #include <sys/utsname.h>
 
 int main(int argc, char** argv)
@@ -49,7 +49,7 @@ int main(int argc, char** argv)
     quit_button->set_text("Okay");
     quit_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
     quit_button->set_preferred_size({ 100, 20 });
-    quit_button->on_click = [] (GButton&) {
+    quit_button->on_click = [](GButton&) {
         GApplication::the().quit(0);
     };
 

+ 2 - 2
Applications/Downloader/main.cpp

@@ -1,7 +1,7 @@
-#include <LibGUI/GApplication.h>
 #include <LibCore/CHttpRequest.h>
 #include <LibCore/CHttpResponse.h>
 #include <LibCore/CNetworkJob.h>
+#include <LibGUI/GApplication.h>
 #include <stdio.h>
 
 int main(int argc, char** argv)
@@ -13,7 +13,7 @@ int main(int argc, char** argv)
     request.set_path("/");
 
     auto job = request.schedule();
-    job->on_finish = [&job] (bool success) {
+    job->on_finish = [&job](bool success) {
         if (!success) {
             dbgprintf("on_finish: request failed :(\n");
             return;

+ 10 - 10
Applications/FileManager/DirectoryView.cpp

@@ -1,8 +1,8 @@
 #include "DirectoryView.h"
-#include <LibGUI/GSortingProxyModel.h>
 #include <AK/FileSystemPath.h>
-#include <unistd.h>
+#include <LibGUI/GSortingProxyModel.h>
 #include <stdio.h>
+#include <unistd.h>
 
 void DirectoryView::handle_activation(const GModelIndex& index)
 {
@@ -58,28 +58,28 @@ DirectoryView::DirectoryView(GWidget* parent)
 
     m_item_view->set_model_column(GDirectoryModel::Column::Name);
 
-    m_item_view->on_model_notification = [this] (const GModelNotification& notification) {
+    m_item_view->on_model_notification = [this](const GModelNotification& notification) {
         if (notification.type() == GModelNotification::Type::ModelUpdated) {
             set_status_message(String::format("%d item%s (%u byte%s)",
-                                              model().row_count(),
-                                              model().row_count() != 1 ? "s" : "",
-                                              model().bytes_in_files(),
-                                              model().bytes_in_files() != 1 ? "s" : ""));
+                model().row_count(),
+                model().row_count() != 1 ? "s" : "",
+                model().bytes_in_files(),
+                model().bytes_in_files() != 1 ? "s" : ""));
 
             if (on_path_change)
                 on_path_change(model().path());
         }
     };
 
-    m_model->on_thumbnail_progress = [this] (int done, int total) {
+    m_model->on_thumbnail_progress = [this](int done, int total) {
         if (on_thumbnail_progress)
             on_thumbnail_progress(done, total);
     };
 
-    m_item_view->on_activation = [&] (const GModelIndex& index) {
+    m_item_view->on_activation = [&](const GModelIndex& index) {
         handle_activation(index);
     };
-    m_table_view->on_activation = [&] (auto& index) {
+    m_table_view->on_activation = [&](auto& index) {
         auto& filter_model = (GSortingProxyModel&)*m_table_view->model();
         handle_activation(filter_model.map_to_target(index));
     };

+ 33 - 33
Applications/FileManager/main.cpp

@@ -1,25 +1,25 @@
-#include <LibGUI/GWindow.h>
-#include <LibGUI/GWidget.h>
-#include <LibGUI/GBoxLayout.h>
-#include <LibGUI/GApplication.h>
-#include <LibGUI/GStatusBar.h>
-#include <LibGUI/GTextEditor.h>
-#include <LibGUI/GToolBar.h>
-#include <LibGUI/GMenuBar.h>
+#include "DirectoryView.h"
+#include <AK/FileSystemPath.h>
+#include <LibCore/CUserInfo.h>
 #include <LibGUI/GAction.h>
-#include <LibGUI/GLabel.h>
+#include <LibGUI/GApplication.h>
+#include <LibGUI/GBoxLayout.h>
+#include <LibGUI/GFileSystemModel.h>
 #include <LibGUI/GInputBox.h>
+#include <LibGUI/GLabel.h>
+#include <LibGUI/GMenuBar.h>
 #include <LibGUI/GMessageBox.h>
 #include <LibGUI/GProgressBar.h>
-#include <LibGUI/GTreeView.h>
-#include <LibGUI/GFileSystemModel.h>
 #include <LibGUI/GSplitter.h>
-#include <LibCore/CUserInfo.h>
-#include <AK/FileSystemPath.h>
-#include <unistd.h>
+#include <LibGUI/GStatusBar.h>
+#include <LibGUI/GTextEditor.h>
+#include <LibGUI/GToolBar.h>
+#include <LibGUI/GTreeView.h>
+#include <LibGUI/GWidget.h>
+#include <LibGUI/GWindow.h>
 #include <signal.h>
 #include <stdio.h>
-#include "DirectoryView.h"
+#include <unistd.h>
 
 int main(int argc, char** argv)
 {
@@ -76,24 +76,24 @@ int main(int argc, char** argv)
         directory_view->open(location_textbox->text());
     };
 
-    file_system_model->on_selection_changed = [&] (auto& index) {
+    file_system_model->on_selection_changed = [&](auto& index) {
         auto path = file_system_model->path(index);
         if (directory_view->path() == path)
             return;
         directory_view->open(path);
     };
 
-    auto open_parent_directory_action = GAction::create("Open parent directory", { Mod_Alt, Key_Up }, GraphicsBitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [directory_view] (const GAction&) {
+    auto open_parent_directory_action = GAction::create("Open parent directory", { Mod_Alt, Key_Up }, GraphicsBitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [directory_view](const GAction&) {
         directory_view->open_parent_directory();
     });
 
-    auto mkdir_action = GAction::create("New directory...", GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&] (const GAction&) {
+    auto mkdir_action = GAction::create("New directory...", GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GAction&) {
         GInputBox input_box("Enter name:", "New directory", window);
         if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty()) {
             auto new_dir_path = FileSystemPath(String::format("%s/%s",
-                directory_view->path().characters(),
-                input_box.text_value().characters()
-            )).string();
+                                                   directory_view->path().characters(),
+                                                   input_box.text_value().characters()))
+                                    .string();
             int rc = mkdir(new_dir_path.characters(), 0777);
             if (rc < 0) {
                 GMessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, window);
@@ -106,7 +106,7 @@ int main(int argc, char** argv)
     RetainPtr<GAction> view_as_table_action;
     RetainPtr<GAction> view_as_icons_action;
 
-    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&) {
+    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);
         view_as_icons_action->set_checked(false);
         view_as_table_action->set_checked(true);
@@ -114,7 +114,7 @@ int main(int argc, char** argv)
     view_as_table_action->set_checkable(true);
     view_as_table_action->set_checked(false);
 
-    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&) {
+    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);
         view_as_table_action->set_checked(false);
         view_as_icons_action->set_checked(true);
@@ -122,20 +122,20 @@ int main(int argc, char** argv)
     view_as_icons_action->set_checkable(true);
     view_as_icons_action->set_checked(true);
 
-    auto copy_action = GAction::create("Copy", GraphicsBitmap::load_from_file("/res/icons/16x16/edit-copy.png"), [] (const GAction&) {
+    auto copy_action = GAction::create("Copy", GraphicsBitmap::load_from_file("/res/icons/16x16/edit-copy.png"), [](const GAction&) {
         dbgprintf("'Copy' action activated!\n");
     });
 
-    auto delete_action = GAction::create("Delete", GraphicsBitmap::load_from_file("/res/icons/16x16/delete.png"), [] (const GAction&) {
+    auto delete_action = GAction::create("Delete", GraphicsBitmap::load_from_file("/res/icons/16x16/delete.png"), [](const GAction&) {
         dbgprintf("'Delete' action activated!\n");
     });
 
-    auto go_back_action = GAction::create("Go Back", GraphicsBitmap::load_from_file("/res/icons/16x16/go-back.png"), [directory_view] (const GAction&) {
+    auto go_back_action = GAction::create("Go Back", GraphicsBitmap::load_from_file("/res/icons/16x16/go-back.png"), [directory_view](const GAction&) {
         dbgprintf("'Go Back' action activated!\n");
         directory_view->open_previous_directory();
     });
 
-    auto go_forward_action = GAction::create("Go Forward", GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [directory_view] (const GAction&) {
+    auto go_forward_action = GAction::create("Go Forward", GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [directory_view](const GAction&) {
         dbgprintf("'Go Forward' action activated!\n");
         directory_view->open_next_directory();
     });
@@ -143,7 +143,7 @@ int main(int argc, char** argv)
     auto menubar = make<GMenuBar>();
 
     auto app_menu = make<GMenu>("File Manager");
-    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) {
+    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [](const GAction&) {
         GApplication::the().quit(0);
         return;
     }));
@@ -167,7 +167,7 @@ int main(int argc, char** argv)
     menubar->add_menu(move(go_menu));
 
     auto help_menu = make<GMenu>("Help");
-    help_menu->add_action(GAction::create("About", [] (const GAction&) {
+    help_menu->add_action(GAction::create("About", [](const GAction&) {
         dbgprintf("FIXME: Implement Help/About\n");
     }));
     menubar->add_menu(move(help_menu));
@@ -187,7 +187,7 @@ int main(int argc, char** argv)
     main_toolbar->add_action(*view_as_icons_action);
     main_toolbar->add_action(*view_as_table_action);
 
-    directory_view->on_path_change = [window, location_textbox, &file_system_model, tree_view, &go_forward_action, &go_back_action, directory_view] (const String& new_path) {
+    directory_view->on_path_change = [window, location_textbox, &file_system_model, tree_view, &go_forward_action, &go_back_action, directory_view](const String& new_path) {
         window->set_title(String::format("File Manager: %s", new_path.characters()));
         location_textbox->set_text(new_path);
         file_system_model->set_selected_index(file_system_model->index(new_path));
@@ -195,15 +195,15 @@ int main(int argc, char** argv)
         tree_view->update();
 
         go_forward_action->set_enabled(directory_view->path_history_position()
-                                       < directory_view->path_history_size() - 1);
+            < directory_view->path_history_size() - 1);
         go_back_action->set_enabled(directory_view->path_history_position() > 0);
     };
 
-    directory_view->on_status_message = [statusbar] (const StringView& message) {
+    directory_view->on_status_message = [statusbar](const StringView& message) {
         statusbar->set_text(message);
     };
 
-    directory_view->on_thumbnail_progress = [&] (int done, int total) {
+    directory_view->on_thumbnail_progress = [&](int done, int total) {
         if (done == total) {
             progressbar->set_visible(false);
             return;

+ 11 - 11
Applications/FontEditor/FontEditor.cpp

@@ -1,13 +1,13 @@
 #include "FontEditor.h"
-#include "GlyphMapWidget.h"
 #include "GlyphEditorWidget.h"
-#include <LibGUI/GPainter.h>
+#include "GlyphMapWidget.h"
 #include <LibGUI/GButton.h>
-#include <LibGUI/GLabel.h>
-#include <LibGUI/GTextBox.h>
 #include <LibGUI/GCheckBox.h>
-#include <LibGUI/GSpinBox.h>
 #include <LibGUI/GGroupBox.h>
+#include <LibGUI/GLabel.h>
+#include <LibGUI/GPainter.h>
+#include <LibGUI/GSpinBox.h>
+#include <LibGUI/GTextBox.h>
 #include <stdlib.h>
 
 FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_font, GWidget* parent)
@@ -52,7 +52,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_
     auto* save_button = new GButton(this);
     save_button->set_text("Save");
     save_button->set_relative_rect({ 5, 300, 105, 20 });
-    save_button->on_click = [this] (GButton&) {
+    save_button->on_click = [this](GButton&) {
         dbgprintf("write to file: '%s'\n", m_path.characters());
         m_edited_font->write_to_file(m_path);
     };
@@ -60,7 +60,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_
     auto* quit_button = new GButton(this);
     quit_button->set_text("Quit");
     quit_button->set_relative_rect({ 110, 300, 105, 20 });
-    quit_button->on_click = [] (GButton&) {
+    quit_button->on_click = [](GButton&) {
         exit(0);
     };
 
@@ -91,25 +91,25 @@ FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_
         demo_label_2->update();
     };
 
-    m_glyph_editor_widget->on_glyph_altered = [this, update_demo] (byte glyph) {
+    m_glyph_editor_widget->on_glyph_altered = [this, update_demo](byte glyph) {
         m_glyph_map_widget->update_glyph(glyph);
         update_demo();
     };
 
-    m_glyph_map_widget->on_glyph_selected = [this, info_label, width_spinbox] (byte glyph) {
+    m_glyph_map_widget->on_glyph_selected = [this, info_label, width_spinbox](byte glyph) {
         m_glyph_editor_widget->set_glyph(glyph);
         width_spinbox->set_value(m_edited_font->glyph_width(m_glyph_map_widget->selected_glyph()));
         info_label->set_text(String::format("0x%b (%c)", glyph, glyph));
     };
 
-    fixed_width_checkbox->on_checked = [this, width_spinbox, update_demo] (bool checked) {
+    fixed_width_checkbox->on_checked = [this, width_spinbox, update_demo](bool checked) {
         m_edited_font->set_fixed_width(checked);
         width_spinbox->set_value(m_edited_font->glyph_width(m_glyph_map_widget->selected_glyph()));
         m_glyph_editor_widget->update();
         update_demo();
     };
 
-    width_spinbox->on_change = [this, update_demo] (int value) {
+    width_spinbox->on_change = [this, update_demo](int value) {
         m_edited_font->set_glyph_width(m_glyph_map_widget->selected_glyph(), value);
         m_glyph_editor_widget->update();
         m_glyph_map_widget->update_glyph(m_glyph_map_widget->selected_glyph());

+ 3 - 3
Applications/FontEditor/GlyphMapWidget.cpp

@@ -44,7 +44,8 @@ Rect GlyphMapWidget::get_outer_rect(byte glyph) const
         row * (font().glyph_height() + m_vertical_spacing) + 1,
         font().max_glyph_width() + m_horizontal_spacing,
         font().glyph_height() + m_horizontal_spacing
-    }.translated(frame_thickness(), frame_thickness());
+    }
+        .translated(frame_thickness(), frame_thickness());
 }
 
 void GlyphMapWidget::update_glyph(byte glyph)
@@ -71,8 +72,7 @@ void GlyphMapWidget::paint_event(GPaintEvent& event)
                 outer_rect.x() + m_horizontal_spacing / 2,
                 outer_rect.y() + m_vertical_spacing / 2,
                 font().max_glyph_width(),
-                font().glyph_height()
-            );
+                font().glyph_height());
             if (glyph == m_selected_glyph) {
                 painter.fill_rect(outer_rect, Color::from_rgb(0x84351a));
                 painter.draw_glyph(inner_rect.location(), glyph, Color::White);

+ 16 - 16
Applications/IRCClient/IRCAppWindow.cpp

@@ -1,16 +1,16 @@
 #include "IRCAppWindow.h"
 #include "IRCWindow.h"
 #include "IRCWindowListModel.h"
+#include <LibGUI/GAction.h>
 #include <LibGUI/GApplication.h>
-#include <LibGUI/GStackWidget.h>
-#include <LibGUI/GTableView.h>
 #include <LibGUI/GBoxLayout.h>
-#include <LibGUI/GToolBar.h>
-#include <LibGUI/GAction.h>
+#include <LibGUI/GInputBox.h>
 #include <LibGUI/GMenu.h>
 #include <LibGUI/GMenuBar.h>
-#include <LibGUI/GInputBox.h>
 #include <LibGUI/GSplitter.h>
+#include <LibGUI/GStackWidget.h>
+#include <LibGUI/GTableView.h>
+#include <LibGUI/GToolBar.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -36,7 +36,7 @@ void IRCAppWindow::update_title()
 
 void IRCAppWindow::setup_client()
 {
-    m_client.aid_create_window = [this] (void* owner, IRCWindow::Type type, const String& name) {
+    m_client.aid_create_window = [this](void* owner, IRCWindow::Type type, const String& name) {
         return &create_window(owner, type, name);
     };
     m_client.aid_get_active_window = [this] {
@@ -45,7 +45,7 @@ void IRCAppWindow::setup_client()
     m_client.aid_update_window_list = [this] {
         m_window_list->model()->update();
     };
-    m_client.on_nickname_changed = [this] (const String&) {
+    m_client.on_nickname_changed = [this](const String&) {
         update_title();
     };
 
@@ -64,33 +64,33 @@ void IRCAppWindow::setup_client()
 
 void IRCAppWindow::setup_actions()
 {
-    m_join_action = GAction::create("Join channel", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-join.png"), [&] (auto&) {
+    m_join_action = GAction::create("Join channel", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-join.png"), [&](auto&) {
         GInputBox input_box("Enter channel name:", "Join channel", this);
         if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty())
             m_client.handle_join_action(input_box.text_value());
     });
 
-    m_part_action = GAction::create("Part from channel", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-part.png"), [] (auto&) {
+    m_part_action = GAction::create("Part from channel", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-part.png"), [](auto&) {
         printf("FIXME: Implement part action\n");
     });
 
-    m_whois_action = GAction::create("Whois user", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-whois.png"), [&] (auto&) {
+    m_whois_action = GAction::create("Whois user", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-whois.png"), [&](auto&) {
         GInputBox input_box("Enter nickname:", "IRC WHOIS lookup", this);
         if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty())
             m_client.handle_whois_action(input_box.text_value());
     });
 
-    m_open_query_action = GAction::create("Open query", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-open-query.png"), [&] (auto&) {
+    m_open_query_action = GAction::create("Open query", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-open-query.png"), [&](auto&) {
         GInputBox input_box("Enter nickname:", "Open IRC query with...", this);
         if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty())
             m_client.handle_open_query_action(input_box.text_value());
     });
 
-    m_close_query_action = GAction::create("Close query", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-close-query.png"), [] (auto&) {
+    m_close_query_action = GAction::create("Close query", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-close-query.png"), [](auto&) {
         printf("FIXME: Implement close-query action\n");
     });
 
-    m_change_nick_action = GAction::create("Change nickname", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-nick.png"), [this] (auto&) {
+    m_change_nick_action = GAction::create("Change nickname", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-nick.png"), [this](auto&) {
         GInputBox input_box("Enter nickname:", "Change nickname", this);
         if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty())
             m_client.handle_change_nick_action(input_box.text_value());
@@ -101,7 +101,7 @@ void IRCAppWindow::setup_menus()
 {
     auto menubar = make<GMenuBar>();
     auto app_menu = make<GMenu>("IRC Client");
-    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) {
+    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [](const GAction&) {
         dbgprintf("Terminal: Quit menu activated!\n");
         GApplication::the().quit(0);
         return;
@@ -120,7 +120,7 @@ void IRCAppWindow::setup_menus()
     menubar->add_menu(move(server_menu));
 
     auto help_menu = make<GMenu>("Help");
-    help_menu->add_action(GAction::create("About", [] (const GAction&) {
+    help_menu->add_action(GAction::create("About", [](const GAction&) {
         dbgprintf("FIXME: Implement Help/About\n");
     }));
     menubar->add_menu(move(help_menu));
@@ -156,7 +156,7 @@ void IRCAppWindow::setup_widgets()
     m_window_list->set_activates_on_selection(true);
     m_window_list->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
     m_window_list->set_preferred_size({ 100, 0 });
-    m_window_list->on_activation = [this] (auto& index) {
+    m_window_list->on_activation = [this](auto& index) {
         auto& window = m_client.window_at(index.row());
         m_container->set_active_widget(&window);
         window.clear_unread_count();

+ 2 - 2
Applications/IRCClient/IRCChannel.cpp

@@ -1,6 +1,6 @@
 #include "IRCChannel.h"
-#include "IRCClient.h"
 #include "IRCChannelMemberListModel.h"
+#include "IRCClient.h"
 #include <stdio.h>
 #include <time.h>
 
@@ -37,7 +37,7 @@ void IRCChannel::add_member(const String& name, char prefix)
 
 void IRCChannel::remove_member(const String& name)
 {
-    m_members.remove_first_matching([&] (auto& member) { return name == member.name; });
+    m_members.remove_first_matching([&](auto& member) { return name == member.name; });
 }
 
 void IRCChannel::add_message(char prefix, const String& name, const String& text, Color color)

+ 7 - 4
Applications/IRCClient/IRCChannelMemberListModel.cpp

@@ -25,7 +25,8 @@ int IRCChannelMemberListModel::column_count(const GModelIndex&) const
 String IRCChannelMemberListModel::column_name(int column) const
 {
     switch (column) {
-    case Column::Name: return "Name";
+    case Column::Name:
+        return "Name";
     }
     ASSERT_NOT_REACHED();
 }
@@ -33,7 +34,8 @@ String IRCChannelMemberListModel::column_name(int column) const
 GModel::ColumnMetadata IRCChannelMemberListModel::column_metadata(int column) const
 {
     switch (column) {
-    case Column::Name: return { 70, TextAlignment::CenterLeft };
+    case Column::Name:
+        return { 70, TextAlignment::CenterLeft };
     }
     ASSERT_NOT_REACHED();
 }
@@ -42,10 +44,11 @@ GVariant IRCChannelMemberListModel::data(const GModelIndex& index, Role role) co
 {
     if (role == Role::Display) {
         switch (index.column()) {
-        case Column::Name: return m_channel.member_at(index.row());
+        case Column::Name:
+            return m_channel.member_at(index.row());
         }
     }
-    return { };
+    return {};
 }
 
 void IRCChannelMemberListModel::update()

+ 35 - 25
Applications/IRCClient/IRCClient.cpp

@@ -1,20 +1,21 @@
 #include "IRCClient.h"
 #include "IRCChannel.h"
-#include "IRCQuery.h"
 #include "IRCLogBuffer.h"
+#include "IRCQuery.h"
 #include "IRCWindow.h"
 #include "IRCWindowListModel.h"
 #include <LibCore/CNotifier.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
 #include <arpa/inet.h>
-#include <unistd.h>
+#include <netinet/in.h>
 #include <stdio.h>
+#include <sys/socket.h>
 #include <time.h>
+#include <unistd.h>
 
 #define IRC_DEBUG
 
-enum IRCNumeric {
+enum IRCNumeric
+{
     RPL_WHOISUSER = 311,
     RPL_WHOISSERVER = 312,
     RPL_WHOISOPERATOR = 313,
@@ -43,7 +44,7 @@ IRCClient::~IRCClient()
 {
 }
 
-void IRCClient::set_server(const String &hostname, int port)
+void IRCClient::set_server(const String& hostname, int port)
 {
     m_hostname = hostname;
     m_port = port;
@@ -105,14 +106,16 @@ void IRCClient::process_line(ByteBuffer&& line)
     Vector<char, 32> prefix;
     Vector<char, 32> command;
     Vector<char, 256> current_parameter;
-    enum {
+    enum
+    {
         Start,
         InPrefix,
         InCommand,
         InStartOfParameter,
         InParameter,
         InTrailingParameter,
-    } state = Start;
+    } state
+        = Start;
 
     for (int i = 0; i < line.size(); ++i) {
         char ch = line[i];
@@ -216,8 +219,7 @@ void IRCClient::handle(const Message& msg)
     printf("IRCClient::execute: prefix='%s', command='%s', arguments=%d\n",
         msg.prefix.characters(),
         msg.command.characters(),
-        msg.arguments.size()
-    );
+        msg.arguments.size());
 
     int i = 0;
     for (auto& arg : msg.arguments) {
@@ -231,16 +233,26 @@ void IRCClient::handle(const Message& msg)
 
     if (is_numeric) {
         switch (numeric) {
-        case RPL_WHOISCHANNELS: return handle_rpl_whoischannels(msg);
-        case RPL_ENDOFWHOIS: return handle_rpl_endofwhois(msg);
-        case RPL_WHOISOPERATOR: return handle_rpl_whoisoperator(msg);
-        case RPL_WHOISSERVER: return handle_rpl_whoisserver(msg);
-        case RPL_WHOISUSER: return handle_rpl_whoisuser(msg);
-        case RPL_WHOISIDLE: return handle_rpl_whoisidle(msg);
-        case RPL_TOPICWHOTIME: return handle_rpl_topicwhotime(msg);
-        case RPL_TOPIC: return handle_rpl_topic(msg);
-        case RPL_NAMREPLY: return handle_rpl_namreply(msg);
-        case RPL_ENDOFNAMES: return handle_rpl_endofnames(msg);
+        case RPL_WHOISCHANNELS:
+            return handle_rpl_whoischannels(msg);
+        case RPL_ENDOFWHOIS:
+            return handle_rpl_endofwhois(msg);
+        case RPL_WHOISOPERATOR:
+            return handle_rpl_whoisoperator(msg);
+        case RPL_WHOISSERVER:
+            return handle_rpl_whoisserver(msg);
+        case RPL_WHOISUSER:
+            return handle_rpl_whoisuser(msg);
+        case RPL_WHOISIDLE:
+            return handle_rpl_whoisidle(msg);
+        case RPL_TOPICWHOTIME:
+            return handle_rpl_topicwhotime(msg);
+        case RPL_TOPIC:
+            return handle_rpl_topic(msg);
+        case RPL_NAMREPLY:
+            return handle_rpl_namreply(msg);
+        case RPL_ENDOFNAMES:
+            return handle_rpl_endofnames(msg);
         }
     }
 
@@ -441,7 +453,7 @@ void IRCClient::handle_rpl_topic(const Message& msg)
         return;
     auto& channel_name = msg.arguments[1];
     auto& topic = msg.arguments[2];
-    ensure_channel(channel_name).handle_topic({ }, topic);
+    ensure_channel(channel_name).handle_topic({}, topic);
     // FIXME: Handle RPL_TOPICWHOTIME so we can know who set it and when.
 }
 
@@ -502,8 +514,7 @@ void IRCClient::handle_rpl_whoisuser(const Message& msg)
         nick.characters(),
         username.characters(),
         host.characters(),
-        realname.characters()
-    ));
+        realname.characters()));
 }
 
 void IRCClient::handle_rpl_whoisidle(const Message& msg)
@@ -541,8 +552,7 @@ void IRCClient::handle_rpl_topicwhotime(const Message& msg)
             tm->tm_mday,
             tm->tm_hour,
             tm->tm_min,
-            tm->tm_sec
-        );
+            tm->tm_sec);
     }
     ensure_channel(channel_name).add_message(String::format("*** (set by %s at %s)", nick.characters(), setat.characters()), Color::Blue);
 }

+ 16 - 9
Applications/IRCClient/IRCLogBufferModel.cpp

@@ -1,8 +1,8 @@
 #include "IRCLogBufferModel.h"
 #include "IRCLogBuffer.h"
+#include <SharedGraphics/Font.h>
 #include <stdio.h>
 #include <time.h>
-#include <SharedGraphics/Font.h>
 
 IRCLogBufferModel::IRCLogBufferModel(Retained<IRCLogBuffer>&& log_buffer)
     : m_log_buffer(move(log_buffer))
@@ -26,9 +26,12 @@ int IRCLogBufferModel::column_count(const GModelIndex&) const
 String IRCLogBufferModel::column_name(int column) const
 {
     switch (column) {
-    case Column::Timestamp: return "Time";
-    case Column::Name: return "Name";
-    case Column::Text: return "Text";
+    case Column::Timestamp:
+        return "Time";
+    case Column::Name:
+        return "Name";
+    case Column::Text:
+        return "Text";
     }
     ASSERT_NOT_REACHED();
 }
@@ -36,9 +39,12 @@ String IRCLogBufferModel::column_name(int column) const
 GModel::ColumnMetadata IRCLogBufferModel::column_metadata(int column) const
 {
     switch (column) {
-    case Column::Timestamp: return { 60, TextAlignment::CenterLeft };
-    case Column::Name: return { 70, TextAlignment::CenterRight, &Font::default_bold_font() };
-    case Column::Text: return { 800, TextAlignment::CenterLeft };
+    case Column::Timestamp:
+        return { 60, TextAlignment::CenterLeft };
+    case Column::Name:
+        return { 70, TextAlignment::CenterRight, &Font::default_bold_font() };
+    case Column::Text:
+        return { 800, TextAlignment::CenterLeft };
     }
     ASSERT_NOT_REACHED();
 }
@@ -56,7 +62,8 @@ GVariant IRCLogBufferModel::data(const GModelIndex& index, Role role) const
             if (entry.sender.is_empty())
                 return String::empty();
             return String::format("<%c%s>", entry.prefix ? entry.prefix : ' ', entry.sender.characters());
-        case Column::Text: return entry.text;
+        case Column::Text:
+            return entry.text;
         }
     }
     if (role == Role::ForegroundColor) {
@@ -65,7 +72,7 @@ GVariant IRCLogBufferModel::data(const GModelIndex& index, Role role) const
         if (index.column() == Column::Text)
             return m_log_buffer->at(index.row()).color;
     }
-    return { };
+    return {};
 }
 
 void IRCLogBufferModel::update()

+ 3 - 3
Applications/IRCClient/IRCWindow.cpp

@@ -1,13 +1,13 @@
 #include "IRCWindow.h"
-#include "IRCClient.h"
 #include "IRCChannel.h"
 #include "IRCChannelMemberListModel.h"
+#include "IRCClient.h"
 #include "IRCLogBufferModel.h"
 #include <LibGUI/GBoxLayout.h>
+#include <LibGUI/GSplitter.h>
 #include <LibGUI/GTableView.h>
-#include <LibGUI/GTextEditor.h>
 #include <LibGUI/GTextBox.h>
-#include <LibGUI/GSplitter.h>
+#include <LibGUI/GTextEditor.h>
 
 IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name, GWidget* parent)
     : GWidget(parent)

+ 7 - 5
Applications/IRCClient/IRCWindowListModel.cpp

@@ -1,7 +1,7 @@
 #include "IRCWindowListModel.h"
-#include "IRCWindow.h"
-#include "IRCClient.h"
 #include "IRCChannel.h"
+#include "IRCClient.h"
+#include "IRCWindow.h"
 #include <stdio.h>
 #include <time.h>
 
@@ -27,7 +27,8 @@ int IRCWindowListModel::column_count(const GModelIndex&) const
 String IRCWindowListModel::column_name(int column) const
 {
     switch (column) {
-    case Column::Name: return "Name";
+    case Column::Name:
+        return "Name";
     }
     ASSERT_NOT_REACHED();
 }
@@ -35,7 +36,8 @@ String IRCWindowListModel::column_name(int column) const
 GModel::ColumnMetadata IRCWindowListModel::column_metadata(int column) const
 {
     switch (column) {
-    case Column::Name: return { 70, TextAlignment::CenterLeft };
+    case Column::Name:
+        return { 70, TextAlignment::CenterLeft };
     }
     ASSERT_NOT_REACHED();
 }
@@ -64,7 +66,7 @@ GVariant IRCWindowListModel::data(const GModelIndex& index, Role role) const
         }
         }
     }
-    return { };
+    return {};
 }
 
 void IRCWindowListModel::update()

+ 1 - 1
Applications/IRCClient/main.cpp

@@ -1,6 +1,6 @@
+#include "IRCAppWindow.h"
 #include "IRCClient.h"
 #include <LibGUI/GApplication.h>
-#include "IRCAppWindow.h"
 #include <stdio.h>
 
 int main(int argc, char** argv)

+ 15 - 14
Applications/Launcher/main.cpp

@@ -1,16 +1,16 @@
-#include <SharedGraphics/GraphicsBitmap.h>
-#include <LibGUI/GWindow.h>
-#include <LibGUI/GWidget.h>
-#include <LibGUI/GButton.h>
+#include <LibCore/CConfigFile.h>
+#include <LibCore/CUserInfo.h>
 #include <LibGUI/GApplication.h>
 #include <LibGUI/GBoxLayout.h>
-#include <LibCore/CConfigFile.h>
-#include <sys/wait.h>
+#include <LibGUI/GButton.h>
+#include <LibGUI/GWidget.h>
+#include <LibGUI/GWindow.h>
+#include <SharedGraphics/GraphicsBitmap.h>
+#include <errno.h>
 #include <signal.h>
-#include <unistd.h>
 #include <stdio.h>
-#include <errno.h>
-#include <LibCore/CUserInfo.h>
+#include <sys/wait.h>
+#include <unistd.h>
 
 static GWindow* make_launcher_window();
 
@@ -47,7 +47,7 @@ public:
         set_icon(GraphicsBitmap::load_from_file(icon_path));
         set_preferred_size({ 50, 50 });
         set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
-        on_click = [this] (GButton&) {
+        on_click = [this](GButton&) {
             pid_t child_pid = fork();
             if (!child_pid) {
                 int rc = execl(m_executable_path.characters(), m_executable_path.characters(), nullptr);
@@ -55,7 +55,8 @@ public:
                     perror("execl");
             }
         };
-    } virtual ~LauncherButton() { }
+    }
+    virtual ~LauncherButton() {}
 
 private:
     String m_executable_path;
@@ -78,9 +79,9 @@ GWindow* make_launcher_window()
 
     for (auto& group : config->groups()) {
         new LauncherButton(config->read_entry(group, "Name", group),
-                           config->read_entry(group, "Icon", ""),
-                           config->read_entry(group, "Path", ""),
-                           widget);
+            config->read_entry(group, "Icon", ""),
+            config->read_entry(group, "Path", ""),
+            widget);
     }
 
     return window;

+ 2 - 2
Applications/ProcessManager/MemoryStatsWidget.cpp

@@ -1,8 +1,8 @@
 #include "MemoryStatsWidget.h"
 #include "GraphWidget.h"
-#include <LibGUI/GPainter.h>
 #include <LibGUI/GBoxLayout.h>
 #include <LibGUI/GLabel.h>
+#include <LibGUI/GPainter.h>
 #include <SharedGraphics/StylePainter.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -21,7 +21,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph, GWidget* parent)
     layout()->set_margins({ 0, 8, 0, 0 });
     layout()->set_spacing(3);
 
-    auto build_widgets_for_label = [this] (const String& description) -> GLabel* {
+    auto build_widgets_for_label = [this](const String& description) -> GLabel* {
         auto* container = new GWidget(this);
         container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
         container->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);

+ 83 - 43
Applications/ProcessManager/ProcessModel.cpp

@@ -2,8 +2,8 @@
 #include "GraphWidget.h"
 #include <LibCore/CFile.h>
 #include <fcntl.h>
-#include <stdio.h>
 #include <pwd.h>
+#include <stdio.h>
 
 ProcessModel::ProcessModel(GraphWidget& graph)
     : m_graph(graph)
@@ -42,34 +42,56 @@ int ProcessModel::column_count(const GModelIndex&) const
 String ProcessModel::column_name(int column) const
 {
     switch (column) {
-    case Column::Icon: return "";
-    case Column::PID: return "PID";
-    case Column::State: return "State";
-    case Column::User: return "User";
-    case Column::Priority: return "Pr";
-    case Column::Linear: return "Linear";
-    case Column::Physical: return "Physical";
-    case Column::CPU: return "CPU";
-    case Column::Name: return "Name";
-    case Column::Syscalls: return "Syscalls";
-    default: ASSERT_NOT_REACHED();
+    case Column::Icon:
+        return "";
+    case Column::PID:
+        return "PID";
+    case Column::State:
+        return "State";
+    case Column::User:
+        return "User";
+    case Column::Priority:
+        return "Pr";
+    case Column::Linear:
+        return "Linear";
+    case Column::Physical:
+        return "Physical";
+    case Column::CPU:
+        return "CPU";
+    case Column::Name:
+        return "Name";
+    case Column::Syscalls:
+        return "Syscalls";
+    default:
+        ASSERT_NOT_REACHED();
     }
 }
 
 GModel::ColumnMetadata ProcessModel::column_metadata(int column) const
 {
     switch (column) {
-    case Column::Icon: return { 16, TextAlignment::CenterLeft };
-    case Column::PID: return { 32, TextAlignment::CenterRight };
-    case Column::State: return { 75, TextAlignment::CenterLeft };
-    case Column::Priority: return { 16, TextAlignment::CenterLeft };
-    case Column::User: return { 50, TextAlignment::CenterLeft };
-    case Column::Linear: return { 65, TextAlignment::CenterRight };
-    case Column::Physical: return { 65, TextAlignment::CenterRight };
-    case Column::CPU: return { 32, TextAlignment::CenterRight };
-    case Column::Name: return { 140, TextAlignment::CenterLeft };
-    case Column::Syscalls: return { 60, TextAlignment::CenterRight };
-    default: ASSERT_NOT_REACHED();
+    case Column::Icon:
+        return { 16, TextAlignment::CenterLeft };
+    case Column::PID:
+        return { 32, TextAlignment::CenterRight };
+    case Column::State:
+        return { 75, TextAlignment::CenterLeft };
+    case Column::Priority:
+        return { 16, TextAlignment::CenterLeft };
+    case Column::User:
+        return { 50, TextAlignment::CenterLeft };
+    case Column::Linear:
+        return { 65, TextAlignment::CenterRight };
+    case Column::Physical:
+        return { 65, TextAlignment::CenterRight };
+    case Column::CPU:
+        return { 32, TextAlignment::CenterRight };
+    case Column::Name:
+        return { 140, TextAlignment::CenterLeft };
+    case Column::Syscalls:
+        return { 60, TextAlignment::CenterRight };
+    default:
+        ASSERT_NOT_REACHED();
     }
 }
 
@@ -87,10 +109,14 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
 
     if (role == Role::Sort) {
         switch (index.column()) {
-        case Column::Icon: return 0;
-        case Column::PID: return process.current_state.pid;
-        case Column::State: return process.current_state.state;
-        case Column::User: return process.current_state.user;
+        case Column::Icon:
+            return 0;
+        case Column::PID:
+            return process.current_state.pid;
+        case Column::State:
+            return process.current_state.state;
+        case Column::User:
+            return process.current_state.user;
         case Column::Priority:
             if (process.current_state.priority == "Idle")
                 return 0;
@@ -102,23 +128,32 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
                 return 3;
             ASSERT_NOT_REACHED();
             return 3;
-        case Column::Linear: return (int)process.current_state.linear;
-        case Column::Physical: return (int)process.current_state.physical;
-        case Column::CPU: return process.current_state.cpu_percent;
-        case Column::Name: return process.current_state.name;
+        case Column::Linear:
+            return (int)process.current_state.linear;
+        case Column::Physical:
+            return (int)process.current_state.physical;
+        case Column::CPU:
+            return process.current_state.cpu_percent;
+        case Column::Name:
+            return process.current_state.name;
         // FIXME: GVariant with unsigned?
-        case Column::Syscalls: return (int)process.current_state.syscalls;
+        case Column::Syscalls:
+            return (int)process.current_state.syscalls;
         }
         ASSERT_NOT_REACHED();
-        return { };
+        return {};
     }
 
     if (role == Role::Display) {
         switch (index.column()) {
-        case Column::Icon: return *m_generic_process_icon;
-        case Column::PID: return process.current_state.pid;
-        case Column::State: return process.current_state.state;
-        case Column::User: return process.current_state.user;
+        case Column::Icon:
+            return *m_generic_process_icon;
+        case Column::PID:
+            return process.current_state.pid;
+        case Column::State:
+            return process.current_state.state;
+        case Column::User:
+            return process.current_state.user;
         case Column::Priority:
             if (process.current_state.priority == "Idle")
                 return String::empty();
@@ -129,16 +164,21 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
             if (process.current_state.priority == "Normal")
                 return *m_normal_priority_icon;
             return process.current_state.priority;
-        case Column::Linear: return pretty_byte_size(process.current_state.linear);
-        case Column::Physical: return pretty_byte_size(process.current_state.physical);
-        case Column::CPU: return process.current_state.cpu_percent;
-        case Column::Name: return process.current_state.name;
+        case Column::Linear:
+            return pretty_byte_size(process.current_state.linear);
+        case Column::Physical:
+            return pretty_byte_size(process.current_state.physical);
+        case Column::CPU:
+            return process.current_state.cpu_percent;
+        case Column::Name:
+            return process.current_state.name;
         // FIXME: It's weird that GVariant doesn't support unsigned ints. Should it?
-        case Column::Syscalls: return (int)process.current_state.syscalls;
+        case Column::Syscalls:
+            return (int)process.current_state.syscalls;
         }
     }
 
-    return { };
+    return {};
 }
 
 void ProcessModel::update()

+ 24 - 24
Applications/ProcessManager/main.cpp

@@ -1,20 +1,20 @@
+#include "GraphWidget.h"
+#include "MemoryStatsWidget.h"
+#include "ProcessTableView.h"
 #include <LibCore/CTimer.h>
-#include <LibGUI/GWindow.h>
-#include <LibGUI/GWidget.h>
-#include <LibGUI/GBoxLayout.h>
+#include <LibGUI/GAction.h>
 #include <LibGUI/GApplication.h>
-#include <LibGUI/GToolBar.h>
-#include <LibGUI/GMenuBar.h>
+#include <LibGUI/GBoxLayout.h>
 #include <LibGUI/GGroupBox.h>
-#include <LibGUI/GAction.h>
-#include <LibGUI/GTabWidget.h>
 #include <LibGUI/GLabel.h>
-#include <unistd.h>
-#include <stdio.h>
+#include <LibGUI/GMenuBar.h>
+#include <LibGUI/GTabWidget.h>
+#include <LibGUI/GToolBar.h>
+#include <LibGUI/GWidget.h>
+#include <LibGUI/GWindow.h>
 #include <signal.h>
-#include "ProcessTableView.h"
-#include "MemoryStatsWidget.h"
-#include "GraphWidget.h"
+#include <stdio.h>
+#include <unistd.h>
 
 int main(int argc, char** argv)
 {
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
     cpu_graph->set_max(100);
     cpu_graph->set_text_color(Color::Green);
     cpu_graph->set_graph_color(Color::from_rgb(0x00bb00));
-    cpu_graph->text_formatter = [] (int value, int) {
+    cpu_graph->text_formatter = [](int value, int) {
         return String::format("%d%%", value);
     };
 
@@ -58,7 +58,7 @@ int main(int argc, char** argv)
     auto* memory_graph = new GraphWidget(memory_graph_group_box);
     memory_graph->set_text_color(Color::Cyan);
     memory_graph->set_graph_color(Color::from_rgb(0x00bbbb));
-    memory_graph->text_formatter = [] (int value, int max) {
+    memory_graph->text_formatter = [](int value, int max) {
         return String::format("%d / %d KB", value, max);
     };
 
@@ -78,19 +78,19 @@ int main(int argc, char** argv)
         memory_stats_widget->refresh();
     });
 
-    auto kill_action = GAction::create("Kill process", GraphicsBitmap::load_from_file("/res/icons/kill16.png"), [process_table_view] (const GAction&) {
+    auto kill_action = GAction::create("Kill process", GraphicsBitmap::load_from_file("/res/icons/kill16.png"), [process_table_view](const GAction&) {
         pid_t pid = process_table_view->selected_pid();
         if (pid != -1)
             kill(pid, SIGKILL);
     });
 
-    auto stop_action = GAction::create("Stop process", GraphicsBitmap::load_from_file("/res/icons/stop16.png"), [process_table_view] (const GAction&) {
+    auto stop_action = GAction::create("Stop process", GraphicsBitmap::load_from_file("/res/icons/stop16.png"), [process_table_view](const GAction&) {
         pid_t pid = process_table_view->selected_pid();
         if (pid != -1)
             kill(pid, SIGSTOP);
     });
 
-    auto continue_action = GAction::create("Continue process", GraphicsBitmap::load_from_file("/res/icons/continue16.png"), [process_table_view] (const GAction&) {
+    auto continue_action = GAction::create("Continue process", GraphicsBitmap::load_from_file("/res/icons/continue16.png"), [process_table_view](const GAction&) {
         pid_t pid = process_table_view->selected_pid();
         if (pid != -1)
             kill(pid, SIGCONT);
@@ -102,7 +102,7 @@ int main(int argc, char** argv)
 
     auto menubar = make<GMenuBar>();
     auto app_menu = make<GMenu>("Process Manager");
-    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) {
+    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [](const GAction&) {
         GApplication::the().quit(0);
         return;
     }));
@@ -115,25 +115,25 @@ int main(int argc, char** argv)
     menubar->add_menu(move(process_menu));
 
     auto frequency_menu = make<GMenu>("Frequency");
-    frequency_menu->add_action(GAction::create("0.25 sec", [refresh_timer] (auto&) {
+    frequency_menu->add_action(GAction::create("0.25 sec", [refresh_timer](auto&) {
         refresh_timer->restart(250);
     }));
-    frequency_menu->add_action(GAction::create("0.5 sec", [refresh_timer] (auto&) {
+    frequency_menu->add_action(GAction::create("0.5 sec", [refresh_timer](auto&) {
         refresh_timer->restart(500);
     }));
-    frequency_menu->add_action(GAction::create("1 sec", [refresh_timer] (auto&) {
+    frequency_menu->add_action(GAction::create("1 sec", [refresh_timer](auto&) {
         refresh_timer->restart(1000);
     }));
-    frequency_menu->add_action(GAction::create("3 sec", [refresh_timer] (auto&) {
+    frequency_menu->add_action(GAction::create("3 sec", [refresh_timer](auto&) {
         refresh_timer->restart(3000);
     }));
-    frequency_menu->add_action(GAction::create("5 sec", [refresh_timer] (auto&) {
+    frequency_menu->add_action(GAction::create("5 sec", [refresh_timer](auto&) {
         refresh_timer->restart(5000);
     }));
     menubar->add_menu(move(frequency_menu));
 
     auto help_menu = make<GMenu>("Help");
-    help_menu->add_action(GAction::create("About", [] (const GAction&) {
+    help_menu->add_action(GAction::create("About", [](const GAction&) {
         dbgprintf("FIXME: Implement Help/About\n");
     }));
     menubar->add_menu(move(help_menu));

+ 5 - 5
Applications/Taskbar/TaskbarButton.cpp

@@ -1,8 +1,8 @@
 #include "TaskbarButton.h"
-#include <WindowServer/WSAPITypes.h>
 #include <LibGUI/GAction.h>
-#include <LibGUI/GMenu.h>
 #include <LibGUI/GEventLoop.h>
+#include <LibGUI/GMenu.h>
+#include <WindowServer/WSAPITypes.h>
 
 static void set_window_minimized_state(const WindowIdentifier& identifier, bool minimized)
 {
@@ -34,13 +34,13 @@ GMenu& TaskbarButton::ensure_menu()
 {
     if (!m_menu) {
         m_menu = make<GMenu>("");
-        m_menu->add_action(GAction::create("Minimize", [this] (auto&) {
+        m_menu->add_action(GAction::create("Minimize", [this](auto&) {
             set_window_minimized_state(m_identifier, true);
         }));
-        m_menu->add_action(GAction::create("Unminimize", [this] (auto&) {
+        m_menu->add_action(GAction::create("Unminimize", [this](auto&) {
             set_window_minimized_state(m_identifier, false);
         }));
-        m_menu->add_action(GAction::create("Close", [this] (auto&) {
+        m_menu->add_action(GAction::create("Close", [this](auto&) {
             dbgprintf("FIXME: Close!\n");
         }));
     }

+ 9 - 13
Applications/Taskbar/TaskbarWindow.cpp

@@ -1,11 +1,11 @@
 #include "TaskbarWindow.h"
 #include "TaskbarButton.h"
-#include <LibGUI/GWindow.h>
-#include <LibGUI/GDesktop.h>
-#include <LibGUI/GEventLoop.h>
 #include <LibGUI/GBoxLayout.h>
 #include <LibGUI/GButton.h>
+#include <LibGUI/GDesktop.h>
+#include <LibGUI/GEventLoop.h>
 #include <LibGUI/GFrame.h>
+#include <LibGUI/GWindow.h>
 #include <WindowServer/WSAPITypes.h>
 #include <stdio.h>
 
@@ -19,7 +19,7 @@ TaskbarWindow::TaskbarWindow()
 
     on_screen_rect_change(GDesktop::the().rect());
 
-    GDesktop::the().on_rect_change = [this] (const Rect& rect) { on_screen_rect_change(rect); };
+    GDesktop::the().on_rect_change = [this](const Rect& rect) { on_screen_rect_change(rect); };
 
     auto* widget = new GFrame;
     widget->set_fill_with_background_color(true);
@@ -31,7 +31,7 @@ TaskbarWindow::TaskbarWindow()
     widget->set_frame_shadow(FrameShadow::Raised);
     set_main_widget(widget);
 
-    WindowList::the().aid_create_button = [this] (auto& identifier) {
+    WindowList::the().aid_create_button = [this](auto& identifier) {
         return create_button(identifier);
     };
 }
@@ -70,8 +70,7 @@ void TaskbarWindow::wm_event(GWMEvent& event)
         auto& removed_event = static_cast<GWMWindowRemovedEvent&>(event);
         dbgprintf("WM_WindowRemoved: client_id=%d, window_id=%d\n",
             removed_event.client_id(),
-            removed_event.window_id()
-        );
+            removed_event.window_id());
 #endif
         WindowList::the().remove_window(identifier);
         update();
@@ -83,8 +82,7 @@ void TaskbarWindow::wm_event(GWMEvent& event)
         dbgprintf("WM_WindowRectChanged: client_id=%d, window_id=%d, rect=%s\n",
             changed_event.client_id(),
             changed_event.window_id(),
-            changed_event.rect().to_string().characters()
-        );
+            changed_event.rect().to_string().characters());
 #endif
         break;
     }
@@ -94,8 +92,7 @@ void TaskbarWindow::wm_event(GWMEvent& event)
         dbgprintf("WM_WindowIconChanged: client_id=%d, window_id=%d, icon_path=%s\n",
             changed_event.client_id(),
             changed_event.window_id(),
-            changed_event.icon_path().characters()
-        );
+            changed_event.icon_path().characters());
 #endif
         if (auto* window = WindowList::the().window(identifier)) {
             window->set_icon_path(changed_event.icon_path());
@@ -113,8 +110,7 @@ void TaskbarWindow::wm_event(GWMEvent& event)
             changed_event.title().characters(),
             changed_event.rect().to_string().characters(),
             changed_event.is_active(),
-            changed_event.is_minimized()
-        );
+            changed_event.is_minimized());
 #endif
         if (!should_include_window(changed_event.window_type()))
             break;

+ 2 - 2
Applications/Taskbar/WindowList.cpp

@@ -1,6 +1,6 @@
 #include "WindowList.h"
-#include <WindowServer/WSAPITypes.h>
 #include <LibGUI/GEventLoop.h>
+#include <WindowServer/WSAPITypes.h>
 
 WindowList& WindowList::the()
 {
@@ -25,7 +25,7 @@ Window& WindowList::ensure_window(const WindowIdentifier& identifier)
         return *it->value;
     auto window = make<Window>(identifier);
     window->set_button(aid_create_button(identifier));
-    window->button()->on_click = [window = window.ptr(), identifier] (GButton&) {
+    window->button()->on_click = [window = window.ptr(), identifier](GButton&) {
         WSAPI_ClientMessage message;
         if (window->is_minimized() || !window->is_active()) {
             message.type = WSAPI_ClientMessage::Type::WM_SetActiveWindow;

+ 1 - 1
Applications/Taskbar/main.cpp

@@ -1,5 +1,5 @@
-#include <LibGUI/GApplication.h>
 #include "TaskbarWindow.h"
+#include <LibGUI/GApplication.h>
 
 int main(int argc, char** argv)
 {

+ 34 - 37
Applications/Terminal/main.cpp

@@ -1,27 +1,26 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <assert.h>
-#include <sys/ioctl.h>
-#include <sys/select.h>
-#include <pwd.h>
 #include "Terminal.h"
 #include <Kernel/KeyCode.h>
+#include <LibCore/CUserInfo.h>
+#include <LibGUI/GAction.h>
 #include <LibGUI/GApplication.h>
 #include <LibGUI/GBoxLayout.h>
-#include <LibGUI/GRadioButton.h>
-#include <LibGUI/GWidget.h>
-#include <LibGUI/GWindow.h>
+#include <LibGUI/GFontDatabase.h>
 #include <LibGUI/GGroupBox.h>
 #include <LibGUI/GMenuBar.h>
-#include <LibGUI/GAction.h>
-#include <LibGUI/GFontDatabase.h>
-#include <LibGUI/GSlider.h>
 #include <LibGUI/GRadioButton.h>
-#include <LibCore/CUserInfo.h>
+#include <LibGUI/GSlider.h>
+#include <LibGUI/GWidget.h>
+#include <LibGUI/GWindow.h>
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/select.h>
+#include <unistd.h>
 
 static void make_shell(int ptm_fd)
 {
@@ -40,7 +39,7 @@ static void make_shell(int ptm_fd)
         }
 
         // NOTE: It's okay if this fails.
-        (void) ioctl(0, TIOCNOTTY);
+        (void)ioctl(0, TIOCNOTTY);
 
         close(0);
         close(1);
@@ -88,7 +87,6 @@ GWindow* create_settings_window(Terminal& terminal, RetainPtr<CConfigFile> confi
     window->set_title("Terminal Settings");
     window->set_rect(50, 50, 200, 140);
 
-
     auto* settings = new GWidget;
     window->set_main_widget(settings);
     settings->set_fill_with_background_color(true);
@@ -106,9 +104,9 @@ GWindow* create_settings_window(Terminal& terminal, RetainPtr<CConfigFile> confi
     auto* visbell_radio = new GRadioButton("Use (Visual) Terminal Bell", radio_container);
     sysbell_radio->set_checked(terminal.should_beep());
     visbell_radio->set_checked(!terminal.should_beep());
-    sysbell_radio->on_checked = [&terminal] (const bool checked) {
-                                    terminal.set_should_beep(checked);
-                                };
+    sysbell_radio->on_checked = [&terminal](const bool checked) {
+        terminal.set_should_beep(checked);
+    };
 
     auto* slider_container = new GGroupBox("Background Opacity", settings);
     slider_container->set_layout(make<GBoxLayout>(Orientation::Vertical));
@@ -120,10 +118,10 @@ GWindow* create_settings_window(Terminal& terminal, RetainPtr<CConfigFile> confi
     slider->set_fill_with_background_color(true);
     slider->set_background_color(Color::LightGray);
 
-    slider->on_value_changed = [&terminal, &config] (int value) {
-                                   float opacity = value / 100.0;
-                                   terminal.set_opacity(opacity);
-                               };
+    slider->on_value_changed = [&terminal, &config](int value) {
+        float opacity = value / 100.0;
+        terminal.set_opacity(opacity);
+    };
 
     slider->set_range(0, 100);
     slider->set_value(terminal.opacity() * 100.0);
@@ -170,14 +168,13 @@ int main(int argc, char** argv)
 
     auto app_menu = make<GMenu>("Terminal");
     app_menu->add_action(GAction::create("Settings...",
-                                         [&settings_window, &terminal, &config] (const GAction&) {
-                                             if (!settings_window)
-                                                 settings_window =
-                                                     create_settings_window(terminal, config)->make_weak_ptr();
-                                             settings_window->show();
-                                             settings_window->move_to_front();
-                                         }));
-    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) {
+        [&settings_window, &terminal, &config](const GAction&) {
+            if (!settings_window)
+                settings_window = create_settings_window(terminal, config)->make_weak_ptr();
+            settings_window->show();
+            settings_window->move_to_front();
+        }));
+    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [](const GAction&) {
         dbgprintf("Terminal: Quit menu activated!\n");
         GApplication::the().quit(0);
         return;
@@ -185,8 +182,8 @@ int main(int argc, char** argv)
     menubar->add_menu(move(app_menu));
 
     auto font_menu = make<GMenu>("Font");
-    GFontDatabase::the().for_each_fixed_width_font([&] (const StringView& font_name) {
-                                                       font_menu->add_action(GAction::create(font_name, [&terminal, &config] (const GAction& action) {
+    GFontDatabase::the().for_each_fixed_width_font([&](const StringView& font_name) {
+        font_menu->add_action(GAction::create(font_name, [&terminal, &config](const GAction& action) {
             terminal.set_font(GFontDatabase::the().get_by_name(action.text()));
             auto metadata = GFontDatabase::the().get_metadata_by_name(action.text());
             config->write_entry("Text", "Font", metadata.path);
@@ -197,7 +194,7 @@ int main(int argc, char** argv)
     menubar->add_menu(move(font_menu));
 
     auto help_menu = make<GMenu>("Help");
-    help_menu->add_action(GAction::create("About", [] (const GAction&) {
+    help_menu->add_action(GAction::create("About", [](const GAction&) {
         dbgprintf("FIXME: Implement Help/About\n");
     }));
     menubar->add_menu(move(help_menu));

+ 18 - 18
Applications/TextEditor/main.cpp

@@ -1,21 +1,21 @@
-#include <LibGUI/GWindow.h>
-#include <LibGUI/GWidget.h>
-#include <LibGUI/GBoxLayout.h>
+#include <AK/StringBuilder.h>
+#include <LibCore/CFile.h>
+#include <LibGUI/GAction.h>
 #include <LibGUI/GApplication.h>
+#include <LibGUI/GBoxLayout.h>
 #include <LibGUI/GFilePicker.h>
+#include <LibGUI/GFontDatabase.h>
+#include <LibGUI/GMenuBar.h>
 #include <LibGUI/GMessageBox.h>
 #include <LibGUI/GStatusBar.h>
-#include <LibGUI/GToolBar.h>
-#include <LibGUI/GMenuBar.h>
 #include <LibGUI/GTextEditor.h>
-#include <LibGUI/GAction.h>
-#include <LibGUI/GFontDatabase.h>
-#include <LibCore/CFile.h>
-#include <AK/StringBuilder.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <signal.h>
+#include <LibGUI/GToolBar.h>
+#include <LibGUI/GWidget.h>
+#include <LibGUI/GWindow.h>
 #include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
 
 void open_sesame(GWindow& window, GTextEditor& editor, const String& path)
 {
@@ -57,7 +57,7 @@ int main(int argc, char** argv)
         open_sesame(*window, *text_editor, path);
     }
 
-    auto new_action = GAction::create("New document", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [] (const GAction&) {
+    auto new_action = GAction::create("New document", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [](const GAction&) {
         dbgprintf("FIXME: Implement File/New\n");
     });
 
@@ -69,14 +69,14 @@ int main(int argc, char** argv)
         }
     });
 
-    auto save_action = GAction::create("Save document", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&] (const GAction&) {
+    auto save_action = GAction::create("Save document", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](const GAction&) {
         dbgprintf("Writing document to '%s'\n", path.characters());
         text_editor->write_to_file(path);
     });
 
     auto menubar = make<GMenuBar>();
     auto app_menu = make<GMenu>("Text Editor");
-    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) {
+    app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [](const GAction&) {
         GApplication::the().quit(0);
         return;
     }));
@@ -99,8 +99,8 @@ int main(int argc, char** argv)
     menubar->add_menu(move(edit_menu));
 
     auto font_menu = make<GMenu>("Font");
-    GFontDatabase::the().for_each_fixed_width_font([&] (const StringView& font_name) {
-        font_menu->add_action(GAction::create(font_name, [text_editor] (const GAction& action) {
+    GFontDatabase::the().for_each_fixed_width_font([&](const StringView& font_name) {
+        font_menu->add_action(GAction::create(font_name, [text_editor](const GAction& action) {
             text_editor->set_font(GFontDatabase::the().get_by_name(action.text()));
             text_editor->update();
         }));
@@ -108,7 +108,7 @@ int main(int argc, char** argv)
     menubar->add_menu(move(font_menu));
 
     auto help_menu = make<GMenu>("Help");
-    help_menu->add_action(GAction::create("About", [] (const GAction&) {
+    help_menu->add_action(GAction::create("About", [](const GAction&) {
         dbgprintf("FIXME: Implement Help/About\n");
     }));
     menubar->add_menu(move(help_menu));