From 399314b407ee6010bb5057151569afeef5438216 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 30 May 2017 14:58:49 -0300 Subject: [PATCH] Load preset palettes faster Load all queued resources on each onTick() instead of one per tick. --- src/app/ui/resources_listbox.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/app/ui/resources_listbox.cpp b/src/app/ui/resources_listbox.cpp index 223b9de56..52ee7b935 100644 --- a/src/app/ui/resources_listbox.cpp +++ b/src/app/ui/resources_listbox.cpp @@ -177,22 +177,20 @@ void ResourcesListBox::onTick() base::UniquePtr resource; std::string name; - if (!m_resourcesLoader->next(resource)) { - if (m_resourcesLoader->isDone()) { - stop(); - } - return; + while (m_resourcesLoader->next(resource)) { + base::UniquePtr listItem(onCreateResourceItem(resource)); + insertChild(getItemsCount()-1, listItem); + layout(); + + if (View* view = View::getView(this)) + view->updateView(); + + resource.release(); + listItem.release(); } - base::UniquePtr listItem(onCreateResourceItem(resource)); - insertChild(getItemsCount()-1, listItem); - layout(); - - if (View* view = View::getView(this)) - view->updateView(); - - resource.release(); - listItem.release(); + if (m_resourcesLoader->isDone()) + stop(); } void ResourcesListBox::stop()