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