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 {
property alias image: imageToFilter.source property alias image: imageToFilter.source
property string presence property string presence
property string username property string username
function _computeInitials () {
var spaceIndex = username.indexOf(' ')
var firstLetter = username.charAt(0)
// Image mask. (Circle) if (spaceIndex === -1) {
Rectangle { return firstLetter
anchors.fill: parent
color: '#8F8F8F'
id: mask
radius: 50
} }
// Initials. return firstLetter + username.charAt(spaceIndex + 1)
Text { }
anchors.centerIn: parent
color: '#FFFFFF'
text: {
var spaceIndex = username.indexOf(' ')
var firstLetter = username.charAt(0)
if (spaceIndex === -1) { // Image mask. (Circle)
return firstLetter Rectangle {
} id: mask
return firstLetter + username.charAt(spaceIndex + 1) anchors.fill: parent
} color: AvatarStyle.mask.color
} radius: AvatarStyle.mask.radius
}
Image { // Initials.
anchors.fill: parent Text {
id: imageToFilter anchors.centerIn: parent
fillMode: Image.PreserveAspectFit color: AvatarStyle.initials.color
font.pointSize: AvatarStyle.initials.fontSize
text: _computeInitials()
}
// Image must be invisible. Image {
// The only visible image is the OpacityMask! anchors.fill: parent
visible: false id: imageToFilter
} fillMode: Image.PreserveAspectFit
// Avatar. // Image must be invisible.
OpacityMask { // The only visible image is the OpacityMask!
anchors.fill: imageToFilter visible: false
maskSource: mask }
source: imageToFilter
}
// Presence. // Avatar.
Image { OpacityMask {
anchors.bottom: parent.bottom anchors.fill: imageToFilter
anchors.right: parent.right maskSource: mask
fillMode: Image.PreserveAspectFit source: imageToFilter
height: parent.height / 3 }
id: presenceImage
source: presence // Presence.
? 'qrc:/imgs/led_' + presence + '.svg' Icon {
: '' anchors.bottom: parent.bottom
width: parent.width / 3 anchors.right: parent.right
} height: parent.height / 3
icon: presence
? 'led_' + presence
: ''
width: parent.width / 3
}
} }
...@@ -2,42 +2,44 @@ import QtQuick 2.7 ...@@ -2,42 +2,44 @@ 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
// =================================================================== // ===================================================================
Item { 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: ContactStyle.leftMargin
anchors.leftMargin: 14 anchors.rightMargin: ContactStyle.rightMargin
anchors.rightMargin: 14 spacing: ContactStyle.spacing
spacing: 14
Avatar {
Avatar { id: avatar
Layout.preferredHeight: 32
Layout.preferredWidth: 32 Layout.preferredHeight: ContactStyle.contentHeight
id: avatar Layout.preferredWidth: ContactStyle.contentHeight
username: contact.username }
}
ContactDescription {
ContactDescription { id: description
Layout.fillHeight: true
Layout.fillWidth: true Layout.fillHeight: true
id: contactDescription Layout.fillWidth: true
username: contact.username username: avatar.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 {
property alias sipAddress: sipAddress.text property alias sipAddress: sipAddress.text
property alias username: username.text property alias username: username.text
// Username.
Text {
id: username
clip: true
color: ContactDescriptionStyle.username.color
font.bold: true
font.pointSize: ContactDescriptionStyle.username.fontSize
height: parent.height / 2
verticalAlignment: Text.AlignBottom
width: parent.width
}
// Username. // Sip address.
Text { Text {
clip: true id: sipAddress
color: '#5A585B'
font.pointSize: 11
font.bold: true
height: parent.height / 2
id: username
verticalAlignment: Text.AlignBottom
width: parent.width
}
// Sip address. clip: true
Text { color: ContactDescriptionStyle.sipAddress.color
clip: true font.pointSize: ContactDescriptionStyle.sipAddress.fontSize
color: '#5A585B' height: parent.height / 2
height: parent.height / 2 verticalAlignment: Text.AlignTop
id: sipAddress width: parent.width
verticalAlignment: Text.AlignTop }
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,92 +15,65 @@ DialogPlus { ...@@ -15,92 +15,65 @@ DialogPlus {
onClicked: exit(0) onClicked: exit(0)
} }
Item { // TODO: Compute list max.
anchors.fill: parent ScrollableListView {
id: accounts
// TODO: Compute list max. anchors.fill: parent
ScrollableListView { model: model1 // TMP
id: accounts
anchors.fill: parent delegate: Item {
function isDefaultAccount () {
return accounts.currentIndex === index
}
// TODO: Remove, use C++ model instead. height: 34
model: model1 width: parent.width
delegate: Item { Rectangle {
function isDefaultAccount () { anchors.fill: parent
return accounts.currentIndex === index color: isDefaultAccount() ? '#EAEAEA' : 'transparent'
}
height: 34 RowLayout {
width: parent.width
Rectangle {
anchors.fill: parent anchors.fill: parent
color: isDefaultAccount() ? '#EAEAEA' : 'transparent' anchors.leftMargin: 15
id: accountLine anchors.rightMargin: 15
spacing: 15
RowLayout {
anchors.fill: parent // Is default account?
spacing: 15 Icon {
anchors.leftMargin: 15 Layout.preferredHeight: 20
anchors.rightMargin: 15 Layout.preferredWidth: 20
icon: isDefaultAccount() ? 'valid' : ''
// Default account. }
Item {
Layout.fillHeight: parent.height
Layout.preferredWidth: 20
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: isDefaultAccount() ? 'qrc:/imgs/valid.svg' : ''
}
}
// Sip account.
Item {
Layout.fillHeight: parent.height
Layout.fillWidth: true
Text {
anchors.fill: parent
clip: true
color: '#59575A'
text: sipAddress;
verticalAlignment: Text.AlignVCenter
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: accounts.currentIndex = index
}
}
}
// Presence.
Item {
Layout.fillHeight: parent.height
Layout.preferredWidth: 20
Image { // Sip account.
anchors.fill: parent Text {
fillMode: Image.PreserveAspectFit Layout.fillWidth: true
source: 'qrc:/imgs/led_' + presence + '.svg' clip: true
} color: '#59575A'
text: $sipAddress
verticalAlignment: Text.AlignVCenter
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: accounts.currentIndex = index
} }
}
// Update presence. // Presence.
Item { Icon {
Layout.fillHeight: parent.height Layout.preferredHeight: 20
Layout.preferredWidth: 160 Layout.preferredWidth: 20
icon: 'led_' + $presence
}
TransparentComboBox { // Update presence.
anchors.fill: parent TransparentComboBox {
model: model2 Layout.preferredWidth: 160
textRole: 'key' model: model2 // TMP.
} textRole: 'key'
}
} }
} }
} }
...@@ -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