fix(color): top bar widgets may not be shown (#7174)
This commit is contained in:
@@ -1575,7 +1575,7 @@ void edgeTxInit()
|
||||
#endif // defined(GUI)
|
||||
|
||||
#if defined(COLORLCD)
|
||||
LayoutFactory::deleteCustomScreens(true);
|
||||
LayoutFactory::deleteCustomScreens();
|
||||
LayoutFactory::loadCustomScreens();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ WidgetsContainer* LayoutFactory::loadLayout(
|
||||
//
|
||||
// Detaches and deletes all custom screens
|
||||
//
|
||||
void LayoutFactory::deleteCustomScreens(bool clearTopBar)
|
||||
void LayoutFactory::deleteCustomScreens()
|
||||
{
|
||||
for (auto& screen : customScreens) {
|
||||
if (screen) {
|
||||
@@ -115,9 +115,12 @@ void LayoutFactory::deleteCustomScreens(bool clearTopBar)
|
||||
screen = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clearTopBar)
|
||||
ViewMain::instance()->getTopbar()->removeAllWidgets();
|
||||
// Clear top bar
|
||||
void LayoutFactory::deleteTopBarWidgets()
|
||||
{
|
||||
ViewMain::instance()->getTopbar()->removeAllWidgets();
|
||||
}
|
||||
|
||||
void LayoutFactory::loadDefaultLayout()
|
||||
|
||||
@@ -176,7 +176,9 @@ class LayoutFactory
|
||||
void initPersistentData(int screenNum, bool setDefault) const;
|
||||
|
||||
// delete all custom screens from memory
|
||||
static void deleteCustomScreens(bool clearTopBar = false);
|
||||
static void deleteCustomScreens();
|
||||
// delete all top bar widgets from memory
|
||||
static void deleteTopBarWidgets();
|
||||
|
||||
// intended for existing models
|
||||
static void loadCustomScreens();
|
||||
|
||||
@@ -626,7 +626,8 @@ void ModelLabelsWindow::newModel()
|
||||
snprintf(path, LEN_BUFFER, "%s/%s", TEMPLATES_PATH, folder.c_str());
|
||||
|
||||
// Read model template
|
||||
LayoutFactory::deleteCustomScreens(true);
|
||||
LayoutFactory::deleteCustomScreens();
|
||||
LayoutFactory::deleteTopBarWidgets();
|
||||
loadModel((name + YAML_EXT).c_str(), false, path);
|
||||
storageFlushCurrentModel();
|
||||
storageCheck(true);
|
||||
|
||||
@@ -149,7 +149,8 @@ void applyDefaultTemplate()
|
||||
|
||||
#if defined(COLORLCD)
|
||||
g_model.resetScreenData();
|
||||
LayoutFactory::deleteCustomScreens(true);
|
||||
LayoutFactory::deleteCustomScreens();
|
||||
LayoutFactory::deleteTopBarWidgets();
|
||||
LayoutFactory::loadDefaultLayout();
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user