Fix colors and alignment in dialogs

This commit is contained in:
Nicolas Werner 2021-11-18 22:33:45 +01:00
parent 7be659af46
commit 57fb0d79f9
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
5 changed files with 15 additions and 27 deletions

View file

@ -114,8 +114,7 @@ ApplicationWindow {
id: layout id: layout
spacing: Nheko.paddingMedium spacing: Nheko.paddingMedium
anchors.verticalCenter: parent.verticalCenter anchors.centerIn: parent
x: parent.x + Nheko.paddingSmall
width: del.width - Nheko.paddingSmall * 2 width: del.width - Nheko.paddingSmall * 2
Avatar { Avatar {
@ -132,26 +131,20 @@ ApplicationWindow {
Label { Label {
text: model.displayName 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 font.pointSize: fontMetrics.font.pointSize
} }
Label { Label {
text: model.mxid text: model.mxid
color: Nheko.colors.buttonText color: del.hovered ? Nheko.colors.brightText : Nheko.colors.buttonText
font.pointSize: fontMetrics.font.pointSize * 0.9 font.pointSize: fontMetrics.font.pointSize * 0.9
} }
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
} }
ImageButton { ImageButton {

View file

@ -102,15 +102,10 @@ ApplicationWindow {
font.pointSize: fontMetrics.font.pointSize * 0.9 font.pointSize: fontMetrics.font.pointSize * 0.9
} }
Item {
Layout.fillWidth: true
}
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
} }
} }

View file

@ -100,8 +100,8 @@ ApplicationWindow {
id: memberLayout id: memberLayout
spacing: Nheko.paddingMedium spacing: Nheko.paddingMedium
anchors.verticalCenter: parent.verticalCenter anchors.centerIn: parent
x: parent.x + Nheko.paddingSmall width: parent.width - Nheko.paddingSmall * 2
Avatar { Avatar {
id: avatar id: avatar
@ -119,23 +119,22 @@ ApplicationWindow {
ElidedLabel { ElidedLabel {
fullText: model.displayName 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 font.pixelSize: fontMetrics.font.pixelSize
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
} }
ElidedLabel { ElidedLabel {
fullText: model.mxid 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) font.pixelSize: Math.ceil(fontMetrics.font.pixelSize * 0.9)
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
} }
Item {
Layout.fillHeight: true
Layout.fillWidth: true
} }
Item {
Layout.fillWidth: true
} }
EncryptionIndicator { EncryptionIndicator {

View file

@ -116,9 +116,10 @@ TimelineViewManager::updateColorPalette()
QColor QColor
TimelineViewManager::userColor(QString id, QColor background) TimelineViewManager::userColor(QString id, QColor background)
{ {
if (!userColors.contains(id)) QPair<QString, quint64> idx{id, background.rgba64()};
userColors.insert(id, QColor(utils::generateContrastingHexColor(id, background))); if (!userColors.contains(idx))
return userColors.value(id); userColors.insert(idx, QColor(utils::generateContrastingHexColor(id, background)));
return userColors.value(idx);
} }
QString QString

View file

@ -147,7 +147,7 @@ private:
CallManager *callManager_ = nullptr; CallManager *callManager_ = nullptr;
VerificationManager *verificationManager_ = 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::KeyVerificationAccept)
Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationCancel) Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationCancel)