[code] The addScript button disappears when needed.

When there is already the maximal number of scripts or when the
ScriptStore accordion buffer is full.

Change-Id: I0d43d42626da7f060a2309c66f1806b35a29bf38
This commit is contained in:
Léa Saviot
2017-11-10 17:49:05 +01:00
committed by Romain Goyet
parent 024067d8a8
commit 4f74b6d849
6 changed files with 37 additions and 23 deletions

View File

@@ -99,6 +99,10 @@ void ScriptStore::deleteAllScripts() {
m_accordion.deleteAll();
}
bool ScriptStore::isFull() {
return (m_accordion.freeSpaceSize() < k_fullFreeSpaceSizeLimit);
}
const char * ScriptStore::contentOfScript(const char * name) {
Script script = scriptNamed(name);
if (script.isNull()) {
@@ -107,7 +111,6 @@ const char * ScriptStore::contentOfScript(const char * name) {
return script.content();
}
bool ScriptStore::addScriptFromTemplate(const ScriptTemplate * scriptTemplate) {
const char autoImportationString[2] = {Script::DefaultAutoImportationMarker, 0};
if (!m_accordion.appendBuffer(autoImportationString)) {