-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGloryDialog.cpp
40 lines (32 loc) · 1.14 KB
/
GloryDialog.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
#include "GloryDialog.hpp"
GloryDialog::GloryDialog(BoardModel *boardModel, QWidget *parent)
: QDialog(parent),
boardModel(boardModel)
{
this->setWindowTitle("Glory Score Overview");
this->gridLayout = new QGridLayout(this);
this->setLayout(this->gridLayout);
QFont font("monospace");
this->gloryOverview = new QPlainTextEdit(this);
this->gloryOverview->setFont(font);
this->gloryOverview->setReadOnly(true);
this->gridLayout->addWidget(this->gloryOverview, 0,0);
}
void GloryDialog::show()
{
this->QDialog::show();
this->update();
}
void GloryDialog::update()
{
QList<int> gloryByEra = this->boardModel->getGloryScoreByEra();
this->gloryOverview->clear();
this->gloryOverview->insertPlainText(QString("### Glory Score ###\n"));
for(int i = 0; i < gloryByEra.count(); ++i)
{
this->gloryOverview->insertPlainText(QString("Era %1: %2 VP\n").arg(i+1).arg(gloryByEra[i]));
}
this->gloryOverview->insertPlainText("---------\n");
this->gloryOverview->insertPlainText(QString("Total Glory Score: %1 VP\n").arg(this->boardModel->getGloryScore()));
this->QDialog::update();
}