1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:57:47 +00:00

Run: Use the new DialogButton

This commit is contained in:
FrHun 2022-06-10 23:08:10 +02:00 committed by Linus Groh
parent 992ff4bd63
commit fc3fd7212f
2 changed files with 6 additions and 9 deletions

View file

@ -43,22 +43,19 @@
@GUI::Layout::Spacer {} @GUI::Layout::Spacer {}
@GUI::Button { @GUI::DialogButton {
name: "ok_button" name: "ok_button"
text: "OK" text: "OK"
fixed_width: 80
} }
@GUI::Button { @GUI::DialogButton {
name: "cancel_button" name: "cancel_button"
text: "Cancel" text: "Cancel"
fixed_width: 80
} }
@GUI::Button { @GUI::DialogButton {
name: "browse_button" name: "browse_button"
text: "Browse..." text: "Browse..."
fixed_width: 80
} }
} }
} }

View file

@ -49,18 +49,18 @@ RunWindow::RunWindow()
m_path_combo_box->set_model(m_path_history_model); m_path_combo_box->set_model(m_path_history_model);
m_path_combo_box->set_selected_index(0); m_path_combo_box->set_selected_index(0);
m_ok_button = *main_widget.find_descendant_of_type_named<GUI::Button>("ok_button"); m_ok_button = *main_widget.find_descendant_of_type_named<GUI::DialogButton>("ok_button");
m_ok_button->on_click = [this](auto) { m_ok_button->on_click = [this](auto) {
do_run(); do_run();
}; };
m_ok_button->set_default(true); m_ok_button->set_default(true);
m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button"); m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::DialogButton>("cancel_button");
m_cancel_button->on_click = [this](auto) { m_cancel_button->on_click = [this](auto) {
close(); close();
}; };
m_browse_button = *find_descendant_of_type_named<GUI::Button>("browse_button"); m_browse_button = *find_descendant_of_type_named<GUI::DialogButton>("browse_button");
m_browse_button->on_click = [this](auto) { m_browse_button->on_click = [this](auto) {
Optional<String> path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), false, GUI::Dialog::ScreenPosition::Center); Optional<String> path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), false, GUI::Dialog::ScreenPosition::Center);
if (path.has_value()) if (path.has_value())