]> git.sesse.net Git - ccbs/commitdiff
Use short titles in the bigscreen headings.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 19 Feb 2005 20:04:56 +0000 (20:04 +0000)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 19 Feb 2005 20:04:56 +0000 (20:04 +0000)
bigscreen/fetch_group.cpp
bigscreen/group.h
bigscreen/groupscreen.cpp

index 6411525ba4f5f49eb9665a5ddd2b4d0ba1c3ac05..bdaa0c9a9b309e469e24fde3db634eb51d983030 100644 (file)
@@ -5,7 +5,8 @@ FetchGroup::FetchGroup(unsigned tournament, unsigned round, unsigned parallel, G
        
 void FetchGroup::operator() (pqxx::transaction<> &t)
 {
        
 void FetchGroup::operator() (pqxx::transaction<> &t)
 {
-       pqxx::result res( t.exec("SELECT round,parallel,position,playmode,difficulty,songnumber,player,nick,song,title,artist,chosen,score FROM roundparticipation NATURAL JOIN players NATURAL JOIN scores NATURAL LEFT JOIN songs WHERE " 
+       // note: this _will_ break if any song has more than one short title!
+       pqxx::result res( t.exec("SELECT round,parallel,position,playmode,difficulty,songnumber,player,nick,song,title,COALESCE(shorttitle,title) AS shorttitle,artist,chosen,score FROM roundparticipation NATURAL JOIN players NATURAL JOIN scores NATURAL LEFT JOIN songs NATURAL LEFT JOIN songshorttitles WHERE " 
                "tournament=" + pqxx::to_string(tournament) + " AND " +
                "round=" + pqxx::to_string(round) + " AND " +
                "parallel=" + pqxx::to_string(parallel) + " " +
                "tournament=" + pqxx::to_string(tournament) + " AND " +
                "round=" + pqxx::to_string(round) + " AND " +
                "parallel=" + pqxx::to_string(parallel) + " " +
@@ -41,6 +42,7 @@ void FetchGroup::operator() (pqxx::transaction<> &t)
                        so.id = i["song"].as(so.id);
                        so.title = i["title"].as(so.title);
                        so.artist = i["artist"].as(so.artist);
                        so.id = i["song"].as(so.id);
                        so.title = i["title"].as(so.title);
                        so.artist = i["artist"].as(so.artist);
+                       so.short_title = i["shorttitle"].as(so.short_title);
                }
        
                sc.song = so;
                }
        
                sc.song = so;
index c57f7b3aba6a2b368d0495bcf4469c921c216c0b..3aa0efce2d08e2b97ec9b36e90cf212a475edb35 100644 (file)
@@ -7,7 +7,7 @@
 /* This more or less mimics the structures from show-tournament.pl */
 struct Song {
        int id;
 /* This more or less mimics the structures from show-tournament.pl */
 struct Song {
        int id;
-       widestring title, artist;
+       widestring title, short_title, artist;
 };
 struct Score {
        Song song;
 };
 struct Score {
        Song song;
index 09c4389d17166848e3bb1c378aac900ceb5807f0..ff8cbace21439de9f30bf83844f0c2c7e023d3f8 100644 (file)
@@ -44,7 +44,7 @@ void GroupScreen::draw(unsigned char *buf)
                                width[col] = std::max(width[col], my_draw_text(j->song.title, NULL, 12.0) + 
                                                                  max_num_width + 10);
                        } else {                
                                width[col] = std::max(width[col], my_draw_text(j->song.title, NULL, 12.0) + 
                                                                  max_num_width + 10);
                        } else {                
-                               width[col] = std::max(width[col], my_draw_text(j->song.title, NULL, 12.0));
+                               width[col] = std::max(width[col], my_draw_text(j->song.short_title, NULL, 12.0));
                                width[col] = std::max(width[col], max_num_width);
                        }
                }
                                width[col] = std::max(width[col], max_num_width);
                        }
                }
@@ -54,8 +54,8 @@ void GroupScreen::draw(unsigned char *buf)
        unsigned col = 1, x = 40 + width[0];
        for (std::vector<Score>::const_iterator i = group.players[0].scores.begin(); i != group.players[0].scores.end(); ++i, ++col) {
                if (!i->chosen) {
        unsigned col = 1, x = 40 + width[0];
        for (std::vector<Score>::const_iterator i = group.players[0].scores.begin(); i != group.players[0].scores.end(); ++i, ++col) {
                if (!i->chosen) {
-                       unsigned this_width = my_draw_text(i->song.title, NULL, 12.0);
-                       my_draw_text(i->song.title, buf, 12.0, x + width[col] / 2 - this_width / 2, 30);
+                       unsigned this_width = my_draw_text(i->song.short_title, NULL, 12.0);
+                       my_draw_text(i->song.short_title, buf, 12.0, x + width[col] / 2 - this_width / 2, 30);
                }
                x += width[col] + 20;
        }
                }
                x += width[col] + 20;
        }