summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-11-18 22:33:45 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-11-18 22:33:45 +0100
commit57fb0d79f97f4e0c83f474892876e6898b10cb86 (patch)
tree682ab07abb60a03ab28a67ab0789687fa1523962
parentFix video call filename and qtjdenticon for windows (diff)
downloadnheko-57fb0d79f97f4e0c83f474892876e6898b10cb86.tar.xz
Fix colors and alignment in dialogs
-rw-r--r--resources/qml/dialogs/InviteDialog.qml13
-rw-r--r--resources/qml/dialogs/ReadReceipts.qml5
-rw-r--r--resources/qml/dialogs/RoomMembers.qml15
-rw-r--r--src/timeline/TimelineViewManager.cpp7
-rw-r--r--src/timeline/TimelineViewManager.h2
5 files changed, 15 insertions, 27 deletions
diff --git a/resources/qml/dialogs/InviteDialog.qml b/resources/qml/dialogs/InviteDialog.qml
index 3acaa69d..9ddf8ed0 100644
--- a/resources/qml/dialogs/InviteDialog.qml
+++ b/resources/qml/dialogs/InviteDialog.qml
@@ -114,8 +114,7 @@ ApplicationWindow {
                     id: layout
 
                     spacing: Nheko.paddingMedium
-                    anchors.verticalCenter: parent.verticalCenter
-                    x: parent.x + Nheko.paddingSmall
+                    anchors.centerIn: parent
                     width: del.width - Nheko.paddingSmall * 2
 
                     Avatar {
@@ -132,26 +131,20 @@ ApplicationWindow {
 
                         Label {
                             text: model.displayName
-                            color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
+                            color: TimelineManager.userColor(model ? model.mxid : "", del.background.color)
                             font.pointSize: fontMetrics.font.pointSize
                         }
 
                         Label {
                             text: model.mxid
-                            color: Nheko.colors.buttonText
+                            color: del.hovered ? Nheko.colors.brightText : Nheko.colors.buttonText
                             font.pointSize: fontMetrics.font.pointSize * 0.9
                         }
 
-                        Item {
-                            Layout.fillHeight: true
-                            Layout.fillWidth: true
-                        }
-
                     }
 
                     Item {
                         Layout.fillWidth: true
-                        Layout.fillHeight: true
                     }
 
                     ImageButton {
diff --git a/resources/qml/dialogs/ReadReceipts.qml b/resources/qml/dialogs/ReadReceipts.qml
index 1afa4785..52e4512b 100644
--- a/resources/qml/dialogs/ReadReceipts.qml
+++ b/resources/qml/dialogs/ReadReceipts.qml
@@ -102,15 +102,10 @@ ApplicationWindow {
                                 font.pointSize: fontMetrics.font.pointSize * 0.9
                             }
 
-                            Item {
-                                Layout.fillWidth: true
-                            }
-
                         }
 
                         Item {
                             Layout.fillWidth: true
-                            Layout.fillHeight: true
                         }
 
                     }
diff --git a/resources/qml/dialogs/RoomMembers.qml b/resources/qml/dialogs/RoomMembers.qml
index 6750ed81..37ab6a80 100644
--- a/resources/qml/dialogs/RoomMembers.qml
+++ b/resources/qml/dialogs/RoomMembers.qml
@@ -100,8 +100,8 @@ ApplicationWindow {
                         id: memberLayout
 
                         spacing: Nheko.paddingMedium
-                        anchors.verticalCenter: parent.verticalCenter
-                        x: parent.x + Nheko.paddingSmall
+                        anchors.centerIn: parent
+                        width: parent.width - Nheko.paddingSmall * 2
 
                         Avatar {
                             id: avatar
@@ -119,23 +119,22 @@ ApplicationWindow {
 
                             ElidedLabel {
                                 fullText: model.displayName
-                                color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
+                                color: TimelineManager.userColor(model ? model.mxid : "", del.background.color)
                                 font.pixelSize: fontMetrics.font.pixelSize
                                 elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
                             }
 
                             ElidedLabel {
                                 fullText: model.mxid
-                                color: Nheko.colors.buttonText
+                                color: del.hovered ? Nheko.colors.brightText : Nheko.colors.buttonText
                                 font.pixelSize: Math.ceil(fontMetrics.font.pixelSize * 0.9)
                                 elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
                             }
 
-                            Item {
-                                Layout.fillHeight: true
-                                Layout.fillWidth: true
-                            }
+                        }
 
+                        Item {
+                            Layout.fillWidth: true
                         }
 
                         EncryptionIndicator {
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 84aa2c90..c5fe6b4b 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -116,9 +116,10 @@ TimelineViewManager::updateColorPalette()
 QColor
 TimelineViewManager::userColor(QString id, QColor background)
 {
-    if (!userColors.contains(id))
-        userColors.insert(id, QColor(utils::generateContrastingHexColor(id, background)));
-    return userColors.value(id);
+    QPair<QString, quint64> idx{id, background.rgba64()};
+    if (!userColors.contains(idx))
+        userColors.insert(idx, QColor(utils::generateContrastingHexColor(id, background)));
+    return userColors.value(idx);
 }
 
 QString
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index 6696b1c4..3e3952a8 100644
--- a/src/timeline/TimelineViewManager.h
+++ b/src/timeline/TimelineViewManager.h
@@ -147,7 +147,7 @@ private:
     CallManager *callManager_                 = nullptr;
     VerificationManager *verificationManager_ = nullptr;
 
-    QHash<QString, QColor> userColors;
+    QHash<QPair<QString, quint64>, QColor> userColors;
 };
 Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationAccept)
 Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationCancel)