123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- import QtQuick 1.0
- import meegim 1.0
- DialogLiquid {
- id: dlgMyStatus
- signal myStatusChange
- property variant myStatusSet
- property string myTextStatus//: main.statText
- hideTo: hideToLeft
- function setStatus( status, textStatus )
- {
- var resSet = false
- for( var k=0; k<modelListStat.count; k++)
- {
- var ss = dlgMyStatus.status( modelListStat.get(k).name )
- if( ss == status ) {
- listViewStatus.currentIndex = k
- wrapperTextEdit.text = textStatus
- resSet = true
- break;
- }
- }
- return resSet
- }
- width: parent.width*0.9
- height: parent.height*0.58
- ListModel {
- id: modelListStat
- ListElement {
- name: "online"
- image: "qrc:/qml/images/presence-online.png"
- }
- ListElement {
- name: "chat"
- image: "qrc:/qml/images/presence-online.png"
- }
- ListElement {
- name: "away"
- image: "qrc:/qml/images/presence-away.png"
- }
- ListElement {
- name: "XA"
- image: "qrc:/qml/images/presence-away.png"
- }
- ListElement {
- name: "DND"
- image: "qrc:/qml/images/presence-busy.png"
- }
- ListElement {
- name: "offline"
- image: "qrc:/qml/images/presence-offline.png"
- }
- }
- function status( nameElement )
- {
- var ret = ""
- if( nameElement === "online" ) {
- ret = XmppClient.Online
- } else if( nameElement === "chat" ) {
- ret = XmppClient.Chat
- } else if( nameElement === "away" ) {
- ret = XmppClient.Away
- } else if( nameElement === "XA" ) {
- ret = XmppClient.XA
- } else if( nameElement === "DND" ) {
- ret = XmppClient.DND
- } else if( nameElement === "offline" ) {
- ret = XmppClient.Offline
- }
- return ret
- }
- function textItem( nameElement )
- {
- var ret = ""
- if( nameElement === "online" ) {
- ret = qsTr("Available")
- } else if( nameElement === "chat" ) {
- ret = qsTr("Chatty")
- } else if( nameElement === "away" ) {
- ret = qsTr("Away")
- } else if( nameElement === "XA" ) {
- ret = qsTr("Extended away")
- } else if( nameElement === "DND" ) {
- ret = qsTr("Do not disturb")
- } else if( nameElement === "offline" ) {
- ret = qsTr("Offline")
- }
- return ret
- }
- Component {
- id: componentWrapper
- Rectangle {
- id: wrapper
- width: listViewStatus.width
- height: 70
- //border.color: "gray"
- gradient: gr_free
- Image {
- id: imgStatus
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 20
- source: image
- height: 56; width: height
- smooth: true
- }
- Text {
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: imgStatus.right
- anchors.leftMargin: 20
- id: txtStatus
- text: textItem( name )
- font.pixelSize: 28
- }
- Gradient {
- id: gr_free
- GradientStop { id: gr1; position: 0; color: "white" }
- GradientStop { id: gr2; position: 0.5; color: "#ededed" }
- GradientStop { id: gr3; position: 1; color: "#d7d7d7" }
- }
- Gradient {
- id: gr_press
- GradientStop { position: 0; color: "lightblue" }
- GradientStop { position: 1; color: "lightblue" }
- GradientStop { position: 0.5; color: "#ededed" }
- }
- MouseArea {
- id: mouseAreaItem;
- anchors.fill: parent
- onClicked: {
- wrapper.ListView.view.currentIndex = index
- dlgMyStatus.myStatusSet = status( name )
- dlgMyStatus.myTextStatus = wrapperTextEdit.text
- dlgMyStatus.myStatusChange()
- dlgMyStatus.state = "hidden"
- }
- }
- states: State {
- name: "Current"
- when: wrapper.ListView.isCurrentItem
- //PropertyChanges { target: wrapper; color: "lightblue" }
- PropertyChanges { target: wrapper; gradient: gr_press }
- PropertyChanges { target: imgStatus; anchors.leftMargin: 30 }
- }
- }
- }
- property int __marg1 : 3
- ListView {
- id: listViewStatus
- anchors.top: parent.top
- anchors.topMargin: __marg1
- anchors.left: parent.left
- anchors.leftMargin: __marg1
- anchors.bottom: wrapperTextEdit.top
- anchors.bottomMargin: 10
- width: parent.width - 2*__marg1
- model: modelListStat
- delegate: componentWrapper
- clip: true
- }
- MyTextInput2 {
- id: wrapperTextEdit
- height: 55
- anchors.bottom: parent.bottom; anchors.bottomMargin: 5
- anchors.left: parent.left; anchors.leftMargin: 10
- anchors.right: parent.right; anchors.rightMargin: 10
- text: dlgMyStatus.myTextStatus
- placeholderText: qsTr("Status text")
- }
- }
|