QTfrontend/statsPage.cpp
changeset 3815 8754f7874395
parent 3788 9aa8a832e296
child 4176 4e3942f5827c
equal deleted inserted replaced
3813:9c32b0e0b6c9 3815:8754f7874395
    49 
    49 
    50     // details
    50     // details
    51     labelGameStats = new QLabel(this);
    51     labelGameStats = new QLabel(this);
    52     QLabel * l = new QLabel(this);
    52     QLabel * l = new QLabel(this);
    53     l->setTextFormat(Qt::RichText);
    53     l->setTextFormat(Qt::RichText);
    54     l->setText(PageGameStats::tr("<h1><img src=\":/res/StatsD.png\"> Details</h1>"));
    54     l->setText("<h1><img src=\":/res/StatsD.png\"> " + PageGameStats::tr("Details") + "</h1>");
    55     l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    55     l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    56     labelGameStats->setTextFormat(Qt::RichText);
    56     labelGameStats->setTextFormat(Qt::RichText);
    57     labelGameStats->setAlignment(Qt::AlignTop);
    57     labelGameStats->setAlignment(Qt::AlignTop);
    58     gbl->addWidget(l);
    58     gbl->addWidget(l);
    59     gbl->addWidget(labelGameStats);
    59     gbl->addWidget(labelGameStats);
    62     
    62     
    63     // graph
    63     // graph
    64     graphic = new FitGraphicsView(gb);
    64     graphic = new FitGraphicsView(gb);
    65     l = new QLabel(this);
    65     l = new QLabel(this);
    66     l->setTextFormat(Qt::RichText);
    66     l->setTextFormat(Qt::RichText);
    67     l->setText(PageGameStats::tr("<br><h1><img src=\":/res/StatsH.png\"> Health graph</h1>"));
    67     l->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>");
    68     l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    68     l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    69     gbl->addWidget(l);
    69     gbl->addWidget(l);
    70     gbl->addWidget(graphic);
    70     gbl->addWidget(graphic);
    71     graphic->scale(1.0, -1.0);
    71     graphic->scale(1.0, -1.0);
    72     graphic->setBackgroundBrush(QBrush(Qt::black));
    72     graphic->setBackgroundBrush(QBrush(Qt::black));
    79     gb = new QGroupBox(this);
    79     gb = new QGroupBox(this);
    80     gbl = new QVBoxLayout;
    80     gbl = new QVBoxLayout;
    81     labelGameRank = new QLabel(gb);
    81     labelGameRank = new QLabel(gb);
    82     l = new QLabel(this);
    82     l = new QLabel(this);
    83     l->setTextFormat(Qt::RichText);
    83     l->setTextFormat(Qt::RichText);
    84     l->setText(PageGameStats::tr("<h1><img src=\":/res/StatsR.png\"> Ranking</h1>"));
    84     l->setText("<h1><img src=\":/res/StatsR.png\"> " + PageGameStats::tr("Ranking") + "</h1>");
    85     l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    85     l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    86     gbl->addWidget(l);
    86     gbl->addWidget(l);
    87     gbl->addWidget(labelGameRank);
    87     gbl->addWidget(labelGameRank);
    88     gb->setLayout(gbl);
    88     gb->setLayout(gbl);
    89 
    89 
   139             labelGameWin->setText(QString("<h1 align=\"center\">%1</h1>").arg(info));
   139             labelGameWin->setText(QString("<h1 align=\"center\">%1</h1>").arg(info));
   140             break;
   140             break;
   141         }
   141         }
   142         case 'D' : {
   142         case 'D' : {
   143             int i = info.indexOf(' ');
   143             int i = info.indexOf(' ');
   144             QString message = PageGameStats::tr("<p><img src=\":/res/StatsBestShot.png\"> The best shot award was won by <b>%1</b> with <b>%2</b> pts.</p>")
   144             QString message = "<p><img src=\":/res/StatsBestShot.png\"> " + PageGameStats::tr("The best shot award was won by <b>%1</b> with <b>%2</b> pts.").arg(info.mid(i + 1), info.left(i)) + "</p>";
   145                     .arg(info.mid(i + 1), info.left(i));
       
   146             AddStatText(message);
   145             AddStatText(message);
   147             break;
   146             break;
   148         }
   147         }
   149         case 'k' : {
   148         case 'k' : {
   150             int i = info.indexOf(' ');
   149             int i = info.indexOf(' ');
   151             int num = info.left(i).toInt();
   150             int num = info.left(i).toInt();
   152             QString message = PageGameStats::tr("<p><img src=\":/res/StatsBestKiller.png\"> The best killer is <b>%1</b> with <b>%2</b> kills in a turn.</p>", "", num)
   151             QString message = "<p><img src=\":/res/StatsBestKiller.png\"> " + PageGameStats::tr("The best killer is <b>%1</b> with <b>%2</b> kills in a turn.", "", num).arg(info.mid(i + 1), info.left(i)) + "</p>";
   153                     .arg(info.mid(i + 1), info.left(i));
       
   154             AddStatText(message);
   152             AddStatText(message);
   155             break;
   153             break;
   156         }
   154         }
   157         case 'K' : {
   155         case 'K' : {
   158             int num = info.toInt();
   156             int num = info.toInt();
   159             QString message = PageGameStats::tr("<p><img src=\":/res/StatsHedgehogsKilled.png\"> A total of <b>%1</b> hedgehog(s) were killed during this round.</p>", "", num).arg(num);
   157             QString message = "<p><img src=\":/res/StatsHedgehogsKilled.png\"> " +  PageGameStats::tr("A total of <b>%1</b> hedgehog(s) were killed during this round.", "", num).arg(num) + "</p>";
   160             AddStatText(message);
   158             AddStatText(message);
   161             break;
   159             break;
   162         }
   160         }
   163         case 'H' : {
   161         case 'H' : {
   164             int i = info.indexOf(' ');
   162             int i = info.indexOf(' ');
   215 			image = "<img src=\":/res/StatsMedal4.png\">";
   213 			image = "<img src=\":/res/StatsMedal4.png\">";
   216 			break;
   214 			break;
   217 	    }
   215 	    }
   218 
   216 
   219             QString message;
   217             QString message;
       
   218 	    QString killstring;
   220 	    if (kills.toInt() == 1)
   219 	    if (kills.toInt() == 1)
   221 	    {
   220 	    {
   222 	    	message = PageGameStats::tr("<p><h2>%1 %2. <font color=\"%5\">%3</font>  (%4 kill).</h2></p>").arg(image, QString::number(playerPosition), playername, kills, clanColor.name());
   221 	    	killstring = PageGameStats::tr("(%1 kill)").arg(kills);
   223 	    } else {
   222 	    } else {
   224 	        message = PageGameStats::tr("<p><h2>%1 %2. <font color=\"%5\">%3</font>  (%4 kills).</h2></p>").arg(image, QString::number(playerPosition), playername, kills, clanColor.name());
   223 	    	killstring = PageGameStats::tr("(%1 kills)").arg(kills);
   225             }
   224             }
   226             labelGameRank->setText(labelGameRank->text() + message);
   225 	    
       
   226 	    message = QString("<p><h2>%1 %2. <font color=\"%4\">%3</font> ").arg(image, QString::number(playerPosition), playername, clanColor.name()) + killstring + "</h2></p>";
       
   227             
       
   228 	    labelGameRank->setText(labelGameRank->text() + message);
   227             break;
   229             break;
   228 	}
   230 	}
   229         case 's' : {
   231         case 's' : {
   230             int i = info.indexOf(' ');
   232             int i = info.indexOf(' ');
   231             QString message = PageGameStats::tr("<p><img src=\":/res/StatsMostSelfDamage.png\"> <b>%1</b> thought it's good to shoot his own hedgehogs with <b>%2</b> pts.</p>")
   233             QString message = "<p><img src=\":/res/StatsMostSelfDamage.png\"> " + PageGameStats::tr("<b>%1</b> thought it's good to shoot his own hedgehogs with <b>%2</b> pts.").arg(info.mid(i + 1), info.left(i)) + "</p>";
   232                     .arg(info.mid(i + 1), info.left(i));
       
   233             AddStatText(message);
   234             AddStatText(message);
   234             break;
   235             break;
   235         }
   236         }
   236         case 'S' : {
   237         case 'S' : {
   237             int i = info.indexOf(' ');
   238             int i = info.indexOf(' ');
   238             QString message = PageGameStats::tr("<p><img src=\":/res/StatsSelfKilled.png\"> <b>%1</b> killed <b>%2</b> of his own hedgehogs.</p>")
   239             QString message = "<p><img src=\":/res/StatsSelfKilled.png\"> " + PageGameStats::tr("<b>%1</b> killed <b>%2</b> of his own hedgehogs.").arg(info.mid(i + 1), info.left(i)) + "</p>"; 
   239                     .arg(info.mid(i + 1), info.left(i));
       
   240             AddStatText(message);
   240             AddStatText(message);
   241             break;
   241             break;
   242         }
   242         }
   243         case 'B' : {
   243         case 'B' : {
   244             int i = info.indexOf(' ');
   244             int i = info.indexOf(' ');
   245             QString message = PageGameStats::tr("<p><img src=\":/res/StatsSkipped.png\"> <b>%1</b> was scared and skipped turn <b>%2</b> times.</p>")
   245             QString message = "<p><img src=\":/res/StatsSkipped.png\"> " + PageGameStats::tr("<b>%1</b> was scared and skipped turn <b>%2</b> times.").arg(info.mid(i + 1), info.left(i)) + "</p>";
   246                     .arg(info.mid(i + 1), info.left(i));
       
   247             AddStatText(message);
   246             AddStatText(message);
   248             break;
   247             break;
   249         }
   248         }
   250 
   249 
   251     }
   250     }