use system palete colors
[makneto-zunavac1.git] / src / ui-mobile / declarative / SessionControlPanel.qml
blobc013c992fceef5efdd8dcb45448ef9c6b9cb6fcd
1 /*
2  *   Copyright (C) 2011 Lukáš Karas <lukas.karas@centrum.cz>
3  *
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.
8  *
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.
13  *
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.
18  */
19 import Qt 4.7
21 TopPanel{
22     id: sessionToolbar
23     //BorderImage { source: "img/toolbar.sci"; anchors.fill: parent }
24     //color: "transparent"
25     //y: 10
26     //width: height * 3
27     height: 40
28     //anchors.horizontalCenter: parent.horizontalCenter
29     anchors{top: parent.top; left: parent.left; right: parent.right}
30     state: "chat"
31     //anchors.right: crossIcon.right
33     signal requestCall(string sessionId, bool video);
34     signal requestHangup(string sessionId);
36     function log(msg){
37         console.log("II [SessionControlPanel.qml]: "+msg);
38     }
39     function error(msg){
40         console.log("EE [SessionControlPanel.qml]: "+msg);
41     }
42     function warn(msg){
43         console.log("WW [SessionControlPanel.qml]: "+msg);
44     }
46     function updateMicIcon(b){
47         //micIcon.source = b ? "img/mic-on.svg": "img/mic-off.png";
48     }
50     Rectangle{
51         width: height * 3
52         anchors{top: parent.top; bottom: parent.bottom}
53         anchors.horizontalCenter: parent.horizontalCenter
54         color: "transparent"
56         Image {
57             id: boardIcon
58             source: "img/table.svg"
59             height: parent.height * 0.8
60             width: height
61             anchors{ margins: parent.height*0.1; left: parent.left; top: parent.top }
63             MouseArea{
64                 anchors.fill: parent
65                 onClicked: {
66                     sessionToolbar.parent.setBoard(!sessionToolbar.parent.board);
67                 }
68             }
69         }
71         Image {
72             id: callIcon
73             source: "img/call-start.png"
74             height: parent.height * 0.8
75             width: height
76             anchors{ margins: parent.height*0.1; left: boardIcon.right; top: parent.top }
77             MouseArea{
78                 anchors.fill: parent
79                 onClicked: {
80                     if (sessionToolbar.state == "call"){
81                         log("request hangup "+sessionToolbar.parent.sessionId);
82                         requestHangup(sessionToolbar.parent.sessionId);
83                     }else{
84                         log("request audio call "+sessionToolbar.parent.sessionId);
85                         requestCall(sessionToolbar.parent.sessionId, false);
86                     }
87                 }
88             }
89         }
91         Image {
92             id: camIcon
93             source: "img/cam.svg"
94             height: parent.height * 0.8
95             width: 0
96             //visible: false
97             anchors{ margins: 0; left: callIcon.right; top: parent.top }
98             MouseArea{
99                 anchors.fill: parent
100                 onClicked: {
101                     log("request video call "+sessionToolbar.parent.sessionId);
102                     requestCall(sessionToolbar.parent.sessionId, true);
103                 }
104             }
105         }
107         Image {
108             id: crossIcon
109             source: "img/cross.svg"
110             height: parent.height * 0.8
111             width: height
112             anchors{ margins: parent.height*0.1; left: camIcon.right; top: parent.top}
114             MouseArea{
115                 anchors.fill: parent
116                 onClicked: {
117                     sessionToolbar.parent.closeSession();
118                 }
119             }
120         }
121     }
123     states: [
124         State {
125             name: "chat"
126             PropertyChanges { target: sessionToolbar; width:  height*4}
127             PropertyChanges { target: callIcon; source: "img/call-start.png" }
128             PropertyChanges { target: camIcon; anchors.margins: parent.height*0.1; visible: true; width: height; }
129         },
130         State {
131             name: "call"
132             PropertyChanges { target: callIcon; source: "img/call-end.png";}
133             PropertyChanges { target: sessionToolbar; width:  height*3 }
134             PropertyChanges { target: camIcon; anchors.margins:0; visible: false; width: 0; }
135         }
136     ]
138     transitions: [
139         Transition {
140             from: "chat"; to: "call"
141             NumberAnimation { properties: "width,height,x,y,anchors.margins"; easing.type: Easing.InOutQuad; duration: 500 }
142         },
143         Transition {
144             from: "call"; to: "chat"
145             NumberAnimation { properties: "width,height,x,y,anchors.margins"; easing.type: Easing.InOutQuad; duration: 500 }
146         }
147     ]