mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-02 18:36:24 +00:00
feat(app): add PresenceStatus and used in MainWindow
This commit is contained in:
parent
8ca63e094c
commit
ee86c54537
10 changed files with 78 additions and 43 deletions
|
|
@ -120,7 +120,7 @@
|
|||
<file>ui/modules/Linphone/Contact/Avatar.qml</file>
|
||||
<file>ui/modules/Linphone/Contact/ContactDescription.qml</file>
|
||||
<file>ui/modules/Linphone/Contact/Contact.qml</file>
|
||||
<file>ui/modules/Linphone/Contact/PresenceLevel.qml</file>
|
||||
<file>ui/modules/Linphone/PresenceLevel.qml</file>
|
||||
<file>ui/modules/Linphone/qmldir</file>
|
||||
<file>ui/modules/Linphone/Select/SelectContact.qml</file>
|
||||
<file>ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml</file>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import Linphone 1.0
|
||||
import Linphone.Styles 1.0
|
||||
import Utils 1.0
|
||||
|
||||
|
|
@ -9,16 +11,30 @@ Item {
|
|||
Column {
|
||||
anchors.fill: parent
|
||||
|
||||
Text {
|
||||
clip: true
|
||||
color: AccountStatusStyle.username.color
|
||||
elide: Text.ElideRight
|
||||
font.bold: true
|
||||
font.pointSize: AccountStatusStyle.username.fontSize
|
||||
RowLayout {
|
||||
height: parent.height / 2
|
||||
text: AccountSettingsModel.username
|
||||
verticalAlignment: Text.AlignBottom
|
||||
spacing: AccountStatusStyle.horizontalSpacing
|
||||
width: parent.width
|
||||
|
||||
PresenceLevel {
|
||||
Layout.preferredHeight: AccountStatusStyle.presenceLevel.size
|
||||
Layout.preferredWidth: AccountStatusStyle.presenceLevel.size
|
||||
icon: 'chevron'
|
||||
level: AccountSettingsModel.presenceLevel
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
Layout.bottomMargin: AccountStatusStyle.presenceLevel.bottoMargin
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
color: AccountStatusStyle.username.color
|
||||
elide: Text.ElideRight
|
||||
font.bold: true
|
||||
font.pointSize: AccountStatusStyle.username.fontSize
|
||||
text: AccountSettingsModel.username
|
||||
verticalAlignment: Text.AlignBottom
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ Column {
|
|||
Text {
|
||||
id: username
|
||||
|
||||
clip: true
|
||||
color: usernameColor
|
||||
elide: Text.ElideRight
|
||||
font.bold: true
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
import QtQuick 2.7
|
||||
|
||||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
|
||||
// ===================================================================
|
||||
|
||||
Icon {
|
||||
property int level: -1
|
||||
|
||||
function _getColorString () {
|
||||
if (level === Presence.Green) {
|
||||
return 'green'
|
||||
}
|
||||
if (level === Presence.Orange) {
|
||||
return 'orange'
|
||||
}
|
||||
if (level === Presence.Red) {
|
||||
return 'red'
|
||||
}
|
||||
if (level === Presence.White) {
|
||||
return 'white'
|
||||
}
|
||||
}
|
||||
|
||||
icon: {
|
||||
var level = _getColorString()
|
||||
return level ? 'led_' + level : ''
|
||||
}
|
||||
}
|
||||
38
tests/ui/modules/Linphone/PresenceLevel.qml
Normal file
38
tests/ui/modules/Linphone/PresenceLevel.qml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import QtQuick 2.7
|
||||
|
||||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
|
||||
// ===================================================================
|
||||
|
||||
// Wrapper to use `icon` property.
|
||||
Item {
|
||||
property int level: -1
|
||||
property string icon: 'led'
|
||||
|
||||
Icon {
|
||||
anchors.fill:parent
|
||||
|
||||
function _getColorString () {
|
||||
if (level === Presence.Green) {
|
||||
return 'green'
|
||||
}
|
||||
if (level === Presence.Orange) {
|
||||
return 'orange'
|
||||
}
|
||||
if (level === Presence.Red) {
|
||||
return 'red'
|
||||
}
|
||||
if (level === Presence.White) {
|
||||
return 'white'
|
||||
}
|
||||
}
|
||||
|
||||
icon: {
|
||||
var level = _getColorString()
|
||||
return level
|
||||
? parent.icon + '_' + level
|
||||
: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,16 @@ import QtQuick 2.7
|
|||
|
||||
import Common 1.0
|
||||
|
||||
// ===================================================================
|
||||
|
||||
QtObject {
|
||||
property int horizontalSpacing: 6
|
||||
|
||||
property QtObject presenceLevel: QtObject {
|
||||
property int bottomMargin: 2
|
||||
property int size: 16
|
||||
}
|
||||
|
||||
property QtObject sipAddress: QtObject {
|
||||
property color color: Colors.j75
|
||||
property int fontSize: 10
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ Chat 1.0 Chat/Chat.qml
|
|||
Avatar 1.0 Contact/Avatar.qml
|
||||
Contact 1.0 Contact/Contact.qml
|
||||
ContactDescription 1.0 Contact/ContactDescription.qml
|
||||
PresenceLevel 1.0 Contact/PresenceLevel.qml
|
||||
|
||||
# PresenceLevel
|
||||
PresenceLevel 1.0 PresenceLevel.qml
|
||||
|
||||
# Select
|
||||
SelectContact 1.0 Select/SelectContact.qml
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ function openWindow (window, parent, options) {
|
|||
object = Qt.createQmlObject(window, parent)
|
||||
} else {
|
||||
var component = Qt.createComponent(
|
||||
'qrc:/ui/views/' + window + '.qml'
|
||||
'qrc:/ui/views/App/' + window + '.qml'
|
||||
)
|
||||
|
||||
if (component.status !== Component.Ready) {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ ApplicationWindow {
|
|||
Layout.fillHeight: true
|
||||
Layout.maximumWidth: MainWindowStyle.menu.width
|
||||
Layout.preferredWidth: MainWindowStyle.menu.width
|
||||
spacing: 0
|
||||
spacing: MainWindowStyle.menu.spacing
|
||||
|
||||
Menu {
|
||||
entryHeight: MainWindowStyle.menu.entryHeight
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ QtObject {
|
|||
|
||||
property QtObject menu: QtObject {
|
||||
property int entryHeight: 50
|
||||
property int spacing: 0
|
||||
property int width: 250
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue