-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatswindow.cpp
58 lines (50 loc) · 1.44 KB
/
statswindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/// StatsWindow.cpp impliments displaying the users stats in a window.
/// Written By: name'); DROP TABLE teams;-- ?
#include "statswindow.h"
#include "ui_statswindow.h"
/// \brief StatsWindow::StatsWindow
/// Constructor
/// \param parent
StatsWindow::StatsWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::StatsWindow)
{
ui->setupUi(this);
}
/// \brief StatsWindow::~StatsWindow
/// Deconstructors
StatsWindow::~StatsWindow()
{
delete ui;
}
/// \brief StatsWindow::receiveStats
/// Takes in an array with raw stats. Displays stats with meaning in the stats window.
/// \param stats
void StatsWindow::receiveStats(std::array<int, 6> stats)
{
//Stat: Complete games
double gamesPlayed = 0;
for(int i : stats)
{
gamesPlayed += i;
}
ui->gamesPlayed->setText((QString::number((int)gamesPlayed/12)));
//Stat: correct Guesses
int numCorrectGuesses = 0;
for(int i = 0; i < 5; i++)
{
numCorrectGuesses += stats[i];
}
ui->correctGuesses->setText(QString::number(numCorrectGuesses));
//Stat: Never Got It
ui->noCorrectGuess->setText(QString::number(stats[5]));
//Stat: right on first guess
ui->firstGuessRight->setText(QString::number(stats[0]));
//Stat: every time they guessed wrong
int totalWrongGuesses = 0;
for(int i = 0; i < 6; i++)
{
totalWrongGuesses +=i*stats[i];
}
ui->wrongGuesses->setText(QString::number(totalWrongGuesses));
}