1#include "gameslistview.h"
2#include "ui_gameslistview.h"
4GamesListView::GamesListView(QWidget *parent)
7 connect(ui->gameNameComboBox, SIGNAL(currentIndexChanged(
int)),
this,
8 SLOT(repeaterCurrentIndexChanged(
int)));
11void GamesListView::repeaterCurrentIndexChanged(
int index) {
16 emit currentIndexChanged(index);
17 emit requestGameStatistics(ui->gameNameComboBox->currentData().toString());
20GamesListView::~GamesListView() {
24void GamesListView::on_backButton_clicked() {
26 emit shownStartView();
29void GamesListView::on_downloadQmlButton_clicked() {
30 emit requestedDownloadGame(ui->gameNameComboBox->currentIndex());
33void GamesListView::gotGamesListUpdate(
34 const std::vector<GameInfo> &newGamesList) {
35 ui->gameNameComboBox->clear();
36 for (
const auto &gameInfo : newGamesList) {
37 ui->gameNameComboBox->addItem(gameInfo.display_name, gameInfo.id);
41void GamesListView::gotNewSelectedGame(
const GameInfo &gameInfo) {
42 ui->gameDescriptionTextBrowser->setText(gameInfo.description);
43 ui->playersAllowedLabel->setText(QString::number(gameInfo.players_num));
46void GamesListView::gotNewGameStatistics(
const GameStatistics &gameStatistics) {
47 ui->averageDurationLabel->setText(
48 QString::number(gameStatistics.average_duration_sec));
49 ui->averagePlayersLabel->setText(
50 QString::number(gameStatistics.average_players_count));
51 ui->totalTimePlayedLabel->setText(
52 QString::number(gameStatistics.total_time_played_sec));
53 ui->totalGamesPlayedLabel->setText(
54 QString::number(gameStatistics.total_games_played));
57void GamesListView::displayEmpty() {
58 ui->gameDescriptionTextBrowser->clear();
59 ui->playersAllowedLabel->clear();