Changeset 286:dc0e36586866 in qutecom-coip


Ignore:
Timestamp:
Jul 28, 2011 5:50:49 AM (22 months ago)
Author:
laurent <laurent@…>
Branch:
default
Message:

registering indicator process

Location:
gui
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • gui/resources/pix/pix.qrc

    r284 r286  
    55        <file>account/warning.png</file> 
    66        <file>account/avatar_background.png</file> 
     7        <file>account/loading.png</file> 
    78        <file>protocol/aim.png</file> 
    89        <file>protocol/facebook.png</file> 
  • gui/src/account/accountmonitoritem.cpp

    r283 r286  
    66:QWidget(parent),ui(new Ui::AccountMonitorItem),_accountId(accountdId) 
    77{        
     8    _hideTimer = 0; 
     9    _animationTimer = 0; 
     10     
    811    QPalette pal = palette(); 
    912    pal.setBrush(backgroundRole(), pal.dark()); 
     
    6871                        if( state == EnumConnectionState::ConnectionStateDisconnected) 
    6972                        { 
     73                stopAnimationTimer(); 
    7074                                ui->pushButtonPresence->setText("disconnected"); 
     75                QPixmap pix = Pix::getPresencePix(EnumPresenceState::PresenceStateOffline); 
     76                ui->labelPresence->setPixmap(pix); 
    7177                                show(); 
    7278                        } 
    7379                        else if( state == EnumConnectionState::ConnectionStateConnected) 
    7480                        { 
     81                stopAnimationTimer(); 
    7582                                ui->pushButtonPresence->setText("connected"); 
    76                                 _hideTimer = startTimer(1500); 
     83                QPixmap pix = Pix::getPresencePix(account->getPresenceState()); 
     84                ui->labelPresence->setPixmap(pix); 
     85                                startHideTimer(); 
    7786                        } 
    7887                } 
     
    8897                if(account) 
    8998                { 
     99            stopAnimationTimer(); 
    90100                        ui->pushButtonPresence->setText("Error"); 
     101            QPixmap pix = Pix::getPresencePix(EnumPresenceState::PresenceStateOffline); 
     102                        ui->labelPresence->setPixmap(pix); 
    91103                        show(); 
    92104                } 
     
    102114                if(account) 
    103115                { 
     116            startAnimationTimer(); 
    104117                        ui->pushButtonPresence->setText("registering"); 
    105118                        show(); 
     
    124137                AccountList accountList = Coip::self()->getTUserProfileManager().getCopyOfUserProfile().getAccountList(); 
    125138                Account * account = AccountListHelper::getCopyOfAccount(accountList, accountId); 
    126                 if(account) 
     139                if(account && _animationTimer == 0) 
    127140                { 
    128141                        QPixmap pix = Pix::getPresencePix(account->getPresenceState()); 
     
    138151        if(account) 
    139152        { 
    140                  
    141153                account->setPresenceState(presenceState); 
    142154                Coip::self()->getTUserProfileManager().getTAccountManager().update(*account,EnumUpdateSection::UpdateSectionPresenceState); 
     
    192204} 
    193205 
     206void AccountMonitorItem::startAnimationTimer() 
     207{ 
     208    if(_animationTimer == 0) 
     209        _animationTimer = startTimer(50); 
     210} 
     211 
     212void AccountMonitorItem::stopAnimationTimer() 
     213{ 
     214    if (_animationTimer > 0) 
     215    { 
     216        killTimer(_animationTimer); 
     217        _animationTimer = 0; 
     218    } 
     219} 
     220 
     221void AccountMonitorItem::startHideTimer() 
     222{ 
     223    if(_hideTimer == 0) 
     224        _hideTimer = startTimer(1500); 
     225} 
     226void AccountMonitorItem::stopHideTimer() 
     227{ 
     228    if (_hideTimer > 0) 
     229    { 
     230        killTimer(_hideTimer); 
     231        _hideTimer = 0; 
     232    } 
     233} 
     234 
    194235void AccountMonitorItem::timerEvent(QTimerEvent *e) 
    195236{ 
    196237        if(e->timerId() == _hideTimer) 
    197238        { 
    198                 killTimer(_hideTimer); 
     239                stopHideTimer(); 
    199240                hide(); 
    200241        } 
    201 } 
     242    else if(e->timerId() == _animationTimer) 
     243    { 
     244        QTransform transform; 
     245        transform.rotate(_angle); 
     246        QPixmap pix = QPixmap(":/account/loading.png").transformed(transform,Qt::SmoothTransformation).scaled(9,9); 
     247        ui->labelPresence->setPixmap(pix); 
     248        _angle += 10; 
     249    } 
     250} 
  • gui/src/account/accountmonitoritem.h

    r283 r286  
    1717        std::string _accountId; 
    1818        int _hideTimer; 
     19    int _animationTimer; 
     20    int _angle; 
    1921         
    2022        void updatePresenceState(EnumPresenceState::PresenceState presenceState); 
     23     
     24    void startAnimationTimer(); 
     25    void stopAnimationTimer(); 
     26     
     27    void startHideTimer(); 
     28    void stopHideTimer(); 
    2129         
    2230public: 
Note: See TracChangeset for help on using the changeset viewer.