-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathContacts.qml
109 lines (101 loc) · 2.68 KB
/
Contacts.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
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1
Item {
id: contacts;
anchors.fill: parent;
signal talkTo(int peerIndex);
signal startScan();
objectName: "contacts";
function scanAccessPoint(){
startScan();
scanButton.enabled = false;
apmodel.scan();
}
Rectangle {
id: title;
width: parent.width;
height: 48;
color: "#7378ba";
ImageButton {
id: scanButton;
anchors.centerIn: parent;
width: 48;
height: 48;
z: 2;
iconNormal: "res/ic_search.png";
iconPressed: "res/ic_search_pressed.png";
onClicked: scanAccessPoint();
}
}
ListView {
id: peoples;
anchors.left: parent.left;
anchors.right: parent.right;
anchors.top: title.bottom;
anchors.bottom: requestTalk.top;
anchors.margins: 4;
clip: true;
spacing: 6;
highlight: Rectangle {
width: peoples.width;
color: "lightsteelblue";
}
model: apmodel;
delegate: Item{
id: wrapper;
width: parent.width;
height: Math.max(52, 8 + fontUtil.height(20));
Image {
id: headPortrait;
source: "res/head_%1.png".arg(portraitIndex);
width: 48;
height: 48;
x: 2;
y: 2;
}
Text {
id: nick;
font.pointSize: 20;
anchors.left: headPortrait.right;
anchors.leftMargin: 4;
anchors.verticalCenter: headPortrait.verticalCenter;
text: nickName;
}
MouseArea {
anchors.fill: parent;
onClicked: {
wrapper.ListView.view.currentIndex = index;
}
}
}
}
Rectangle {
id: requestTalk;
width: parent.width;
height: 64;
anchors.bottom: parent.bottom;
color: "gray"; //"#605550";
ImageButton {
anchors.centerIn: parent;
width: 60;
height: 64;
z: 2;
iconNormal: "res/ic_chat.png";
iconPressed: "res/ic_chat_pressed.png";
onClicked: {
var cur = peoples.currentIndex;
if(cur >= 0){
contacts.talkTo(cur);
}
}
}
}
Connections {
target: apmodel;
onScanFinished:{
console.log("scanFinished");
scanButton.enabled = true;
}
}
}