chore(colorlcd): Page header unification and other cosmetics (#3326)

* chore: Change Radio setup page headers

* chore: Model Setup page header changes

* Main menu, Model Manager, Model Templates
Including needed translation strings

* Model telemetry sensor edit page
Taking into account sensor value shown in header

* chore: Change "Edit Labels"
Resolves #3014

* fix(b&w): "Rx channel ord" -> "Def chan order"
Resolves #3348

* chore: Update translations

* chore: Change to prefered "Manage Models"

* chore: Cleanup

* chore: Move some colorlcd-only strings
May or may not save some flash memory

* fix: Missed a translation string rename
This commit is contained in:
Peter Feerick
2023-03-23 11:53:27 +10:00
committed by GitHub
parent edd469645f
commit 335c0a3a0a
39 changed files with 188 additions and 97 deletions
+1 -1
View File
@@ -640,7 +640,7 @@ void menuRadioSetup(event_t event)
#endif
case ITEM_RADIO_SETUP_RX_CHANNEL_ORD:
lcdDrawTextAlignedLeft(y, STR_RXCHANNELORD); // RAET->AETR
lcdDrawTextAlignedLeft(y, STR_DEF_CHAN_ORD); // RAET->AETR
for (uint8_t i=1; i<=4; i++) {
putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channelOrder(i), attr);
}
+1 -1
View File
@@ -582,7 +582,7 @@ void menuRadioSetup(event_t event)
break;
case ITEM_RADIO_SETUP_RX_CHANNEL_ORD:
lcdDrawTextAlignedLeft(y, STR_RXCHANNELORD); // RAET->AETR
lcdDrawTextAlignedLeft(y, STR_DEF_CHAN_ORD); // RAET->AETR
for (uint8_t i=1; i<=4; i++) {
putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channelOrder(i), attr);
}
+1 -1
View File
@@ -371,7 +371,7 @@ CurveEditWindow::CurveEditWindow(uint8_t index):
void CurveEditWindow::buildHeader(Window * window)
{
header.setTitle(STR_MENUCURVE);
header.setTitle(STR_MENUCURVES);
char s[16];
strAppendStringWithIndex(s, STR_CV, index + 1);
header.setTitle2(s);
+3 -4
View File
@@ -36,10 +36,9 @@ InputEditWindow::InputEditWindow(int8_t input, uint8_t index) :
input(input),
index(index)
{
std::string title(STR_MENUINPUTS);
title += "\n";
title += getSourceString(MIXSRC_FIRST_INPUT + input);
header.setTitle(title);
std::string title2(getSourceString(MIXSRC_FIRST_INPUT + input));
header.setTitle(STR_MENUINPUTS);
header.setTitle2(title2);
auto body_obj = body.getLvObj();
#if LCD_H > LCD_W // portrait
+3 -4
View File
@@ -33,10 +33,9 @@ static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
InputEditAdvanced::InputEditAdvanced(uint8_t input_n, uint8_t index) :
Page(ICON_MODEL_INPUTS)
{
std::string title(STR_MENUINPUTS);
title += "\n";
title += getSourceString(MIXSRC_FIRST_INPUT + input_n);
header.setTitle(title);
std::string title2(getSourceString(MIXSRC_FIRST_INPUT + input_n));
header.setTitle(STR_MENUINPUTS);
header.setTitle2(title2);
rect_t r = rect_t{0, 0, body.width(), body.height()};
auto form = new FormWindow(&body, r);
+3 -4
View File
@@ -72,10 +72,9 @@ MixEditWindow::MixEditWindow(int8_t channel, uint8_t index) :
void MixEditWindow::buildHeader(Window *window)
{
std::string title(STR_MIXES);
title += "\n";
title += getSourceString(MIXSRC_CH1 + channel);
header.setTitle(title);
std::string title2(getSourceString(MIXSRC_CH1 + channel));
header.setTitle(STR_MIXES);
header.setTitle2(title2);
new MixerEditStatusBar(
window,
+3 -3
View File
@@ -146,9 +146,9 @@ struct FMTrimSettings : public Dialog {
FlightModeEdit::FlightModeEdit(uint8_t index) :
Page(ICON_MODEL_FLIGHT_MODES)
{
std::string title = std::string(TR_MENUFLIGHTMODE)
+ " " + std::to_string(index);
header.setTitle(title);
std::string title2 = std::string(STR_FM) + std::to_string(index);
header.setTitle(STR_MENUFLIGHTMODES);
header.setTitle2(title2);
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
auto form = new FormWindow(&body, rect_t{});
+1 -1
View File
@@ -193,7 +193,7 @@ class GVarEditWindow : public Page
void buildHeader(Window* window)
{
header.setTitle(STR_GLOBAL_VAR);
header.setTitle(STR_MENU_GLOBAL_VARS);
gVarInHeader = header.setTitle2("");
}
+6 -7
View File
@@ -516,7 +516,7 @@ void ModelsPageBody::openMenu()
menu->addLine(STR_SELECT_MODEL, [=]() { selectModel(focusedModel); });
}
menu->addLine(STR_DUPLICATE_MODEL, [=]() { duplicateModel(focusedModel); });
menu->addLine(STR_EDIT_LABELS, [=]() { editLabels(focusedModel); });
menu->addLine(STR_LABEL_MODEL, [=]() { editLabels(focusedModel); });
menu->addLine(STR_SAVE_TEMPLATE, [=]() { saveAsTemplate(focusedModel);});
if (focusedModel != modelslist.getCurrentModel()) {
menu->addLine(STR_DELETE_MODEL, [=]() { deleteModel(focusedModel); });
@@ -982,13 +982,12 @@ void ModelLabelsWindow::setTitle()
auto curModel = modelslist.getCurrentModel();
auto modelName = curModel != nullptr ? curModel->modelName : STR_NONE;
std::string titleName = STR_SELECT_MODEL;
titleName += "\n";
titleName += STR_CURRENT_MODEL;
titleName += ": ";
titleName += modelName;
std::string title2 = STR_ACTIVE;
title2 += ": ";
title2 += modelName;
header.setTitle(titleName);
header.setTitle(STR_MANAGE_MODELS);
header.setTitle2(title2);
}
//-----------------------------------------------------------------------------
+10 -4
View File
@@ -259,9 +259,10 @@ class SensorEditWindow : public Page {
void buildHeader(Window * window)
{
header.setTitle(STR_SENSOR + std::to_string(index + 1));
std::string title2 = STR_SENSOR + std::to_string(index + 1) + " = " + STR_NA;
header.setTitle(STR_MENUTELEMETRY);
headerValue = header.setTitle2("");
headerValue = header.setTitle2(title2);
lv_obj_set_style_text_color(headerValue->getLvObj(), makeLvColor(COLOR_THEME_WARNING), LV_STATE_USER_1);
}
@@ -280,9 +281,14 @@ class SensorEditWindow : public Page {
if (telemetryItem.isAvailable()) {
if (telemetryItem.isOld())
lv_obj_add_state(headerValue->getLvObj(), LV_STATE_USER_1);
headerValue->setText(getSensorCustomValue(index, getValue(MIXSRC_FIRST_TELEM + 3 * index), LEFT));
std::string title2 =
STR_SENSOR + std::to_string(index + 1) + " = " +
getSensorCustomValue(
index, getValue(MIXSRC_FIRST_TELEM + 3 * index), LEFT);
headerValue->setText(title2);
} else {
headerValue->setText("---");
headerValue->setText(STR_SENSOR + std::to_string(index + 1) + " = " +
STR_NA);
}
}
}
+4 -2
View File
@@ -96,7 +96,8 @@ class SelectTemplate : public TemplatePage
public:
SelectTemplate(SelectTemplateFolder* tp, std::string folder) : templateFolderPage(tp)
{
header.setTitle(STR_SELECT_TEMPLATE);
header.setTitle(STR_MANAGE_MODELS);
header.setTitle2(STR_NEW_MODEL);
char path[LEN_PATH + 1];
snprintf(path, LEN_PATH, "%s/%s", TEMPLATES_PATH, folder.c_str());
@@ -170,7 +171,8 @@ SelectTemplateFolder::SelectTemplateFolder(std::function<void(std::string folder
{
this->update = update;
header.setTitle(STR_SELECT_TEMPLATE_FOLDER);
header.setTitle(STR_MANAGE_MODELS);
header.setTitle2(STR_NEW_MODEL);
auto tfb = new TextButton(listWindow,
rect_t{0, 0, lv_pct(100), PAGE_LINE_HEIGHT * 2},
+3 -2
View File
@@ -732,9 +732,10 @@ static void update_module_window(lv_event_t* e)
ModulePage::ModulePage(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
{
const char* title = moduleIdx == INTERNAL_MODULE ?
const char* title2 = moduleIdx == INTERNAL_MODULE ?
STR_INTERNALRF : STR_EXTERNALRF;
header.setTitle(title);
header.setTitle(STR_MENU_MODEL_SETUP);
header.setTitle2(title2);
auto form = new FormGroup(&body, rect_t{});
form->setFlexLayout();
+3 -3
View File
@@ -62,9 +62,9 @@ class OutputEditStatusBar : public Window
OutputEditWindow::OutputEditWindow(uint8_t channel) :
Page(ICON_MODEL_OUTPUTS), channel(channel)
{
std::string title(STR_MENULIMITS);
title += "\n";
title += getSourceString(MIXSRC_CH1 + channel);
std::string title2(getSourceString(MIXSRC_CH1 + channel));
header.setTitle(STR_MENULIMITS);
header.setTitle2(title2);
auto form = new FormWindow(&body, rect_t{});
auto form_obj = form->getLvObj();
+2 -1
View File
@@ -102,7 +102,8 @@ private:
PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
{
header.setTitle(STR_PREFLIGHT);
header.setTitle(STR_MENU_MODEL_SETUP);
header.setTitle2(STR_PREFLIGHT);
body.padAll(8);
+2 -1
View File
@@ -125,7 +125,8 @@ class RadioKeyDiagsWindow : public Window
void RadioKeyDiagsPage::buildHeader(Window * window)
{
header.setTitle(STR_MENU_RADIO_SWITCHES);
header.setTitle(STR_RADIO_SETUP);
header.setTitle2(STR_MENU_RADIO_SWITCHES);
}
void RadioKeyDiagsPage::buildBody(Window * window)
+23 -5
View File
@@ -215,7 +215,7 @@ class WindowButtonGroup : public FormGroup
typedef std::function<void()> PageFct;
typedef std::pair<const char*, PageFct> PageDef;
typedef std::list<PageDef> PageDefs;
WindowButtonGroup(
Window* parent, const rect_t& rect, PageDefs pages) :
FormGroup(parent, rect),
@@ -254,6 +254,9 @@ class SoundPage : public SubPage {
public:
SoundPage() : SubPage(ICON_RADIO_SETUP, STR_SOUND_LABEL)
{
header.setTitle(STR_RADIO_SETUP);
header.setTitle2(STR_SOUND_LABEL);
FlexGridLayout grid(col_two_dsc, row_dsc, 3);
auto line = body.newLine(&grid);
@@ -308,6 +311,9 @@ class VarioPage : public SubPage {
public:
VarioPage() : SubPage(ICON_RADIO_SETUP, STR_VARIO)
{
header.setTitle(STR_RADIO_SETUP);
header.setTitle2(STR_VARIO);
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
auto line = body.newLine(&grid);
@@ -349,6 +355,9 @@ class HapticPage : public SubPage {
public:
HapticPage() : SubPage(ICON_RADIO_SETUP, STR_HAPTIC_LABEL)
{
header.setTitle(STR_RADIO_SETUP);
header.setTitle2(STR_HAPTIC_LABEL);
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
auto line = body.newLine(&grid);
@@ -375,6 +384,9 @@ class AlarmsPage : public SubPage {
public:
AlarmsPage() : SubPage(ICON_RADIO_SETUP, STR_ALARMS_LABEL)
{
header.setTitle(STR_RADIO_SETUP);
header.setTitle2(STR_ALARMS_LABEL);
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
auto line = body.newLine(&grid);
@@ -433,6 +445,9 @@ class BacklightPage : public SubPage {
public:
BacklightPage() : SubPage(ICON_RADIO_SETUP, STR_BACKLIGHT_LABEL)
{
header.setTitle(STR_RADIO_SETUP);
header.setTitle2(STR_BACKLIGHT_LABEL);
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
auto line = body.newLine(&grid);
@@ -547,6 +562,9 @@ class GpsPage : public SubPage {
public:
GpsPage() : SubPage(ICON_RADIO_SETUP, STR_GPS)
{
header.setTitle(STR_RADIO_SETUP);
header.setTitle2(STR_GPS);
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
auto line = body.newLine(&grid);
@@ -589,7 +607,7 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(HAPTIC)
{STR_HAPTIC_LABEL, []() { new HapticPage(); }},
#endif
{STR_ALARM, []() { new AlarmsPage(); }},
{STR_ALARMS_LABEL, []() { new AlarmsPage(); }},
{STR_BACKLIGHT_LABEL, []() { new BacklightPage(); }},
{STR_GPS, [](){new GpsPage();}},
});
@@ -610,7 +628,7 @@ void RadioSetupPage::build(FormWindow * window)
});
}
#endif
#if defined(PXX2)
// Owner ID
{
@@ -682,9 +700,9 @@ void RadioSetupPage::build(FormWindow * window)
GET_SET_DEFAULT(g_eeGeneral.rotEncMode));
#endif
// RX channel order
// Default channel order
line = window->newLine(&grid);
new StaticText(line, rect_t{}, STR_RXCHANNELORD, 0,
new StaticText(line, rect_t{}, STR_DEF_CHAN_ORD, 0,
COLOR_THEME_PRIMARY1); // RAET->AETR
choice = new Choice(line, rect_t{}, 0, 4 * 3 * 2 - 1,
GET_SET_DEFAULT(g_eeGeneral.templateSetup));
@@ -221,7 +221,8 @@ RadioSpectrumAnalyser::RadioSpectrumAnalyser(uint8_t moduleIdx) :
void RadioSpectrumAnalyser::buildHeader(Window * window)
{
header.setTitle(STR_MENU_SPECTRUM_ANALYSER);
header.setTitle(STR_MENUTOOLS);
header.setTitle2(STR_MENU_SPECTRUM_ANALYSER);
}
void RadioSpectrumAnalyser::buildBody(FormWindow * window)
+2 -1
View File
@@ -55,7 +55,8 @@ static void setThrottleTrimSource(int16_t src)
ThrottleParams::ThrottleParams() : Page(ICON_MODEL_SETUP)
{
header.setTitle(STR_THROTTLE_LABEL);
header.setTitle(STR_MENU_MODEL_SETUP);
header.setTitle2(STR_THROTTLE_LABEL);
body.setFlexLayout();
body.padAll(8);
+3 -2
View File
@@ -56,8 +56,9 @@ static void timer_start_changed(lv_event_t* e)
TimerWindow::TimerWindow(uint8_t timer) : Page(ICON_STATS_TIMERS)
{
std::string title = std::string(STR_TIMER) + std::to_string(timer + 1);
header.setTitle(title);
std::string title2 = std::string(STR_TIMER) + std::to_string(timer + 1);
header.setTitle(STR_MENU_MODEL_SETUP);
header.setTitle2(title2);
auto form = new FormGroup(&body, rect_t{});
form->setFlexLayout();
+2 -1
View File
@@ -140,7 +140,8 @@ void TrainerModuleWindow::update()
TrainerPage::TrainerPage() : Page(ICON_MODEL_SETUP)
{
header.setTitle(STR_TRAINER);
header.setTitle(STR_MENU_MODEL_SETUP);
header.setTitle2(STR_TRAINER);
auto form = new FormGroup(&body, rect_t{});
form->setFlexLayout();
+2 -1
View File
@@ -38,7 +38,8 @@ static void resetTrims()
TrimsSetup::TrimsSetup() : Page(ICON_MODEL_SETUP)
{
header.setTitle(STR_TRIMS);
header.setTitle(STR_MENU_MODEL_SETUP);
header.setTitle2(STR_TRIMS);
body.setFlexLayout();
body.padAll(8);
+1 -1
View File
@@ -46,7 +46,7 @@ ViewMainMenu::ViewMainMenu(Window* parent, std::function<void()> closeHandler) :
setHeight(parent->height());
auto carousel = new SelectFabCarousel(this);
carousel->addButton(ICON_MODEL_SELECT, STR_MAIN_MENU_SELECT_MODEL, [=]() -> uint8_t {
carousel->addButton(ICON_MODEL_SELECT,STR_MAIN_MENU_MANAGE_MODELS, [=]() -> uint8_t {
deleteLater();
new ModelLabelsWindow();
return 0;