Changeset 286:dc0e36586866 in qutecom-coip
- Timestamp:
- Jul 28, 2011 5:50:49 AM (22 months ago)
- Branch:
- default
- Location:
- gui
- Files:
-
- 1 added
- 3 edited
-
resources/pix/account/loading.png (added)
-
resources/pix/pix.qrc (modified) (1 diff)
-
src/account/accountmonitoritem.cpp (modified) (7 diffs)
-
src/account/accountmonitoritem.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gui/resources/pix/pix.qrc
r284 r286 5 5 <file>account/warning.png</file> 6 6 <file>account/avatar_background.png</file> 7 <file>account/loading.png</file> 7 8 <file>protocol/aim.png</file> 8 9 <file>protocol/facebook.png</file> -
gui/src/account/accountmonitoritem.cpp
r283 r286 6 6 :QWidget(parent),ui(new Ui::AccountMonitorItem),_accountId(accountdId) 7 7 { 8 _hideTimer = 0; 9 _animationTimer = 0; 10 8 11 QPalette pal = palette(); 9 12 pal.setBrush(backgroundRole(), pal.dark()); … … 68 71 if( state == EnumConnectionState::ConnectionStateDisconnected) 69 72 { 73 stopAnimationTimer(); 70 74 ui->pushButtonPresence->setText("disconnected"); 75 QPixmap pix = Pix::getPresencePix(EnumPresenceState::PresenceStateOffline); 76 ui->labelPresence->setPixmap(pix); 71 77 show(); 72 78 } 73 79 else if( state == EnumConnectionState::ConnectionStateConnected) 74 80 { 81 stopAnimationTimer(); 75 82 ui->pushButtonPresence->setText("connected"); 76 _hideTimer = startTimer(1500); 83 QPixmap pix = Pix::getPresencePix(account->getPresenceState()); 84 ui->labelPresence->setPixmap(pix); 85 startHideTimer(); 77 86 } 78 87 } … … 88 97 if(account) 89 98 { 99 stopAnimationTimer(); 90 100 ui->pushButtonPresence->setText("Error"); 101 QPixmap pix = Pix::getPresencePix(EnumPresenceState::PresenceStateOffline); 102 ui->labelPresence->setPixmap(pix); 91 103 show(); 92 104 } … … 102 114 if(account) 103 115 { 116 startAnimationTimer(); 104 117 ui->pushButtonPresence->setText("registering"); 105 118 show(); … … 124 137 AccountList accountList = Coip::self()->getTUserProfileManager().getCopyOfUserProfile().getAccountList(); 125 138 Account * account = AccountListHelper::getCopyOfAccount(accountList, accountId); 126 if(account )139 if(account && _animationTimer == 0) 127 140 { 128 141 QPixmap pix = Pix::getPresencePix(account->getPresenceState()); … … 138 151 if(account) 139 152 { 140 141 153 account->setPresenceState(presenceState); 142 154 Coip::self()->getTUserProfileManager().getTAccountManager().update(*account,EnumUpdateSection::UpdateSectionPresenceState); … … 192 204 } 193 205 206 void AccountMonitorItem::startAnimationTimer() 207 { 208 if(_animationTimer == 0) 209 _animationTimer = startTimer(50); 210 } 211 212 void AccountMonitorItem::stopAnimationTimer() 213 { 214 if (_animationTimer > 0) 215 { 216 killTimer(_animationTimer); 217 _animationTimer = 0; 218 } 219 } 220 221 void AccountMonitorItem::startHideTimer() 222 { 223 if(_hideTimer == 0) 224 _hideTimer = startTimer(1500); 225 } 226 void AccountMonitorItem::stopHideTimer() 227 { 228 if (_hideTimer > 0) 229 { 230 killTimer(_hideTimer); 231 _hideTimer = 0; 232 } 233 } 234 194 235 void AccountMonitorItem::timerEvent(QTimerEvent *e) 195 236 { 196 237 if(e->timerId() == _hideTimer) 197 238 { 198 killTimer(_hideTimer);239 stopHideTimer(); 199 240 hide(); 200 241 } 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 17 17 std::string _accountId; 18 18 int _hideTimer; 19 int _animationTimer; 20 int _angle; 19 21 20 22 void updatePresenceState(EnumPresenceState::PresenceState presenceState); 23 24 void startAnimationTimer(); 25 void stopAnimationTimer(); 26 27 void startHideTimer(); 28 void stopHideTimer(); 21 29 22 30 public:
Note: See TracChangeset
for help on using the changeset viewer.
