Commit fa047030 authored by Ronan's avatar Ronan
Browse files

fix(dialog): better code

parent c5478fa8
......@@ -19,6 +19,7 @@ Window {
signal exitStatus (int status)
// Derived class must use this function instead of close.
// Destroy the component and send signal to caller.
function exit (status) {
if (!_disableExitStatus) {
_disableExitStatus = true
......@@ -52,19 +53,14 @@ Window {
}
// Buttons.
Item {
Layout.fillWidth: true
Layout.preferredHeight: DialogStyle.buttonsAreaHeight
Row {
id: buttons
anchors.left: (!centeredButtons && parent.left) || undefined
anchors.centerIn: centeredButtons ? parent : undefined
anchors.leftMargin: DialogStyle.leftMargin
anchors.verticalCenter: (!centeredButtons && parent.verticalCenter) || undefined
spacing: DialogStyle.buttonsSpacing
}
Row {
id: buttons
Layout.alignment: (centeredButtons && Qt.AlignHCenter) || Qt.AlignLeft
Layout.bottomMargin: DialogStyle.buttons.bottomMargin
Layout.leftMargin: (!centeredButtons && DialogStyle.leftMargin) || undefined
Layout.topMargin: DialogStyle.buttons.topMargin
spacing: DialogStyle.buttons.spacing
}
}
}
import QtQuick 2.7
// ===================================================================
Image {
property int iconSize
property string icon
......
......@@ -7,6 +7,10 @@ import 'qrc:/ui/components/image'
import 'qrc:/ui/components/scrollBar'
ColumnLayout {
id: item
property var model
Row {
Layout.preferredHeight: 35
spacing: 30
......@@ -39,49 +43,7 @@ ColumnLayout {
highlightRangeMode: ListView.ApplyRange
spacing: 0
// Replace by C++ class.
model: ListModel {
ListElement {
$presence: 'connected'
$sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'connected'
$sipAddress: 'toto.lala.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'machin.truc.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'absent'
$sipAddress: 'hey.listen.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'valentin.cognito.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'charles.henri.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'yesyes.nono.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'connected'
$sipAddress: 'nsa.sip.linphone.org'
$username: 'Toto'
}
}
model: item.model
delegate: Contact {
presence: $presence
......
......@@ -2,19 +2,23 @@ pragma Singleton
import QtQuick 2.7
QtObject {
property int buttonsAreaHeight: 60
property int buttonsSpacing: 20
property int leftMargin: 50
property int rightMargin: 50
property QtObject description: QtObject {
property int fontSize: 12
property int height: 90
property int minHeight: 25
property QtObject buttons: QtObject {
property int bottomMargin: 15
property int spacing: 20
property int topMargin: 15
}
property QtObject confirm: QtObject {
property int height: 150
property int width: 370
}
property QtObject description: QtObject {
property int fontSize: 12
property int height: 90
property int minHeight: 25
}
}
......@@ -116,8 +116,50 @@ ApplicationWindow {
Timeline {
Layout.fillHeight: true
Layout.fillWidth: true
}
model: ListModel {
ListElement {
$presence: 'connected'
$sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'connected'
$sipAddress: 'toto.lala.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'machin.truc.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'absent'
$sipAddress: 'hey.listen.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'valentin.cognito.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'do_not_disturb'
$sipAddress: 'charles.henri.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'disconnected'
$sipAddress: 'yesyes.nono.sip.linphone.org'
$username: 'Toto'
}
ListElement {
$presence: 'connected'
$sipAddress: 'nsa.sip.linphone.org'
$username: 'Toto'
}
}
}
// Logo.
Rectangle {
Layout.fillWidth: true
......
......@@ -19,6 +19,7 @@ DialogPlus {
Item {
anchors.fill: parent
// TODO: Compute list max.
ListView {
ScrollBar.vertical: ForceScrollBar { }
anchors.fill: parent
......
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