Merge branch 'resources' (closes #29)

This commit is contained in:
ouwou
2021-07-25 23:00:16 -04:00
15 changed files with 143 additions and 17 deletions

View File

@@ -21,8 +21,9 @@ ChatInputIndicator::ChatInputIndicator()
m_label.show();
// try loading gif
if (!std::filesystem::exists("./res/typing_indicator.gif")) return;
auto gif_data = ReadWholeFile("./res/typing_indicator.gif");
const static auto path = Abaddon::GetResPath("/typing_indicator.gif");
if (!std::filesystem::exists(path)) return;
auto gif_data = ReadWholeFile(path);
auto loader = Gdk::PixbufLoader::create();
loader->signal_size_prepared().connect([&](int inw, int inh) {
int w, h;

View File

@@ -17,7 +17,8 @@ MemberListUserRow::MemberListUserRow(const std::optional<GuildData> &guild, cons
static bool crown = Abaddon::Get().GetSettings().GetShowOwnerCrown();
if (crown && guild.has_value() && guild->OwnerID == data.ID) {
try {
auto pixbuf = Gdk::Pixbuf::create_from_file("./res/crown.png", 12, 12);
const static auto crown_path = Abaddon::GetResPath("/crown.png");
auto pixbuf = Gdk::Pixbuf::create_from_file(crown_path, 12, 12);
m_crown = Gtk::manage(new Gtk::Image(pixbuf));
m_crown->set_valign(Gtk::ALIGN_CENTER);
m_crown->set_margin_end(8);

View File

@@ -15,9 +15,10 @@ RateLimitIndicator::RateLimitIndicator()
add(m_img);
m_label.show();
if (std::filesystem::exists("./res/clock.png")) {
const static auto clock_path = Abaddon::GetResPath("/clock.png");
if (std::filesystem::exists(clock_path)) {
try {
const auto pixbuf = Gdk::Pixbuf::create_from_file("./res/clock.png");
const auto pixbuf = Gdk::Pixbuf::create_from_file(clock_path);
int w, h;
GetImageDimensions(pixbuf->get_width(), pixbuf->get_height(), w, h, 20, 10);
m_img.property_pixbuf() = pixbuf->scale_simple(w, h, Gdk::INTERP_BILINEAR);