QTfrontend/ui/page/pagegamestats.cpp
changeset 9177 d5e98b81e135
parent 9175 dc3c0e44f7f3
child 9178 c0902317c823
equal deleted inserted replaced
9176:c21c88dca14c 9177:d5e98b81e135
    38     fitInView(sceneRect());
    38     fitInView(sceneRect());
    39 }
    39 }
    40 
    40 
    41 QLayout * PageGameStats::bodyLayoutDefinition()
    41 QLayout * PageGameStats::bodyLayoutDefinition()
    42 {
    42 {
       
    43 	defaultGraphTitle = true;	
    43     QGridLayout * pageLayout = new QGridLayout();
    44     QGridLayout * pageLayout = new QGridLayout();
    44     pageLayout->setSpacing(20);
    45     pageLayout->setSpacing(20);
    45     pageLayout->setColumnStretch(0, 1);
    46     pageLayout->setColumnStretch(0, 1);
    46     pageLayout->setColumnStretch(1, 1);
    47     pageLayout->setColumnStretch(1, 1);
    47     pageLayout->setRowStretch(0, 1);    
    48     pageLayout->setRowStretch(0, 1);    
   157 
   158 
   158 void PageGameStats::renderStats()
   159 void PageGameStats::renderStats()
   159 {
   160 {
   160 	graphic->show();
   161 	graphic->show();
   161 	labelGraphTitle-> show();
   162 	labelGraphTitle-> show();
       
   163 	if(defaultGraphTitle) {
       
   164 		labelGraphTitle->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>");
       
   165 	} else {
       
   166 		defaultGraphTitle = true;
       
   167 	}
   162 	// if not health data sent
   168 	// if not health data sent
   163 	if(healthPoints.size() == 0) {
   169 	if(healthPoints.size() == 0) {
   164 		labelGraphTitle->hide();
   170 		labelGraphTitle->hide();
   165 		graphic->hide();
   171 		graphic->hide();
   166 	} else {
   172 	} else {
   167 		labelGraphTitle->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>");
       
   168 		QGraphicsScene * scene = new QGraphicsScene();
   173 		QGraphicsScene * scene = new QGraphicsScene();
   169 
   174 
   170 		QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin();
   175 		QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin();
   171 		while (i != healthPoints.constEnd())
   176 		while (i != healthPoints.constEnd())
   172 		{
   177 		{
   230             break;
   235             break;
   231         }
   236         }
   232         case 'g' :
   237         case 'g' :
   233         {
   238         {
   234 			// TODO: change default picture or add change pic capability
   239 			// TODO: change default picture or add change pic capability
       
   240 			defaultGraphTitle = false;
   235 			labelGraphTitle->setText("<br><h1><img src=\":/res/StatsR.png\"> " + info + "</h1>");
   241 			labelGraphTitle->setText("<br><h1><img src=\":/res/StatsR.png\"> " + info + "</h1>");
   236             break;
   242             break;
   237         }
   243         }
   238         case 'T':   // local team stats
   244         case 'T':   // local team stats
   239         {
   245         {