-
Notifications
You must be signed in to change notification settings - Fork 1
/
Chat.qml
223 lines (175 loc) · 5.08 KB
/
Chat.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
import QtQuick 2.2
import QtQuick.Controls 2.2
import QtQuick.Dialogs 1.2
//import QtWebKit 3.0
//import QtWebView 1.0
import QtQuick.Window 2.0
import QtPositioning 5.2
import QtQuick.Controls.Material 2.2
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import QtQuick.LocalStorage 2.0 as Sql
Item {
id:thisWindow
property int roomId: 0
clip: true
states: [
State {
name: "Active"
PropertyChanges {
target:thisWindow
x:0
}
},
State {
name: "InActive"
PropertyChanges {
target:thisWindow
x:width * -1
}
}
]
transitions: [
Transition {
from: "InActive"
to: "Active"
reversible: true
NumberAnimation {
target: thisWindow
property: "x"
duration: 200
easing.type: Easing.InOutQuad
}
}
]
Rectangle {
anchors.fill: parent
color:backgroundColor
}
ListView {
id:chatLog
width:parent.width
height:parent.height - bottomBar.height
verticalLayoutDirection: ListView.BottomToTop
spacing:thisWindow.height * 0.01
clip:true
model: ListModel {
id:chatlog
ListElement {
who:151
speaker:"Someone Else"
timecode:1231213914534
message:"Talk later."
}
ListElement {
who:151
speaker: "Someone Else"
timecode:1231213814534
message:"Not bad, I've got lots to do though."
}
ListElement {
who:150
speaker: "Benjamin Flanagin"
timecode:1231213414534
message:"Hey, How's it going?"
}
}
delegate: Item {
width:parent.width * 0.60
height:content.height * 1.2
anchors.right:if(who == usercardNum) {parent.right} else {""}
//anchors.left:if(who != usercardNum) {parent.left} else {""}
clip:true
Rectangle {anchors.centerIn: content
width:content.width
height:content.height
color:"white"
radius:5
}
Column {
id:content
anchors.horizontalCenter: parent.horizontalCenter
width:parent.width * 0.98
spacing: thisWindow.height * 0.01
Text {
text:if(who == usercardNum) {"<h2>You</h2>"} else {"<h2>"+speaker+"</h2>"}
// font.pixelSize: thisWindow.width * 0.035
width:parent.width * 0.98
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignLeft
//anchors.left:parent.left
Text {
text:timecode
width:parent.width * 0.5
// font.pixelSize: thisWindow.width
horizontalAlignment: Text.AlignRight
anchors.right:parent.right
opacity: 0.1
}
}
Rectangle {
anchors.horizontalCenter:parent.horizontalCenter
width:parent.width * 0.98
height:thisWindow.height * 0.005
color:seperatorColor1
}
Text {
text:"<p>"+message+"</p>"
// font.pixelSize: thisWindow.width * 0.3
width:parent.width * 0.98
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.LeftRight
wrapMode: Text.WordWrap
}
}
}
}
Rectangle {
id:bottomBar
anchors.bottom:parent.bottom
width:parent.width
height:parent.height * 0.08
color:bottombarColor
Image {
id:addstuff
anchors.verticalCenter: parent.verticalCenter
anchors.left:parent.left
anchors.leftMargin: thisWindow.height * 0.01
height:parent.height * 0.6
width:parent.height * 0.6
source:"./img/add.svg"
Flasher {
}
}
TextField {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
// anchors.left:addstuff.right
// anchors.leftMargin:addstuff.width * 0.4
width:parent.width - addstuff.width * 1.8 - sendMsg.width * 1.5
height:parent.height * 0.6
maximumLength: 144
}
Image {
id:sendMsg
anchors.right:parent.right
anchors.rightMargin: thisWindow.height * 0.01
source:"./img/message.svg"
anchors.verticalCenter: parent.verticalCenter
width:parent.height * 0.6
height:parent.height * 0.6
Flasher {
}
}
}
DropShadow {
anchors.fill:bottomBar
horizontalOffset: 0
verticalOffset: -4
radius: 8.0
samples: 17
color: "#80000000"
source:bottomBar
z:1
}
}