layoutName is now layoutId
This commit is contained in:
@@ -550,9 +550,9 @@ typedef uint8_t swarnenable_t;
|
||||
#elif defined(COLORLCD)
|
||||
#include "gui/colorlcd/layout.h"
|
||||
#include "gui/colorlcd/topbar.h"
|
||||
#define LAYOUT_NAME_LEN 10
|
||||
#define LAYOUT_ID_LEN 10
|
||||
PACK(struct CustomScreenData {
|
||||
char layoutName[LAYOUT_NAME_LEN];
|
||||
char LayoutId[LAYOUT_ID_LEN];
|
||||
Layout::PersistentData layoutData;
|
||||
});
|
||||
#define CUSTOM_SCREENS_DATA \
|
||||
|
||||
@@ -75,7 +75,7 @@ void loadDefaultLayout()
|
||||
auto& screenData = g_model.screenData[0];
|
||||
|
||||
if (screen == nullptr && defaultLayout != nullptr) {
|
||||
strcpy(screenData.layoutName, defaultLayout->getId());
|
||||
strcpy(screenData.LayoutId, defaultLayout->getId());
|
||||
screen = defaultLayout->create(&screenData.layoutData);
|
||||
if (screen) {
|
||||
screen->attach(ViewMain::instance());
|
||||
@@ -88,7 +88,7 @@ void loadCustomScreens()
|
||||
for (unsigned int i = 0; i < MAX_CUSTOM_SCREENS; i++) {
|
||||
|
||||
auto& screen = customScreens[i];
|
||||
screen = loadLayout(g_model.screenData[i].layoutName,
|
||||
screen = loadLayout(g_model.screenData[i].LayoutId,
|
||||
&g_model.screenData[i].layoutData);
|
||||
|
||||
if (screen) {
|
||||
|
||||
@@ -69,7 +69,7 @@ void ScreenAddPage::build(FormWindow * window)
|
||||
const LayoutFactory * factory = getRegisteredLayouts().front();
|
||||
|
||||
screen = factory->create(&screenData.layoutData);
|
||||
strncpy(screenData.layoutName, factory->getId(), sizeof(screenData.layoutName));
|
||||
strncpy(screenData.LayoutId, factory->getId(), sizeof(screenData.LayoutId));
|
||||
|
||||
auto tab = new ScreenSetupPage(menu, screen, screenData);
|
||||
std::string title(STR_MAIN_VIEW_X);
|
||||
@@ -301,7 +301,7 @@ void ScreenSetupPage::build(FormWindow * window)
|
||||
layoutChoice = new LayoutChoice(window, layoutSlot, GET_VALUE(screen->getFactory()), [=](const LayoutFactory *factory) {
|
||||
delete screen;
|
||||
screen = factory->create(&screenData.layoutData);
|
||||
strncpy(screenData.layoutName, factory->getId(), sizeof(CustomScreenData::layoutName));
|
||||
strncpy(screenData.LayoutId, factory->getId(), sizeof(CustomScreenData::LayoutId));
|
||||
SET_DIRTY();
|
||||
updateLayoutOptions();
|
||||
});
|
||||
|
||||
@@ -323,7 +323,7 @@ void convertModelData_218_to_219(ModelData &model)
|
||||
|
||||
for (int screen=0; screen<MAX_CUSTOM_SCREENS; screen++) {
|
||||
CustomScreenData& screenData = g_model.screenData[screen];
|
||||
if (screenData.layoutName[0] == '\0')
|
||||
if (screenData.LayoutId[0] == '\0')
|
||||
continue;
|
||||
for (int zone=0; zone<MAX_LAYOUT_ZONES; zone++) {
|
||||
Layout::ZonePersistentData * zoneData = &screenData.layoutData.zones[zone];
|
||||
|
||||
@@ -397,7 +397,7 @@ PACK(struct TelemetrySensor_218 {
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
PACK(struct CustomScreenData_v218 {
|
||||
char layoutName[10];
|
||||
char LayoutId[10];
|
||||
Layout::PersistentData layoutData;
|
||||
});
|
||||
#define VIEW_DATA \
|
||||
|
||||
@@ -697,7 +697,7 @@ static const struct YamlNode struct_Layout__PersistentData[] = {
|
||||
};
|
||||
static const struct YamlNode struct_CustomScreenData[] = {
|
||||
YAML_IDX,
|
||||
YAML_STRING("layoutName", 10),
|
||||
YAML_STRING("LayoutId", 10),
|
||||
YAML_STRUCT("layoutData", 6720, struct_Layout__PersistentData, NULL),
|
||||
YAML_END
|
||||
};
|
||||
|
||||
@@ -698,7 +698,7 @@ static const struct YamlNode struct_Layout__PersistentData[] = {
|
||||
};
|
||||
static const struct YamlNode struct_CustomScreenData[] = {
|
||||
YAML_IDX,
|
||||
YAML_STRING("layoutName", 10),
|
||||
YAML_STRING("LayoutId", 10),
|
||||
YAML_STRUCT("layoutData", 6720, struct_Layout__PersistentData, NULL),
|
||||
YAML_END
|
||||
};
|
||||
|
||||
@@ -291,7 +291,7 @@ TEST(Conversions, ConversionX10From22)
|
||||
EXPECT_EQ(9, g_model.telemetrySensors[0].frskyInstance.physID);
|
||||
EXPECT_EQ((NUM_POTS + NUM_SLIDERS + 3), g_model.thrTraceSrc); // CH3
|
||||
|
||||
EXPECT_STREQ("Layout2P1", g_model.screenData[0].layoutName);
|
||||
EXPECT_STREQ("Layout2P1", g_model.screenData[0].LayoutId);
|
||||
EXPECT_STREQ("ModelBmp", g_model.screenData[0].layoutData.zones[0].widgetName);
|
||||
EXPECT_STREQ("Value", g_model.topbarData.zones[0].widgetName);
|
||||
EXPECT_EQ(MIXSRC_FIRST_TELEM, g_model.topbarData.zones[0].widgetData.options[0].value.unsignedValue);
|
||||
@@ -358,7 +358,7 @@ TEST(Conversions, ConversionX12SFrom22)
|
||||
EXPECT_EQ(9, g_model.telemetrySensors[0].frskyInstance.physID);
|
||||
EXPECT_EQ((NUM_POTS + NUM_SLIDERS + 3), g_model.thrTraceSrc); // CH3
|
||||
|
||||
EXPECT_STREQ("Layout2P1", g_model.screenData[0].layoutName);
|
||||
EXPECT_STREQ("Layout2P1", g_model.screenData[0].LayoutId);
|
||||
EXPECT_STREQ("ModelBmp", g_model.screenData[0].layoutData.zones[0].widgetName);
|
||||
EXPECT_STREQ("Value", g_model.topbarData.zones[0].widgetName);
|
||||
EXPECT_EQ(MIXSRC_FIRST_TELEM, g_model.topbarData.zones[0].widgetData.options[0].unsignedValue);
|
||||
|
||||
Reference in New Issue
Block a user