Changeset 273:4d083abe9c33 in qutecom-coip
- Timestamp:
- Jun 24, 2010 12:20:11 AM (3 years ago)
- Branch:
- default
- Location:
- gui/src/call
- Files:
-
- 2 edited
-
callwidget.cpp (modified) (7 diffs)
-
callwidget.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gui/src/call/callwidget.cpp
r195 r273 5 5 :QMainWindow(parent),_tCallSession(tCallSession),ui(new Ui::CallWidget) 6 6 { 7 _timerIdProgressAnimation = 0; 8 _timerIdSession = 0; 9 _durationSession = 0; 10 11 _lastStatus = EnumPhoneCallState::PhoneCallStateIncoming; 12 7 13 ui->setupUi(this); 8 14 9 _callButton = new CallButton;10 statusBar()->addPermanentWidget(_callButton);11 15 _labelMsg = new QLabel; 12 16 statusBar()->addWidget(_labelMsg); … … 14 18 15 19 _remoteVideoFrame = QPixmap(":/qute.png"); 16 17 connect(_callButton,SIGNAL(clickedSignal()),this,SLOT(callButtonClickedSlot()));18 20 19 21 connect(_tCallSession, … … 31 33 :QMainWindow(parent),ui(new Ui::CallWidget) 32 34 { 35 _timerIdProgressAnimation = 0; 36 _timerIdSession = 0; 37 _durationSession = 0; 38 39 _lastStatus = EnumPhoneCallState::PhoneCallStateUnknown; 40 33 41 ui->setupUi(this); 34 42 35 _callButton = new CallButton;36 statusBar()->addPermanentWidget(_callButton);37 43 _labelMsg = new QLabel; 38 44 statusBar()->addWidget(_labelMsg); … … 40 46 41 47 _remoteVideoFrame = QPixmap(":/qute.png"); 42 43 connect(_callButton,SIGNAL(clickedSignal()),this,SLOT(callButtonClickedSlot()));44 45 _callButton->hide();46 48 47 49 _tCallSession = Coip::self()->getTCallSessionManager().createTCallSession(); … … 83 85 { 84 86 QPainter painter(this); 87 painter.setRenderHint(QPainter::Antialiasing, true); 85 88 86 89 if(!_remoteVideoFrame.isNull()) 87 painter.drawPixmap(ui->label->pos(),_remoteVideoFrame.scaled(ui->label->size(),Qt::KeepAspectRatio,Qt::SmoothTransformation)); 90 { 91 QPixmap pix = _remoteVideoFrame.scaled(ui->label->size(),Qt::KeepAspectRatio,Qt::SmoothTransformation); 92 QRect re(0,0,pix.width(),pix.height()); 93 re.moveCenter(ui->label->rect().center()); 94 painter.drawPixmap(re,pix); 95 } 96 88 97 if(!_localVideoFrame.isNull()) 89 98 painter.drawPixmap(ui->label->pos(),_localVideoFrame.scaled(ui->label->size()/6,Qt::KeepAspectRatio,Qt::SmoothTransformation)); 90 } 99 100 if(_lastStatus != EnumPhoneCallState::PhoneCallStateTalking) 101 { 102 painter.fillRect(centralWidget()->rect(),QColor(30,30,30,200)); 103 104 if(!_timerIdProgressAnimation && (_lastStatus == EnumPhoneCallState::PhoneCallStateIncoming || _lastStatus == EnumPhoneCallState::PhoneCallStateHold)) 105 { 106 painter.setPen(QPen(QColor(255,255,255,200), 3)); 107 QRect re(0,0,50,50); 108 re.moveCenter(centralWidget()->rect().center()); 109 painter.drawEllipse(re); 110 111 re.translate(re.width()/4, 0); 112 painter.setBrush(QColor(255,255,255,200)); 113 painter.drawPie(re, 150 * 16, 60 * 16); 114 } 115 } 116 117 if(_timerIdProgressAnimation) 118 { 119 for (int i=0; i<9; i++) 120 { 121 QColor color = Qt::white; 122 color.setAlphaF(1.0f - (i/9.0f)); 123 painter.setPen(Qt::NoPen); 124 painter.setBrush(color); 125 painter.save(); 126 painter.translate(centralWidget()->rect().center()); 127 painter.rotate(_angleProgressAnimation - i*40.0f); 128 painter.drawRect(QRectF(5.5, 0.9, 21.5, 5)); 129 painter.restore(); 130 } 131 } 132 } 133 134 void CallWidget::mouseReleaseEvent(QMouseEvent *) 135 { 136 if(_tCallSession->isStarted()) 137 { 138 if(_lastStatus == EnumPhoneCallState::PhoneCallStateTalking) 139 { 140 startProgressAnimation(); 141 _tCallSession->pause(); 142 } 143 else if(_lastStatus == EnumPhoneCallState::PhoneCallStateHold) 144 { 145 startProgressAnimation(); 146 _tCallSession->resume(); 147 } 148 149 } 150 else if(_lastStatus == EnumPhoneCallState::PhoneCallStateIncoming) 151 { 152 startProgressAnimation(); 153 _tCallSession->start(); 154 } 155 } 156 157 void CallWidget::timerEvent(QTimerEvent* event) 158 { 159 if(event->timerId() == _timerIdProgressAnimation) 160 { 161 _angleProgressAnimation = (_angleProgressAnimation+30)%360; 162 update(); 163 } 164 else if(event->timerId() == _timerIdSession) 165 { 166 _durationSession++; 167 QTime time; 168 setWindowTitle(time.addSecs(_durationSession).toString()); 169 } 170 } 171 172 void CallWidget::startSessionTimer() 173 { 174 _timerIdSession = startTimer(1000); 175 } 176 177 void CallWidget::stopSessionTimer() 178 { 179 killTimer(_timerIdSession); 180 } 181 182 void CallWidget::startProgressAnimation() 183 { 184 if(!_timerIdProgressAnimation) 185 _timerIdProgressAnimation = startTimer(100); 186 } 187 188 void CallWidget::stopProgressAnimation() 189 { 190 if(_timerIdProgressAnimation) 191 { 192 killTimer(_timerIdProgressAnimation); 193 _timerIdProgressAnimation = 0; 194 } 195 } 196 91 197 92 198 void CallWidget::hangUpButtonClicked() { 93 199 94 200 _tCallSession->stop(); 95 //_ui->hangUpButton->setEnabled(false);96 201 } 97 202 … … 108 213 109 214 void CallWidget::phoneCallStateChangedSlot(EnumPhoneCallState::PhoneCallState state) { 215 216 _lastStatus = state; 217 110 218 switch(state) { 111 219 //case EnumPhoneCallState::PhoneCallStateUnknown: 112 220 case EnumPhoneCallState::PhoneCallStateClosed: 221 stopProgressAnimation(); 222 stopSessionTimer(); 223 _labelMsg->setText("Closed..."); 224 break; 225 113 226 case EnumPhoneCallState::PhoneCallStateError: 114 _labelMsg->setText("Closed...");115 _callButton->showProgressIndicator(false);116 _ callButton->hide();227 stopProgressAnimation(); 228 stopSessionTimer(); 229 _labelMsg->setText("Error..."); 117 230 break; 118 231 119 232 case EnumPhoneCallState::PhoneCallStateTalking: 233 stopProgressAnimation(); 234 startSessionTimer(); 120 235 _labelMsg->setText("Talking..."); 121 _callButton->show();122 _callButton->showProgressIndicator(false);123 _callButton->setPixBackground(QPixmap(":/call/holdButtonFullScreen.png"));124 236 break; 125 237 126 238 case EnumPhoneCallState::PhoneCallStateDialing: 239 startProgressAnimation(); 127 240 _labelMsg->setText("Dialing..."); 128 _callButton->showProgressIndicator(true);129 241 break; 130 242 131 243 case EnumPhoneCallState::PhoneCallStateRinging: 132 244 _labelMsg->setText("Ringing..."); 133 _callButton->showProgressIndicator(true);134 245 break; 135 246 136 247 case EnumPhoneCallState::PhoneCallStateHold: 248 stopProgressAnimation(); 137 249 _labelMsg->setText("Hold..."); 138 _callButton->showProgressIndicator(false);139 250 break; 140 251 141 252 case EnumPhoneCallState::PhoneCallStateResumed: 142 253 _labelMsg->setText("Resumed..."); 143 _callButton->showProgressIndicator(false);144 254 break; 145 255 146 256 case EnumPhoneCallState::PhoneCallStateMissed: 257 stopProgressAnimation(); 147 258 _labelMsg->setText("Missed..."); 148 _callButton->showProgressIndicator(false);149 _callButton->hide();150 259 break; 151 260 152 261 case EnumPhoneCallState::PhoneCallStateRedirected: 262 stopProgressAnimation(); 263 stopSessionTimer(); 153 264 _labelMsg->setText("Redirected..."); 154 _callButton->showProgressIndicator(false);155 _callButton->hide();156 265 break; 157 266 … … 161 270 break; 162 271 } 272 update(); 163 273 } 164 274 -
gui/src/call/callwidget.h
r177 r273 4 4 #include <QtGui> 5 5 #include <coip/coip.h> 6 #include <call/callbutton.h>7 6 8 7 namespace Ui { … … 25 24 void closeEvent(QCloseEvent*); 26 25 void paintEvent(QPaintEvent*); 26 void mouseReleaseEvent(QMouseEvent *); 27 void timerEvent(QTimerEvent*); 27 28 28 29 private: … … 31 32 32 33 QLabel * _labelMsg; 33 CallButton * _callButton; 34 35 int _timerIdSession; 36 int _durationSession; 37 void startSessionTimer(); 38 void stopSessionTimer(); 39 40 int _timerIdProgressAnimation; 41 int _angleProgressAnimation; 42 void startProgressAnimation(); 43 void stopProgressAnimation(); 44 34 45 Ui::CallWidget *ui; 35 46 TCallSession * _tCallSession; 36 47 EnumPhoneCallState::PhoneCallState _lastStatus; 48 37 49 private Q_SLOTS: 38 50 void hangUpButtonClicked();
Note: See TracChangeset
for help on using the changeset viewer.
