Skip to content

Commit 8efc179

Browse files
committed
toast messages refactoring
1 parent 0186893 commit 8efc179

19 files changed

+21094
-21287
lines changed

modular-psu-firmware.eez-project

+20-204
Original file line numberDiff line numberDiff line change
@@ -9480,167 +9480,6 @@
94809480
"width": 480,
94819481
"height": 240
94829482
},
9483-
{
9484-
"name": "toast3_alert",
9485-
"description": "Info message",
9486-
"style": "toast_alert",
9487-
"widgets": [
9488-
{
9489-
"type": "Text",
9490-
"style": {
9491-
"inheritFrom": "toast_alert",
9492-
"padding": 0
9493-
},
9494-
"activeStyle": {
9495-
"padding": 0
9496-
},
9497-
"data": "alert_message",
9498-
"left": 0,
9499-
"top": 8,
9500-
"width": 280,
9501-
"height": 28,
9502-
"text": ""
9503-
},
9504-
{
9505-
"type": "Text",
9506-
"style": {
9507-
"inheritFrom": "toast_alert",
9508-
"padding": 0
9509-
},
9510-
"activeStyle": {
9511-
"padding": 0
9512-
},
9513-
"data": "alert_message_2",
9514-
"left": 0,
9515-
"top": 36,
9516-
"width": 280,
9517-
"height": 28,
9518-
"text": ""
9519-
},
9520-
{
9521-
"type": "Text",
9522-
"style": {
9523-
"inheritFrom": "toast_alert",
9524-
"padding": 0
9525-
},
9526-
"activeStyle": {
9527-
"padding": 0
9528-
},
9529-
"data": "alert_message_3",
9530-
"left": 0,
9531-
"top": 64,
9532-
"width": 280,
9533-
"height": 28,
9534-
"text": ""
9535-
}
9536-
],
9537-
"left": 20,
9538-
"top": 64,
9539-
"width": 280,
9540-
"height": 100
9541-
},
9542-
{
9543-
"name": "error_alert",
9544-
"description": "Error message, single line",
9545-
"style": "error_alert",
9546-
"widgets": [
9547-
{
9548-
"type": "Text",
9549-
"style": {
9550-
"inheritFrom": "error_alert",
9551-
"padding": 0
9552-
},
9553-
"activeStyle": {
9554-
"padding": 0
9555-
},
9556-
"data": "alert_message",
9557-
"left": 0,
9558-
"top": 8,
9559-
"width": 280,
9560-
"height": 32,
9561-
"text": ""
9562-
},
9563-
{
9564-
"type": "Text",
9565-
"style": {
9566-
"inheritFrom": "error_alert_button",
9567-
"padding": 0
9568-
},
9569-
"activeStyle": {
9570-
"padding": 0
9571-
},
9572-
"action": "ok",
9573-
"left": 110,
9574-
"top": 48,
9575-
"width": 60,
9576-
"height": 32,
9577-
"text": "OK"
9578-
}
9579-
],
9580-
"left": 20,
9581-
"top": 76,
9582-
"width": 280,
9583-
"height": 88
9584-
},
9585-
{
9586-
"name": "error_long_alert",
9587-
"description": "Error message, two line",
9588-
"style": "error_alert",
9589-
"widgets": [
9590-
{
9591-
"type": "Text",
9592-
"style": {
9593-
"inheritFrom": "error_alert",
9594-
"padding": 0
9595-
},
9596-
"activeStyle": {
9597-
"padding": 0
9598-
},
9599-
"data": "alert_message",
9600-
"left": 0,
9601-
"top": 8,
9602-
"width": 280,
9603-
"height": 28,
9604-
"text": ""
9605-
},
9606-
{
9607-
"type": "Text",
9608-
"style": {
9609-
"inheritFrom": "error_alert",
9610-
"padding": 0
9611-
},
9612-
"activeStyle": {
9613-
"padding": 0
9614-
},
9615-
"data": "alert_message_2",
9616-
"left": 0,
9617-
"top": 36,
9618-
"width": 280,
9619-
"height": 28,
9620-
"text": ""
9621-
},
9622-
{
9623-
"type": "Text",
9624-
"style": {
9625-
"inheritFrom": "error_alert_button",
9626-
"padding": 0
9627-
},
9628-
"activeStyle": {
9629-
"padding": 0
9630-
},
9631-
"action": "ok",
9632-
"left": 110,
9633-
"top": 72,
9634-
"width": 60,
9635-
"height": 32,
9636-
"text": "OK"
9637-
}
9638-
],
9639-
"left": 20,
9640-
"top": 64,
9641-
"width": 280,
9642-
"height": 112
9643-
},
96449483
{
96459484
"name": "error_alert_with_action",
96469485
"description": "Error message, two line with action",
@@ -9701,33 +9540,6 @@
97019540
"width": 280,
97029541
"height": 112
97039542
},
9704-
{
9705-
"name": "error_toast_alert",
9706-
"description": "Error message",
9707-
"style": "error_alert",
9708-
"widgets": [
9709-
{
9710-
"type": "Text",
9711-
"style": {
9712-
"inheritFrom": "error_alert",
9713-
"padding": 0
9714-
},
9715-
"activeStyle": {
9716-
"padding": 0
9717-
},
9718-
"data": "alert_message",
9719-
"left": 0,
9720-
"top": 8,
9721-
"width": 280,
9722-
"height": 32,
9723-
"text": ""
9724-
}
9725-
],
9726-
"left": 20,
9727-
"top": 76,
9728-
"width": 280,
9729-
"height": 48
9730-
},
97319543
{
97329544
"name": "yes_no",
97339545
"description": "Confirmation message",
@@ -25658,8 +25470,8 @@
2565825470
"activeStyle": {
2565925471
"padding": 0
2566025472
},
25661-
"left": 8,
25662-
"top": 8,
25473+
"left": "88",
25474+
"top": 25,
2566325475
"width": 304,
2566425476
"height": 141,
2566525477
"text": "Use a stylus or something similar to touch as close to the center of the highlighted crosshair as possible. Keep holding as still as possible until the highlight is removed. Repeat for all crosshairs in sequence."
@@ -25673,8 +25485,8 @@
2567325485
"activeStyle": {
2567425486
"padding": 0
2567525487
},
25676-
"left": 8,
25677-
"top": 149,
25488+
"left": "88",
25489+
"top": 166,
2567825490
"width": 35,
2567925491
"height": 26,
2568025492
"text": "\\u0081"
@@ -25688,8 +25500,8 @@
2568825500
"activeStyle": {
2568925501
"padding": 0
2569025502
},
25691-
"left": 43,
25692-
"top": 149,
25503+
"left": "123",
25504+
"top": 166,
2569325505
"width": 269,
2569425506
"height": 51,
2569525507
"text": "Do not use your finger as a stylus or the result will be imprecise."
@@ -25705,7 +25517,7 @@
2570525517
},
2570625518
"action": "enter_touch_calibration",
2570725519
"left": 0,
25708-
"top": 204,
25520+
"top": 236,
2570925521
"width": 64,
2571025522
"height": 36,
2571125523
"text": "Start"
@@ -25720,8 +25532,8 @@
2572025532
"padding": 0
2572125533
},
2572225534
"left": 64,
25723-
"top": 204,
25724-
"width": 160,
25535+
"top": 236,
25536+
"width": 320,
2572525537
"height": 36
2572625538
},
2572725539
{
@@ -25734,8 +25546,8 @@
2573425546
"padding": 0
2573525547
},
2573625548
"action": "show_main_page",
25737-
"left": 272,
25738-
"top": 204,
25549+
"left": 432,
25550+
"top": 236,
2573925551
"width": 48,
2574025552
"height": 36,
2574125553
"text": "X"
@@ -25750,8 +25562,8 @@
2575025562
"padding": 0
2575125563
},
2575225564
"action": "show_previous_page",
25753-
"left": 224,
25754-
"top": 204,
25565+
"left": 384,
25566+
"top": 236,
2575525567
"width": 48,
2575625568
"height": 36,
2575725569
"text": "B"
@@ -25760,7 +25572,7 @@
2576025572
"left": 0,
2576125573
"top": 0,
2576225574
"width": 480,
25763-
"height": 240
25575+
"height": "272"
2576425576
},
2576525577
{
2576625578
"name": "sys_settings_display",
@@ -36978,7 +36790,9 @@
3697836790
"name": "error_alert",
3697936791
"inheritFrom": "default_S",
3698036792
"backgroundColor": "#f78000",
36981-
"padding": 0
36793+
"padding": "20",
36794+
"margin": "20",
36795+
"alwaysBuild": true
3698236796
},
3698336797
{
3698436798
"name": "error_alert_button",
@@ -37366,7 +37180,9 @@
3736637180
"name": "toast_alert",
3736737181
"inheritFrom": "default_S",
3736837182
"backgroundColor": "#808080",
37369-
"padding": 0
37183+
"padding": "20",
37184+
"margin": "20",
37185+
"alwaysBuild": true
3737037186
},
3737137187
{
3737237188
"name": "yt_graph_U_defualt",

src/eez/apps/home/touch_calibration.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ void selectTouchCalibrationPoint() {
105105
if (success) {
106106
yesNoDialog(g_yesNoPageId, "Save changes?", dialogYes, dialogNo, dialogCancel);
107107
} else {
108-
toastMessageP("Received data is invalid due to", "imprecise pointing or",
109-
"communication problem!", startCalibration);
108+
toastMessage("Received data is invalid due to", "imprecise pointing or", "communication problem!", startCalibration);
110109
}
111110
}
112111
}

