source/MainGUI.cpp
/**
 * Sets the new slotlist of the game.
 *
 * @param slotList The new slotlist.
 */
Sets the new slotlist of the game.
@param slotList The new slotlist.
Sets the new slotlist of the game . @param slotList The new slotlist .
void MainGUI::setGameslots (QList<Slot*> slotList)
{
    widget.channelList->clear();
    int currentTeam = -1;
    foreach (Slot* slot, slotList)
    {
        if (currentTeam != slot->getTeam())
        {
            currentTeam = slot->getTeam();
            QListWidgetItem* teamItem = new QListWidgetItem();
            if (gproxy->isDotaMap())
            {
                if (currentTeam == 0)
                {
                    teamItem->setData(ChannellistDelegate::USER, "The Sentinel");
                    teamItem->setData(ChannellistDelegate::SLOT_TEAM, 0);
                    teamItem->setData(ChannellistDelegate::COLOR_USER, QColor(255, 0, 0));
                }
                else
                {
                    teamItem->setData(ChannellistDelegate::USER, "The Scourge");
                    teamItem->setData(ChannellistDelegate::SLOT_TEAM, 1);
                    teamItem->setData(ChannellistDelegate::COLOR_USER, QColor(0, 255, 0));
                }
            }
            else
            {
                teamItem->setData(ChannellistDelegate::USER, "Team " + QString::number(currentTeam + 1));
                teamItem->setData(ChannellistDelegate::SLOT_TEAM, currentTeam);
            }
            widget.channelList->addItem(teamItem);
        }
        QListWidgetItem* playerItem = new QListWidgetItem();
        playerItem->setData(ChannellistDelegate::SLOT_PID, slot->getPlayerId());
        playerItem->setData(ChannellistDelegate::SLOT_DOWNLOAD_STATUS, slot->getDownloadProgress());
        playerItem->setData(ChannellistDelegate::SLOT_STATUS, slot->getSlotStatus());
        playerItem->setData(ChannellistDelegate::SLOT_COMPUTER_STATUS, slot->getComputerStatus());
        playerItem->setData(ChannellistDelegate::SLOT_TEAM, slot->getTeam());
        playerItem->setData(ChannellistDelegate::SLOT_COLOR, slot->getColor());
        playerItem->setData(ChannellistDelegate::SLOT_RACE, slot->getRace());
        playerItem->setData(ChannellistDelegate::SLOT_COMPUTER_TYPE, slot->getComputerType());
        playerItem->setData(ChannellistDelegate::SLOT_HANDICAP, slot->getHandicap());
        if (slot->getPlayer())
        {
            playerItem->setData(ChannellistDelegate::USER, slot->getPlayer()->getName().getMessage());
            playerItem->setData(ChannellistDelegate::COLOR_USER, slot->getPlayer()->getName().getColor());
        }
        else
        {
            playerItem->setData(ChannellistDelegate::USER, "");
        }
        widget.channelList->addItem(playerItem);
    }
}
void MainGUI :: setGameslots ( QList < Slot * > slotList ) { widget . channelList -> clear ( ) ; int currentTeam = -1 ; foreach ( Slot * slot , slotList ) { if ( currentTeam != slot -> getTeam ( ) ) { currentTeam = slot -> getTeam ( ) ; QListWidgetItem * teamItem = new QListWidgetItem ( ) ; if ( gproxy -> isDotaMap ( ) ) { if ( currentTeam == 0 ) { teamItem -> setData ( ChannellistDelegate :: USER , " " ) ; teamItem -> setData ( ChannellistDelegate :: SLOT_TEAM , 0 ) ; teamItem -> setData ( ChannellistDelegate :: COLOR_USER , QColor ( 255 , 0 , 0 ) ) ; } else { teamItem -> setData ( ChannellistDelegate :: USER , " " ) ; teamItem -> setData ( ChannellistDelegate :: SLOT_TEAM , 1 ) ; teamItem -> setData ( ChannellistDelegate :: COLOR_USER , QColor ( 0 , 255 , 0 ) ) ; } } else { teamItem -> setData ( ChannellistDelegate :: USER , " " + QString :: number ( currentTeam + 1 ) ) ; teamItem -> setData ( ChannellistDelegate :: SLOT_TEAM , currentTeam ) ; } widget . channelList -> addItem ( teamItem ) ; } QListWidgetItem * playerItem = new QListWidgetItem ( ) ; playerItem -> setData ( ChannellistDelegate :: SLOT_PID , slot -> getPlayerId ( ) ) ; playerItem -> setData ( ChannellistDelegate :: SLOT_DOWNLOAD_STATUS , slot -> getDownloadProgress ( ) ) ; playerItem -> setData ( ChannellistDelegate :: SLOT_STATUS , slot -> getSlotStatus ( ) ) ; playerItem -> setData ( ChannellistDelegate :: SLOT_COMPUTER_STATUS , slot -> getComputerStatus ( ) ) ; playerItem -> setData ( ChannellistDelegate :: SLOT_TEAM , slot -> getTeam ( ) ) ; playerItem -> setData ( ChannellistDelegate :: SLOT_COLOR , slot -> getColor ( ) ) ; playerItem -> setData ( ChannellistDelegate :: SLOT_RACE , slot -> getRace ( ) ) ; playerItem -> setData ( ChannellistDelegate :: SLOT_COMPUTER_TYPE , slot -> getComputerType ( ) ) ; playerItem -> setData ( ChannellistDelegate :: SLOT_HANDICAP , slot -> getHandicap ( ) ) ; if ( slot -> getPlayer ( ) ) { playerItem -> setData ( ChannellistDelegate :: USER , slot -> getPlayer ( ) -> getName ( ) . getMessage ( ) ) ; playerItem -> setData ( ChannellistDelegate :: COLOR_USER , slot -> getPlayer ( ) -> getName ( ) . getColor ( ) ) ; } else { playerItem -> setData ( ChannellistDelegate :: USER , " " ) ; } widget . channelList -> addItem ( playerItem ) ; } }
Sets the new slotlist of the game.
Sets the new slotlist of the game .