Commit dc38da1d authored by Ronan Abhamon's avatar Ronan Abhamon

feat(Contact): use style file

parent 24ee1aa9
...@@ -36,6 +36,7 @@ lupdate_only{ ...@@ -36,6 +36,7 @@ lupdate_only{
ui/modules/Linphone/Popup/*.qml \ ui/modules/Linphone/Popup/*.qml \
ui/modules/Linphone/Select/*.qml \ ui/modules/Linphone/Select/*.qml \
ui/modules/Linphone/Styles/*.qml \ ui/modules/Linphone/Styles/*.qml \
ui/modules/Linphone/Styles/Contact/*.qml \
ui/modules/Linphone/Styles/Form/*.qml \ ui/modules/Linphone/Styles/Form/*.qml \
ui/modules/Linphone/View/*.qml \ ui/modules/Linphone/View/*.qml \
ui/views/*.qml \ ui/views/*.qml \
......
...@@ -60,6 +60,9 @@ ...@@ -60,6 +60,9 @@
<file>ui/modules/Linphone/SearchBox.qml</file> <file>ui/modules/Linphone/SearchBox.qml</file>
<file>ui/modules/Linphone/Select/SelectContact.qml</file> <file>ui/modules/Linphone/Select/SelectContact.qml</file>
<file>ui/modules/Linphone/Styles/CollapseStyle.qml</file> <file>ui/modules/Linphone/Styles/CollapseStyle.qml</file>
<file>ui/modules/Linphone/Styles/Contact/AvatarStyle.qml</file>
<file>ui/modules/Linphone/Styles/Contact/ContactDescriptionStyle.qml</file>
<file>ui/modules/Linphone/Styles/Contact/ContactStyle.qml</file>
<file>ui/modules/Linphone/Styles/DialogStyle.qml</file> <file>ui/modules/Linphone/Styles/DialogStyle.qml</file>
<file>ui/modules/Linphone/Styles/ForceScrollBarStyle.qml</file> <file>ui/modules/Linphone/Styles/ForceScrollBarStyle.qml</file>
<file>ui/modules/Linphone/Styles/Form/AbstractTextButtonStyle.qml</file> <file>ui/modules/Linphone/Styles/Form/AbstractTextButtonStyle.qml</file>
......
...@@ -26,7 +26,7 @@ Item { ...@@ -26,7 +26,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
background: CollapseStyle.background background: CollapseStyle.background
icon: CollapseStyle.icon icon: 'collapse'
iconSize: CollapseStyle.iconSize iconSize: CollapseStyle.iconSize
onClicked: collapse() onClicked: collapse()
......
import QtQuick 2.7 import QtQuick 2.7
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import Linphone 1.0
import Linphone.Styles 1.0
// =================================================================== // ===================================================================
Item { Item {
...@@ -8,19 +11,7 @@ Item { ...@@ -8,19 +11,7 @@ Item {
property string presence property string presence
property string username property string username
// Image mask. (Circle) function _computeInitials () {
Rectangle {
anchors.fill: parent
color: '#8F8F8F'
id: mask
radius: 50
}
// Initials.
Text {
anchors.centerIn: parent
color: '#FFFFFF'
text: {
var spaceIndex = username.indexOf(' ') var spaceIndex = username.indexOf(' ')
var firstLetter = username.charAt(0) var firstLetter = username.charAt(0)
...@@ -30,6 +21,22 @@ Item { ...@@ -30,6 +21,22 @@ Item {
return firstLetter + username.charAt(spaceIndex + 1) return firstLetter + username.charAt(spaceIndex + 1)
} }
// Image mask. (Circle)
Rectangle {
id: mask
anchors.fill: parent
color: AvatarStyle.mask.color
radius: AvatarStyle.mask.radius
}
// Initials.
Text {
anchors.centerIn: parent
color: AvatarStyle.initials.color
font.pointSize: AvatarStyle.initials.fontSize
text: _computeInitials()
} }
Image { Image {
...@@ -50,14 +57,12 @@ Item { ...@@ -50,14 +57,12 @@ Item {
} }
// Presence. // Presence.
Image { Icon {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
fillMode: Image.PreserveAspectFit
height: parent.height / 3 height: parent.height / 3
id: presenceImage icon: presence
source: presence ? 'led_' + presence
? 'qrc:/imgs/led_' + presence + '.svg'
: '' : ''
width: parent.width / 3 width: parent.width / 3
} }
......
...@@ -2,6 +2,7 @@ import QtQuick 2.7 ...@@ -2,6 +2,7 @@ import QtQuick 2.7
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import Linphone 1.0 import Linphone 1.0
import Linphone.Styles 1.0
// =================================================================== // ===================================================================
...@@ -9,35 +10,36 @@ Item { ...@@ -9,35 +10,36 @@ Item {
property alias actions: actionBar.data property alias actions: actionBar.data
property alias image: avatar.image property alias image: avatar.image
property alias presence: avatar.presence property alias presence: avatar.presence
property alias sipAddress: contactDescription.sipAddress property alias sipAddress: description.sipAddress
property string username property alias username: avatar.username
id: contact height: ContactStyle.height
height: 50
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 14 anchors.leftMargin: ContactStyle.leftMargin
anchors.rightMargin: 14 anchors.rightMargin: ContactStyle.rightMargin
spacing: 14 spacing: ContactStyle.spacing
Avatar { Avatar {
Layout.preferredHeight: 32
Layout.preferredWidth: 32
id: avatar id: avatar
username: contact.username
Layout.preferredHeight: ContactStyle.contentHeight
Layout.preferredWidth: ContactStyle.contentHeight
} }
ContactDescription { ContactDescription {
id: description
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
id: contactDescription username: avatar.username
username: contact.username
} }
ActionBar { ActionBar {
Layout.preferredHeight: 32
id: actionBar id: actionBar
Layout.preferredHeight: ContactStyle.contentHeight
} }
} }
} }
import QtQuick 2.7 import QtQuick 2.7
import Linphone.Styles 1.0
// =================================================================== // ===================================================================
Column { Column {
...@@ -8,22 +10,25 @@ Column { ...@@ -8,22 +10,25 @@ Column {
// Username. // Username.
Text { Text {
id: username
clip: true clip: true
color: '#5A585B' color: ContactDescriptionStyle.username.color
font.pointSize: 11
font.bold: true font.bold: true
font.pointSize: ContactDescriptionStyle.username.fontSize
height: parent.height / 2 height: parent.height / 2
id: username
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
width: parent.width width: parent.width
} }
// Sip address. // Sip address.
Text { Text {
id: sipAddress
clip: true clip: true
color: '#5A585B' color: ContactDescriptionStyle.sipAddress.color
font.pointSize: ContactDescriptionStyle.sipAddress.fontSize
height: parent.height / 2 height: parent.height / 2
id: sipAddress
verticalAlignment: Text.AlignTop verticalAlignment: Text.AlignTop
width: parent.width width: parent.width
} }
......
...@@ -42,7 +42,7 @@ RowLayout { ...@@ -42,7 +42,7 @@ RowLayout {
ActionButton { ActionButton {
Layout.preferredHeight: ListFormStyle.titleArea.iconSize Layout.preferredHeight: ListFormStyle.titleArea.iconSize
Layout.preferredWidth: ListFormStyle.titleArea.iconSize Layout.preferredWidth: ListFormStyle.titleArea.iconSize
icon: ListFormStyle.titleArea.icon icon: 'add_field'
onClicked: _addValue('') onClicked: _addValue('')
} }
......
...@@ -64,7 +64,7 @@ ColumnLayout { ...@@ -64,7 +64,7 @@ ColumnLayout {
Layout.preferredHeight: MenuStyle.entry.selectionIconSize Layout.preferredHeight: MenuStyle.entry.selectionIconSize
Layout.preferredWidth: MenuStyle.entry.selectionIconSize Layout.preferredWidth: MenuStyle.entry.selectionIconSize
icon: _selectedEntry === index icon: _selectedEntry === index
? MenuStyle.entry.selectionIcon ? 'right_arrow'
: '' : ''
} }
} }
......
...@@ -5,8 +5,6 @@ QtObject { ...@@ -5,8 +5,6 @@ QtObject {
property int animationDuration: 200 property int animationDuration: 200
property int iconSize: 32 property int iconSize: 32
property string icon: 'collapse'
property Rectangle background: Rectangle { property Rectangle background: Rectangle {
// Do not use Constants.colors. // Do not use Constants.colors.
// Collapse uses an icon without background color. // Collapse uses an icon without background color.
......
...@@ -32,8 +32,6 @@ QtObject { ...@@ -32,8 +32,6 @@ QtObject {
property int spacing: 10 property int spacing: 10
property int iconSize: 16 property int iconSize: 16
property string icon: 'add_field'
property QtObject text: QtObject { property QtObject text: QtObject {
property color color: '#000000' property color color: '#000000'
......
...@@ -13,8 +13,6 @@ QtObject { ...@@ -13,8 +13,6 @@ QtObject {
property int selectionIconSize: 12 property int selectionIconSize: 12
property int spacing: 18 property int spacing: 18
property string selectionIcon: 'right_arrow'
property QtObject color: QtObject { property QtObject color: QtObject {
property color normal: Colors.g property color normal: Colors.g
property color hovered: Colors.h property color hovered: Colors.h
......
...@@ -13,8 +13,6 @@ QtObject { ...@@ -13,8 +13,6 @@ QtObject {
property int leftMargin: 18 property int leftMargin: 18
property int spacing: 16 property int spacing: 16
property int topMargin: 10 property int topMargin: 10
property string icon: 'history'
} }
property QtObject separator: QtObject { property QtObject separator: QtObject {
......
...@@ -11,6 +11,10 @@ singleton PopupStyle 1.0 PopupStyle.qml ...@@ -11,6 +11,10 @@ singleton PopupStyle 1.0 PopupStyle.qml
singleton SearchBoxStyle 1.0 SearchBoxStyle.qml singleton SearchBoxStyle 1.0 SearchBoxStyle.qml
singleton TimelineStyle 1.0 TimelineStyle.qml singleton TimelineStyle 1.0 TimelineStyle.qml
singleton AvatarStyle 1.0 Contact/AvatarStyle.qml
singleton ContactDescriptionStyle 1.0 Contact/ContactDescriptionStyle.qml
singleton ContactStyle 1.0 Contact/ContactStyle.qml
singleton AbstractTextButtonStyle 1.0 Form/AbstractTextButtonStyle.qml singleton AbstractTextButtonStyle 1.0 Form/AbstractTextButtonStyle.qml
singleton ActionBarStyle 1.0 Form/ActionBarStyle.qml singleton ActionBarStyle 1.0 Form/ActionBarStyle.qml
singleton CheckBoxTextStyle 1.0 Form/CheckBoxTextStyle.qml singleton CheckBoxTextStyle 1.0 Form/CheckBoxTextStyle.qml
......
...@@ -16,7 +16,7 @@ ColumnLayout { ...@@ -16,7 +16,7 @@ ColumnLayout {
spacing: TimelineStyle.legend.spacing spacing: TimelineStyle.legend.spacing
Icon { Icon {
icon: TimelineStyle.legend.icon icon: 'history'
iconSize: TimelineStyle.legend.iconSize iconSize: TimelineStyle.legend.iconSize
} }
......
...@@ -87,90 +87,7 @@ ApplicationWindow { ...@@ -87,90 +87,7 @@ ApplicationWindow {
content.enabled = false content.enabled = false
} }
model: ListModel { model: model1
id: model
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'
}
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
...@@ -317,4 +234,89 @@ ApplicationWindow { ...@@ -317,4 +234,89 @@ ApplicationWindow {
} }
} }
} }
ListModel {
id: model1
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'
}
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'
}
}
} }
...@@ -15,17 +15,12 @@ DialogPlus { ...@@ -15,17 +15,12 @@ DialogPlus {
onClicked: exit(0) onClicked: exit(0)
} }
Item {
anchors.fill: parent
// TODO: Compute list max. // TODO: Compute list max.
ScrollableListView { ScrollableListView {
id: accounts id: accounts
anchors.fill: parent anchors.fill: parent
model: model1 // TMP
// TODO: Remove, use C++ model instead.
model: model1
delegate: Item { delegate: Item {
function isDefaultAccount () { function isDefaultAccount () {
...@@ -38,36 +33,26 @@ DialogPlus { ...@@ -38,36 +33,26 @@ DialogPlus {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: isDefaultAccount() ? '#EAEAEA' : 'transparent' color: isDefaultAccount() ? '#EAEAEA' : 'transparent'
id: accountLine
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
spacing: 15
anchors.leftMargin: 15 anchors.leftMargin: 15
anchors.rightMargin: 15 anchors.rightMargin: 15
spacing: 15
// Default account. // Is default account?
Item { Icon {
Layout.fillHeight: parent.height Layout.preferredHeight: 20
Layout.preferredWidth: 20 Layout.preferredWidth: 20
icon: isDefaultAccount() ? 'valid' : ''
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: isDefaultAccount() ? 'qrc:/imgs/valid.svg' : ''
}
} }
// Sip account. // Sip account.
Item {
Layout.fillHeight: parent.height
Layout.fillWidth: true
Text { Text {
anchors.fill: parent Layout.fillWidth: true
clip: true clip: true
color: '#59575A' color: '#59575A'
text: sipAddress; text: $sipAddress
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
MouseArea { MouseArea {
...@@ -76,36 +61,24 @@ DialogPlus { ...@@ -76,36 +61,24 @@ DialogPlus {
onClicked: accounts.currentIndex = index onClicked: accounts.currentIndex = index
} }
} }
}
// Presence. // Presence.
Item { Icon {
Layout.fillHeight: parent.height Layout.preferredHeight: 20
Layout.preferredWidth: 20 Layout.preferredWidth: 20
icon: 'led_' + $presence
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: 'qrc:/imgs/led_' + presence + '.svg'
}
} }
// Update presence. // Update presence.
Item {
Layout.fillHeight: parent.height
Layout.preferredWidth: 160
TransparentComboBox { TransparentComboBox {
anchors.fill: parent Layout.preferredWidth: 160
model: model2 model: model2 // TMP.
textRole: 'key' textRole: 'key'
} }
} }
} }
} }
} }
}
}
// ================================================================= // =================================================================
// TMP // TMP
...@@ -115,36 +88,36 @@ DialogPlus { ...@@ -115,36 +88,36 @@ DialogPlus {
id: model1 id: model1
ListElement { ListElement {
presence: 'connected' $presence: 'connected'
sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org' $sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org'
} }
ListElement { ListElement {
presence: 'connected' $presence: 'connected'
sipAddress: 'toto.lala.sip.linphone.org' $sipAddress: 'toto.lala.sip.linphone.org'
} }
ListElement { ListElement {
presence: 'disconnected' $presence: 'disconnected'
sipAddress: 'machin.truc.sip.linphone.org' $sipAddress: 'machin.truc.sip.linphone.org'
} }
ListElement { ListElement {
presence: 'absent' $presence: 'absent'
sipAddress: 'hey.listen.sip.linphone.org' $sipAddress: 'hey.listen.sip.linphone.org'
} }
ListElement { ListElement {
presence: 'do_not_disturb' $presence: 'do_not_disturb'
sipAddress: 'valentin.cognito.sip.linphone.org' $sipAddress: 'valentin.cognito.sip.linphone.org'
} }
ListElement { ListElement {
presence: 'do_not_disturb' $presence: 'do_not_disturb'
sipAddress: 'charles.henri.sip.linphone.org' $sipAddress: 'charles.henri.sip.linphone.org'
} }
ListElement { ListElement {
presence: 'disconnected' $presence: 'disconnected'
sipAddress: 'yesyes.nono.sip.linphone.org' $sipAddress: 'yesyes.nono.sip.linphone.org'
} }
ListElement { ListElement {
presence: 'connected' $presence: 'connected'
sipAddress: 'nsa.sip.linphone.org' $sipAddress: 'nsa.sip.linphone.org'
} }
} }
......
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