mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-19 20:11:59 +03:00
improve build process, add github actions
This commit is contained in:
@@ -46,7 +46,7 @@ ChannelListRowDMHeader::ChannelListRowDMHeader() {
|
||||
show_all_children();
|
||||
}
|
||||
|
||||
ChannelListRowDMChannel::ChannelListRowDMChannel(const Channel *data) {
|
||||
ChannelListRowDMChannel::ChannelListRowDMChannel(const ChannelData *data) {
|
||||
ID = data->ID;
|
||||
m_ev = Gtk::manage(new Gtk::EventBox);
|
||||
m_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
@@ -56,7 +56,7 @@ ChannelListRowDMChannel::ChannelListRowDMChannel(const Channel *data) {
|
||||
get_style_context()->add_class("channel-row");
|
||||
m_lbl->get_style_context()->add_class("channel-row-label");
|
||||
|
||||
User top_recipient;
|
||||
UserData top_recipient;
|
||||
const auto recipients = data->GetDMRecipients();
|
||||
top_recipient = recipients[0];
|
||||
|
||||
@@ -95,7 +95,7 @@ void ChannelListRowDMChannel::OnImageLoad(Glib::RefPtr<Gdk::Pixbuf> buf) {
|
||||
m_icon->property_pixbuf() = buf->scale_simple(24, 24, Gdk::INTERP_BILINEAR);
|
||||
}
|
||||
|
||||
ChannelListRowGuild::ChannelListRowGuild(const Guild *data) {
|
||||
ChannelListRowGuild::ChannelListRowGuild(const GuildData *data) {
|
||||
ID = data->ID;
|
||||
m_ev = Gtk::manage(new Gtk::EventBox);
|
||||
m_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
@@ -176,7 +176,7 @@ ChannelListRowGuild::type_signal_leave ChannelListRowGuild::signal_leave() {
|
||||
return m_signal_leave;
|
||||
}
|
||||
|
||||
ChannelListRowCategory::ChannelListRowCategory(const Channel *data) {
|
||||
ChannelListRowCategory::ChannelListRowCategory(const ChannelData *data) {
|
||||
ID = data->ID;
|
||||
m_ev = Gtk::manage(new Gtk::EventBox);
|
||||
m_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
@@ -222,7 +222,7 @@ ChannelListRowCategory::type_signal_copy_id ChannelListRowCategory::signal_copy_
|
||||
return m_signal_copy_id;
|
||||
}
|
||||
|
||||
ChannelListRowChannel::ChannelListRowChannel(const Channel *data) {
|
||||
ChannelListRowChannel::ChannelListRowChannel(const ChannelData *data) {
|
||||
ID = data->ID;
|
||||
m_ev = Gtk::manage(new Gtk::EventBox);
|
||||
m_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
@@ -591,8 +591,8 @@ void ChannelList::InsertGuildAt(Snowflake id, int pos) {
|
||||
const auto guild_data = discord.GetGuild(id);
|
||||
if (!guild_data.has_value()) return;
|
||||
|
||||
std::map<int, Channel> orphan_channels;
|
||||
std::unordered_map<Snowflake, std::vector<Channel>> cat_to_channels;
|
||||
std::map<int, ChannelData> orphan_channels;
|
||||
std::unordered_map<Snowflake, std::vector<ChannelData>> cat_to_channels;
|
||||
if (guild_data->Channels.has_value())
|
||||
for (const auto &dc : *guild_data->Channels) {
|
||||
const auto channel = discord.GetChannel(dc.ID);
|
||||
@@ -626,7 +626,7 @@ void ChannelList::InsertGuildAt(Snowflake id, int pos) {
|
||||
}
|
||||
|
||||
// categories
|
||||
std::map<int, std::vector<Channel>> sorted_categories;
|
||||
std::map<int, std::vector<ChannelData>> sorted_categories;
|
||||
if (guild_data->Channels.has_value())
|
||||
for (const auto &dc : *guild_data->Channels) {
|
||||
const auto channel = discord.GetChannel(dc.ID);
|
||||
@@ -636,7 +636,7 @@ void ChannelList::InsertGuildAt(Snowflake id, int pos) {
|
||||
}
|
||||
|
||||
for (auto &[pos, catvec] : sorted_categories) {
|
||||
std::sort(catvec.begin(), catvec.end(), [](const Channel &a, const Channel &b) { return a.ID < b.ID; });
|
||||
std::sort(catvec.begin(), catvec.end(), [](const ChannelData &a, const ChannelData &b) { return a.ID < b.ID; });
|
||||
for (const auto cat : catvec) {
|
||||
auto *cat_row = Gtk::manage(new ChannelListRowCategory(&cat));
|
||||
cat_row->IsUserCollapsed = false;
|
||||
@@ -648,7 +648,7 @@ void ChannelList::InsertGuildAt(Snowflake id, int pos) {
|
||||
|
||||
// child channels
|
||||
if (cat_to_channels.find(cat.ID) == cat_to_channels.end()) continue;
|
||||
std::map<int, Channel> sorted_channels;
|
||||
std::map<int, ChannelData> sorted_channels;
|
||||
|
||||
for (const auto channel : cat_to_channels.at(cat.ID))
|
||||
sorted_channels[*channel.Position] = channel;
|
||||
@@ -669,12 +669,12 @@ void ChannelList::InsertGuildAt(Snowflake id, int pos) {
|
||||
void ChannelList::AddPrivateChannels() {
|
||||
const auto &discord = Abaddon::Get().GetDiscordClient();
|
||||
auto dms_ = discord.GetPrivateChannels();
|
||||
std::vector<Channel> dms;
|
||||
std::vector<ChannelData> dms;
|
||||
for (const auto &x : dms_) {
|
||||
const auto chan = discord.GetChannel(x);
|
||||
dms.push_back(*chan);
|
||||
}
|
||||
std::sort(dms.begin(), dms.end(), [&](const Channel &a, const Channel &b) -> bool {
|
||||
std::sort(dms.begin(), dms.end(), [&](const ChannelData &a, const ChannelData &b) -> bool {
|
||||
return a.LastMessageID > b.LastMessageID;
|
||||
});
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ protected:
|
||||
|
||||
class ChannelListRowDMChannel : public ChannelListRow {
|
||||
public:
|
||||
ChannelListRowDMChannel(const Channel *data);
|
||||
ChannelListRowDMChannel(const ChannelData *data);
|
||||
|
||||
protected:
|
||||
void OnImageLoad(Glib::RefPtr<Gdk::Pixbuf> buf);
|
||||
@@ -48,7 +48,7 @@ protected:
|
||||
|
||||
class ChannelListRowGuild : public ChannelListRow {
|
||||
public:
|
||||
ChannelListRowGuild(const Guild *data);
|
||||
ChannelListRowGuild(const GuildData *data);
|
||||
|
||||
int GuildIndex;
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
class ChannelListRowCategory : public ChannelListRow {
|
||||
public:
|
||||
ChannelListRowCategory(const Channel *data);
|
||||
ChannelListRowCategory(const ChannelData *data);
|
||||
|
||||
virtual void Collapse();
|
||||
virtual void Expand();
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
|
||||
class ChannelListRowChannel : public ChannelListRow {
|
||||
public:
|
||||
ChannelListRowChannel(const Channel *data);
|
||||
ChannelListRowChannel(const ChannelData *data);
|
||||
|
||||
protected:
|
||||
Gtk::EventBox *m_ev;
|
||||
|
||||
@@ -436,7 +436,7 @@ Gtk::Widget *ChatMessageItemContainer::CreateAttachmentComponent(const Attachmen
|
||||
return ev;
|
||||
}
|
||||
|
||||
Gtk::Widget *ChatMessageItemContainer::CreateStickerComponent(const Sticker &data) {
|
||||
Gtk::Widget *ChatMessageItemContainer::CreateStickerComponent(const StickerData &data) {
|
||||
auto *box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
auto *imgw = Gtk::manage(new Gtk::Image);
|
||||
box->add(*imgw);
|
||||
@@ -715,7 +715,7 @@ void ChatMessageItemContainer::HandleCustomEmojis(Gtk::TextView &tv) {
|
||||
|
||||
startpos = mend;
|
||||
if (is_animated && show_animations) {
|
||||
auto pixbuf = img.GetAnimationFromURLIfCached(Emoji::URLFromID(match.fetch(2), "gif"), EmojiSize, EmojiSize);
|
||||
auto pixbuf = img.GetAnimationFromURLIfCached(EmojiData::URLFromID(match.fetch(2), "gif"), EmojiSize, EmojiSize);
|
||||
if (pixbuf) {
|
||||
const auto it = buf->erase(start_it, end_it);
|
||||
const int alen = text.size();
|
||||
@@ -742,10 +742,10 @@ void ChatMessageItemContainer::HandleCustomEmojis(Gtk::TextView &tv) {
|
||||
img->show();
|
||||
tv.add_child_at_anchor(*img, anchor);
|
||||
};
|
||||
img.LoadAnimationFromURL(Emoji::URLFromID(match.fetch(2), "gif"), EmojiSize, EmojiSize, sigc::track_obj(cb, tv));
|
||||
img.LoadAnimationFromURL(EmojiData::URLFromID(match.fetch(2), "gif"), EmojiSize, EmojiSize, sigc::track_obj(cb, tv));
|
||||
}
|
||||
} else {
|
||||
auto pixbuf = img.GetFromURLIfCached(Emoji::URLFromID(match.fetch(2)));
|
||||
auto pixbuf = img.GetFromURLIfCached(EmojiData::URLFromID(match.fetch(2)));
|
||||
if (pixbuf) {
|
||||
const auto it = buf->erase(start_it, end_it);
|
||||
const int alen = text.size();
|
||||
@@ -767,7 +767,7 @@ void ChatMessageItemContainer::HandleCustomEmojis(Gtk::TextView &tv) {
|
||||
auto it = buf->erase(start_it, end_it);
|
||||
buf->insert_pixbuf(it, pixbuf->scale_simple(EmojiSize, EmojiSize, Gdk::INTERP_BILINEAR));
|
||||
};
|
||||
img.LoadFromURL(Emoji::URLFromID(match.fetch(2)), sigc::track_obj(cb, tv));
|
||||
img.LoadFromURL(EmojiData::URLFromID(match.fetch(2)), sigc::track_obj(cb, tv));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ protected:
|
||||
Gtk::Widget *CreateEmbedComponent(const EmbedData &data); // Message.Embeds[0]
|
||||
Gtk::Widget *CreateImageComponent(const std::string &proxy_url, const std::string &url, int inw, int inh);
|
||||
Gtk::Widget *CreateAttachmentComponent(const AttachmentData &data); // non-image attachments
|
||||
Gtk::Widget *CreateStickerComponent(const Sticker &data);
|
||||
Gtk::Widget *CreateStickerComponent(const StickerData &data);
|
||||
Gtk::Widget *CreateReactionsComponent(const Message &data);
|
||||
Gtk::Widget *CreateReplyComponent(const Message &data);
|
||||
void ReactionUpdateImage(Gtk::Image *img, const Glib::RefPtr<Gdk::Pixbuf> &pb);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "../abaddon.hpp"
|
||||
#include "../util.hpp"
|
||||
|
||||
MemberListUserRow::MemberListUserRow(Snowflake guild_id, const User *data) {
|
||||
MemberListUserRow::MemberListUserRow(Snowflake guild_id, const UserData *data) {
|
||||
ID = data->ID;
|
||||
m_ev = Gtk::manage(new Gtk::EventBox);
|
||||
m_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
||||
@@ -111,8 +111,8 @@ void MemberList::UpdateMemberListInternal() {
|
||||
}
|
||||
|
||||
// process all the shit first so its in proper order
|
||||
std::map<int, Role> pos_to_role;
|
||||
std::map<int, std::vector<User>> pos_to_users;
|
||||
std::map<int, RoleData> pos_to_role;
|
||||
std::map<int, std::vector<UserData>> pos_to_users;
|
||||
std::unordered_map<Snowflake, int> user_to_color;
|
||||
std::vector<Snowflake> roleless_users;
|
||||
|
||||
@@ -139,7 +139,7 @@ void MemberList::UpdateMemberListInternal() {
|
||||
user_to_color[id] = col_role->Color;
|
||||
}
|
||||
|
||||
auto add_user = [this, &user_to_color](const User *data) {
|
||||
auto add_user = [this, &user_to_color](const UserData *data) {
|
||||
auto *row = Gtk::manage(new MemberListUserRow(m_guild_id, data));
|
||||
m_id_to_row[data->ID] = row;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
class MemberListUserRow : public Gtk::ListBoxRow {
|
||||
public:
|
||||
MemberListUserRow(Snowflake guild_id, const User *data);
|
||||
MemberListUserRow(Snowflake guild_id, const UserData *data);
|
||||
void SetAvatarFromPixbuf(Glib::RefPtr<Gdk::Pixbuf> pixbuf);
|
||||
|
||||
Snowflake ID;
|
||||
|
||||
Reference in New Issue
Block a user