diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-06-30 18:15:03 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-06-30 18:15:03 -0400 |
commit | 698ec52d5c056f3584c46e67b199adcfba9f8d2e (patch) | |
tree | 3b48df8eed852c2f4ecbdbcaaff9bf29d16f7b50 /components | |
parent | 220aa6d13a9cb12687139305c6f68eb9cf6f73a1 (diff) | |
download | abaddon-portaudio-698ec52d5c056f3584c46e67b199adcfba9f8d2e.tar.gz abaddon-portaudio-698ec52d5c056f3584c46e67b199adcfba9f8d2e.zip |
try loading resources from share, fallback to cwd
Diffstat (limited to 'components')
-rw-r--r-- | components/chatinputindicator.cpp | 5 | ||||
-rw-r--r-- | components/memberlist.cpp | 3 | ||||
-rw-r--r-- | components/ratelimitindicator.cpp | 5 |
3 files changed, 8 insertions, 5 deletions
diff --git a/components/chatinputindicator.cpp b/components/chatinputindicator.cpp index 3b43b7e..8b05c71 100644 --- a/components/chatinputindicator.cpp +++ b/components/chatinputindicator.cpp @@ -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; diff --git a/components/memberlist.cpp b/components/memberlist.cpp index ed02505..e91ce88 100644 --- a/components/memberlist.cpp +++ b/components/memberlist.cpp @@ -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); diff --git a/components/ratelimitindicator.cpp b/components/ratelimitindicator.cpp index d962f98..6115900 100644 --- a/components/ratelimitindicator.cpp +++ b/components/ratelimitindicator.cpp @@ -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); |