From d3e178474df40aa868350c5b19ca5a1d313e1ef6 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 20 Nov 2019 13:05:50 -0800 Subject: [PATCH] show add profile button --- qml/widgets/ContactPicture.qml | 3 ++- qml/widgets/ContactRow.qml | 1 + qml/widgets/ProfileList.qml | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/qml/widgets/ContactPicture.qml b/qml/widgets/ContactPicture.qml index 42971be5..d8b9ead6 100644 --- a/qml/widgets/ContactPicture.qml +++ b/qml/widgets/ContactPicture.qml @@ -17,6 +17,7 @@ Item { property bool isGroup property bool showStatus property bool highlight + property bool button property real logscale: 4 * Math.log10(gcd.themeScale + 1) property int baseWidth: 48 * logscale @@ -30,7 +31,7 @@ Item { Rectangle { width: highlight ? baseWidth - 4 : baseWidth height: highlight ? baseWidth - 4 : baseWidth - color: "#FFFFFF" + color: button ? windowItem.cwtch_dark_color: "#FFFFFF" radius: width / 2 anchors.centerIn:parent diff --git a/qml/widgets/ContactRow.qml b/qml/widgets/ContactRow.qml index e5de3639..88f3abf9 100644 --- a/qml/widgets/ContactRow.qml +++ b/qml/widgets/ContactRow.qml @@ -41,6 +41,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY ContactPicture { id: imgProfile showStatus: type == "contact" + button: type == "button" } ColumnLayout { diff --git a/qml/widgets/ProfileList.qml b/qml/widgets/ProfileList.qml index 8e8db340..a2a4f147 100644 --- a/qml/widgets/ProfileList.qml +++ b/qml/widgets/ProfileList.qml @@ -50,10 +50,12 @@ ColumnLayout { } } - profilesModel.append({ + profilesModel.insert(profilesModel.count-1, + { "_handle": handle, "_displayName": displayName, - "_image": image + "_image": image, + "_type": "profile" }) } @@ -71,6 +73,13 @@ ColumnLayout { ListModel { // Profile OBJECTS ARE STORED HERE ... id: profilesModel + + ListElement { + _handle: "" + _displayName: qsTr("Add new profile") + _image: "qrc:/qml/images/fontawesome/solid/user-plus.svg" + _type: "button" + } } Repeater { @@ -84,7 +93,7 @@ ColumnLayout { status: 0 blocked: false loading: false - type: "profile" + type: _type } } }