This commit is contained in:
ouwou 2021-05-06 20:11:15 -04:00
commit ad0d4e7d4d
5 changed files with 33 additions and 30 deletions

View File

@ -36,13 +36,8 @@ void StatusIndicator::CheckStatus() {
get_style_context()->remove_class("dnd");
get_style_context()->remove_class("idle");
get_style_context()->remove_class("offline");
if (status.has_value()) {
get_style_context()->add_class(GetPresenceString(*status));
m_status = *status;
} else {
m_status = PresenceStatus::Offline;
get_style_context()->add_class("offline");
}
get_style_context()->add_class(GetPresenceString(status));
m_status = status;
if (last_status != m_status)
queue_draw();

View File

@ -842,12 +842,12 @@ void DiscordClient::SetUserAgent(std::string agent) {
m_websocket.SetUserAgent(agent);
}
std::optional<PresenceStatus> DiscordClient::GetUserStatus(Snowflake id) const {
PresenceStatus DiscordClient::GetUserStatus(Snowflake id) const {
auto it = m_user_to_status.find(id);
if (it != m_user_to_status.end())
return it->second;
return std::nullopt;
return PresenceStatus::Offline;
}
std::unordered_set<Snowflake> DiscordClient::GetRelationships(RelationshipType type) const {

View File

@ -176,7 +176,7 @@ public:
void UpdateToken(std::string token);
void SetUserAgent(std::string agent);
std::optional<PresenceStatus> GetUserStatus(Snowflake id) const;
PresenceStatus GetUserStatus(Snowflake id) const;
std::unordered_set<Snowflake> GetRelationships(RelationshipType type) const;

View File

@ -124,33 +124,40 @@ MainWindow::MainWindow() {
} else {
m_main_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
m_content_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
m_chan_chat_paned = Gtk::manage(new Gtk::Paned(Gtk::ORIENTATION_HORIZONTAL));
m_chat_members_paned = Gtk::manage(new Gtk::Paned(Gtk::ORIENTATION_HORIZONTAL));
m_chan_content_paned = Gtk::manage(new Gtk::Paned(Gtk::ORIENTATION_HORIZONTAL));
m_content_members_paned = Gtk::manage(new Gtk::Paned(Gtk::ORIENTATION_HORIZONTAL));
m_content_stack = Gtk::manage(new Gtk::Stack);
m_main_box->show();
m_content_box->set_hexpand(true);
m_content_box->set_vexpand(true);
m_content_box->show();
m_main_box->add(m_menu_bar);
m_main_box->add(*m_content_box);
m_main_box->show();
m_content_stack->add(*chat);
m_content_stack->set_vexpand(true);
m_content_stack->set_hexpand(true);
m_content_stack->show();
m_chan_chat_paned->pack1(*channel_list);
m_chan_chat_paned->pack2(*m_chat_members_paned);
m_chan_chat_paned->child_property_shrink(*channel_list) = false;
m_chan_chat_paned->child_property_resize(*channel_list) = false;
m_chan_chat_paned->set_position(200);
m_chan_chat_paned->show();
m_content_box->add(*m_chan_chat_paned);
m_chan_content_paned->pack1(*channel_list);
m_chan_content_paned->pack2(*m_content_members_paned);
m_chan_content_paned->child_property_shrink(*channel_list) = false;
m_chan_content_paned->child_property_resize(*channel_list) = false;
m_chan_content_paned->set_position(200);
m_chan_content_paned->show();
m_content_box->add(*m_chan_content_paned);
m_chat_members_paned->pack1(*chat);
m_chat_members_paned->pack2(*member_list);
m_chat_members_paned->child_property_shrink(*member_list) = false;
m_chat_members_paned->child_property_resize(*member_list) = false;
m_content_members_paned->pack1(*m_content_stack);
m_content_members_paned->pack2(*member_list);
m_content_members_paned->child_property_shrink(*member_list) = false;
m_content_members_paned->child_property_resize(*member_list) = false;
int w, h;
get_default_size(w, h); // :s
m_chat_members_paned->set_position(w - m_chan_chat_paned->get_position() - 150);
m_chat_members_paned->show();
m_content_members_paned->set_position(w - m_chan_content_paned->get_position() - 150);
m_content_members_paned->show();
m_main_box->add(m_menu_bar);
m_main_box->add(*m_content_box);
add(*m_main_box);
}

View File

@ -69,8 +69,9 @@ protected:
Gtk::Box *m_main_box;
// normal
Gtk::Box *m_content_box = nullptr;
Gtk::Paned *m_chan_chat_paned = nullptr;
Gtk::Paned *m_chat_members_paned = nullptr;
Gtk::Paned *m_chan_content_paned = nullptr;
Gtk::Paned *m_content_members_paned = nullptr;
Gtk::Stack *m_content_stack = nullptr;
// mobile
Gtk::StackSwitcher *m_switcher = nullptr;