From ff69b9df8ab08323ef912c384542ad1ca8f6c79f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 19 Feb 2012 21:17:27 +0100 Subject: [PATCH 1/1] Support odd/even theming for top5/top10. --- bigscreen/top10scorescreen.cpp | 23 +++++++++++++++-------- bigscreen/top5chosenscreen.cpp | 19 +++++++++++++------ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/bigscreen/top10scorescreen.cpp b/bigscreen/top10scorescreen.cpp index a9a52bf..2ac1cb0 100644 --- a/bigscreen/top10scorescreen.cpp +++ b/bigscreen/top10scorescreen.cpp @@ -66,18 +66,25 @@ void Top10ScoreScreen::draw(unsigned char *buf, unsigned width, unsigned height) unsigned row = 1, y = 140; for (std::vector::const_iterator i = scores.begin(); i != scores.end(); ++i) { + std::string suffix; + if (row % 2 == 1) { + suffix = ".odd"; + } else { + suffix = ".even"; + } + char str[16]; - std::string heading_theme_element = "top10scores.rowheading"; - std::string nick_theme_element = "top10scores.nick"; - std::string songname_theme_element = "top10scores.songname"; - std::string frequency_theme_element = "top10scores.frequency"; + std::string heading_theme_element = "top10scores.rowheading" + suffix; + std::string nick_theme_element = "top10scores.nick" + suffix; + std::string songname_theme_element = "top10scores.songname" + suffix; + std::string frequency_theme_element = "top10scores.frequency" + suffix; // print new entries in red if (seen_topscore.count(*i) == 0 && seen_topscore.size() > 0) { - heading_theme_element = "top10scores.freshrowheading"; - nick_theme_element = "top10scores.freshnick"; - songname_theme_element = "top10scores.freshsongname"; - frequency_theme_element = "top10scores.freshfrequency"; + heading_theme_element = "top10scores.freshrowheading" + suffix; + nick_theme_element = "top10scores.freshnick" + suffix; + songname_theme_element = "top10scores.freshsongname" + suffix; + frequency_theme_element = "top10scores.freshfrequency" + suffix; } std::sprintf(str, "%u", row++); diff --git a/bigscreen/top5chosenscreen.cpp b/bigscreen/top5chosenscreen.cpp index 32ca278..ccfbea9 100644 --- a/bigscreen/top5chosenscreen.cpp +++ b/bigscreen/top5chosenscreen.cpp @@ -64,16 +64,23 @@ void Top5ChosenScreen::draw(unsigned char *buf, unsigned width, unsigned height) unsigned row = 1, y = 140; for (std::vector::const_iterator i = scores.begin(); i != scores.end(); ++i) { + std::string suffix; + if (row % 2 == 1) { + suffix = ".odd"; + } else { + suffix = ".even"; + } + char str[16]; - std::string heading_theme_element = "top5chosensongs.rowheading"; - std::string songname_theme_element = "top5chosensongs.songname"; - std::string frequency_theme_element = "top5chosensongs.frequency"; + std::string heading_theme_element = "top5chosensongs.rowheading" + suffix; + std::string songname_theme_element = "top5chosensongs.songname" + suffix; + std::string frequency_theme_element = "top5chosensongs.frequency" + suffix; // print new entries in red if (seen_topchosen.count(*i) == 0 && seen_topchosen.size() > 0) { - heading_theme_element = "top5chosensongs.freshrowheading"; - songname_theme_element = "top5chosensongs.freshsongname"; - frequency_theme_element = "top5chosensongs.freshfrequency"; + heading_theme_element = "top5chosensongs.freshrowheading" + suffix; + songname_theme_element = "top5chosensongs.freshsongname" + suffix; + frequency_theme_element = "top5chosensongs.freshfrequency" + suffix; } std::sprintf(str, "%u", row++); -- 2.39.5