source/MainGUI.cpp
/**
 * Adds a user to the channellist.
 *
 * @param username The name of the user.
 * @param clanTag The clantag of the user.
 */
Adds a user to the channellist.
@param username The name of the user.
@param clanTag The clantag of the user.
Adds a user to the channellist . @param username The name of the user . @param clanTag The clantag of the user .
void MainGUI::addChannelUser (QString username, QString clanTag)
{
    for (int i = 0; i < widget.channelList->count(); i++)
    {
        QListWidgetItem *item = widget.channelList->item(i);
        if (item->data(ChannellistDelegate::USER).toString() == username)
        {
            if (item->data(ChannellistDelegate::CLAN_TAG).toString() == clanTag)
            {
                return;
            }
            else
            {
                QListWidgetItem *newItem = new QListWidgetItem();
                newItem->setData(ChannellistDelegate::USER, username);
                newItem->setData(ChannellistDelegate::CLAN_TAG, clanTag);
                addColor(newItem);
                addTooltip(newItem);
                delete widget.channelList->takeItem(i);
                widget.channelList->addItem(newItem);
                return;
            }
        }
    }
    QListWidgetItem *newItem = new QListWidgetItem();
    newItem->setData(ChannellistDelegate::USER, username);
    if (!clanTag.isEmpty())
    {
        newItem->setData(ChannellistDelegate::CLAN_TAG, clanTag);
    }
    addColor(newItem);
    addTooltip(newItem);
    widget.channelList->addItem(newItem);
}
void MainGUI :: addChannelUser ( QString username , QString clanTag ) { for ( int i = 0 ; i < widget . channelList -> count ( ) ; i ++ ) { QListWidgetItem * item = widget . channelList -> item ( i ) ; if ( item -> data ( ChannellistDelegate :: USER ) . toString ( ) == username ) { if ( item -> data ( ChannellistDelegate :: CLAN_TAG ) . toString ( ) == clanTag ) { return ; } else { QListWidgetItem * newItem = new QListWidgetItem ( ) ; newItem -> setData ( ChannellistDelegate :: USER , username ) ; newItem -> setData ( ChannellistDelegate :: CLAN_TAG , clanTag ) ; addColor ( newItem ) ; addTooltip ( newItem ) ; delete widget . channelList -> takeItem ( i ) ; widget . channelList -> addItem ( newItem ) ; return ; } } } QListWidgetItem * newItem = new QListWidgetItem ( ) ; newItem -> setData ( ChannellistDelegate :: USER , username ) ; if ( ! clanTag . isEmpty ( ) ) { newItem -> setData ( ChannellistDelegate :: CLAN_TAG , clanTag ) ; } addColor ( newItem ) ; addTooltip ( newItem ) ; widget . channelList -> addItem ( newItem ) ; }
Adds a user to the channellist.
Adds a user to the channellist .
// Update