mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-19 20:11:59 +03:00
committed by
GitHub
parent
108002248c
commit
9d21df8e1b
@@ -61,7 +61,6 @@ void CellRendererPixbufAnimation::render_vfunc(const Cairo::RefPtr<Cairo::Contex
|
||||
Gtk::CellRendererState flags) {
|
||||
Gtk::Requisition minimum, natural;
|
||||
get_preferred_size(widget, minimum, natural);
|
||||
auto alloc = widget.get_allocation();
|
||||
int xpad, ypad;
|
||||
get_padding(xpad, ypad);
|
||||
int pix_x = cell_area.get_x() + xpad;
|
||||
|
||||
@@ -16,8 +16,8 @@ ChannelList::ChannelList()
|
||||
, m_menu_guild_leave("_Leave", true)
|
||||
, m_menu_category_copy_id("_Copy ID", true)
|
||||
, m_menu_channel_copy_id("_Copy ID", true)
|
||||
, m_menu_dm_close("") // changes depending on if group or not
|
||||
, m_menu_dm_copy_id("_Copy ID", true)
|
||||
, m_menu_dm_close("") // changes depending on if group or not
|
||||
, m_menu_thread_copy_id("_Copy ID", true)
|
||||
, m_menu_thread_leave("_Leave", true)
|
||||
, m_menu_thread_archive("_Archive", true)
|
||||
@@ -167,7 +167,6 @@ void ChannelList::UpdateListing() {
|
||||
m_model->clear();
|
||||
|
||||
auto &discord = Abaddon::Get().GetDiscordClient();
|
||||
auto &img = Abaddon::Get().GetImageManager();
|
||||
|
||||
const auto guild_ids = discord.GetUserSortedGuilds();
|
||||
int sortnum = 0;
|
||||
@@ -185,10 +184,7 @@ void ChannelList::UpdateListing() {
|
||||
}
|
||||
|
||||
void ChannelList::UpdateNewGuild(const GuildData &guild) {
|
||||
auto &img = Abaddon::Get().GetImageManager();
|
||||
|
||||
auto iter = AddGuild(guild);
|
||||
|
||||
AddGuild(guild);
|
||||
// update sort order
|
||||
int sortnum = 0;
|
||||
for (const auto guild_id : Abaddon::Get().GetDiscordClient().GetUserSortedGuilds()) {
|
||||
@@ -561,7 +557,7 @@ void ChannelList::UpdateChannelCategory(const ChannelData &channel) {
|
||||
}
|
||||
|
||||
Gtk::TreeModel::iterator ChannelList::GetIteratorForGuildFromID(Snowflake id) {
|
||||
for (const auto child : m_model->children()) {
|
||||
for (const auto &child : m_model->children()) {
|
||||
if (child[m_columns.m_id] == id)
|
||||
return child;
|
||||
}
|
||||
@@ -570,14 +566,14 @@ Gtk::TreeModel::iterator ChannelList::GetIteratorForGuildFromID(Snowflake id) {
|
||||
|
||||
Gtk::TreeModel::iterator ChannelList::GetIteratorForChannelFromID(Snowflake id) {
|
||||
std::queue<Gtk::TreeModel::iterator> queue;
|
||||
for (const auto child : m_model->children())
|
||||
for (const auto child2 : child.children())
|
||||
for (const auto &child : m_model->children())
|
||||
for (const auto &child2 : child.children())
|
||||
queue.push(child2);
|
||||
|
||||
while (!queue.empty()) {
|
||||
auto item = queue.front();
|
||||
if ((*item)[m_columns.m_id] == id) return item;
|
||||
for (const auto child : item->children())
|
||||
for (const auto &child : item->children())
|
||||
queue.push(child);
|
||||
queue.pop();
|
||||
}
|
||||
@@ -1052,9 +1048,6 @@ void CellRendererChannels::get_preferred_height_for_width_vfunc_category(Gtk::Wi
|
||||
}
|
||||
|
||||
void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr<Cairo::Context> &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, const Gdk::Rectangle &cell_area, Gtk::CellRendererState flags) {
|
||||
int available_xpad = background_area.get_width();
|
||||
int available_ypad = background_area.get_height();
|
||||
|
||||
// todo: figure out how Gtk::Arrow is rendered because i like it better :^)
|
||||
constexpr static int len = 5;
|
||||
int x1, y1, x2, y2, x3, y3;
|
||||
|
||||
@@ -112,7 +112,7 @@ void ChatInputIndicator::ComputeTypingString() {
|
||||
SetTypingString(typers[0].Username + " and " + typers[1].Username + " are typing...");
|
||||
} else if (typers.size() > 2 && typers.size() <= MaxUsersInIndicator) {
|
||||
Glib::ustring str;
|
||||
for (int i = 0; i < typers.size() - 1; i++)
|
||||
for (size_t i = 0; i < typers.size() - 1; i++)
|
||||
str += typers[i].Username + ", ";
|
||||
SetTypingString(str + "and " + typers[typers.size() - 1].Username + " are typing...");
|
||||
} else { // size() > MaxUsersInIndicator
|
||||
|
||||
@@ -308,8 +308,6 @@ Gtk::Widget *ChatMessageItemContainer::CreateEmbedComponent(const EmbedData &emb
|
||||
|
||||
constexpr static int AuthorIconSize = 20;
|
||||
if (embed.Author->ProxyIconURL.has_value()) {
|
||||
auto &img = Abaddon::Get().GetImageManager();
|
||||
|
||||
auto *author_img = Gtk::manage(new LazyImage(*embed.Author->ProxyIconURL, AuthorIconSize, AuthorIconSize));
|
||||
author_img->set_halign(Gtk::ALIGN_START);
|
||||
author_img->set_valign(Gtk::ALIGN_START);
|
||||
|
||||
@@ -47,7 +47,7 @@ bool Completer::ProcessKeyPress(GdkEventKey *e) {
|
||||
switch (e->keyval) {
|
||||
case GDK_KEY_Down: {
|
||||
if (m_entries.size() == 0) return true;
|
||||
const int index = m_list.get_selected_row()->get_index();
|
||||
const auto index = static_cast<size_t>(m_list.get_selected_row()->get_index());
|
||||
if (index >= m_entries.size() - 1) return true;
|
||||
m_list.select_row(*m_entries[index + 1]);
|
||||
ScrollListBoxToSelected(m_list);
|
||||
@@ -55,7 +55,7 @@ bool Completer::ProcessKeyPress(GdkEventKey *e) {
|
||||
return true;
|
||||
case GDK_KEY_Up: {
|
||||
if (m_entries.size() == 0) return true;
|
||||
const int index = m_list.get_selected_row()->get_index();
|
||||
const auto index = static_cast<size_t>(m_list.get_selected_row()->get_index());
|
||||
if (index == 0) return true;
|
||||
m_list.select_row(*m_entries[index - 1]);
|
||||
ScrollListBoxToSelected(m_list);
|
||||
@@ -169,7 +169,7 @@ void Completer::CompleteEmojis(const Glib::ustring &term) {
|
||||
const auto guild = discord.GetGuild(*channel->GuildID);
|
||||
|
||||
if (guild.has_value() && guild->Emojis.has_value())
|
||||
for (const auto tmp : *guild->Emojis) {
|
||||
for (const auto &tmp : *guild->Emojis) {
|
||||
const auto emoji = *discord.GetEmoji(tmp.ID);
|
||||
if (emoji.IsAnimated.has_value() && *emoji.IsAnimated) continue;
|
||||
if (emoji.IsAvailable.has_value() && !*emoji.IsAvailable) continue;
|
||||
@@ -186,7 +186,7 @@ void Completer::CompleteEmojis(const Glib::ustring &term) {
|
||||
for (const auto guild_id : discord.GetGuilds()) {
|
||||
const auto guild = discord.GetGuild(guild_id);
|
||||
if (!guild.has_value()) continue;
|
||||
for (const auto tmp : *guild->Emojis) {
|
||||
for (const auto &tmp : *guild->Emojis) {
|
||||
const auto emoji = *discord.GetEmoji(tmp.ID);
|
||||
const bool is_animated = emoji.IsAnimated.has_value() && *emoji.IsAnimated;
|
||||
if (emoji.IsAvailable.has_value() && !*emoji.IsAvailable) continue;
|
||||
@@ -330,8 +330,8 @@ Glib::ustring Completer::GetTerm() {
|
||||
}
|
||||
|
||||
CompleterEntry::CompleterEntry(const Glib::ustring &completion, int index)
|
||||
: m_index(index)
|
||||
, m_completion(completion)
|
||||
: m_completion(completion)
|
||||
, m_index(index)
|
||||
, m_box(Gtk::ORIENTATION_HORIZONTAL) {
|
||||
set_halign(Gtk::ALIGN_START);
|
||||
get_style_context()->add_class("completer-entry");
|
||||
|
||||
@@ -185,9 +185,9 @@ bool FriendsList::ListFilterFunc(Gtk::ListBoxRow *row_) {
|
||||
FriendsListAddComponent::FriendsListAddComponent()
|
||||
: Gtk::Box(Gtk::ORIENTATION_VERTICAL)
|
||||
, m_label("Add a Friend", Gtk::ALIGN_START)
|
||||
, m_box(Gtk::ORIENTATION_HORIZONTAL)
|
||||
, m_status("", Gtk::ALIGN_START)
|
||||
, m_add("Add")
|
||||
, m_status("", Gtk::ALIGN_START) {
|
||||
, m_box(Gtk::ORIENTATION_HORIZONTAL) {
|
||||
m_box.add(m_entry);
|
||||
m_box.add(m_add);
|
||||
m_box.add(m_status);
|
||||
@@ -241,9 +241,9 @@ bool FriendsListAddComponent::OnKeyPress(GdkEventKey *e) {
|
||||
}
|
||||
|
||||
FriendsListFriendRow::FriendsListFriendRow(RelationshipType type, const UserData &data)
|
||||
: Name(data.Username + "#" + data.Discriminator)
|
||||
: ID(data.ID)
|
||||
, Type(type)
|
||||
, ID(data.ID)
|
||||
, Name(data.Username + "#" + data.Discriminator)
|
||||
, Status(Abaddon::Get().GetDiscordClient().GetUserStatus(data.ID))
|
||||
, m_accept("Accept") {
|
||||
auto *ev = Gtk::manage(new Gtk::EventBox);
|
||||
|
||||
Reference in New Issue
Block a user