From 7bdf6d79552f829aece87dd514601e77135f8515 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Sat, 25 Jul 2020 09:44:47 -0700 Subject: [PATCH] updates and minor error fixes while ravamping Messages in ui --- EllipsisLabel.qml | 3 ++- Portrait.qml | 5 +++-- PortraitRow.qml | 2 +- Setting.qml | 2 +- Toolbar.qml | 4 ++-- theme/CwtchDark.qml | 5 +++++ theme/CwtchLight.qml | 5 +++++ theme/Theme.qml | 12 +++++++++--- theme/ThemeType.qml | 5 +++++ 9 files changed, 33 insertions(+), 10 deletions(-) diff --git a/EllipsisLabel.qml b/EllipsisLabel.qml index f5dada2..a6b5262 100644 --- a/EllipsisLabel.qml +++ b/EllipsisLabel.qml @@ -17,6 +17,7 @@ Item { property alias strikeout: label.font.strikeout property alias font: label.font property alias topPadding: label.topPadding + property alias leftPadding: label.leftPadding property int extraPadding: 0 property Item container: parent @@ -48,7 +49,7 @@ Item { var i = 2 var containerWidth = container != null ? container.width : 50 // - 30 for padding - while (textMetric.width > containerWidth - ((30 + extraPadding) * gcd.themeScale) && containerWidth > 50) { + while (textMetric.width > containerWidth - ((30 + extraPadding) * gcd.themeScale) && textMetric.width > 50) { textMetric.text = text.slice(0, text.length - (i * 3)) + "..." i++ } diff --git a/Portrait.qml b/Portrait.qml index 90432e5..8fe05a1 100644 --- a/Portrait.qml +++ b/Portrait.qml @@ -14,9 +14,10 @@ Item { property string source property alias badgeColor: badge.color + property int size: Theme.contactPortraitSize property real logscale: 4 * Math.log10(gcd.themeScale + 1) - property int baseWidth: 78 * logscale - height: 78 * logscale + property int baseWidth: size * logscale + height: size * logscale property alias portraitBorderColor: mainImage.color property alias portraitColor: imageInner.color diff --git a/PortraitRow.qml b/PortraitRow.qml index 92b0a7c..8c5a3c3 100644 --- a/PortraitRow.qml +++ b/PortraitRow.qml @@ -13,7 +13,7 @@ import QtQuick.Controls.Styles 1.4 Item { id: crItem - implicitHeight: 78 * logscale + 3 + implicitHeight: Theme.contactPortraitSize * logscale + 3 height: implicitHeight property real logscale: 4 * Math.log10(gcd.themeScale + 1) diff --git a/Setting.qml b/Setting.qml index 02dfef4..903a186 100644 --- a/Setting.qml +++ b/Setting.qml @@ -41,7 +41,7 @@ Column { anchors.horizontalCenter: parent.horizontalCenter Column { - Opaque.EllipsisLabel { + Opaque.ScalingLabel { id: settingLabel width: container.gridWidth color: Theme.mainTextColor diff --git a/Toolbar.qml b/Toolbar.qml index d628cb7..8cb3ffd 100644 --- a/Toolbar.qml +++ b/Toolbar.qml @@ -99,7 +99,7 @@ Rectangle { // Global Toolbar function setTitle(text, width) { paneTitle.text = text - paneArea.width = width + paneArea.width = theStack.width paneTitle.textResize() paneTitle.visible = true } @@ -113,7 +113,7 @@ Rectangle { // Global Toolbar target: gcd onSetToolbarTitle: function(handle) { - setTitle(handle, theStack.width) + setTitle(handle) btnRightMenu.visible = true } } diff --git a/theme/CwtchDark.qml b/theme/CwtchDark.qml index c494289..c280ce7 100644 --- a/theme/CwtchDark.qml +++ b/theme/CwtchDark.qml @@ -58,4 +58,9 @@ ThemeType { statusbarConnectingFontColor: whitePurple statusbarOnlineColor: mauvePurple statusbarOnlineFontColor: whitePurple + + messageFromMeBackgroundColor: mauvePurple + messageFromMeTextColor: darkGreyPurple + messageFromOtherBackgroundColor: deepPurple + messageFromOtherTextColor: whitePurple } diff --git a/theme/CwtchLight.qml b/theme/CwtchLight.qml index 51d1995..57dacb7 100644 --- a/theme/CwtchLight.qml +++ b/theme/CwtchLight.qml @@ -58,4 +58,9 @@ ThemeType { statusbarConnectingFontColor: whitePurple statusbarOnlineColor: darkPurple statusbarOnlineFontColor: whitePurple + + messageFromMeBackgroundColor: darkPurple + messageFromMeTextColor: whitePurple + messageFromOtherBackgroundColor: purple + messageFromOtherTextColor: darkPurple } diff --git a/theme/Theme.qml b/theme/Theme.qml index 2d219ea..3e416be 100644 --- a/theme/Theme.qml +++ b/theme/Theme.qml @@ -26,9 +26,9 @@ Item { readonly property color portraitOfflineBorderColor: theme.portraitOfflineBorderColor readonly property color portraitOfflineBackgroundColor: theme.portraitOfflineBackgroundColor readonly property color portraitOfflineTextColor: theme.portraitOfflineTextColor - property color portraitBlockedBorderColor: theme.portraitBlockedBorderColor - property color portraitBlockedBackgroundColor: theme.portraitBlockedBackgroundColor - property color portraitBlockedTextColor: theme.portraitBlockedTextColor + readonly property color portraitBlockedBorderColor: theme.portraitBlockedBorderColor + readonly property color portraitBlockedBackgroundColor: theme.portraitBlockedBackgroundColor + readonly property color portraitBlockedTextColor: theme.portraitBlockedTextColor readonly property color portraitContactBadgeColor: theme.portraitContactBadgeColor readonly property color portraitContactBadgeTextColor: theme.portraitContactBadgeTextColor @@ -52,6 +52,11 @@ Item { readonly property color statusbarOnlineColor: theme.statusbarOnlineColor readonly property color statusbarOnlineFontColor: theme.statusbarOnlineFontColor + readonly property color messageFromMeBackgroundColor: theme.messageFromMeBackgroundColor + readonly property color messageFromMeTextColor: theme.messageFromMeTextColor + readonly property color messageFromOtherBackgroundColor: theme.messageFromOtherBackgroundColor + readonly property color messageFromOtherTextColor: theme.messageFromOtherTextColor + readonly property int headerSize: 50 readonly property int usernameSize: 30 readonly property int tabSize: 25 @@ -60,6 +65,7 @@ Item { readonly property int chatMetaTextSize: 15 readonly property int badgeTextSize: 12 readonly property int statusTextSize: 12 + readonly property int contactPortraitSize: 75 readonly property int sidePaneMinSize: 700 readonly property int doublePaneMinSize: 1000 diff --git a/theme/ThemeType.qml b/theme/ThemeType.qml index 0401398..512a594 100644 --- a/theme/ThemeType.qml +++ b/theme/ThemeType.qml @@ -49,6 +49,11 @@ QtObject { property color statusbarOnlineColor: "red" property color statusbarOnlineFontColor: "red" + property color messageFromMeBackgroundColor: "red" + property color messageFromMeTextColor: "red" + property color messageFromOtherBackgroundColor: "red" + property color messageFromOtherTextColor: "red" + // ... more to come