Serenity Operating System
1/*
2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#pragma once
28
29#include "IRCClient.h"
30#include "IRCWindow.h"
31#include <LibGUI/Widget.h>
32#include <LibGUI/Window.h>
33
34class IRCAppWindow : public GUI::Window {
35 C_OBJECT(IRCAppWindow);
36public:
37 virtual ~IRCAppWindow() override;
38
39 static IRCAppWindow& the();
40
41 void set_active_window(IRCWindow&);
42
43private:
44 IRCAppWindow();
45
46 void setup_client();
47 void setup_actions();
48 void setup_menus();
49 void setup_widgets();
50 void update_title();
51 void update_gui_actions();
52
53 NonnullRefPtr<IRCWindow> create_window(void* owner, IRCWindow::Type, const String& name);
54 NonnullRefPtr<IRCClient> m_client;
55 RefPtr<GUI::StackWidget> m_container;
56 RefPtr<GUI::TableView> m_window_list;
57 RefPtr<GUI::Action> m_join_action;
58 RefPtr<GUI::Action> m_list_channels_action;
59 RefPtr<GUI::Action> m_part_action;
60 RefPtr<GUI::Action> m_cycle_channel_action;
61 RefPtr<GUI::Action> m_whois_action;
62 RefPtr<GUI::Action> m_open_query_action;
63 RefPtr<GUI::Action> m_close_query_action;
64 RefPtr<GUI::Action> m_change_nick_action;
65 RefPtr<GUI::Action> m_change_topic_action;
66 RefPtr<GUI::Action> m_invite_user_action;
67 RefPtr<GUI::Action> m_banlist_action;
68 RefPtr<GUI::Action> m_voice_user_action;
69 RefPtr<GUI::Action> m_devoice_user_action;
70 RefPtr<GUI::Action> m_hop_user_action;
71 RefPtr<GUI::Action> m_dehop_user_action;
72 RefPtr<GUI::Action> m_op_user_action;
73 RefPtr<GUI::Action> m_deop_user_action;
74 RefPtr<GUI::Action> m_kick_user_action;
75};