Declare escape strings for colored text (#1409)

* Color strings

* Color strings

* Color strings

* Color strings

* Color strings

* Color strings & fix first group scrolling off screen

* Color strings

* Color strings

* Clang

* Clang

* Clang attempt #3

* Update ui_painter.cpp

* Update ui_widget.cpp

* Clang test

* Clang

* Clang test

* Update ui_about_simple.cpp

* Update lge_app.cpp
This commit is contained in:
Mark Thompson 2023-08-25 20:01:37 -05:00 committed by GitHub
parent 9af1308e29
commit cf25d85d51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 49 additions and 36 deletions

View file

@ -159,7 +159,7 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage* message) {
logger.log_raw_data(message->packet, receiver_model.target_frequency());
if (message->packet.flag() != NORMAL) {
console.writeln("\n\x1B\x04" + prefix + " CRC ERROR: " + pocsag::flag_str(message->packet.flag()));
console.writeln("\n" STR_COLOR_DARK_RED + prefix + " CRC ERROR: " + pocsag::flag_str(message->packet.flag()));
last_address = 0;
return;
} else {
@ -168,7 +168,7 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage* message) {
/*
// Too many errors for reliable decode.
if (pocsag_state.errors >= 3) {
console.write("\n\x1B\x0D" + prefix + " Too many decode errors.");
console.write("\n" STR_COLOR_MAGENTA + prefix + " Too many decode errors.");
last_address = 0;
return;
}
@ -176,13 +176,13 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage* message) {
// Ignored address.
if (ignore() && pocsag_state.address == settings_.address_to_ignore) {
console.write("\n\x1B\x03" + prefix + " Ignored: " + to_string_dec_uint(pocsag_state.address));
console.write("\n" STR_COLOR_DARK_CYAN + prefix + " Ignored: " + to_string_dec_uint(pocsag_state.address));
last_address = pocsag_state.address;
return;
}
// Color indicates the message has lots of decoding errors.
std::string color = pocsag_state.errors >= 3 ? "\x1B\x07" : "";
std::string color = pocsag_state.errors >= 3 ? STR_COLOR_MAGENTA : "";
std::string console_info = "\n" + color + prefix;
console_info += " #" + to_string_dec_uint(pocsag_state.address);