badge # count; contact name, onion elipses if not enough space
the build was successful Details

This commit is contained in:
Dan Ballard 2020-04-16 15:24:20 -07:00
parent 522f395d86
commit 7495a6dca4
4 changed files with 40 additions and 13 deletions

View File

@ -126,21 +126,15 @@ ApplicationWindow {
RowLayout { // CONTAINS EVERYTHING EXCEPT THE TOOLBAR
/* anchors.left: ratio >= 0.92 ? parent.left : toolbar.right
anchors.top: ratio >= 0.92 ? toolbar.bottom : parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom */
anchors.fill: parent
spacing: 0
Rectangle { // THE LEFT PANE WITH TOOLS AND CONTACTS
color: "#D2C0DD"
Layout.fillHeight: true
Layout.minimumWidth: Layout.maximumWidth
Layout.maximumWidth: theStack.pane == theStack.emptyPane ? parent.width : 450
visible: (ratio <= 1.08 && windowItem.width >= 700 && !Qt.inputMethod.visible) || theStack.pane == theStack.emptyPane
Layout.maximumWidth: theStack.pane == theStack.emptyPane ? parent.width : Theme.sidePaneMinSize
visible: (windowItem.width >= Theme.doublePaneMinSize && !Qt.inputMethod.visible) || theStack.pane == theStack.emptyPane
ContactList{

View File

@ -33,5 +33,8 @@ Item {
readonly property int chatMetaTextSize: 15
readonly property int badgeTextSize: 12
readonly property int sidePaneMinSize: 700
readonly property int doublePaneMinSize: 1000
property ThemeType theme: CwtchLight { }
}

View File

@ -24,7 +24,7 @@ PortraitRow {
color: Theme.portraitContactBadgeTextColor
font.pixelSize: Theme.badgeTextSize * gcd.themeScale
font.weight: Font.Bold
text: badge
text: badge > 99 ? "99+" : badge
}
ProgressBar { // LOADING ?
@ -70,7 +70,7 @@ PortraitRow {
portraitColor = Theme.portraitOnlineBackgroundColor
nameColor = Theme.portraitOnlineTextColor
onionColor = Theme.portraitOnlineTextColor
} else if (status == 3 || status == 2) {
} else if (status == 2 || status == 1) {
portraitBorderColor = Theme.portraitConnectingBorderColor
portraitColor = Theme.portraitConnectingBackgroundColor
nameColor = Theme.portraitConnectingTextColor

View File

@ -10,7 +10,6 @@ import "../theme"
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
id: crItem
anchors.left: parent.left
@ -19,7 +18,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
implicitHeight: 78 * logscale + 3 //height
property real logscale: 4 * Math.log10(gcd.themeScale + 1)
property alias displayName: cn.text
property string displayName //: nameTxtmetric.text
property alias image: portrait.source
property string handle
property bool isActive
@ -70,11 +69,19 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
font.weight: Font.Bold
font.strikeout: blocked
elide: Text.ElideRight
text: nameTxtmetric.text
}
TextMetrics {
id: nameTxtmetric
text: displayName
font: cn.font
}
Label { // Onion
id: onion
text: handle
text: onionTxtmetric.text
leftPadding: 10
rightPadding: 10
font.pixelSize: Theme.secondaryTextSize * gcd.themeScale
@ -83,6 +90,29 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
elide: Text.ElideRight
}
TextMetrics {
id: onionTxtmetric
text: handle
font: onion.font
}
}
onWidthChanged: {
nameTxtmetric.text = displayName
onionTxtmetric.text = handle
var i = 2
var maxWidth = Math.max(200, width - portrait.width - (50 * logscale))
while (nameTxtmetric.width > maxWidth) {
nameTxtmetric.text = displayName.slice(0, displayName.length - (i * 3)) + "..."
i++
}
i = 2
while (onionTxtmetric.width > maxWidth) {
onionTxtmetric.text = handle.slice(0, handle.length - (i * 3)) + "..."
i++
}
}
}