summaryrefslogtreecommitdiff
path: root/Applications/IRCClient
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-23 10:57:42 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-23 11:10:52 +0100
commit3d20da9ee451460b6e233f5efdf5a13e11525f97 (patch)
tree524b72d0874304c68036dbbc0514b632a4a08c59 /Applications/IRCClient
parent7ec758773cdd85755d91f52614f361e7e750c7e9 (diff)
downloadserenity-3d20da9ee451460b6e233f5efdf5a13e11525f97.zip
Userspace: Use Core::Object::add() when building interfaces
Diffstat (limited to 'Applications/IRCClient')
-rw-r--r--Applications/IRCClient/IRCAppWindow.cpp14
-rw-r--r--Applications/IRCClient/IRCWindow.cpp8
2 files changed, 11 insertions, 11 deletions
diff --git a/Applications/IRCClient/IRCAppWindow.cpp b/Applications/IRCClient/IRCAppWindow.cpp
index 80f9d8967c..0662fb0670 100644
--- a/Applications/IRCClient/IRCAppWindow.cpp
+++ b/Applications/IRCClient/IRCAppWindow.cpp
@@ -94,7 +94,7 @@ void IRCAppWindow::setup_client()
};
if (m_client->hostname().is_empty()) {
- auto input_box = GUI::InputBox::construct("Enter server:", "Connect to server", this);
+ auto input_box = add<GUI::InputBox>("Enter server:", "Connect to server");
auto result = input_box->exec();
if (result == GUI::InputBox::ExecCancel)
::exit(0);
@@ -109,7 +109,7 @@ void IRCAppWindow::setup_client()
void IRCAppWindow::setup_actions()
{
m_join_action = GUI::Action::create("Join channel", { Mod_Ctrl, Key_J }, Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-join.png"), [&](auto&) {
- auto input_box = GUI::InputBox::construct("Enter channel name:", "Join channel", this);
+ auto input_box = add<GUI::InputBox>("Enter channel name:", "Join channel");
if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty())
m_client->handle_join_action(input_box->text_value());
});
@@ -185,7 +185,7 @@ void IRCAppWindow::setup_widgets()
widget->set_layout(make<GUI::VerticalBoxLayout>());
widget->layout()->set_spacing(0);
- auto toolbar = GUI::ToolBar::construct(widget);
+ auto toolbar = widget->add<GUI::ToolBar>();
toolbar->set_has_frame(false);
toolbar->add_action(*m_change_nick_action);
toolbar->add_separator();
@@ -196,13 +196,13 @@ void IRCAppWindow::setup_widgets()
toolbar->add_action(*m_open_query_action);
toolbar->add_action(*m_close_query_action);
- auto outer_container = GUI::Widget::construct(widget.ptr());
+ auto outer_container = widget->add<GUI::Widget>();
outer_container->set_layout(make<GUI::VerticalBoxLayout>());
outer_container->layout()->set_margins({ 2, 0, 2, 2 });
- auto horizontal_container = GUI::HorizontalSplitter::construct(outer_container);
+ auto horizontal_container = outer_container->add<GUI::HorizontalSplitter>();
- m_window_list = GUI::TableView::construct(horizontal_container);
+ m_window_list = horizontal_container->add<GUI::TableView>();
m_window_list->set_headers_visible(false);
m_window_list->set_alternating_row_colors(false);
m_window_list->set_size_columns_to_fit_content(true);
@@ -214,7 +214,7 @@ void IRCAppWindow::setup_widgets()
set_active_window(m_client->window_at(index.row()));
};
- m_container = GUI::StackWidget::construct(horizontal_container);
+ m_container = horizontal_container->add<GUI::StackWidget>();
m_container->on_active_widget_change = [this](auto*) {
update_part_action();
};
diff --git a/Applications/IRCClient/IRCWindow.cpp b/Applications/IRCClient/IRCWindow.cpp
index 835ef1f039..83ba78148a 100644
--- a/Applications/IRCClient/IRCWindow.cpp
+++ b/Applications/IRCClient/IRCWindow.cpp
@@ -45,12 +45,12 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
set_layout(make<GUI::VerticalBoxLayout>());
// Make a container for the log buffer view + (optional) member list.
- auto container = GUI::HorizontalSplitter::construct(this);
+ auto container = add<GUI::HorizontalSplitter>();
- m_html_view = HtmlView::construct(container);
+ m_html_view = container->add<HtmlView>();
if (m_type == Channel) {
- auto member_view = GUI::TableView::construct(container);
+ auto member_view = container->add<GUI::TableView>();
member_view->set_headers_visible(false);
member_view->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
member_view->set_preferred_size(100, 0);
@@ -59,7 +59,7 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
member_view->set_activates_on_selection(true);
}
- m_text_editor = GUI::TextEditor::construct(GUI::TextEditor::SingleLine, this);
+ m_text_editor = add<GUI::TextBox>();
m_text_editor->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
m_text_editor->set_preferred_size(0, 19);
m_text_editor->on_return_pressed = [this] {