Commit 303639fe authored by Sébastien Blin's avatar Sébastien Blin
Browse files

misc: graphical adjustments

+ Adapt primary color via the luma of the background
+ Adapt font size
+ Adapt some margins
+ Add highlight on avatars
+ Fix selected UID when creating swarms

GitLab: #670
Change-Id: I219acd5a1726298050a1ca908dbf38929bab171a
parent dcd4cad6
......@@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
......
......@@ -61,15 +61,10 @@ SBSMessageBase {
onLinkHovered: root.hoveredLink = hoveredLink
onLinkActivated: Qt.openUrlExternally(hoveredLink)
readOnly: true
color: {
var luma = 0.2126 * bubble.color.r + 0.7152 * bubble.color.g + 0.0722 * bubble.color.b // ITU-R BT.709
return luma < 0.60 ?
color: UtilsAdapter.luma(bubble.color) ?
JamiTheme.chatviewTextColorLight :
JamiTheme.chatviewTextColorDark
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: function onTapped(eventPoint) {
......
......@@ -20,6 +20,7 @@ import QtQuick
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
import net.jami.Models 1.1
......
......@@ -179,7 +179,7 @@ Rectangle {
ColorDialog {
id: colorDialog
title: JamiTheme.chooseAColor
title: JamiStrings.chooseAColor
onAccepted: {
console.warn("TODO SAVE preference")
CurrentConversation.color = colorDialog.color
......@@ -220,14 +220,14 @@ Rectangle {
}
}
RowLayout {
Layout.leftMargin: JamiTheme.preferredMarginSize
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4
Text {
Layout.fillWidth: true
Layout.preferredHeight: 30
Layout.rightMargin: JamiTheme.preferredMarginSize
anchors.left: parent.left
anchors.top: parent.top
anchors.margins: JamiTheme.preferredMarginSize
text: JamiStrings.leaveTheSwarm
font.pointSize: JamiTheme.settingsFontSize
font.kerning: true
......@@ -238,17 +238,20 @@ Rectangle {
color: JamiTheme.textColor
}
PushButton {
id: leaveTheSwarmBtn
anchors.verticalCenter: parent.verticalCenter
source: JamiResources.round_close_24dp_svg
color: "transparent"
normalColor: JamiTheme.backgroundColor
imageColor: JamiTheme.textColor
toolTipText: JamiStrings.leave
HoverHandler {
target: parent
enabled: parent.visible
onHoveredChanged: {
parent.color = hovered ? Qt.darker(JamiTheme.selectedColor, 1.05) : "transparent"
}
}
onClicked: {
TapHandler {
target: parent
enabled: parent.visible
onTapped: function onTapped(eventPoint) {
MessagesAdapter.removeConversation(LRCInstance.selectedConvUid)
}
}
......
......@@ -571,5 +571,6 @@ UtilsAdapter::getParticipantRole(const QString& accountId, const QString& convId
bool
UtilsAdapter::luma(const QColor& color) const
{
return (0.2126 * color.red() + 0.7152 * color.green() + 0.0722 * color.blue()) > .6;
return (0.2126 * color.red() + 0.7152 * color.green() + 0.0722 * color.blue())
< 153 /* .6 * 256 */;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment