1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-05 03:50:07 +00:00

Introjucer: stopped the modules panel from hammering the website.

This commit is contained in:
jules 2013-10-05 19:14:03 +01:00
parent 0ff1e14b8b
commit c6becf2532
3 changed files with 24 additions and 2 deletions

View file

@ -52,7 +52,14 @@ ModuleList::ModuleList()
ModuleList::ModuleList (const ModuleList& other)
{
operator= (other);
}
ModuleList& ModuleList::operator= (const ModuleList& other)
{
modules.clear();
modules.addCopiesOf (other.modules);
return *this;
}
const ModuleDescription* ModuleList::getModuleWithID (const String& moduleID) const

View file

@ -62,6 +62,7 @@ struct ModuleList
{
ModuleList();
ModuleList (const ModuleList&);
ModuleList& operator= (const ModuleList&);
const ModuleDescription* getModuleWithID (const String& moduleID) const;
StringArray getIDs() const;

View file

@ -161,7 +161,6 @@ public:
void webUpdateFinished (const ModuleList& newList)
{
listFromWebsite = new ModuleList (newList);
webUpdateThread = nullptr;
table.updateContent();
table.repaint();
@ -326,8 +325,23 @@ private:
void run() override
{
if (list.loadFromWebsite() && ! threadShouldExit())
static Time lastDownloadTime;
static ModuleList lastList;
if (Time::getCurrentTime() < lastDownloadTime + RelativeTime::minutes (2.0))
{
list = lastList;
triggerAsyncUpdate();
}
else
{
if (list.loadFromWebsite() && ! threadShouldExit())
{
lastList = list;
lastDownloadTime = Time::getCurrentTime();
triggerAsyncUpdate();
}
}
}
void handleAsyncUpdate() override