From ac265b24085a908811a74debad526a10082ad496 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 2 Jan 2024 22:55:38 +0100 Subject: [PATCH] lcd4l: replace "\n" with string EOL Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/b212d93b10f53eb58e049a2d81c07da3b3b717f1 Author: vanhofen Date: 2024-01-02 (Tue, 02 Jan 2024) Origin message was: ------------------ - lcd4l: replace "\n" with string EOL Conflicts: src/driver/lcd4l.cpp The change seems to be an improvement in code quality, although it might not be strictly necessary in this specific case, but from time to time, providing justifications in the commit messages would also be a good idea, to be precise. That would be a nice thing to do. --- src/driver/lcd4l.cpp | 51 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/src/driver/lcd4l.cpp b/src/driver/lcd4l.cpp index cc022afe8..26b2a9a5d 100644 --- a/src/driver/lcd4l.cpp +++ b/src/driver/lcd4l.cpp @@ -401,8 +401,10 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) { SNeutrinoTheme &t = g_settings.theme; + std::string EOL = "\n"; + std::string font = g_settings.font_file; - font += "\n" + g_settings.font_file_monospace; + font += EOL + g_settings.font_file_monospace; if (m_font.compare(font)) { @@ -511,7 +513,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) y_res = 1080; std::string Resolution = to_string(x_res) + "x" + to_string(y_res); - //Resolution += "\n" + to_string(framerate); //TODO + //Resolution += EOL + to_string(framerate); //TODO if (m_Resolution.compare(Resolution)) { @@ -662,7 +664,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) int RecordCount = CRecordManager::getInstance()->GetRecordCount(); std::string _ModeRec = (ModeRec ? "on" : "off"); - _ModeRec += "\n" + to_string(RecordCount); + _ModeRec += EOL + to_string(RecordCount); if ((m_ModeRec != ModeRec) || (m_RecordCount != RecordCount)) { @@ -961,7 +963,36 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) } else Layout += "normal"; +#if 0 + { + switch (g_settings.lcd4l_skin) + { + case 100: + DisplayMode = "user"; + break; + case 4: + DisplayMode = "xcam"; + break; + case 3: + DisplayMode = "d-box2"; + break; + case 2: + DisplayMode = "small"; + break; + case 1: + DisplayMode = "large"; + break; + case 0: + default: + DisplayMode = "standard"; + } + } + std::string Layout = DisplayType + "_" + DisplayMode; + Layout += EOL + DisplayDriver; + Layout += EOL + DisplayRes; + Layout += EOL + DisplayMode; +#endif if (m_Layout.compare(Layout)) { if (!ModeStandby) @@ -1007,7 +1038,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) else { Event = g_InfoViewer->get_livestreamInfo1(); - Event += "\n" + g_InfoViewer->get_livestreamInfo2(); + Event += EOL + g_InfoViewer->get_livestreamInfo2(); } } @@ -1059,7 +1090,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) if (CurrentNext.flags & CSectionsdClient::epgflags::has_next) { - Event += "\n" + CurrentNext.next_name; + Event += EOL + CurrentNext.next_name; time_t next_start_time = CurrentNext.next_zeit.startzeit; tm_struct = localtime(&next_start_time); snprintf(End, sizeof(End), "%02d:%02d", tm_struct->tm_hour, tm_struct->tm_min); @@ -1168,7 +1199,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) #endif /* ----------------------------------------------------------------- */ - Event += "\n"; // make sure we have at least two lines in event-file + Event += EOL; // make sure we have at least two lines in event-file if (m_Event.compare(Event)) { @@ -1232,7 +1263,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) std::string wtimestamp = to_string((int)CWeather::getInstance()->getCurrentTimestamp()); for (int i = 0; i < forecast; i++) // 0 is current day { - wtimestamp += "\n" + to_string(CWeather::getInstance()->getForecastWeekday(i)); + wtimestamp += EOL + to_string(CWeather::getInstance()->getForecastWeekday(i)); } if (m_wtimestamp.compare(wtimestamp)) { @@ -1243,7 +1274,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) std::string wtemp = CWeather::getInstance()->getCurrentTemperature(); for (int i = 0; i < forecast; i++) // 0 is current day { - wtemp += "\n" + CWeather::getInstance()->getForecastTemperatureMin(i); + wtemp += EOL + CWeather::getInstance()->getForecastTemperatureMin(i); wtemp += "|" + CWeather::getInstance()->getForecastTemperatureMax(i); } if (m_wtemp.compare(wtemp)) @@ -1257,7 +1288,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) wwind += "|" + CWeather::getInstance()->getCurrentWindDirection(); for (int i = 0; i < forecast; i++) // 0 is current day { - wwind += "\n" + CWeather::getInstance()->getForecastWindSpeed(i); + wwind += EOL + CWeather::getInstance()->getForecastWindSpeed(i); wwind += "|" + CWeather::getInstance()->getForecastWindBearing(i); wwind += "|" + CWeather::getInstance()->getForecastWindDirection(i); } @@ -1269,7 +1300,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) std::string wicon = CWeather::getInstance()->getCurrentIcon(); for (int i = 0; i < forecast; i++) - wicon += "\n" + CWeather::getInstance()->getForecastIcon(i); + wicon += EOL + CWeather::getInstance()->getForecastIcon(i); if (m_wicon.compare(wicon)) { WriteFile(WEATHER_ICON, wicon);