Skip to content

Commit

Permalink
UI|Client: Load game logos asynchronously
Browse files Browse the repository at this point in the history
It may take a little while to load all the icons, and the UI shouldn’t be blocked in the meantime. This was particularly noticeable when reconfiguring the search folders.
  • Loading branch information
skyjake committed Nov 3, 2018
1 parent 8fcfb35 commit 4921c65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion doomsday/apps/client/src/ui/home/gamepanelbuttonwidget.cpp
Expand Up @@ -33,6 +33,7 @@
#include <doomsday/res/Bundles>

#include <de/App>
#include <de/Async>
#include <de/CallbackAction>
#include <de/ChildWidgetOrganizer>
#include <de/FileSystem>
Expand All @@ -45,6 +46,7 @@ using namespace de;
DENG_GUI_PIMPL(GamePanelButtonWidget)
, DENG2_OBSERVES(Profiles::AbstractProfile, Change)
, DENG2_OBSERVES(res::Bundles, Identify)
, public AsyncScope
{
GameProfile &gameProfile;
ui::FilteredDataT<SaveListData::SaveItem> savedItems;
Expand Down Expand Up @@ -240,7 +242,8 @@ DENG_GUI_PIMPL(GamePanelButtonWidget)

void updateGameTitleImage()
{
self().icon().setImage(IdTech1Image::makeGameLogo(game(), catalog));
*this += async([this]() { return IdTech1Image::makeGameLogo(game(), catalog); },
[this](const Image &gameLogo) { self().icon().setImage(gameLogo); });
}

void profileChanged(Profiles::AbstractProfile &) override
Expand Down
1 change: 0 additions & 1 deletion doomsday/apps/client/src/ui/widgets/packageswidget.cpp
Expand Up @@ -854,7 +854,6 @@ DENG_GUI_PIMPL(PackagesWidget)
auto &w = widget.as<PackageListItemWidget>();
w.setItem(item.as<PackageItem>());
DENG2_ASSERT_IN_MAIN_THREAD();
DENG2_ASSERT(FS::get().busyLevel() == 0);
w.updateContents();
}
};
Expand Down

0 comments on commit 4921c65

Please sign in to comment.