diff --git a/qml/main.qml b/qml/main.qml index 9de89540..c1a58094 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -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{ diff --git a/qml/theme/Theme.qml b/qml/theme/Theme.qml index 261a1b65..5fc5685b 100644 --- a/qml/theme/Theme.qml +++ b/qml/theme/Theme.qml @@ -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 { } } \ No newline at end of file diff --git a/qml/widgets/ContactRow.qml b/qml/widgets/ContactRow.qml index e81b4596..ce315713 100644 --- a/qml/widgets/ContactRow.qml +++ b/qml/widgets/ContactRow.qml @@ -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 diff --git a/qml/widgets/PortraitRow.qml b/qml/widgets/PortraitRow.qml index 3c1d5dd9..d506ce58 100644 --- a/qml/widgets/PortraitRow.qml +++ b/qml/widgets/PortraitRow.qml @@ -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++ + } } }