src/eez/apps/psu/gui/calibration.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void onSetOk(float value) {
175175
popPage();
176176
nextStep();
177177
} else {
178-
errorMessageP("Value out of range!");
178+
errorMessage("Value out of range!");
179179
}
180180
}
181181

@@ -279,7 +279,7 @@ void save() {
279279
calibration::stop();
280280
infoMessage("Calibration data saved!", popPage);
281281
} else {
282-
errorMessageP("Save failed!");
282+
errorMessage("Save failed!");
283283
}
284284
}
285285

src/eez/apps/psu/gui/numeric_keypad.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ void NumericKeypad::ok() {
525525
m_state = START;
526526
m_keypadText[0] = 0;
527527
} else {
528-
errorMessageP("Invalid IP address format!");
528+
errorMessage("Invalid IP address format!");
529529
}
530530

531531
return;

src/eez/apps/psu/gui/page_ch_settings_trigger.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void ChSettingsListsPage::doValueSet(float value) {
280280
if (eez::greater(value * m_currentList[i],
281281
channel_dispatcher::getPowerMaxLimit(*g_channel),
282282
getPrecision(UNIT_WATT))) {
283-
errorMessageP("Power limit exceeded");
283+
errorMessage("Power limit exceeded");
284284
return;
285285
}
286286
}
@@ -297,7 +297,7 @@ void ChSettingsListsPage::doValueSet(float value) {
297297
if (eez::greater(value * m_voltageList[i],
298298
channel_dispatcher::getPowerMaxLimit(*g_channel),
299299
getPrecision(UNIT_WATT))) {
300-
errorMessageP("Power limit exceeded");
300+
errorMessage("Power limit exceeded");
301301
return;
302302
}
303303
}
@@ -312,7 +312,7 @@ void ChSettingsListsPage::doValueSet(float value) {
312312

313313
if (eez::greater(power, channel_dispatcher::getPowerMaxLimit(*g_channel),
314314
getPrecision(UNIT_WATT))) {
315-
errorMessageP("Power limit exceeded");
315+
errorMessage("Power limit exceeded");
316316
return;
317317
}
318318
}
@@ -498,7 +498,7 @@ void ChSettingsListsPage::set() {
498498

499499
infoMessage("Lists changed!", popPage);
500500
} else {
501-
errorMessageP("List lengths are not equivalent!");
501+
errorMessage("List lengths are not equivalent!");
502502
}
503503
}
504504
}

0 commit comments

Comments
 (0)