1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

IRCClient: Rename IRCSubWindow => IRCClientWindow.

This commit is contained in:
Andreas Kling 2019-03-15 13:20:46 +01:00
parent f004db19d0
commit eba5fd3f46
7 changed files with 26 additions and 26 deletions

View file

@ -1,5 +1,5 @@
#include "IRCAppWindow.h" #include "IRCAppWindow.h"
#include "IRCSubWindow.h" #include "IRCClientWindow.h"
#include <LibGUI/GListBox.h> #include <LibGUI/GListBox.h>
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
@ -51,11 +51,11 @@ void IRCAppWindow::setup_widgets()
m_subwindow_container->set_layout(make<GBoxLayout>(Orientation::Vertical)); m_subwindow_container->set_layout(make<GBoxLayout>(Orientation::Vertical));
m_subwindow_container->set_size_policy(SizePolicy::Fill, SizePolicy::Fill); m_subwindow_container->set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
create_subwindow(IRCSubWindow::Server, "Server"); create_subwindow(IRCClientWindow::Server, "Server");
} }
void IRCAppWindow::create_subwindow(IRCSubWindow::Type type, const String& name) void IRCAppWindow::create_subwindow(IRCClientWindow::Type type, const String& name)
{ {
auto* subwindow = new IRCSubWindow(m_client, type, name, m_subwindow_container); auto* subwindow = new IRCClientWindow(m_client, type, name, m_subwindow_container);
m_subwindows.append(subwindow); m_subwindows.append(subwindow);
} }

View file

@ -3,7 +3,7 @@
#include <LibGUI/GWindow.h> #include <LibGUI/GWindow.h>
#include <LibGUI/GWidget.h> #include <LibGUI/GWidget.h>
#include "IRCClient.h" #include "IRCClient.h"
#include "IRCSubWindow.h" #include "IRCClientWindow.h"
class IRCAppWindow : public GWindow { class IRCAppWindow : public GWindow {
public: public:
@ -14,10 +14,10 @@ private:
void setup_client(); void setup_client();
void setup_widgets(); void setup_widgets();
void create_subwindow(IRCSubWindow::Type, const String& name); void create_subwindow(IRCClientWindow::Type, const String& name);
IRCClient m_client; IRCClient m_client;
GWidget* m_subwindow_container { nullptr }; GWidget* m_subwindow_container { nullptr };
Vector<IRCSubWindow*> m_subwindows; Vector<IRCClientWindow*> m_subwindows;
}; };

View file

