- Timestamp:
- Aug 26, 2011 4:30:18 AM (13 years ago)
- Location:
- pjproject/trunk/pjsip-apps/src/vidgui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/vidgui/vidgui.cpp
r3724 r3726 51 51 52 52 initLayout(); 53 onCallReleased();53 emit signalCallReleased(); 54 54 } 55 55 … … 102 102 connect(quitButton_, SIGNAL(clicked()), this, SLOT(quit())); 103 103 //connect(this, SIGNAL(close()), this, SLOT(quit())); 104 105 // UI updates must be done in the UI thread! 106 connect(this, SIGNAL(signalNewCall(int, bool)), 107 this, SLOT(onNewCall(int, bool))); 108 connect(this, SIGNAL(signalCallReleased()), 109 this, SLOT(onCallReleased())); 110 connect(this, SIGNAL(signalInitVideoWindow()), 111 this, SLOT(initVideoWindow())); 112 connect(this, SIGNAL(signalShowStatus(const QString&)), 113 this, SLOT(doShowStatus(const QString&))); 104 114 } 105 115 106 116 void MainWin::quit() 107 117 { 108 //if (preview_on)109 //preview();110 111 118 delete video_prev_; 112 119 video_prev_ = NULL; … … 120 127 void MainWin::showStatus(const char *msg) 121 128 { 129 PJ_LOG(3,(THIS_FILE, "%s", msg)); 130 131 QString msg_ = QString::fromUtf8(msg); 132 emit signalShowStatus(msg_); 133 } 134 135 void MainWin::doShowStatus(const QString& msg) 136 { 122 137 //statusBar_->showMessage(msg); 123 138 statusBar_->setText(msg); 124 PJ_LOG(3,(THIS_FILE, "%s", msg));125 139 } 126 140 … … 135 149 } 136 150 137 void MainWin::onNewCall( pjsua_call_idcid, bool incoming)151 void MainWin::onNewCall(int cid, bool incoming) 138 152 { 139 153 pjsua_call_info ci; … … 206 220 //X11 Display 207 221 //status = pjsua_vid_win_set_show(wid, PJ_TRUE); 208 video_prev_->show(); 222 //This is handled by VidWin now 223 //video_prev_->show(); 209 224 showStatus("Preview started"); 210 225 … … 224 239 pj_status_t status; 225 240 QString dst = url_->text(); 226 const char *uri = dst.toAscii().data(); 241 char uri[256]; 242 243 pj_ansi_strncpy(uri, dst.toAscii().data(), sizeof(uri)); 227 244 pj_str_t uri2 = pj_str((char*)uri); 228 245 … … 243 260 //pjsua_call_hangup(currentCall_, PJSIP_SC_BUSY_HERE, NULL, NULL); 244 261 pjsua_call_hangup_all(); 245 onCallReleased();246 } 247 248 249 void MainWin::init _video_window()262 emit signalCallReleased(); 263 } 264 265 266 void MainWin::initVideoWindow() 250 267 { 251 268 pjsua_call_info ci; … … 311 328 312 329 if (currentCall_ == -1 && ci.state < PJSIP_INV_STATE_DISCONNECTED) { 313 onNewCall(call_id, false);330 emit signalNewCall(call_id, false); 314 331 } 315 332 … … 320 337 ci.last_status_text.ptr); 321 338 showStatus(status); 322 onCallReleased();339 emit signalCallReleased(); 323 340 } else { 324 341 snprintf(status, sizeof(status), "Call is %s", pjsip_inv_state_name(ci.state)); … … 338 355 } 339 356 340 onNewCall(call_id, true);357 emit signalNewCall(call_id, true); 341 358 342 359 pjsua_call_info ci; … … 366 383 } 367 384 } else if (ci.media[i].type == PJMEDIA_TYPE_VIDEO) { 368 init_video_window();385 emit signalInitVideoWindow(); 369 386 } 370 387 } -
pjproject/trunk/pjsip-apps/src/vidgui/vidgui.h
r3686 r3726 48 48 bool initStack(); 49 49 void showError(const char *title, pj_status_t status); 50 void showStatus(const char * );50 void showStatus(const char *msg); 51 51 52 public:53 52 void on_reg_state(pjsua_acc_id acc_id); 54 53 void on_call_state(pjsua_call_id call_id, pjsip_event *e); … … 56 55 void on_call_media_state(pjsua_call_id call_id); 57 56 57 signals: 58 void signalNewCall(int, bool); 59 void signalCallReleased(); 60 void signalInitVideoWindow(); 61 void signalShowStatus(const QString&); 62 58 63 public slots: 59 64 void preview(); … … 62 67 void quit(); 63 68 69 void onNewCall(int cid, bool incoming); 70 void onCallReleased(); 71 void initVideoWindow(); 72 void doShowStatus(const QString& msg); 73 64 74 private: 65 75 static MainWin *theInstance_; … … 67 77 pjsua_call_id currentCall_; 68 78 bool preview_on; 69 70 void onNewCall(pjsua_call_id cid, bool incoming);71 void onCallReleased();72 79 73 80 private: … … 86 93 87 94 void initLayout(); 88 void init_video_window();89 95 }; 90 96 -
pjproject/trunk/pjsip-apps/src/vidgui/vidwin.cpp
r3724 r3726 47 47 VidWin::~VidWin() 48 48 { 49 show(false); 49 50 detach(); 50 pj_bzero(&hwnd, sizeof(hwnd));51 size_hint = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);52 destroy(true, false);53 51 } 54 52 … … 56 54 { 57 55 switch(e->type()) { 56 58 57 case QEvent::Resize: 59 { 60 // revert to default size hint, make it resizable 61 setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); 62 // resize now 63 set_size(); 64 } 65 break; 66 case QEvent::ParentAboutToChange: 58 set_size(); 59 break; 60 61 case QEvent::ParentChange: 67 62 get_size(); 68 setFixedSize(size_hint); 69 break; 70 case QEvent::ParentChange: 71 { 72 get_size(); 73 /* 63 if (0) { 74 64 QRect qr = rect(); 75 65 if (qr.width() > size_hint.width()) … … 77 67 if (qr.height() > size_hint.height()) 78 68 size_hint.setWidth(qr.height()); 79 */80 setFixedSize(size_hint);81 attach();82 69 } 83 break; 70 setFixedSize(size_hint); 71 attach(); 72 break; 73 74 case QEvent::Show: 75 show(true); 76 // revert to default size hint, make it resizable 77 setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); 78 break; 79 80 case QEvent::Hide: 81 show(false); 82 break; 83 84 84 default: 85 85 break; … … 103 103 orig_parent = GetParent(w); 104 104 105 SetWindowLong(w, GWL_STYLE, WS_CHILD); 105 106 SetParent(w, new_parent); 106 SetWindowLong(w, GWL_STYLE, WS_CHILD);107 ShowWindow(w, SW_SHOWNOACTIVATE);108 107 TRACE_("%p new parent handle = %p", w, new_parent); 109 108 } … … 114 113 115 114 HWND w = (HWND)hwnd.info.win.hwnd; 116 ShowWindow(w, SW_HIDE);117 115 SetParent(w, (HWND)orig_parent); 118 116 TRACE_("%p revert parent handle to %p", w, orig_parent); … … 145 143 if (!hwnd.info.win.hwnd) return; 146 144 147 ShowWindow(hwnd.info.win.hwnd, visible ? SW_SHOW : SW_HIDE); 145 HWND w = (HWND)hwnd.info.win.hwnd; 146 ShowWindow(w, visible ? SW_SHOW : SW_HIDE); 148 147 } 149 148 -
pjproject/trunk/pjsip-apps/src/vidgui/vidwin.h
r3724 r3726 33 33 virtual ~VidWin(); 34 34 QSize sizeHint() const { return size_hint; } 35 void show(bool visible=true);36 35 37 36 protected: … … 47 46 void set_size(); 48 47 void get_size(); 48 void show(bool visible=true); 49 49 }; 50 50
Note: See TracChangeset
for help on using the changeset viewer.