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:
parent
0ff1e14b8b
commit
c6becf2532
3 changed files with 24 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ struct ModuleList
|
|||
{
|
||||
ModuleList();
|
||||
ModuleList (const ModuleList&);
|
||||
ModuleList& operator= (const ModuleList&);
|
||||
|
||||
const ModuleDescription* getModuleWithID (const String& moduleID) const;
|
||||
StringArray getIDs() const;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue