2 #define _GROUPSCREEN_H 1
5 #include <pqxx/connection>
10 #include "flagtrigger.h"
14 /* A screen class showing a group in the tournament */
15 class GroupScreen : public GenericScreen {
17 unsigned tournament, round, parallel, machine, num_machines, players_per_machine;
18 FlagTrigger scores_changed;
19 pqxx::connection &conn;
21 struct timeval last_updated;
22 std::vector<TextDefer> last_text;
24 unsigned get_show_players(const Group &group);
25 void draw_main_heading(std::vector<TextDefer> &td);
26 void draw_column_headings(std::vector<TextDefer> &td, const Group &group, const std::vector<unsigned> &colwidth);
27 void draw_scores(std::vector<TextDefer> &td, const Group &group, unsigned min_player, const std::vector<unsigned> &colwidth);
28 const Player *get_next_player(const Group &group);
29 void draw_next_up_player(unsigned char *buf, const Group &group, const Player &player, const Score &song, bool last_song,
30 std::map<unsigned, unsigned> &song_scores, std::map<unsigned, unsigned> &player_scores,
31 const std::vector<unsigned> &max_score, const std::vector<unsigned> &min_score);
32 void draw_next_up_single(unsigned char *buf, const Group &group,
33 std::map<unsigned, unsigned> &song_scores, std::map<unsigned, unsigned> &player_scores,
34 const std::vector<unsigned> &max_score, const std::vector<unsigned> &min_score);
35 void draw_next_up_versus(unsigned char *buf, const Group &group,
36 std::map<unsigned, unsigned> &song_scores, std::map<unsigned, unsigned> &player_scores,
37 const std::vector<unsigned> &max_score, const std::vector<unsigned> &min_score);
38 void find_column_widths(const Group &group, std::vector<unsigned> &colwidth);
41 // the last two parameters should probably not be there, but fetched from GroupScreen itself
42 GroupScreen(pqxx::connection &conn, unsigned tournament, unsigned round, unsigned parallel, unsigned machine, unsigned num_machines, unsigned players_per_machine);
43 virtual ~GroupScreen();
45 bool check_invalidated();
46 void draw(unsigned char *buf, unsigned width, unsigned height);
50 #endif /* !defined(_GROUPSCREEN_H) */