Commit 88e0688e authored by Ronan Abhamon's avatar Ronan Abhamon

unstable

parent a0ea030f
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
<file>ui/modules/Common/Styles/qmldir</file> <file>ui/modules/Common/Styles/qmldir</file>
<file>ui/modules/Common/Styles/SearchBoxStyle.qml</file> <file>ui/modules/Common/Styles/SearchBoxStyle.qml</file>
<file>ui/modules/Common/View/ScrollableListView.qml</file> <file>ui/modules/Common/View/ScrollableListView.qml</file>
<file>ui/modules/Linphone/Call/CallControls.qml</file>
<file>ui/modules/Linphone/Chat/Chat.qml</file> <file>ui/modules/Linphone/Chat/Chat.qml</file>
<file>ui/modules/Linphone/Chat/Event.qml</file> <file>ui/modules/Linphone/Chat/Event.qml</file>
<file>ui/modules/Linphone/Chat/IncomingMessage.qml</file> <file>ui/modules/Linphone/Chat/IncomingMessage.qml</file>
......
...@@ -7,8 +7,6 @@ import QtQuick 2.7 ...@@ -7,8 +7,6 @@ import QtQuick 2.7
// =================================================================== // ===================================================================
Item { Item {
default property alias content: content.data
property var borderColor property var borderColor
property var borderWidth property var borderWidth
...@@ -22,6 +20,8 @@ Item { ...@@ -22,6 +20,8 @@ Item {
property int rightWidth: 0 property int rightWidth: 0
property int topWidth: 0 property int topWidth: 0
default property alias _content: content.data
Rectangle { Rectangle {
id: bottomBorder id: bottomBorder
......
...@@ -9,11 +9,11 @@ import Common.Styles 1.0 ...@@ -9,11 +9,11 @@ import Common.Styles 1.0
// =================================================================== // ===================================================================
Window { Window {
default property alias content: content.data // Required.
property alias buttons: buttons.data // Optionnal. property alias buttons: buttons.data // Optionnal.
property alias descriptionText: description.text // Optionnal. property alias descriptionText: description.text // Optionnal.
property bool centeredButtons: false property bool centeredButtons: false
default property alias _content: content.data // Required.
property bool _disableExitStatus property bool _disableExitStatus
signal exitStatus (int status) signal exitStatus (int status)
......
...@@ -22,26 +22,30 @@ Item { ...@@ -22,26 +22,30 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
layer.enabled: true
layer.samplerName: 'mask'
radius: parent.width / 2
layer.effect: ShaderEffect { layer {
property var image: imageContainer effect: ShaderEffect {
property var image: imageContainer
fragmentShader: "
uniform lowp sampler2D image;
uniform lowp sampler2D mask;
uniform lowp float qt_Opacity;
fragmentShader: " varying highp vec2 qt_TexCoord0;
uniform lowp sampler2D image;
uniform lowp sampler2D mask;
uniform lowp float qt_Opacity;
varying highp vec2 qt_TexCoord0; void main () {
gl_FragColor = texture2D(image, qt_TexCoord0) *
texture2D(mask, qt_TexCoord0).a *
qt_Opacity;
}
"
}
void main () { enabled: true
gl_FragColor = texture2D(image, qt_TexCoord0) * samplerName: 'mask'
texture2D(mask, qt_TexCoord0).a *
qt_Opacity;
}
"
} }
radius: parent.width / 2
} }
} }
...@@ -19,15 +19,7 @@ Item { ...@@ -19,15 +19,7 @@ Item {
_mouseArea = builder.createObject() _mouseArea = builder.createObject()
} }
_mouseArea.parent = (function () { _mouseArea.parent = Utils.getTopParent(item)
var root = item
while (root.parent != null) {
root = root.parent
}
return root
})()
} }
function _deleteMouseArea () { function _deleteMouseArea () {
......
...@@ -2,17 +2,26 @@ import QtQuick 2.7 ...@@ -2,17 +2,26 @@ import QtQuick 2.7
import Common 1.0 import Common 1.0
import Common.Styles 1.0 import Common.Styles 1.0
import Utils 1.0
// =================================================================== // ===================================================================
// Low component to display a list/menu in a popup. // Low component to display a list/menu in a popup.
// =================================================================== // ===================================================================
Rectangle { Rectangle {
default property alias content: content.data property bool drawOnRoot: false
property int entryHeight property int entryHeight // Only with a ListView child.
property int maxMenuHeight property int maxMenuHeight // Only with a ListView child.
property var relativeTo
default property alias _content: content.data
function show () { function show () {
if (drawOnRoot) {
this.x = relativeTo.mapToItem(null, relativeTo.width, 0).x
this.y = relativeTo.mapToItem(null, relativeTo.width, 0).y
}
visible = true visible = true
} }
...@@ -20,16 +29,28 @@ Rectangle { ...@@ -20,16 +29,28 @@ Rectangle {
visible = false visible = false
} }
// Ugly. Just ugly. function _computeHeight () {
// `model` is a reference on a unknown component! var model = _content[0].model
// See usage with SearchBox. if (model == null) {
implicitHeight: { return content.height
}
var height = model.count * entryHeight var height = model.count * entryHeight
return height > maxMenuHeight ? maxMenuHeight : height return (maxMenuHeight !== undefined && height > maxMenuHeight)
? maxMenuHeight
: height
} }
implicitHeight: _computeHeight()
visible: false visible: false
z: Constants.zPopup z: Constants.zPopup
Component.onCompleted: {
if (drawOnRoot) {
parent = Utils.getTopParent(this)
}
}
Rectangle { Rectangle {
id: content id: content
......
...@@ -9,7 +9,7 @@ QtObject { ...@@ -9,7 +9,7 @@ QtObject {
property int transitionDuration: 200 property int transitionDuration: 200
property QtObject handle: QtObject { property QtObject handle: QtObject {
property int width: 10 property int width: 5
property QtObject color: QtObject { property QtObject color: QtObject {
property color hovered: Colors.h property color hovered: Colors.h
......
...@@ -6,8 +6,12 @@ import Common 1.0 ...@@ -6,8 +6,12 @@ import Common 1.0
// =================================================================== // ===================================================================
ListView { ListView {
ScrollBar.vertical: ForceScrollBar {} ScrollBar.vertical: ForceScrollBar {
id: scrollBar
}
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
clip: true clip: true
contentWidth: width - scrollBar.width
spacing: 0 spacing: 0
} }
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.0
import Linphone 1.0
import Common 1.0
RowLayout {
implicitHeight: contact.height
spacing: 1
Rectangle {
Layout.fillWidth: true
color: '#434343'
implicitHeight: contact.height
Contact {
id: contact
anchors.fill: parent
presenceLevel: Presence.Green
sipAddress: 'math.hart@sip-linphone.org'
sipAddressColor: '#FFFFFF'
username: 'Mathilda Hart'
usernameColor: '#FFFFFF'
}
}
Rectangle {
id: button
Layout.preferredHeight: contact.height
Layout.preferredWidth: 42
color: '#434343'
Text {
anchors.centerIn: parent
color: '#FFFFFF'
text: '...'
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onClicked: {
menu.show()
}
}
}
DropDownMenu {
drawOnRoot: true
id: menu
entryHeight: 22
height: 100
width: 120
relativeTo: button
Keys.onEscapePressed: hide()
Rectangle {
color: 'red'
anchors.fill: parent
}
}
}
...@@ -5,9 +5,10 @@ import QtQuick 2.7 ...@@ -5,9 +5,10 @@ import QtQuick 2.7
Item { Item {
id: container id: container
default property alias content: content.data
property alias backgroundColor: rectangle.color property alias backgroundColor: rectangle.color
default property alias _content: content.data
implicitHeight: text.contentHeight + text.padding * 2 implicitHeight: text.contentHeight + text.padding * 2
Rectangle { Rectangle {
......
import QtQuick 2.7
import Common 1.0 import Common 1.0
import Linphone 1.0 import Linphone 1.0
Item { Message {
implicitHeight: message.height id: message
width: parent.width - 16
Message {
id: message
anchors {
left: parent.left
right: parent.right
}
backgroundColor: '#E4E4E4' backgroundColor: '#E4E4E4'
// TODO: Success and re-send icon. // TODO: Success and re-send icon.
Icon { Icon {
iconSize: 16 iconSize: 16
icon: 'valid' icon: 'valid'
}
} }
} }
...@@ -12,7 +12,9 @@ Item { ...@@ -12,7 +12,9 @@ Item {
property alias image: avatar.image property alias image: avatar.image
property alias presenceLevel: avatar.presenceLevel property alias presenceLevel: avatar.presenceLevel
property alias sipAddress: description.sipAddress property alias sipAddress: description.sipAddress
property alias sipAddressColor: description.sipAddressColor
property alias username: avatar.username property alias username: avatar.username
property alias usernameColor: description.usernameColor
height: ContactStyle.height height: ContactStyle.height
......
...@@ -7,6 +7,8 @@ import Linphone.Styles 1.0 ...@@ -7,6 +7,8 @@ import Linphone.Styles 1.0
Column { Column {
property alias sipAddress: sipAddress.text property alias sipAddress: sipAddress.text
property alias username: username.text property alias username: username.text
property color sipAddressColor: ContactDescriptionStyle.sipAddress.color
property color usernameColor: ContactDescriptionStyle.username.color
property int horizontalTextAlignment property int horizontalTextAlignment
// Username. // Username.
...@@ -14,7 +16,8 @@ Column { ...@@ -14,7 +16,8 @@ Column {
id: username id: username
clip: true clip: true
color: ContactDescriptionStyle.username.color color: usernameColor
elide: Text.ElideRight
font.bold: true font.bold: true
font.pointSize: ContactDescriptionStyle.username.fontSize font.pointSize: ContactDescriptionStyle.username.fontSize
height: parent.height / 2 height: parent.height / 2
...@@ -27,8 +30,8 @@ Column { ...@@ -27,8 +30,8 @@ Column {
Text { Text {
id: sipAddress id: sipAddress
clip: true color: sipAddressColor
color: ContactDescriptionStyle.sipAddress.color elide: Text.ElideRight
font.pointSize: ContactDescriptionStyle.sipAddress.fontSize font.pointSize: ContactDescriptionStyle.sipAddress.fontSize
height: parent.height / 2 height: parent.height / 2
horizontalAlignment: horizontalTextAlignment horizontalAlignment: horizontalTextAlignment
......
...@@ -6,6 +6,9 @@ module Linphone ...@@ -6,6 +6,9 @@ module Linphone
# Components --------------------------------------------------------- # Components ---------------------------------------------------------
# Call
CallControls 1.0 Call/CallControls.qml
# Chat # Chat
Chat 1.0 Chat/Chat.qml Chat 1.0 Chat/Chat.qml
......
...@@ -106,6 +106,19 @@ function clearTimeout (timer) { ...@@ -106,6 +106,19 @@ function clearTimeout (timer) {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Returns the top (root) parent of one component.
function getTopParent (component) {
var parent = component.parent
while (parent.parent != null) {
parent = parent.parent
}
return parent
}
// -------------------------------------------------------------------
// Invoke a `cb` function with each value of the interval: `[0, n[`. // Invoke a `cb` function with each value of the interval: `[0, n[`.
// Return a mapped array created with the returned values of `cb`. // Return a mapped array created with the returned values of `cb`.
function times (n, cb, context) { function times (n, cb, context) {
...@@ -144,7 +157,7 @@ function genRandomNumberBetweenIntervals (intervals) { ...@@ -144,7 +157,7 @@ function genRandomNumberBetweenIntervals (intervals) {
return genRandomNumber(intervals[0][0], intervals[0][1]) return genRandomNumber(intervals[0][0], intervals[0][1])
} }
// Compute the number of values. // Compute the intervals size.
var size = 0 var size = 0
intervals.forEach(function (interval) { intervals.forEach(function (interval) {
size += interval[1] - interval[0] size += interval[1] - interval[0]
......
...@@ -16,7 +16,7 @@ Window { ...@@ -16,7 +16,7 @@ Window {
anchors.fill: parent anchors.fill: parent
defaultChildAWidth: 250 defaultChildAWidth: 250
maximumLeftLimit: 300 maximumLeftLimit: 300
minimumLeftLimit: 50 minimumLeftLimit: 150
// Calls list. // Calls list.
childA: ColumnLayout { childA: ColumnLayout {
...@@ -45,10 +45,95 @@ Window { ...@@ -45,10 +45,95 @@ Window {
} }
} }
Rectangle { ScrollableListView {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
color: 'red' spacing: 1
delegate: CallControls {
width: parent.width
}
model: ListModel {
ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'charles.henri.sip.linphone.org'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'yesyes.nono.sip.linphone.org'
}
ListElement {
$presence: 'connected'
$sipAddress: 'nsa.sip.linphone.org'
}
ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'charles.henri.sip.linphone.org'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'yesyes.nono.sip.linphone.org'
}
ListElement {
$presence: 'connected'
$sipAddress: 'nsa.sip.linphone.org'
} ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'charles.henri.sip.linphone.org'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'yesyes.nono.sip.linphone.org'
}
ListElement {
$presence: 'connected'
$sipAddress: 'nsa.sip.linphone.org'
} ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'charles.henri.sip.linphone.org'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'yesyes.nono.sip.linphone.org'
}
ListElement {
$presence: 'connected'
$sipAddress: 'nsa.sip.linphone.org'
} ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'charles.henri.sip.linphone.org'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'yesyes.nono.sip.linphone.org'
}
ListElement {
$presence: 'connected'
$sipAddress: 'nsa.sip.linphone.org'
} ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'charles.henri.sip.linphone.org'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'yesyes.nono.sip.linphone.org'
}
ListElement {
$presence: 'connected'
$sipAddress: 'nsa.sip.linphone.org'
} ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'charles.henri.sip.linphone.org'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'yesyes.nono.sip.linphone.org'
}
ListElement {
$presence: 'connected'
$sipAddress: 'nsa.sip.linphone.org'
}
}
} }
} }
......
...@@ -5,12 +5,13 @@ import Common 1.0 ...@@ -5,12 +5,13 @@ import Common 1.0
import Linphone 1.0 import Linphone 1.0
Rectangle { Rectangle {
default property alias actionArea: actionArea.data
property alias callType: callType.text property alias callType: callType.text
property alias sipAddress: contactDescription.sipAddress property alias sipAddress: contactDescription.sipAddress
property alias username: contactDescription.username property alias username: contactDescription.username
property alias avatarImage: image.source property alias avatarImage: image.source
default property alias _actionArea: actionArea.data
color: '#EAEAEA' color: '#EAEAEA'
ColumnLayout { ColumnLayout {
......
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