mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
IRCClient: Rename IRCSubWindow => IRCClientWindow.
This commit is contained in:
parent
f004db19d0
commit
eba5fd3f46
7 changed files with 26 additions and 26 deletions
|
@ -1,5 +1,5 @@
|
|||
#include "IRCAppWindow.h"
|
||||
#include "IRCSubWindow.h"
|
||||
#include "IRCClientWindow.h"
|
||||
#include <LibGUI/GListBox.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_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);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <LibGUI/GWindow.h>
|
||||
#include <LibGUI/GWidget.h>
|
||||
#include "IRCClient.h"
|
||||
#include "IRCSubWindow.h"
|
||||
#include "IRCClientWindow.h"
|
||||
|
||||
class IRCAppWindow : public GWindow {
|
||||
public:
|
||||
|
@ -14,10 +14,10 @@ private:
|
|||
void setup_client();
|
||||
void setup_widgets();
|
||||
|
||||
void create_subwindow(IRCSubWindow::Type, const String& name);
|
||||
void create_subwindow(IRCClientWindow::Type, const String& name);
|
||||
|
||||
IRCClient m_client;
|
||||
|
||||
GWidget* m_subwindow_container { nullptr };
|
||||
Vector<IRCSubWindow*> m_subwindows;
|
||||
Vector<IRCClientWindow*> m_subwindows;
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "IRCChannel.h"
|
||||
#include "IRCQuery.h"
|
||||
#include "IRCLogBuffer.h"
|
||||
#include "IRCSubWindow.h"
|
||||
#include "IRCClientWindow.h"
|
||||
#include <LibGUI/GNotifier.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
@ -346,28 +346,28 @@ void IRCClient::handle_namreply(const Message& msg)
|
|||
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;
|
||||
subwindow.set_log_buffer(*m_log);
|
||||
return;
|
||||
}
|
||||
if (subwindow.type() == IRCSubWindow::Channel) {
|
||||
if (subwindow.type() == IRCClientWindow::Channel) {
|
||||
auto it = m_channels.find(subwindow.name());
|
||||
ASSERT(it != m_channels.end());
|
||||
auto& channel = *(*it).value;
|
||||
subwindow.set_log_buffer(channel.log());
|
||||
return;
|
||||
}
|
||||
if (subwindow.type() == IRCSubWindow::Query) {
|
||||
if (subwindow.type() == IRCClientWindow::Query) {
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
class IRCChannel;
|
||||
class IRCQuery;
|
||||
class IRCSubWindow;
|
||||
class IRCClientWindow;
|
||||
class GNotifier;
|
||||
|
||||
class IRCClient {
|
||||
|
@ -33,8 +33,8 @@ public:
|
|||
Function<void(const String& name)> on_query_message;
|
||||
Function<void()> on_server_message;
|
||||
|
||||
void register_subwindow(IRCSubWindow&);
|
||||
void unregister_subwindow(IRCSubWindow&);
|
||||
void register_subwindow(IRCClientWindow&);
|
||||
void unregister_subwindow(IRCClientWindow&);
|
||||
|
||||
private:
|
||||
struct Message {
|
||||
|
@ -66,7 +66,7 @@ private:
|
|||
HashMap<String, RetainPtr<IRCChannel>> m_channels;
|
||||
HashMap<String, RetainPtr<IRCQuery>> m_queries;
|
||||
|
||||
IRCSubWindow* m_server_subwindow { nullptr };
|
||||
IRCClientWindow* m_server_subwindow { nullptr };
|
||||
|
||||
Retained<IRCLogBuffer> m_log;
|
||||
};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "IRCSubWindow.h"
|
||||
#include "IRCClientWindow.h"
|
||||
#include "IRCClient.h"
|
||||
#include "IRCLogBufferModel.h"
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GTableView.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)
|
||||
, m_client(client)
|
||||
, m_type(type)
|
||||
|
@ -18,12 +18,12 @@ IRCSubWindow::IRCSubWindow(IRCClient& client, Type type, const String& name, GWi
|
|||
m_client.register_subwindow(*this);
|
||||
}
|
||||
|
||||
IRCSubWindow::~IRCSubWindow()
|
||||
IRCClientWindow::~IRCClientWindow()
|
||||
{
|
||||
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_table_view->set_model(OwnPtr<IRCLogBufferModel>((IRCLogBufferModel*)log_buffer.model()));
|
|
@ -6,7 +6,7 @@ class IRCClient;
|
|||
class IRCLogBuffer;
|
||||
class GTableView;
|
||||
|
||||
class IRCSubWindow : public GWidget {
|
||||
class IRCClientWindow : public GWidget {
|
||||
public:
|
||||
enum Type {
|
||||
Server,
|
||||
|
@ -14,8 +14,8 @@ public:
|
|||
Query,
|
||||
};
|
||||
|
||||
explicit IRCSubWindow(IRCClient&, Type, const String& name, GWidget* parent);
|
||||
virtual ~IRCSubWindow() override;
|
||||
explicit IRCClientWindow(IRCClient&, Type, const String& name, GWidget* parent);
|
||||
virtual ~IRCClientWindow() override;
|
||||
|
||||
String name() const { return m_name; }
|
||||
void set_name(const String& name) { m_name = name; }
|
|
@ -5,7 +5,7 @@ OBJS = \
|
|||
IRCLogBuffer.o \
|
||||
IRCLogBufferModel.o \
|
||||
IRCAppWindow.o \
|
||||
IRCSubWindow.o \
|
||||
IRCClientWindow.o \
|
||||
main.o
|
||||
|
||||
APP = IRCClient
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue