diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-10-24 21:55:26 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-10-24 21:55:26 -0400 |
commit | 8b034e48e27e4889b08ed648745a74d05630a431 (patch) | |
tree | be492529d57526c84df791721a4faee87d2f16ef | |
parent | 201b114183454f3fb9114fed2caef4ac46587225 (diff) | |
download | abaddon-portaudio-8b034e48e27e4889b08ed648745a74d05630a431.tar.gz abaddon-portaudio-8b034e48e27e4889b08ed648745a74d05630a431.zip |
add intermediate container for channel list
-rw-r--r-- | src/components/channellist/channellist.cpp | 50 | ||||
-rw-r--r-- | src/components/channellist/channellist.hpp | 61 | ||||
-rw-r--r-- | src/windows/mainwindow.cpp | 3 | ||||
-rw-r--r-- | src/windows/mainwindow.hpp | 6 |
4 files changed, 115 insertions, 5 deletions
diff --git a/src/components/channellist/channellist.cpp b/src/components/channellist/channellist.cpp new file mode 100644 index 0000000..38a9ecc --- /dev/null +++ b/src/components/channellist/channellist.cpp @@ -0,0 +1,50 @@ +#include "channellist.hpp" + +ChannelList::ChannelList() { + m_tree.show(); + add(m_tree); +} + +void ChannelList::UpdateListing() { + m_tree.UpdateListing(); +} + +void ChannelList::SetActiveChannel(Snowflake id, bool expand_to) { + m_tree.SetActiveChannel(id, expand_to); +} + +void ChannelList::UseExpansionState(const ExpansionStateRoot &state) { + m_tree.UseExpansionState(state); +} + +ExpansionStateRoot ChannelList::GetExpansionState() const { + m_tree.GetExpansionState(); +} + +void ChannelList::UsePanedHack(Gtk::Paned &paned) { + m_tree.UsePanedHack(paned); +} + +ChannelList::type_signal_action_open_new_tab ChannelList::signal_action_open_new_tab() { + return m_signal_action_open_new_tab; +} + +ChannelList::type_signal_action_join_voice_channel ChannelList::signal_action_join_voice_channel() { + return m_signal_action_join_voice_channel; +} + +ChannelList::type_signal_action_disconnect_voice ChannelList::signal_action_disconnect_voice() { + return m_signal_action_disconnect_voice; +} + +ChannelList::type_signal_action_channel_item_select ChannelList::signal_action_channel_item_select() { + return m_signal_action_channel_item_select; +} + +ChannelList::type_signal_action_guild_leave ChannelList::signal_action_guild_leave() { + return m_signal_action_guild_leave; +} + +ChannelList::type_signal_action_guild_settings ChannelList::signal_action_guild_settings() { + return m_signal_action_guild_settings; +} diff --git a/src/components/channellist/channellist.hpp b/src/components/channellist/channellist.hpp new file mode 100644 index 0000000..5863485 --- /dev/null +++ b/src/components/channellist/channellist.hpp @@ -0,0 +1,61 @@ +#pragma once +#include <gtkmm/box.h> +#include <gtkmm/paned.h> +#include "channellisttree.hpp" +#include "discord/snowflake.hpp" +#include "state.hpp" + +// Contains the actual ChannelListTree and the classic listing if enabled +class ChannelList : public Gtk::Box { + // have to proxy public and signals to underlying tree... ew!!! +public: + ChannelList(); + + void UpdateListing(); + void SetActiveChannel(Snowflake id, bool expand_to); + + // channel list should be populated when this is called + void UseExpansionState(const ExpansionStateRoot &state); + ExpansionStateRoot GetExpansionState() const; + + void UsePanedHack(Gtk::Paned &paned); + +private: + ChannelListTree m_tree; + +public: + using type_signal_action_channel_item_select = sigc::signal<void, Snowflake>; + using type_signal_action_guild_leave = sigc::signal<void, Snowflake>; + using type_signal_action_guild_settings = sigc::signal<void, Snowflake>; + +#ifdef WITH_LIBHANDY + using type_signal_action_open_new_tab = sigc::signal<void, Snowflake>; + type_signal_action_open_new_tab signal_action_open_new_tab(); +#endif + +#ifdef WITH_VOICE + using type_signal_action_join_voice_channel = sigc::signal<void, Snowflake>; + using type_signal_action_disconnect_voice = sigc::signal<void>; + + type_signal_action_join_voice_channel signal_action_join_voice_channel(); + type_signal_action_disconnect_voice signal_action_disconnect_voice(); +#endif + + type_signal_action_channel_item_select signal_action_channel_item_select(); + type_signal_action_guild_leave signal_action_guild_leave(); + type_signal_action_guild_settings signal_action_guild_settings(); + +private: + type_signal_action_channel_item_select m_signal_action_channel_item_select; + type_signal_action_guild_leave m_signal_action_guild_leave; + type_signal_action_guild_settings m_signal_action_guild_settings; + +#ifdef WITH_LIBHANDY + type_signal_action_open_new_tab m_signal_action_open_new_tab; +#endif + +#ifdef WITH_VOICE + type_signal_action_join_voice_channel m_signal_action_join_voice_channel; + type_signal_action_disconnect_voice m_signal_action_disconnect_voice; +#endif +}; diff --git a/src/windows/mainwindow.cpp b/src/windows/mainwindow.cpp index 729dcc5..8e030ed 100644 --- a/src/windows/mainwindow.cpp +++ b/src/windows/mainwindow.cpp @@ -1,5 +1,4 @@ #include "mainwindow.hpp" -#include "components/channellist/channellisttree.hpp" MainWindow::MainWindow() : m_main_box(Gtk::ORIENTATION_VERTICAL) @@ -235,7 +234,7 @@ void MainWindow::OnViewSubmenuPopup() { } } -ChannelListTree *MainWindow::GetChannelList() { +ChannelList *MainWindow::GetChannelList() { return &m_channel_list; } diff --git a/src/windows/mainwindow.hpp b/src/windows/mainwindow.hpp index 19222b8..37c1b87 100644 --- a/src/windows/mainwindow.hpp +++ b/src/windows/mainwindow.hpp @@ -1,5 +1,5 @@ #pragma once -#include "components/channellist/channellisttree.hpp" +#include "components/channellist/channellist.hpp" #include "components/chatwindow.hpp" #include "components/memberlist.hpp" #include "components/friendslist.hpp" @@ -39,7 +39,7 @@ public: void GoToTab(int idx); #endif - ChannelListTree *GetChannelList(); + ChannelList *GetChannelList(); ChatWindow *GetChatWindow(); MemberList *GetMemberList(); @@ -54,7 +54,7 @@ private: Gtk::Paned m_chan_content_paned; Gtk::Paned m_content_members_paned; - ChannelListTree m_channel_list; + ChannelList m_channel_list; ChatWindow m_chat; MemberList m_members; FriendsList m_friends; |