QTfrontend/teamselhelper.cpp
changeset 486 7ea71cd3acd5
parent 483 2c8d6072c261
child 612 333d095319de
equal deleted inserted replaced
485:defe001d490c 486:7ea71cd3acd5
     1 /*
     1 /*
     2  * Hedgewars, a worms-like game
     2  * Hedgewars, a worms-like game
     3  * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
     3  * Copyright (c) 2006, 2007 Ulyanov Igor <iulyanov@gmail.com>
     4  *
     4  *
     5  * This program is free software; you can redistribute it and/or modify
     5  * This program is free software; you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation; version 2 of the License
     7  * the Free Software Foundation; version 2 of the License
     8  *
     8  *
    29 {
    29 {
    30   emit teamActivated(text());
    30   emit teamActivated(text());
    31 }
    31 }
    32 
    32 
    33 TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) :
    33 TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) :
    34   QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0), 
    34   QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0),
    35   colorButt(0)
    35   colorButt(0)
    36 {
    36 {
    37   mainLayout.setSpacing(1);
    37   mainLayout.setSpacing(1);
    38   mainLayout.setMargin(2);
    38   mainLayout.setMargin(2);
    39   this->setMaximumHeight(35);
    39   this->setMaximumHeight(35);
    40   QIcon difficultyIcon=team.isNetTeam() ? 
    40   QIcon difficultyIcon=team.isNetTeam() ?
    41     QIcon(QString(":/res/botlevels/net%1.png").arg(m_team.difficulty))
    41     QIcon(QString(":/res/botlevels/net%1.png").arg(m_team.difficulty))
    42     : QIcon(QString(":/res/botlevels/%1.png").arg(m_team.difficulty));
    42     : QIcon(QString(":/res/botlevels/%1.png").arg(m_team.difficulty));
    43 
    43 
    44   QPalette newPalette = palette();
    44   QPalette newPalette = palette();
    45   newPalette.setColor(QPalette::Button, palette().color(backgroundRole()));
    45   newPalette.setColor(QPalette::Button, palette().color(backgroundRole()));
   121       pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
   121       pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
   122     }
   122     }
   123     color=*pOurFrameTeams->currentColor;
   123     color=*pOurFrameTeams->currentColor;
   124   } else {
   124   } else {
   125     // set according color iterator
   125     // set according color iterator
   126     pOurFrameTeams->currentColor=std::find(pOurFrameTeams->availableColors.begin(), 
   126     pOurFrameTeams->currentColor=std::find(pOurFrameTeams->availableColors.begin(),
   127 					   pOurFrameTeams->availableColors.end(), color);
   127 					   pOurFrameTeams->availableColors.end(), color);
   128     if(pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) {
   128     if(pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) {
   129       // error condition
   129       // error condition
   130       pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
   130       pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
   131     }
   131     }