@ -2,7 +2,7 @@
#include "IRCChannel.h" #include "IRCChannel.h"
#include "IRCQuery.h" #include "IRCQuery.h"
#include "IRCLogBuffer.h" #include "IRCLogBuffer.h"
#include "IRCSubWindow.h" #include "IRCClientWindow.h"
#include <LibGUI/GNotifier.h> #include <LibGUI/GNotifier.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -346,28 +346,28 @@ void IRCClient::handle_namreply(const Message& msg)
channel.dump(); channel.dump();
} }
void IRCClient::register_subwindow(IRCSubWindow& subwindow) void IRCClient::register_subwindow(IRCClientWindow& subwindow)
{ {
if (subwindow.type() == IRCSubWindow::Server) { if (subwindow.type() == IRCClientWindow::Server) {
m_server_subwindow = &subwindow; m_server_subwindow = &subwindow;
subwindow.set_log_buffer(*m_log); subwindow.set_log_buffer(*m_log);
return; return;
} }
if (subwindow.type() == IRCSubWindow::Channel) { if (subwindow.type() == IRCClientWindow::Channel) {
auto it = m_channels.find(subwindow.name()); auto it = m_channels.find(subwindow.name());
ASSERT(it != m_channels.end()); ASSERT(it != m_channels.end());
auto& channel = *(*it).value; auto& channel = *(*it).value;
subwindow.set_log_buffer(channel.log()); subwindow.set_log_buffer(channel.log());
return; return;
} }
if (subwindow.type() == IRCSubWindow::Query) { if (subwindow.type() == IRCClientWindow::Query) {
subwindow.set_log_buffer(ensure_query(subwindow.name()).log()); subwindow.set_log_buffer(ensure_query(subwindow.name()).log());
} }
} }
void IRCClient::unregister_subwindow(IRCSubWindow& subwindow) void IRCClient::unregister_subwindow(IRCClientWindow& subwindow)
{ {
if (subwindow.type() == IRCSubWindow::Server) { if (subwindow.type() == IRCClientWindow::Server) {
m_server_subwindow = &subwindow; m_server_subwindow = &subwindow;
return; return;
} }

View file

@ -8,7 +8,7 @@
class IRCChannel; class IRCChannel;
class IRCQuery; class IRCQuery;
class IRCSubWindow; class IRCClientWindow;
class GNotifier; class GNotifier;
class IRCClient { class IRCClient {
@ -33,8 +33,8 @@ public:
Function<void(const String& name)> on_query_message; Function<void(const String& name)> on_query_message;
Function<void()> on_server_message; Function<void()> on_server_message;
void register_subwindow(IRCSubWindow&); void register_subwindow(IRCClientWindow&);
void unregister_subwindow(IRCSubWindow&); void unregister_subwindow(IRCClientWindow&);
private: private:
struct Message { struct Message {
@ -66,7 +66,7 @@ private:
HashMap<String, RetainPtr<IRCChannel>> m_channels; HashMap<String, RetainPtr<IRCChannel>> m_channels;
HashMap<String, RetainPtr<IRCQuery>> m_queries; HashMap<String, RetainPtr<IRCQuery>> m_queries;
IRCSubWindow* m_server_subwindow { nullptr }; IRCClientWindow* m_server_subwindow { nullptr };
Retained<IRCLogBuffer> m_log; Retained<IRCLogBuffer> m_log;
}; };

View file

@ -1,11 +1,11 @@
#include "IRCSubWindow.h" #include "IRCClientWindow.h"
#include "IRCClient.h" #include "IRCClient.h"
#include "IRCLogBufferModel.h" #include "IRCLogBufferModel.h"
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
#include <LibGUI/GTableView.h> #include <LibGUI/GTableView.h>
#include <LibGUI/GTextBox.h> #include <LibGUI/GTextBox.h>
IRCSubWindow::IRCSubWindow(IRCClient& client, Type type, const String& name, GWidget* parent) IRCClientWindow::IRCClientWindow(IRCClient& client, Type type, const String& name, GWidget* parent)
: GWidget(parent) : GWidget(parent)
, m_client(client) , m_client(client)
, m_type(type) , m_type(type)
@ -18,12 +18,12 @@ IRCSubWindow::IRCSubWindow(IRCClient& client, Type type, const String& name, GWi
m_client.register_subwindow(*this); m_client.register_subwindow(*this);
} }
IRCSubWindow::~IRCSubWindow() IRCClientWindow::~IRCClientWindow()
{ {
m_client.unregister_subwindow(*this); m_client.unregister_subwindow(*this);
} }
void IRCSubWindow::set_log_buffer(const IRCLogBuffer& log_buffer) void IRCClientWindow::set_log_buffer(const IRCLogBuffer& log_buffer)
{ {
m_log_buffer = &log_buffer; m_log_buffer = &log_buffer;
m_table_view->set_model(OwnPtr<IRCLogBufferModel>((IRCLogBufferModel*)log_buffer.model())); m_table_view->set_model(OwnPtr<IRCLogBufferModel>((IRCLogBufferModel*)log_buffer.model()));

View file

@ -6,7 +6,7 @@ class IRCClient;
class IRCLogBuffer; class IRCLogBuffer;
class GTableView; class GTableView;
class IRCSubWindow : public GWidget { class IRCClientWindow : public GWidget {
public: public:
enum Type { enum Type {
Server, Server,
@ -14,8 +14,8 @@ public:
Query, Query,
}; };
explicit IRCSubWindow(IRCClient&, Type, const String& name, GWidget* parent); explicit IRCClientWindow(IRCClient&, Type, const String& name, GWidget* parent);
virtual ~IRCSubWindow() override; virtual ~IRCClientWindow() override;
String name() const { return m_name; } String name() const { return m_name; }
void set_name(const String& name) { m_name = name; } void set_name(const String& name) { m_name = name; }

View file

@ -5,7 +5,7 @@ OBJS = \
IRCLogBuffer.o \ IRCLogBuffer.o \
IRCLogBufferModel.o \ IRCLogBufferModel.o \
IRCAppWindow.o \ IRCAppWindow.o \
IRCSubWindow.o \ IRCClientWindow.o \
main.o main.o
APP = IRCClient APP = IRCClient