QTfrontend/statsPage.cpp
changeset 1622 8e0d62727f01
parent 1621 d1ded2532d3f
child 1623 d590e6da04da
equal deleted inserted replaced
1621:d1ded2532d3f 1622:8e0d62727f01
    33 
    33 
    34 	labelGameStats = new QLabel(this);
    34 	labelGameStats = new QLabel(this);
    35 	labelGameStats->setTextFormat(Qt::RichText);
    35 	labelGameStats->setTextFormat(Qt::RichText);
    36 	pageLayout->addWidget(labelGameStats, 0, 0, 1, 3);
    36 	pageLayout->addWidget(labelGameStats, 0, 0, 1, 3);
    37 }
    37 }
       
    38 
       
    39 void PageGameStats::AddStatText(const QString & msg)
       
    40 {
       
    41 	labelGameStats->setText(labelGameStats->text() + msg);
       
    42 }
       
    43 
       
    44 void PageGameStats::clear()
       
    45 {
       
    46 	labelGameStats->setText("");
       
    47 }
       
    48 
       
    49 void PageGameStats::GameStats(char type, const QString & info)
       
    50 {
       
    51 	switch(type) {
       
    52 		case 'r' : {
       
    53 			AddStatText(QString("<h1 align=\"center\">%1</h1>").arg(info));
       
    54 			break;
       
    55 		}
       
    56 		case 'D' : {
       
    57 			int i = info.indexOf(' ');
       
    58 			QString message = tr("<p>The best shot award was won by <b>%1</b> with <b>%2</b> pts.</p>")
       
    59 					.arg(info.mid(i + 1), info.left(i));
       
    60 			AddStatText(message);
       
    61 			break;
       
    62 		}
       
    63 		case 'k' : {
       
    64 			int i = info.indexOf(' ');
       
    65 			QString message = tr("<p>The best shot award was won by <b>%1</b> with <b>%2</b> kills.</p>")
       
    66 					.arg(info.mid(i + 1), info.left(i));
       
    67 			AddStatText(message);
       
    68 			break;
       
    69 		}
       
    70 		case 'K' : {
       
    71 			QString message = tr("<p>A total of <b>%1</b> Hedgehog(s) were killed during this round.</p>").arg(info);
       
    72 			AddStatText(message);
       
    73 			break;
       
    74 		}
       
    75 	}
       
    76 }