Commit fa047030 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(dialog): better code

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