2 * Copyright (C) 2011 Lukáš Karas <lukas.karas@centrum.cz>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 console.log("II [VideoWidget.qml]: "+msg);
37 console.log("EE [VideoWidget.qml]: "+msg);
40 console.log("WW [VideoWidget.qml]: "+msg);
42 function setSessionsModel(model){
43 chatWidget.sendMessage.connect(model.sendTextMessage);
53 source: "img/fullscreen.png"
57 anchors.left: board.right;
58 anchors.bottom: board.bottom
65 source: "img/minimize.png"
69 anchors.left: videoWidget.parent.left;
70 anchors.bottom: videoWidget.parent.bottom
75 property variant session;
76 property variant emptyVideoSurface: VideoSurface{}
77 property variant emptyPreviewSurface: VideoSurface{}
79 function videoSurfaceReady(type, sessionId, newSurface){
80 if (sessionId != session.sessionId)
84 log("video surface ready \""+type+"\" \""+sessionId+"\" "+newSurface+"");
85 //log(JSON.stringify());
88 log("setting surface for previewVideoItem");
89 previewVideoItem.surface = newSurface;
91 log("setting surface for mainVideoItem");
92 mainVideoItem.surface = newSurface;
95 error(JSON.stringify(e));
98 function videoSurfaceRemoved(type, sessionId){
99 if (sessionId != session.sessionId)
103 log("video surface removed \""+type+"\" \""+sessionId+"\"");
104 //log(JSON.stringify(surface));
105 if (type=="preview"){
106 previewVideoItem.surface = emptyPreviewSurface;
108 mainVideoItem.surface = emptyVideoSurface;
111 error(JSON.stringify(e));
116 Component.onCompleted:{
117 videoWidget.session = videoWidget.parent;
118 main.videoSurfaceReady.connect(videoSurfaceReady);
119 main.videoSurfaceRemoved.connect(videoSurfaceRemoved);
124 NumberAnimation{duration: 200}
126 Behavior on opacity {
127 NumberAnimation{duration: 200}
130 NumberAnimation{duration: 200}
133 transitions: Transition {
134 // smoothly reanchor myRect and move into new position
135 AnchorAnimation { duration: 200 }
142 BorderImage { source: "img/lineedit.sci"; anchors.fill: parent }
143 anchors{fill: parent; margins:4 }
146 source: "img/cam.svg"
147 anchors.centerIn: parent;
148 width: Math.min( parent.width / 3, parent.height / 3)
159 surface: emptyVideoSurface
160 size: Qt.size(parent.width, parent.height)
161 //anchors.fill: parent
165 anchors{left: parent.left; bottom: parent.bottom}
166 width: Math.max(80, Math.min(320, parent.width /3));
167 height: (width / 4) * 3
172 surface: emptyPreviewSurface
173 size: Qt.size(parent.width, parent.height)
180 source: "img/fullscreen.png"
181 anchors{right: parent.right; bottom: parent.bottom}
188 //videoWidget.state = videoWidget.state == "normal"? "fullscreen": "normal"
189 if (videoWidget.state == "normal")
190 videoWidget.parent.fullScreenVideo();
192 videoWidget.parent.minimizeVideo();