diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-23 12:07:13 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-23 12:27:53 +0100 |
commit | c5d913970ab122cdeaf23aea24e65efa6b425ab0 (patch) | |
tree | 07ef4cb2d039521ec7b1931c707b5196b7ea1628 /Applications/IRCClient | |
parent | 4ce28c32d1813b043758c0d15d5efc17452c2b77 (diff) | |
download | serenity-c5d913970ab122cdeaf23aea24e65efa6b425ab0.zip |
LibGUI: Remove parent parameter to GUI::Widget constructor
Diffstat (limited to 'Applications/IRCClient')
-rw-r--r-- | Applications/IRCClient/IRCAppWindow.cpp | 6 | ||||
-rw-r--r-- | Applications/IRCClient/IRCAppWindow.h | 2 | ||||
-rw-r--r-- | Applications/IRCClient/IRCClient.h | 2 | ||||
-rw-r--r-- | Applications/IRCClient/IRCQuery.h | 2 | ||||
-rw-r--r-- | Applications/IRCClient/IRCWindow.cpp | 5 | ||||
-rw-r--r-- | Applications/IRCClient/IRCWindow.h | 3 |
6 files changed, 10 insertions, 10 deletions
diff --git a/Applications/IRCClient/IRCAppWindow.cpp b/Applications/IRCClient/IRCAppWindow.cpp index 0662fb0670..0993d3ab9a 100644 --- a/Applications/IRCClient/IRCAppWindow.cpp +++ b/Applications/IRCClient/IRCAppWindow.cpp @@ -78,7 +78,7 @@ void IRCAppWindow::update_title() void IRCAppWindow::setup_client() { m_client->aid_create_window = [this](void* owner, IRCWindow::Type type, const String& name) { - return &create_window(owner, type, name); + return create_window(owner, type, name); }; m_client->aid_get_active_window = [this] { return static_cast<IRCWindow*>(m_container->active_widget()); @@ -237,7 +237,7 @@ void IRCAppWindow::update_part_action() m_part_action->set_enabled(is_open_channel); } -IRCWindow& IRCAppWindow::create_window(void* owner, IRCWindow::Type type, const String& name) +NonnullRefPtr<IRCWindow> IRCAppWindow::create_window(void* owner, IRCWindow::Type type, const String& name) { - return *new IRCWindow(m_client, owner, type, name, m_container); + return m_container->add<IRCWindow>(m_client, owner, type, name); } diff --git a/Applications/IRCClient/IRCAppWindow.h b/Applications/IRCClient/IRCAppWindow.h index 1acb1886bd..72c73dd11d 100644 --- a/Applications/IRCClient/IRCAppWindow.h +++ b/Applications/IRCClient/IRCAppWindow.h @@ -50,7 +50,7 @@ private: void update_title(); void update_part_action(); - IRCWindow& create_window(void* owner, IRCWindow::Type, const String& name); + NonnullRefPtr<IRCWindow> create_window(void* owner, IRCWindow::Type, const String& name); NonnullRefPtr<IRCClient> m_client; RefPtr<GUI::StackWidget> m_container; RefPtr<GUI::TableView> m_window_list; diff --git a/Applications/IRCClient/IRCClient.h b/Applications/IRCClient/IRCClient.h index 71dc41cea4..99f48342c3 100644 --- a/Applications/IRCClient/IRCClient.h +++ b/Applications/IRCClient/IRCClient.h @@ -70,7 +70,7 @@ public: Function<void(const String&)> on_nickname_changed; Function<void(IRCChannel&)> on_part_from_channel; - Function<IRCWindow*(void*, IRCWindow::Type, const String&)> aid_create_window; + Function<NonnullRefPtr<IRCWindow>(void*, IRCWindow::Type, const String&)> aid_create_window; Function<IRCWindow*()> aid_get_active_window; Function<void()> aid_update_window_list; diff --git a/Applications/IRCClient/IRCQuery.h b/Applications/IRCClient/IRCQuery.h index f783f5294d..26625e490a 100644 --- a/Applications/IRCClient/IRCQuery.h +++ b/Applications/IRCClient/IRCQuery.h @@ -59,7 +59,7 @@ private: IRCClient& m_client; String m_name; - IRCWindow* m_window { nullptr }; + RefPtr<IRCWindow> m_window; NonnullRefPtr<IRCLogBuffer> m_log; }; diff --git a/Applications/IRCClient/IRCWindow.cpp b/Applications/IRCClient/IRCWindow.cpp index 83ba78148a..e151bea4af 100644 --- a/Applications/IRCClient/IRCWindow.cpp +++ b/Applications/IRCClient/IRCWindow.cpp @@ -35,9 +35,8 @@ #include <LibGUI/TextEditor.h> #include <LibHTML/HtmlView.h> -IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name, GUI::Widget* parent) - : GUI::Widget(parent) - , m_client(client) +IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name) + : m_client(client) , m_owner(owner) , m_type(type) , m_name(name) diff --git a/Applications/IRCClient/IRCWindow.h b/Applications/IRCClient/IRCWindow.h index 31e4c7f3cb..319184dd85 100644 --- a/Applications/IRCClient/IRCWindow.h +++ b/Applications/IRCClient/IRCWindow.h @@ -43,7 +43,6 @@ public: Query, }; - IRCWindow(IRCClient&, void* owner, Type, const String& name, GUI::Widget* parent); virtual ~IRCWindow() override; String name() const { return m_name; } @@ -67,6 +66,8 @@ public: const IRCQuery& query() const { return *(const IRCQuery*)m_owner; } private: + IRCWindow(IRCClient&, void* owner, Type, const String& name); + IRCClient& m_client; void* m_owner { nullptr }; Type m_type; |