[Horus] MODEL SELECT bug fixes

This commit is contained in:
Bertrand Songis
2016-06-10 23:35:54 +02:00
parent c22818442e
commit 575eb3d0d1
+14 -14
View File
@@ -106,6 +106,7 @@ void onCategorySelectMenu(const char * result)
} }
else if (result == STR_DELETE_CATEGORY) { else if (result == STR_DELETE_CATEGORY) {
modelslist.removeCategory(currentCategory); modelslist.removeCategory(currentCategory);
modelslist.save();
setCurrentCategory(currentCategoryIndex-1); setCurrentCategory(currentCategoryIndex-1);
} }
} }
@@ -260,6 +261,11 @@ bool menuModelSelect(evt_t event)
break; break;
} }
if (currentCategory && currentCategory->size() == 0) {
selectMode = MODE_SELECT_CATEGORY;
currentModel = NULL;
}
// Header // Header
theme->drawTopbarBackground(ICON_LIBRARY); theme->drawTopbarBackground(ICON_LIBRARY);
@@ -320,21 +326,15 @@ bool menuModelSelect(evt_t event)
} }
} }
if (selectMode == MODE_SELECT_MODEL) { if (selectMode == MODE_SELECT_MODEL) {
if (index == 0) { menuVerticalPosition = modelsVerticalPosition;
selectMode = MODE_SELECT_CATEGORY; menuHorizontalPosition = modelsHorizontalPosition;
menuVerticalOffset = modelsVerticalOffset;
if (navigate(event, index, 3, 2)) {
modelsVerticalPosition = menuVerticalPosition;
modelsHorizontalPosition = menuHorizontalPosition;
modelsVerticalOffset = menuVerticalOffset;
putEvent(EVT_REFRESH); putEvent(EVT_REFRESH);
} setCurrentModel(MODEL_INDEX());
else {
menuVerticalPosition = modelsVerticalPosition;
menuHorizontalPosition = modelsHorizontalPosition;
menuVerticalOffset = modelsVerticalOffset;
if (navigate(event, index, 3, 2)) {
modelsVerticalPosition = menuVerticalPosition;
modelsHorizontalPosition = menuHorizontalPosition;
modelsVerticalOffset = menuVerticalOffset;
putEvent(EVT_REFRESH);
setCurrentModel(MODEL_INDEX());
}
} }
if (currentModel) { if (currentModel) {
lcd->drawText(CATEGORIES_WIDTH+MENUS_MARGIN_LEFT, MENU_FOOTER_TOP+2, currentModel->name, TEXT_INVERTED_COLOR); lcd->drawText(CATEGORIES_WIDTH+MENUS_MARGIN_LEFT, MENU_FOOTER_TOP+2, currentModel->name, TEXT_INVERTED_COLOR);