Commit cc4e0252 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(Timeline): supports the selection of contact

parent bd3eb748
...@@ -27,7 +27,7 @@ Item { ...@@ -27,7 +27,7 @@ Item {
effect: ShaderEffect { effect: ShaderEffect {
property var image: imageContainer property var image: imageContainer
fragmentShader: " fragmentShader: '
uniform lowp sampler2D image; uniform lowp sampler2D image;
uniform lowp sampler2D mask; uniform lowp sampler2D mask;
uniform lowp float qt_Opacity; uniform lowp float qt_Opacity;
...@@ -39,7 +39,7 @@ Item { ...@@ -39,7 +39,7 @@ Item {
texture2D(mask, qt_TexCoord0).a * texture2D(mask, qt_TexCoord0).a *
qt_Opacity; qt_Opacity;
} }
" '
} }
enabled: true enabled: true
......
...@@ -7,7 +7,7 @@ import Common 1.0 ...@@ -7,7 +7,7 @@ import Common 1.0
QtObject { QtObject {
property QtObject sipAddress: QtObject { property QtObject sipAddress: QtObject {
property color color: Colors.d property color color: Colors.w
property int fontSize: 10 property int fontSize: 10
} }
......
...@@ -7,9 +7,27 @@ import Common 1.0 ...@@ -7,9 +7,27 @@ import Common 1.0
QtObject { QtObject {
property QtObject contact: QtObject { property QtObject contact: QtObject {
property color colorA: Colors.g10
property color colorB: Colors.a
property int height: 60 property int height: 60
property QtObject backgroundColor: QtObject {
property color a: Colors.g10
property color b: Colors.a
property color selected: Colors.i
}
property QtObject sipAddress: QtObject {
property QtObject color: QtObject {
property color normal: Colors.w
property color selected: Colors.k
}
}
property QtObject username: QtObject {
property QtObject color: QtObject {
property color normal: Colors.j
property color selected: Colors.k
}
}
} }
property QtObject legend: QtObject { property QtObject legend: QtObject {
......
...@@ -13,6 +13,14 @@ ColumnLayout { ...@@ -13,6 +13,14 @@ ColumnLayout {
signal clicked (var contact) signal clicked (var contact)
// -----------------------------------------------------------------
function resetSelectedItem () {
view.currentIndex = -1
}
// -----------------------------------------------------------------
spacing: 0 spacing: 0
Rectangle { Rectangle {
...@@ -51,6 +59,7 @@ ColumnLayout { ...@@ -51,6 +59,7 @@ ColumnLayout {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
currentIndex: -1
delegate: Item { delegate: Item {
height: TimelineStyle.contact.height height: TimelineStyle.contact.height
...@@ -58,10 +67,20 @@ ColumnLayout { ...@@ -58,10 +67,20 @@ ColumnLayout {
Contact { Contact {
anchors.fill: parent anchors.fill: parent
color: index % 2 == 0 color: view.currentIndex === index
? TimelineStyle.contact.colorA ? TimelineStyle.contact.backgroundColor.selected
: TimelineStyle.contact.colorB : (
index % 2 == 0
? TimelineStyle.contact.backgroundColor.a
: TimelineStyle.contact.backgroundColor.b
)
contact: $contact contact: $contact
sipAddressColor: view.currentIndex === index
? TimelineStyle.contact.sipAddress.color.selected
: TimelineStyle.contact.sipAddress.color.normal
usernameColor: view.currentIndex === index
? TimelineStyle.contact.username.color.selected
: TimelineStyle.contact.username.color.normal
} }
MouseArea { MouseArea {
...@@ -71,7 +90,10 @@ ColumnLayout { ...@@ -71,7 +90,10 @@ ColumnLayout {
: Qt.ArrowCursor : Qt.ArrowCursor
hoverEnabled: true hoverEnabled: true
onClicked: timeline.clicked($contact) onClicked: {
view.currentIndex = index
timeline.clicked($contact)
}
} }
} }
} }
......
...@@ -138,6 +138,8 @@ ApplicationWindow { ...@@ -138,6 +138,8 @@ ApplicationWindow {
}] }]
onEntrySelected: { onEntrySelected: {
timeline.resetSelectedItem()
if (entry === 0) { if (entry === 0) {
setView('Home') setView('Home')
} else if (entry === 1) { } else if (entry === 1) {
...@@ -148,6 +150,8 @@ ApplicationWindow { ...@@ -148,6 +150,8 @@ ApplicationWindow {
// History. // History.
Timeline { Timeline {
id: timeline
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
model: ContactsListModel {} // Use History list. model: ContactsListModel {} // Use History list.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment