QTfrontend/ui/widget/teamselect.cpp
author koda
Thu, 28 Feb 2013 22:59:22 +0100
changeset 8609 3f6c08223aa1
parent 8432 f2d57e987ba9
child 8726 ef2abeafa7cb
permissions -rw-r--r--
use NETGAME_DEFAULT_PORT macro across frontend sources
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 884
diff changeset
     2
 * Hedgewars, a free turn based strategy game
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4410
diff changeset
     3
 * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6700
diff changeset
     4
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     5
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     7
 * it under the terms of the GNU General Public License as published by
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     8
 * the Free Software Foundation; version 2 of the License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     9
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    13
 * GNU General Public License for more details.
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    14
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    15
 * You should have received a copy of the GNU General Public License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    16
 * along with this program; if not, write to the Free Software
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    18
 */
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    19
572
302ad5c3836d gcc 4.3 related patch - missing header added :)
displacer
parents: 535
diff changeset
    20
#include <algorithm>
302ad5c3836d gcc 4.3 related patch - missing header added :)
displacer
parents: 535
diff changeset
    21
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    22
#include <QLabel>
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    23
#include <QPixmap>
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    24
#include <QPushButton>
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    25
#include <QFrame>
884
99cc72c8a812 - Some debug info
unc0rr
parents: 572
diff changeset
    26
#include <QDebug>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    27
2522
42986b9ebc74 moves project files to proper directory
koda
parents: 2377
diff changeset
    28
#include "vertScrollArea.h"
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    29
#include "teamselect.h"
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    30
#include "teamselhelper.h"
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    31
#include "frameTeam.h"
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    32
339
7535ab6c3820 Run game message added, team and config info provided for net game
displacer
parents: 322
diff changeset
    33
void TeamSelWidget::addTeam(HWTeam team)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    34
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    35
    if(team.isNetTeam())
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    36
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    37
        framePlaying->addTeam(team, true);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    38
        curPlayingTeams.push_back(team);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    39
        connect(framePlaying->getTeamWidget(team), SIGNAL(hhNmChanged(const HWTeam&)),
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    40
                this, SLOT(hhNumChanged(const HWTeam&)));
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    41
        dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team))->hhNumChanged();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    42
        connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)),
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    43
                this, SLOT(proxyTeamColorChanged(const HWTeam&)));
373
df912aab6b7e network team add can be denied by server
displacer
parents: 372
diff changeset
    44
    }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    45
    else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    46
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    47
        frameDontPlaying->addTeam(team, false);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    48
        m_curNotPlayingTeams.push_back(team);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    49
        if(m_acceptOuter)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    50
        {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    51
            connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    52
                    this, SLOT(pre_changeTeamStatus(HWTeam)));
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    53
        }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    54
        else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    55
        {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    56
            connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    57
                    this, SLOT(changeTeamStatus(HWTeam)));
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    58
        }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    59
    }
8129
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
    60
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    61
    emit setEnabledGameStart(curPlayingTeams.size()>1);
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    62
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    63
1475
bab5650fc894 - Fix ConfigAsked not sending full config (leads to team divide checkbox inconsistency)
unc0rr
parents: 1425
diff changeset
    64
void TeamSelWidget::setInteractivity(bool interactive)
362
b28e0dd48269 hedgehogs num modification now allowed to chief client only
displacer
parents: 356
diff changeset
    65
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    66
    framePlaying->setInteractivity(interactive);
362
b28e0dd48269 hedgehogs num modification now allowed to chief client only
displacer
parents: 356
diff changeset
    67
}
b28e0dd48269 hedgehogs num modification now allowed to chief client only
displacer
parents: 356
diff changeset
    68
352
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
    69
void TeamSelWidget::hhNumChanged(const HWTeam& team)
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
    70
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    71
    QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    72
    if(itPlay==curPlayingTeams.end())
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    73
    {
6015
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5773
diff changeset
    74
        qWarning() << QString("hhNumChanged: team '%1' not found").arg(team.name());
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    75
        return;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    76
    }
6015
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5773
diff changeset
    77
    itPlay->setNumHedgehogs(team.numHedgehogs());
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    78
    emit hhogsNumChanged(team);
352
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
    79
}
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
    80
372
4bac77f8cd38 network colors (alpha)
displacer
parents: 362
diff changeset
    81
void TeamSelWidget::proxyTeamColorChanged(const HWTeam& team)
4bac77f8cd38 network colors (alpha)
displacer
parents: 362
diff changeset
    82
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    83
    QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    84
    if(itPlay==curPlayingTeams.end())
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    85
    {
6015
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5773
diff changeset
    86
        qWarning() << QString("proxyTeamColorChanged: team '%1' not found").arg(team.name());
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    87
        return;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    88
    }
