示例#1
0
bool SessionManager::addSession( std::string address, SessionType type )
{
    lockSessions();

    bool ret = true;
    bool audio = ( type == AUDIOSESSION );
    SessionEntry* entry = new SessionEntry( address, audio );
    Group* sessions = sessionMap[ type ];
    entry->setPos( sessions->getX(), sessions->getY() );
    Texture t = GLUtil::getInstance()->getTexture( "circle" );
    entry->setTexture( t.ID, t.width, t.height );

    if ( type != AVAILABLEVIDEOSESSION )
    {
        ret = ret && initSession( entry );
    }

    /*
     * Note - used to delete entries on fail. Now will display an entry in a
     * failed state, so it can potentially be reenabled when it could work.
     * (But still returns false on failed init)
     */

    sessions->add( entry );
    objectManager->lockSources();
    objectManager->addToDrawList( entry );
    objectManager->unlockSources();
    entry->show( shown, !shown );

    recalculateSize();

    unlockSessions();
    return ret;
}