diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-06-07 11:48:03 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-06-07 11:48:03 +0200 |
commit | fd604a7c68efb4b36dd6eea429458adefba2dcc1 (patch) | |
tree | f9822ea9a0c0faba5eb062dffbad2ed7325813dd /Applications/Terminal | |
parent | e09c3a1ae82ad3ef1938b37faf447335f9aac9ba (diff) | |
download | serenity-fd604a7c68efb4b36dd6eea429458adefba2dcc1.zip |
Applications: Run clang-format on everything.
Diffstat (limited to 'Applications/Terminal')
-rw-r--r-- | Applications/Terminal/main.cpp | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp index 73edad69f3..e78eb11332 100644 --- a/Applications/Terminal/main.cpp +++ b/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)); |