6015
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5773
diff changeset
    89
    itPlay->setColor(team.color());
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    90
    emit teamColorChanged(team);
372
4bac77f8cd38 network colors (alpha)
displacer
parents: 362
diff changeset
    91
}
4bac77f8cd38 network colors (alpha)
displacer
parents: 362
diff changeset
    92
352
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
    93
void TeamSelWidget::changeHHNum(const HWTeam& team)
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
    94
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    95
    QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    96
    if(itPlay==curPlayingTeams.end())
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    97
    {
6015
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5773
diff changeset
    98
        qWarning() << QString("changeHHNum: team '%1' not found").arg(team.name());
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
    99
        return;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   100
    }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   101
    itPlay->setNumHedgehogs(team.numHedgehogs());
352
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
   102
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   103
    framePlaying->setHHNum(team);
352
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
   104
}
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
   105
372
4bac77f8cd38 network colors (alpha)
displacer
parents: 362
diff changeset
   106
void TeamSelWidget::changeTeamColor(const HWTeam& team)
4bac77f8cd38 network colors (alpha)
displacer
parents: 362
diff changeset
   107
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   108
    QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   109
    if(itPlay==curPlayingTeams.end())
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   110
    {
6015
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5773
diff changeset
   111
        qWarning() << QString("changeTeamColor: team '%1' not found").arg(team.name());
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   112
        return;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   113
    }
6015
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5773
diff changeset
   114
    itPlay->setColor(team.color());
372
4bac77f8cd38 network colors (alpha)
displacer
parents: 362
diff changeset
   115
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   116
    framePlaying->setTeamColor(team);
372
4bac77f8cd38 network colors (alpha)
displacer
parents: 362
diff changeset
   117
}
4bac77f8cd38 network colors (alpha)
displacer
parents: 362
diff changeset
   118
347
6521e1b2cd40 more correct remove net teams
displacer
parents: 341
diff changeset
   119
void TeamSelWidget::removeNetTeam(const HWTeam& team)
6521e1b2cd40 more correct remove net teams
displacer
parents: 341
diff changeset
   120
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   121
    //qDebug() << QString("removeNetTeam: removing team '%1'").arg(team.TeamName);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   122
    for(;;)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   123
    {
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   124
        QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   125
        if(itPlay==curPlayingTeams.end())
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   126
        {
6015
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5773
diff changeset
   127
            qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.name());
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   128
            break;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   129
        }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   130
        if(itPlay->isNetTeam())
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   131
        {
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   132
            QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam)));
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   133
            framePlaying->removeTeam(team);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   134
            curPlayingTeams.erase(itPlay);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   135
            break;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   136
        }
7523
0790527b4e00 When exiting a room where one was host, server sends a REMOVE_TEAM for the local team. It appears that this loop would not break in that case. Add a log message and a break. (I've hit a frozen frontend twice now)
nemo
parents: 7145
diff changeset
   137
        else
0790527b4e00 When exiting a room where one was host, server sends a REMOVE_TEAM for the local team. It appears that this loop would not break in that case. Add a log message and a break. (I've hit a frozen frontend twice now)
nemo
parents: 7145
diff changeset
   138
        {
0790527b4e00 When exiting a room where one was host, server sends a REMOVE_TEAM for the local team. It appears that this loop would not break in that case. Add a log message and a break. (I've hit a frozen frontend twice now)
nemo
parents: 7145
diff changeset
   139
            qWarning() << QString("removeNetTeam: team '%1' was actually a local team!").arg(team.name());
0790527b4e00 When exiting a room where one was host, server sends a REMOVE_TEAM for the local team. It appears that this loop would not break in that case. Add a log message and a break. (I've hit a frozen frontend twice now)
nemo
parents: 7145
diff changeset
   140
            break;
0790527b4e00 When exiting a room where one was host, server sends a REMOVE_TEAM for the local team. It appears that this loop would not break in that case. Add a log message and a break. (I've hit a frozen frontend twice now)
nemo
parents: 7145
diff changeset
   141
        }
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   142
    }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   143
    emit setEnabledGameStart(curPlayingTeams.size()>1);
347
6521e1b2cd40 more correct remove net teams
displacer
parents: 341
diff changeset
   144
}
6521e1b2cd40 more correct remove net teams
displacer
parents: 341
diff changeset
   145
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   146
void TeamSelWidget::changeTeamStatus(HWTeam team)
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   147
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   148
    QList<HWTeam>::iterator itDontPlay=std::find(m_curNotPlayingTeams.begin(), m_curNotPlayingTeams.end(), team);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   149
    QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   150
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   151
    bool willBePlaying=itDontPlay!=m_curNotPlayingTeams.end();
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   152
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   153
    if(!willBePlaying)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   154
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   155
        // playing team => dont playing
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   156
        m_curNotPlayingTeams.push_back(*itPlay);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   157
        emit teamNotPlaying(*itPlay);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   158
        curPlayingTeams.erase(itPlay);
8129
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   159
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   160
        // Show team notice if less than two teams.
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   161
        if (curPlayingTeams.size() < 2)
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   162
        {
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   163
            numTeamNotice->show();
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   164
        }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   165
    }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   166
    else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   167
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   168
        // return if max playing teams reached
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   169
        if(framePlaying->isFullTeams()) return;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   170
        // dont playing team => playing
7145
1d1a14b39400 Fix a bug with wrong state of teams list when color isn't changed manually
unc0rr
parents: 6952
diff changeset
   171
        itDontPlay->setColor(framePlaying->getNextColor());
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   172
        team=*itDontPlay; // for net team info saving in framePlaying (we have only name with netID from network)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   173
        curPlayingTeams.push_back(*itDontPlay);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   174
        if(!m_acceptOuter) emit teamWillPlay(*itDontPlay);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   175
        m_curNotPlayingTeams.erase(itDontPlay);
8129
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   176
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   177
        // Hide team notice if at least two teams.
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   178
        if (curPlayingTeams.size() >= 2)
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   179
        {
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   180
            numTeamNotice->hide();
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   181
        }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   182
    }
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   183
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   184
    FrameTeams* pRemoveTeams;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   185
    FrameTeams* pAddTeams;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   186
    if(!willBePlaying)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   187
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   188
        pRemoveTeams=framePlaying;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   189
        pAddTeams=frameDontPlaying;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   190
    }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   191
    else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   192
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   193
        pRemoveTeams=frameDontPlaying;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   194
        pAddTeams=framePlaying;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   195
    }
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   196
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   197
    pAddTeams->addTeam(team, willBePlaying);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   198
    pRemoveTeams->removeTeam(team);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   199
    if(!team.isNetTeam() && m_acceptOuter && !willBePlaying)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   200
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   201
        connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   202
                this, SLOT(pre_changeTeamStatus(HWTeam)));
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   203
    }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   204
    else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   205
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   206
        connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   207
                this, SLOT(changeTeamStatus(HWTeam)));
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   208
    }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   209
    if(willBePlaying)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   210
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   211
        connect(framePlaying->getTeamWidget(team), SIGNAL(hhNmChanged(const HWTeam&)),
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   212
                this, SLOT(hhNumChanged(const HWTeam&)));
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   213
        dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team))->hhNumChanged();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   214
        connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)),
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   215
                this, SLOT(proxyTeamColorChanged(const HWTeam&)));
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   216
        emit teamColorChanged(((TeamShowWidget*)framePlaying->getTeamWidget(team))->getTeam());
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   217
    }
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   218
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   219
    QSize szh=pAddTeams->sizeHint();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   220
    QSize szh1=pRemoveTeams->sizeHint();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   221
    if(szh.isValid() && szh1.isValid())
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   222
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   223
        pAddTeams->resize(pAddTeams->size().width(), szh.height());
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   224
        pRemoveTeams->resize(pRemoveTeams->size().width(), szh1.height());
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   225
    }
492
78e80f899b59 disable start game button with teams num < 2
displacer
parents: 486
diff changeset
   226
8430
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   227
    repaint();
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   228
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   229
    emit setEnabledGameStart(curPlayingTeams.size()>1);
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   230
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   231
1647
ab0c8c4be7b3 Reorganize net game page
unc0rr
parents: 1475
diff changeset
   232
void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color, int fixedHeight)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   233
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   234
    VertScrArea* area = new VertScrArea(color);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   235
    area->setWidget(pfteams);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   236
    mainLayout.addWidget(area, 30);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   237
    if (fixedHeight > 0)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   238
    {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   239
        area->setMinimumHeight(fixedHeight);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   240
        area->setMaximumHeight(fixedHeight);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   241
        area->setStyleSheet(
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   242
            "FrameTeams{"
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   243
            "border: solid;"
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   244
            "border-width: 1px;"
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   245
            "border-radius: 16px;"
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   246
            "border-color: #ffcc00;"
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   247
            "}"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   248
        );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   249
    }
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   250
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   251
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   252
TeamSelWidget::TeamSelWidget(QWidget* parent) :
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   253
    QGroupBox(parent), mainLayout(this), m_acceptOuter(false)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   254
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   255
    setTitle(QGroupBox::tr("Playing teams"));
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   256
    framePlaying = new FrameTeams();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   257
    frameDontPlaying = new FrameTeams();
2377
f3fab2b09e0c And in frontend
nemo
parents: 2110
diff changeset
   258
8129
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   259
    // Add notice about number of required teams.
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   260
    numTeamNotice = new QLabel("Two teams are required to play!");
8140
a098374b847b A bit of refactoring
unc0rr
parents: 8129
diff changeset
   261
    mainLayout.addWidget(numTeamNotice);
8129
98e4a60da2ca GCI2012: Empty list help text (Issue 375)
Bryan Dunsmore
parents: 7835
diff changeset
   262
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   263
    QPalette p;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   264
    p.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8140
diff changeset
   265
    addScrArea(framePlaying, p.color(QPalette::Window).light(105), 150);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2522
diff changeset
   266
    addScrArea(frameDontPlaying, p.color(QPalette::Window).dark(105), 0);
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   267
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   268
373
df912aab6b7e network team add can be denied by server
displacer
parents: 372
diff changeset
   269
void TeamSelWidget::setAcceptOuter(bool acceptOuter)
df912aab6b7e network team add can be denied by server
displacer
parents: 372
diff changeset
   270
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   271
    m_acceptOuter=acceptOuter;
373
df912aab6b7e network team add can be denied by server
displacer
parents: 372
diff changeset
   272
}
df912aab6b7e network team add can be denied by server
displacer
parents: 372
diff changeset
   273
231
c77b16e48273 bots power icons added
displacer
parents: 207
diff changeset
   274
void TeamSelWidget::resetPlayingTeams(const QList<HWTeam>& teamslist)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   275
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   276
    //for(it=curPlayingTeams.begin(); it!=curPlayingTeams.end(); it++) {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   277
    //framePlaying->removeTeam(*it);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   278
    //}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   279
    framePlaying->resetTeams();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   280
    framePlaying->resetColors();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   281
    curPlayingTeams.clear();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   282
    //for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   283
    //frameDontPlaying->removeTeam(*it);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   284
    //}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   285
    frameDontPlaying->resetTeams();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   286
    m_curNotPlayingTeams.clear();
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   287
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   288
    foreach(HWTeam team, teamslist)
8430
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   289
        addTeam(team);
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   290
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   291
    repaint();
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   292
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   293
7835
a84936d1618a Clear hedgehog's gear Power value when switching. Should fix issue 446 (not tested, but looks obvious).
unc0rr
parents: 7523
diff changeset
   294
bool TeamSelWidget::isPlaying(const HWTeam &team) const
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   295
{
7835
a84936d1618a Clear hedgehog's gear Power value when switching. Should fix issue 446 (not tested, but looks obvious).
unc0rr
parents: 7523
diff changeset
   296
    return curPlayingTeams.contains(team);
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   297
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   298
352
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
   299
QList<HWTeam> TeamSelWidget::getPlayingTeams() const
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   300
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   301
    return curPlayingTeams;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   302
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   303
5773
c277657854a2 Some renaming
unc0rr
parents: 5772
diff changeset
   304
QList<HWTeam> TeamSelWidget::getNotPlayingTeams() const
535
a14eaf35cf4b "Setup" button instead of "New team", exclude playing teams from setup
displacer
parents: 523
diff changeset
   305
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   306
    return m_curNotPlayingTeams;
535
a14eaf35cf4b "Setup" button instead of "New team", exclude playing teams from setup
displacer
parents: 523
diff changeset
   307
}
a14eaf35cf4b "Setup" button instead of "New team", exclude playing teams from setup
displacer
parents: 523
diff changeset
   308
7835
a84936d1618a Clear hedgehog's gear Power value when switching. Should fix issue 446 (not tested, but looks obvious).
unc0rr
parents: 7523
diff changeset
   309
void TeamSelWidget::pre_changeTeamStatus(const HWTeam & team)
373
df912aab6b7e network team add can be denied by server
displacer
parents: 372
diff changeset
   310
{
7145
1d1a14b39400 Fix a bug with wrong state of teams list when color isn't changed manually
unc0rr
parents: 6952
diff changeset
   311
    //team.setColor(framePlaying->getNextColor());
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
   312
    emit acceptRequested(team);
373
df912aab6b7e network team add can be denied by server
displacer
parents: 372
diff changeset
   313
}
8430
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   314
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   315
void TeamSelWidget::repaint()
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   316
{
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   317
    QWidget::repaint();
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   318
    framePlaying->repaint();
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   319
    frameDontPlaying->repaint();
8432
f2d57e987ba9 small cleanup, fix ancient warning (the "itPlay" one)
sheepluva
parents: 8430
diff changeset
   320
}