Make palette global in Qml

This commit is contained in:
Nicolas Werner 2021-05-13 08:23:56 +02:00
parent 44c5236808
commit a7f8b23b52
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
47 changed files with 226 additions and 169 deletions

View File

@ -284,11 +284,13 @@ set(SRC_FILES
src/ui/LoadingIndicator.cpp src/ui/LoadingIndicator.cpp
src/ui/NhekoCursorShape.cpp src/ui/NhekoCursorShape.cpp
src/ui/NhekoDropArea.cpp src/ui/NhekoDropArea.cpp
src/ui/NhekoGlobalObject.cpp
src/ui/OverlayModal.cpp src/ui/OverlayModal.cpp
src/ui/OverlayWidget.cpp src/ui/OverlayWidget.cpp
src/ui/RaisedButton.cpp src/ui/RaisedButton.cpp
src/ui/Ripple.cpp src/ui/Ripple.cpp
src/ui/RippleOverlay.cpp src/ui/RippleOverlay.cpp
src/ui/RoomSettings.cpp
src/ui/SnackBar.cpp src/ui/SnackBar.cpp
src/ui/TextField.cpp src/ui/TextField.cpp
src/ui/TextLabel.cpp src/ui/TextLabel.cpp
@ -296,7 +298,6 @@ set(SRC_FILES
src/ui/ThemeManager.cpp src/ui/ThemeManager.cpp
src/ui/ToggleButton.cpp src/ui/ToggleButton.cpp
src/ui/UserProfile.cpp src/ui/UserProfile.cpp
src/ui/RoomSettings.cpp
# Generic notification stuff # Generic notification stuff
src/notifications/Manager.cpp src/notifications/Manager.cpp
@ -500,26 +501,27 @@ qt5_wrap_cpp(MOC_HEADERS
# UI components # UI components
src/ui/Avatar.h src/ui/Avatar.h
src/ui/Badge.h src/ui/Badge.h
src/ui/LoadingIndicator.h
src/ui/InfoMessage.h
src/ui/FlatButton.h src/ui/FlatButton.h
src/ui/Label.h
src/ui/FloatingButton.h src/ui/FloatingButton.h
src/ui/InfoMessage.h
src/ui/Label.h
src/ui/LoadingIndicator.h
src/ui/Menu.h src/ui/Menu.h
src/ui/NhekoCursorShape.h src/ui/NhekoCursorShape.h
src/ui/NhekoDropArea.h src/ui/NhekoDropArea.h
src/ui/NhekoGlobalObject.h
src/ui/OverlayWidget.h src/ui/OverlayWidget.h
src/ui/SnackBar.h
src/ui/RaisedButton.h src/ui/RaisedButton.h
src/ui/Ripple.h src/ui/Ripple.h
src/ui/RippleOverlay.h src/ui/RippleOverlay.h
src/ui/RoomSettings.h
src/ui/SnackBar.h
src/ui/TextField.h src/ui/TextField.h
src/ui/TextLabel.h src/ui/TextLabel.h
src/ui/ToggleButton.h
src/ui/Theme.h src/ui/Theme.h
src/ui/ThemeManager.h src/ui/ThemeManager.h
src/ui/ToggleButton.h
src/ui/UserProfile.h src/ui/UserProfile.h
src/ui/RoomSettings.h
src/notifications/Manager.h src/notifications/Manager.h

View File

@ -20,7 +20,7 @@ Rectangle {
width: 48 width: 48
height: 48 height: 48
radius: Settings.avatarCircles ? height / 2 : 3 radius: Settings.avatarCircles ? height / 2 : 3
color: colors.alternateBase color: Nheko.colors.alternateBase
Component.onCompleted: { Component.onCompleted: {
mouseArea.clicked.connect(clicked); mouseArea.clicked.connect(clicked);
} }
@ -33,7 +33,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
visible: img.status != Image.Ready visible: img.status != Image.Ready
color: colors.text color: Nheko.colors.text
} }
Image { Image {
@ -55,7 +55,7 @@ Rectangle {
Ripple { Ripple {
rippleTarget: mouseArea rippleTarget: mouseArea
color: Qt.rgba(colors.alternateBase.r, colors.alternateBase.g, colors.alternateBase.b, 0.5) color: Qt.rgba(Nheko.colors.alternateBase.r, Nheko.colors.alternateBase.g, Nheko.colors.alternateBase.b, 0.5)
} }
} }

View File

@ -100,7 +100,7 @@ Popup {
delegate: Rectangle { delegate: Rectangle {
property variant modelData: model property variant modelData: model
color: model.index == popup.currentIndex ? colors.highlight : colors.base color: model.index == popup.currentIndex ? Nheko.colors.highlight : Nheko.colors.base
height: chooser.childrenRect.height + 2 * popup.rowMargin height: chooser.childrenRect.height + 2 * popup.rowMargin
implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4 implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4
@ -119,7 +119,7 @@ Popup {
Ripple { Ripple {
rippleTarget: mouseArea rippleTarget: mouseArea
color: Qt.rgba(colors.base.r, colors.base.g, colors.base.b, 0.5) color: Qt.rgba(Nheko.colors.base.r, Nheko.colors.base.g, Nheko.colors.base.b, 0.5)
} }
} }
@ -150,12 +150,12 @@ Popup {
Label { Label {
text: model.displayName text: model.displayName
color: model.index == popup.currentIndex ? colors.highlightedText : colors.text color: model.index == popup.currentIndex ? Nheko.colors.highlightedText : Nheko.colors.text
} }
Label { Label {
text: "(" + model.userid + ")" text: "(" + model.userid + ")"
color: model.index == popup.currentIndex ? colors.highlightedText : colors.buttonText color: model.index == popup.currentIndex ? Nheko.colors.highlightedText : Nheko.colors.buttonText
} }
} }
@ -173,13 +173,13 @@ Popup {
Label { Label {
text: model.unicode text: model.unicode
color: model.index == popup.currentIndex ? colors.highlightedText : colors.text color: model.index == popup.currentIndex ? Nheko.colors.highlightedText : Nheko.colors.text
font: Settings.emojiFont font: Settings.emojiFont
} }
Label { Label {
text: model.shortName text: model.shortName
color: model.index == popup.currentIndex ? colors.highlightedText : colors.text color: model.index == popup.currentIndex ? Nheko.colors.highlightedText : Nheko.colors.text
} }
} }
@ -209,7 +209,7 @@ Popup {
Label { Label {
text: model.roomName text: model.roomName
font.pixelSize: popup.avatarHeight * 0.5 font.pixelSize: popup.avatarHeight * 0.5
color: model.index == popup.currentIndex ? colors.highlightedText : colors.text color: model.index == popup.currentIndex ? Nheko.colors.highlightedText : Nheko.colors.text
} }
} }
@ -235,12 +235,12 @@ Popup {
Label { Label {
text: model.roomName text: model.roomName
color: model.index == popup.currentIndex ? colors.highlightedText : colors.text color: model.index == popup.currentIndex ? Nheko.colors.highlightedText : Nheko.colors.text
} }
Label { Label {
text: "(" + model.roomAlias + ")" text: "(" + model.roomAlias + ")"
color: model.index == popup.currentIndex ? colors.highlightedText : colors.buttonText color: model.index == popup.currentIndex ? Nheko.colors.highlightedText : Nheko.colors.buttonText
} }
} }
@ -274,10 +274,10 @@ Popup {
} }
background: Rectangle { background: Rectangle {
color: colors.base color: Nheko.colors.base
implicitHeight: popup.contentHeight implicitHeight: popup.contentHeight
implicitWidth: popup.contentWidth implicitWidth: popup.contentWidth
border.color: colors.mid border.color: Nheko.colors.mid
} }
} }

View File

@ -20,7 +20,7 @@ Image {
case Crypto.Verified: case Crypto.Verified:
return "image://colorimage/:/icons/icons/ui/lock.png?green"; return "image://colorimage/:/icons/icons/ui/lock.png?green";
case Crypto.TOFU: case Crypto.TOFU:
return "image://colorimage/:/icons/icons/ui/lock.png?" + colors.buttonText; return "image://colorimage/:/icons/icons/ui/lock.png?" + Nheko.colors.buttonText;
default: default:
return "image://colorimage/:/icons/icons/ui/lock.png?#dd3d3d"; return "image://colorimage/:/icons/icons/ui/lock.png?#dd3d3d";
} }

View File

@ -19,7 +19,7 @@ Popup {
x: Math.round(parent.width / 2 - width / 2) x: Math.round(parent.width / 2 - width / 2)
y: Math.round(parent.height / 2 - height / 2) y: Math.round(parent.height / 2 - height / 2)
modal: true modal: true
palette: colors palette: Nheko.colors
parent: Overlay.overlay parent: Overlay.overlay
width: implicitWidth >= (timelineRoot.width * 0.8) ? implicitWidth : (timelineRoot.width * 0.8) width: implicitWidth >= (timelineRoot.width * 0.8) ? implicitWidth : (timelineRoot.width * 0.8)
height: implicitHeight + completerPopup.height + padding * 2 height: implicitHeight + completerPopup.height + padding * 2
@ -44,7 +44,7 @@ Popup {
text: qsTr("Forward Message") text: qsTr("Forward Message")
font.bold: true font.bold: true
bottomPadding: 10 bottomPadding: 10
color: colors.text color: Nheko.colors.text
} }
Reply { Reply {
@ -52,14 +52,14 @@ Popup {
modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : { modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : {
} }
userColor: TimelineManager.userColor(modelData.userId, colors.window) userColor: TimelineManager.userColor(modelData.userId, Nheko.colors.window)
} }
MatrixTextField { MatrixTextField {
id: roomTextInput id: roomTextInput
width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2
color: colors.text color: Nheko.colors.text
onTextEdited: { onTextEdited: {
completerPopup.completer.searchString = text; completerPopup.completer.searchString = text;
} }
@ -107,11 +107,11 @@ Popup {
} }
background: Rectangle { background: Rectangle {
color: colors.window color: Nheko.colors.window
} }
Overlay.modal: Rectangle { Overlay.modal: Rectangle {
color: Qt.rgba(colors.window.r, colors.window.g, colors.window.b, 0.7) color: Qt.rgba(Nheko.colors.window.r, Nheko.colors.window.g, Nheko.colors.window.b, 0.7)
} }
} }

View File

@ -12,8 +12,8 @@ AbstractButton {
property alias cursor: mouseArea.cursorShape property alias cursor: mouseArea.cursorShape
property string image: undefined property string image: undefined
property color highlightColor: colors.highlight property color highlightColor: Nheko.colors.highlight
property color buttonTextColor: colors.buttonText property color buttonTextColor: Nheko.colors.buttonText
property bool changeColorOnHover: true property bool changeColorOnHover: true
focusPolicy: Qt.NoFocus focusPolicy: Qt.NoFocus

View File

@ -13,7 +13,7 @@ TextEdit {
wrapMode: Text.Wrap wrapMode: Text.Wrap
selectByMouse: !Settings.mobileMode selectByMouse: !Settings.mobileMode
enabled: selectByMouse enabled: selectByMouse
color: colors.text color: Nheko.colors.text
onLinkActivated: TimelineManager.openLink(link) onLinkActivated: TimelineManager.openLink(link)
ToolTip.visible: hoveredLink ToolTip.visible: hoveredLink
ToolTip.text: hoveredLink ToolTip.text: hoveredLink

View File

@ -9,14 +9,14 @@ import QtQuick.Layouts 1.12
TextField { TextField {
id: input id: input
palette: colors palette: Nheko.colors
Rectangle { Rectangle {
id: blueBar id: blueBar
anchors.top: parent.bottom anchors.top: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
color: colors.highlight color: Nheko.colors.highlight
height: 1 height: 1
width: parent.width width: parent.width
@ -27,7 +27,7 @@ TextField {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
height: parent.height + 1 height: parent.height + 1
width: 0 width: 0
color: colors.text color: Nheko.colors.text
states: State { states: State {
name: "focused" name: "focused"
@ -60,7 +60,7 @@ TextField {
} }
background: Rectangle { background: Rectangle {
color: colors.base color: Nheko.colors.base
} }
} }

View File

@ -12,7 +12,7 @@ import im.nheko 1.0
Rectangle { Rectangle {
id: inputBar id: inputBar
color: colors.window color: Nheko.colors.window
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: row.implicitHeight Layout.preferredHeight: row.implicitHeight
Layout.minimumHeight: 40 Layout.minimumHeight: 40
@ -69,7 +69,7 @@ Rectangle {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: colors.window color: Nheko.colors.window
visible: TimelineManager.timeline && TimelineManager.timeline.input.uploading visible: TimelineManager.timeline && TimelineManager.timeline.input.uploading
NhekoBusyIndicator { NhekoBusyIndicator {
@ -116,8 +116,8 @@ Rectangle {
selectByMouse: true selectByMouse: true
placeholderText: qsTr("Write a message...") placeholderText: qsTr("Write a message...")
placeholderTextColor: colors.buttonText placeholderTextColor: Nheko.colors.buttonText
color: colors.text color: Nheko.colors.text
width: textInput.width width: textInput.width
wrapMode: TextEdit.Wrap wrapMode: TextEdit.Wrap
padding: 8 padding: 8
@ -357,7 +357,7 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
visible: TimelineManager.timeline ? (!TimelineManager.timeline.permissions.canSend(MtxEvent.TextMessage)) : false visible: TimelineManager.timeline ? (!TimelineManager.timeline.permissions.canSend(MtxEvent.TextMessage)) : false
text: qsTr("You don't have permission to send messages in this room") text: qsTr("You don't have permission to send messages in this room")
color: colors.text color: Nheko.colors.text
} }
} }

View File

@ -13,7 +13,7 @@ import im.nheko 1.0
ScrollView { ScrollView {
clip: false clip: false
palette: colors palette: Nheko.colors
padding: 8 padding: 8
ScrollBar.horizontal.visible: false ScrollBar.horizontal.visible: false
@ -51,8 +51,8 @@ ScrollView {
z: 10 z: 10
height: row.implicitHeight + padding * 2 height: row.implicitHeight + padding * 2
width: row.implicitWidth + padding * 2 width: row.implicitWidth + padding * 2
color: colors.window color: Nheko.colors.window
border.color: colors.buttonText border.color: Nheko.colors.buttonText
border.width: 1 border.width: 1
radius: padding radius: padding
@ -74,7 +74,7 @@ ScrollView {
id: editButton id: editButton
visible: !!row.model && row.model.isEditable visible: !!row.model && row.model.isEditable
buttonTextColor: colors.buttonText buttonTextColor: Nheko.colors.buttonText
width: 16 width: 16
hoverEnabled: true hoverEnabled: true
image: ":/icons/icons/ui/edit.png" image: ":/icons/icons/ui/edit.png"
@ -220,7 +220,7 @@ ScrollView {
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
visible: modelData && modelData.previousMessageDay !== modelData.day visible: modelData && modelData.previousMessageDay !== modelData.day
text: modelData ? chat.model.formatDateSeparator(modelData.timestamp) : "" text: modelData ? chat.model.formatDateSeparator(modelData.timestamp) : ""
color: colors.text color: Nheko.colors.text
height: Math.round(fontMetrics.height * 1.4) height: Math.round(fontMetrics.height * 1.4)
width: contentWidth * 1.2 width: contentWidth * 1.2
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
@ -228,7 +228,7 @@ ScrollView {
background: Rectangle { background: Rectangle {
radius: parent.height / 2 radius: parent.height / 2
color: colors.window color: Nheko.colors.window
} }
} }
@ -267,7 +267,7 @@ ScrollView {
id: userName id: userName
text: modelData ? TimelineManager.escapeEmoji(modelData.userName) : "" text: modelData ? TimelineManager.escapeEmoji(modelData.userName) : ""
color: TimelineManager.userColor(modelData ? modelData.userId : "", colors.window) color: TimelineManager.userColor(modelData ? modelData.userId : "", Nheko.colors.window)
textFormat: Text.RichText textFormat: Text.RichText
ToolTip.visible: displayNameHover.hovered ToolTip.visible: displayNameHover.hovered
ToolTip.text: modelData ? modelData.userId : "" ToolTip.text: modelData ? modelData.userId : ""
@ -288,7 +288,7 @@ ScrollView {
} }
Label { Label {
color: colors.buttonText color: Nheko.colors.buttonText
text: modelData ? TimelineManager.userStatus(modelData.userId) : "" text: modelData ? TimelineManager.userStatus(modelData.userId) : ""
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
@ -317,7 +317,7 @@ ScrollView {
opacity: 0 opacity: 0
visible: true visible: true
anchors.fill: timelinerow anchors.fill: timelinerow
color: colors.highlight color: Nheko.colors.highlight
states: State { states: State {
name: "revealed" name: "revealed"

View File

@ -5,6 +5,7 @@
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import im.nheko 1.0
BusyIndicator { BusyIndicator {
id: control id: control
@ -38,7 +39,7 @@ BusyIndicator {
implicitWidth: radius * 2 implicitWidth: radius * 2
implicitHeight: radius * 2 implicitHeight: radius * 2
radius: item.height / 6 radius: item.height / 6
color: colors.text color: Nheko.colors.text
opacity: (index + 2) / (repeater.count + 2) opacity: (index + 2) / (repeater.count + 2)
transform: [ transform: [
Translate { Translate {

View File

@ -19,7 +19,7 @@ Popup {
modal: true modal: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
parent: Overlay.overlay parent: Overlay.overlay
palette: colors palette: Nheko.colors
onOpened: { onOpened: {
completerPopup.open(); completerPopup.open();
roomTextInput.forceActiveFocus(); roomTextInput.forceActiveFocus();
@ -34,7 +34,7 @@ Popup {
anchors.fill: parent anchors.fill: parent
font.pixelSize: Math.ceil(quickSwitcher.textHeight * 0.6) font.pixelSize: Math.ceil(quickSwitcher.textHeight * 0.6)
padding: textMargin padding: textMargin
color: colors.text color: Nheko.colors.text
onTextEdited: { onTextEdited: {
completerPopup.completer.searchString = text; completerPopup.completer.searchString = text;
} }

View File

@ -12,9 +12,9 @@ Flow {
id: reactionFlow id: reactionFlow
// highlight colors for selfReactedEvent background // highlight colors for selfReactedEvent background
property real highlightHue: colors.highlight.hslHue property real highlightHue: Nheko.colors.highlight.hslHue
property real highlightSat: colors.highlight.hslSaturation property real highlightSat: Nheko.colors.highlight.hslSaturation
property real highlightLight: colors.highlight.hslLightness property real highlightLight: Nheko.colors.highlight.hslLightness
property string eventId property string eventId
property alias reactions: repeater.model property alias reactions: repeater.model
@ -59,7 +59,7 @@ Flow {
anchors.baseline: reactionCounter.baseline anchors.baseline: reactionCounter.baseline
text: textMetrics.elidedText + (textMetrics.elidedText == modelData.key ? "" : "…") text: textMetrics.elidedText + (textMetrics.elidedText == modelData.key ? "" : "…")
font.family: Settings.emojiFont font.family: Settings.emojiFont
color: reaction.hovered ? colors.highlight : colors.text color: reaction.hovered ? Nheko.colors.highlight : Nheko.colors.text
maximumLineCount: 1 maximumLineCount: 1
} }
@ -68,7 +68,7 @@ Flow {
height: Math.floor(reactionCounter.implicitHeight * 1.4) height: Math.floor(reactionCounter.implicitHeight * 1.4)
width: 1 width: 1
color: (reaction.hovered || modelData.selfReactedEvent !== '') ? colors.highlight : colors.text color: (reaction.hovered || modelData.selfReactedEvent !== '') ? Nheko.colors.highlight : Nheko.colors.text
} }
Text { Text {
@ -77,7 +77,7 @@ Flow {
anchors.verticalCenter: divider.verticalCenter anchors.verticalCenter: divider.verticalCenter
text: modelData.count text: modelData.count
font: reaction.font font: reaction.font
color: reaction.hovered ? colors.highlight : colors.text color: reaction.hovered ? Nheko.colors.highlight : Nheko.colors.text
} }
} }
@ -86,8 +86,8 @@ Flow {
anchors.centerIn: parent anchors.centerIn: parent
implicitWidth: reaction.implicitWidth implicitWidth: reaction.implicitWidth
implicitHeight: reaction.implicitHeight implicitHeight: reaction.implicitHeight
border.color: (reaction.hovered || modelData.selfReactedEvent !== '') ? colors.highlight : colors.text border.color: (reaction.hovered || modelData.selfReactedEvent !== '') ? Nheko.colors.highlight : Nheko.colors.text
color: modelData.selfReactedEvent !== '' ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.2) : colors.window color: modelData.selfReactedEvent !== '' ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.2) : Nheko.colors.window
border.width: 1 border.width: 1
radius: reaction.height / 2 radius: reaction.height / 2
} }

View File

@ -17,7 +17,7 @@ Rectangle {
visible: room && (room.reply || room.edit) visible: room && (room.reply || room.edit)
// Height of child, plus margins, plus border // Height of child, plus margins, plus border
implicitHeight: (room && room.reply ? replyPreview.height : closeEditButton.height) + 10 implicitHeight: (room && room.reply ? replyPreview.height : closeEditButton.height) + 10
color: colors.window color: Nheko.colors.window
z: 3 z: 3
Reply { Reply {
@ -31,7 +31,7 @@ Rectangle {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
modelData: room ? room.getDump(room.reply, room.id) : { modelData: room ? room.getDump(room.reply, room.id) : {
} }
userColor: TimelineManager.userColor(modelData.userId, colors.window) userColor: TimelineManager.userColor(modelData.userId, Nheko.colors.window)
} }
ImageButton { ImageButton {

View File

@ -18,8 +18,8 @@ ApplicationWindow {
y: MainWindow.y + (MainWindow.height / 2) - (height / 2) y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
minimumWidth: 420 minimumWidth: 420
minimumHeight: 650 minimumHeight: 650
palette: colors palette: Nheko.colors
color: colors.window color: Nheko.colors.window
modality: Qt.WindowModal modality: Qt.WindowModal
flags: Qt.Dialog flags: Qt.Dialog
title: qsTr("Room Settings") title: qsTr("Room Settings")
@ -126,7 +126,7 @@ ApplicationWindow {
readOnly: true readOnly: true
background: null background: null
selectByMouse: true selectByMouse: true
color: colors.text color: Nheko.colors.text
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
onLinkActivated: TimelineManager.openLink(link) onLinkActivated: TimelineManager.openLink(link)

View File

@ -16,7 +16,7 @@ Item {
height: row.height height: row.height
Rectangle { Rectangle {
color: (Settings.messageHoverHighlight && hoverHandler.hovered) ? colors.alternateBase : "transparent" color: (Settings.messageHoverHighlight && hoverHandler.hovered) ? Nheko.colors.alternateBase : "transparent"
anchors.fill: row anchors.fill: row
} }
@ -57,7 +57,7 @@ Item {
Reply { Reply {
visible: model.replyTo visible: model.replyTo
modelData: chat.model.getDump(model.replyTo, model.id) modelData: chat.model.getDump(model.replyTo, model.id)
userColor: TimelineManager.userColor(modelData.userId, colors.base) userColor: TimelineManager.userColor(modelData.userId, Nheko.colors.base)
} }
// actual message content // actual message content
@ -101,7 +101,7 @@ Item {
width: 16 width: 16
sourceSize.width: 16 sourceSize.width: 16
sourceSize.height: 16 sourceSize.height: 16
source: "image://colorimage/:/icons/icons/ui/edit.png?" + ((model.id == chat.model.edit) ? colors.highlight : colors.buttonText) source: "image://colorimage/:/icons/icons/ui/edit.png?" + ((model.id == chat.model.edit) ? Nheko.colors.highlight : Nheko.colors.buttonText)
ToolTip.visible: editHovered.hovered ToolTip.visible: editHovered.hovered
ToolTip.text: qsTr("Edited") ToolTip.text: qsTr("Edited")
@ -115,7 +115,7 @@ Item {
Layout.alignment: Qt.AlignRight | Qt.AlignTop Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: model.timestamp.toLocaleTimeString(Locale.ShortFormat) text: model.timestamp.toLocaleTimeString(Locale.ShortFormat)
width: Math.max(implicitWidth, text.length * fontMetrics.maximumCharacterWidth) width: Math.max(implicitWidth, text.length * fontMetrics.maximumCharacterWidth)
color: inactiveColors.text color: Nheko.inactiveColors.text
ToolTip.visible: ma.hovered ToolTip.visible: ma.hovered
ToolTip.text: Qt.formatDateTime(model.timestamp, Qt.DefaultLocaleLongDate) ToolTip.text: Qt.formatDateTime(model.timestamp, Qt.DefaultLocaleLongDate)

View File

@ -18,15 +18,13 @@ import im.nheko.EmojiModel 1.0
Page { Page {
id: timelineRoot id: timelineRoot
property var colors: currentActivePalette
property var systemInactive property var systemInactive
property var inactiveColors: currentInactivePalette ? currentInactivePalette : systemInactive
readonly property int avatarSize: 40 readonly property int avatarSize: 40
property real highlightHue: colors.highlight.hslHue property real highlightHue: Nheko.colors.highlight.hslHue
property real highlightSat: colors.highlight.hslSaturation property real highlightSat: Nheko.colors.highlight.hslSaturation
property real highlightLight: colors.highlight.hslLightness property real highlightLight: Nheko.colors.highlight.hslLightness
palette: colors palette: Nheko.colors
FontMetrics { FontMetrics {
id: fontMetrics id: fontMetrics
@ -219,7 +217,7 @@ Page {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: colors.window color: Nheko.colors.window
Component { Component {
id: deviceVerificationDialog id: deviceVerificationDialog
@ -270,7 +268,7 @@ Page {
anchors.centerIn: parent anchors.centerIn: parent
text: qsTr("No room open") text: qsTr("No room open")
font.pointSize: 24 font.pointSize: 24
color: colors.text color: Nheko.colors.text
} }
BusyIndicator { BusyIndicator {
@ -296,7 +294,7 @@ Page {
Layout.fillWidth: true Layout.fillWidth: true
height: 1 height: 1
z: 3 z: 3
color: colors.mid color: Nheko.colors.mid
} }
Rectangle { Rectangle {
@ -304,7 +302,7 @@ Page {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
color: colors.base color: Nheko.colors.base
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
@ -358,7 +356,7 @@ Page {
Layout.fillWidth: true Layout.fillWidth: true
z: 3 z: 3
height: 1 height: 1
color: colors.mid color: Nheko.colors.mid
} }
ReplyPopup { ReplyPopup {
@ -383,8 +381,4 @@ Page {
timelineRoot: timelineLayout timelineRoot: timelineLayout
} }
systemInactive: SystemPalette {
colorGroup: SystemPalette.Disabled
}
} }

View File

@ -16,7 +16,7 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: topLayout.height + 16 implicitHeight: topLayout.height + 16
z: 3 z: 3
color: colors.window color: Nheko.colors.window
TapHandler { TapHandler {
onSingleTapped: { onSingleTapped: {
@ -68,7 +68,7 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.column: 2 Layout.column: 2
Layout.row: 0 Layout.row: 0
color: colors.text color: Nheko.colors.text
font.pointSize: fontMetrics.font.pointSize * 1.1 font.pointSize: fontMetrics.font.pointSize * 1.1
text: room ? room.roomName : qsTr("No room selected") text: room ? room.roomName : qsTr("No room selected")
maximumLineCount: 1 maximumLineCount: 1

View File

@ -17,7 +17,7 @@ Item {
id: typingRect id: typingRect
visible: (room && room.typingUsers.length > 0) visible: (room && room.typingUsers.length > 0)
color: colors.base color: Nheko.colors.base
anchors.fill: parent anchors.fill: parent
z: 3 z: 3
@ -29,8 +29,8 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 10 anchors.rightMargin: 10
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
color: colors.text color: Nheko.colors.text
text: room ? room.formatTypingUsers(room.typingUsers, colors.base) : "" text: room ? room.formatTypingUsers(room.typingUsers, Nheko.colors.base) : ""
textFormat: Text.RichText textFormat: Text.RichText
} }

View File

@ -19,8 +19,8 @@ ApplicationWindow {
height: 650 height: 650
width: 420 width: 420
minimumHeight: 420 minimumHeight: 420
palette: colors palette: Nheko.colors
color: colors.window color: Nheko.colors.window
title: profile.isGlobalUserProfile ? qsTr("Global User Profile") : qsTr("Room User Profile") title: profile.isGlobalUserProfile ? qsTr("Global User Profile") : qsTr("Room User Profile")
modality: Qt.WindowModal modality: Qt.WindowModal
flags: Qt.Dialog flags: Qt.Dialog
@ -97,7 +97,7 @@ ApplicationWindow {
readOnly: !isUsernameEditingAllowed readOnly: !isUsernameEditingAllowed
text: profile.displayName text: profile.displayName
font.pixelSize: 20 font.pixelSize: 20
color: TimelineManager.userColor(profile.userid, colors.window) color: TimelineManager.userColor(profile.userid, Nheko.colors.window)
font.bold: true font.bold: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
selectByMouse: true selectByMouse: true
@ -145,7 +145,7 @@ ApplicationWindow {
Image { Image {
Layout.preferredHeight: 16 Layout.preferredHeight: 16
Layout.preferredWidth: 16 Layout.preferredWidth: 16
source: "image://colorimage/:/icons/icons/ui/lock.png?" + ((profile.userVerified == Crypto.Verified) ? "green" : colors.buttonText) source: "image://colorimage/:/icons/icons/ui/lock.png?" + ((profile.userVerified == Crypto.Verified) ? "green" : Nheko.colors.buttonText)
visible: profile.userVerified != Crypto.Unverified visible: profile.userVerified != Crypto.Unverified
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
@ -218,7 +218,7 @@ ApplicationWindow {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
elide: Text.ElideRight elide: Text.ElideRight
font.bold: true font.bold: true
color: colors.text color: Nheko.colors.text
text: model.deviceId text: model.deviceId
} }
@ -226,7 +226,7 @@ ApplicationWindow {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
elide: Text.ElideRight elide: Text.ElideRight
color: colors.text color: Nheko.colors.text
text: model.deviceName text: model.deviceName
} }

View File

@ -20,7 +20,7 @@ Item {
Rectangle { Rectangle {
id: button id: button
color: colors.light color: Nheko.colors.light
radius: 22 radius: 22
height: 44 height: 44
width: 44 width: 44
@ -55,7 +55,7 @@ Item {
text: model.data.filename text: model.data.filename
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
color: colors.text color: Nheko.colors.text
} }
Text { Text {
@ -65,7 +65,7 @@ Item {
text: model.data.filesize text: model.data.filesize
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
color: colors.text color: Nheko.colors.text
} }
} }
@ -73,7 +73,7 @@ Item {
} }
Rectangle { Rectangle {
color: colors.alternateBase color: Nheko.colors.alternateBase
z: -1 z: -1
radius: 10 radius: 10
height: row.height + 24 height: row.height + 24

View File

@ -19,7 +19,7 @@ Item {
anchors.fill: parent anchors.fill: parent
visible: img.status != Image.Ready visible: img.status != Image.Ready
source: model.data.blurhash ? ("image://blurhash/" + model.data.blurhash) : ("image://colorimage/:/icons/icons/ui/do-not-disturb-rounded-sign@2x.png?" + colors.buttonText) source: model.data.blurhash ? ("image://blurhash/" + model.data.blurhash) : ("image://colorimage/:/icons/icons/ui/do-not-disturb-rounded-sign@2x.png?" + Nheko.colors.buttonText)
asynchronous: true asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
sourceSize.width: parent.width sourceSize.width: parent.width
@ -61,7 +61,7 @@ Item {
width: parent.width width: parent.width
implicitHeight: imgcaption.implicitHeight implicitHeight: imgcaption.implicitHeight
anchors.bottom: overlay.bottom anchors.bottom: overlay.bottom
color: colors.window color: Nheko.colors.window
opacity: 0.75 opacity: 0.75
} }
@ -74,7 +74,7 @@ Item {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
// See this MSC: https://github.com/matrix-org/matrix-doc/pull/2530 // See this MSC: https://github.com/matrix-org/matrix-doc/pull/2530
text: model.data.filename ? model.data.filename : model.data.body text: model.data.filename ? model.data.filename : model.data.body
color: colors.text color: Nheko.colors.text
} }
} }

View File

@ -58,7 +58,7 @@ Item {
NoticeMessage { NoticeMessage {
formatted: TimelineManager.escapeEmoji(modelData.userName) + " " + model.data.formattedBody formatted: TimelineManager.escapeEmoji(modelData.userName) + " " + model.data.formattedBody
color: TimelineManager.userColor(modelData.userId, colors.window) color: TimelineManager.userColor(modelData.userId, Nheko.colors.window)
} }
} }

View File

@ -2,7 +2,9 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import im.nheko 1.0
TextMessage { TextMessage {
font.italic: true font.italic: true
color: colors.buttonText color: Nheko.colors.buttonText
} }

View File

@ -6,14 +6,14 @@ import QtQuick 2.5
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
Label { Label {
color: colors.brightText color: Nheko.colors.brightText
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
height: contentHeight * 1.2 height: contentHeight * 1.2
width: contentWidth * 1.2 width: contentWidth * 1.2
background: Rectangle { background: Rectangle {
radius: parent.height / 2 radius: parent.height / 2
color: colors.alternateBase color: Nheko.colors.alternateBase
} }
} }

View File

@ -3,9 +3,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import ".." import ".."
import im.nheko 1.0
MatrixText { MatrixText {
text: qsTr("unimplemented event: ") + model.data.typeString text: qsTr("unimplemented event: ") + model.data.typeString
width: parent ? parent.width : undefined width: parent ? parent.width : undefined
color: inactiveColors.text color: Nheko.inactiveColors.text
} }

View File

@ -13,7 +13,7 @@ Rectangle {
id: bg id: bg
radius: 10 radius: 10
color: colors.alternateBase color: Nheko.colors.alternateBase
height: Math.round(content.height + 24) height: Math.round(content.height + 24)
width: parent ? parent.width : undefined width: parent ? parent.width : undefined
@ -58,7 +58,7 @@ Rectangle {
id: positionText id: positionText
text: "--:--:--" text: "--:--:--"
color: colors.text color: Nheko.colors.text
} }
Slider { Slider {
@ -92,14 +92,14 @@ Rectangle {
to: media.duration to: media.duration
onMoved: media.seek(value) onMoved: media.seek(value)
onValueChanged: updatePositionTexts() onValueChanged: updatePositionTexts()
palette: colors palette: Nheko.colors
} }
Text { Text {
id: durationText id: durationText
text: "--:--:--" text: "--:--:--"
color: colors.text color: Nheko.colors.text
} }
} }
@ -112,7 +112,7 @@ Rectangle {
id: button id: button
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
//color: colors.window //color: Nheko.colors.window
//radius: 22 //radius: 22
height: 32 height: 32
width: 32 width: 32
@ -194,7 +194,7 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
text: model.data.body text: model.data.body
elide: Text.ElideRight elide: Text.ElideRight
color: colors.text color: Nheko.colors.text
} }
Text { Text {
@ -202,7 +202,7 @@ Rectangle {
text: model.data.filesize text: model.data.filesize
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
color: colors.text color: Nheko.colors.text
} }
} }

View File

@ -33,7 +33,7 @@ Item {
anchors.top: replyContainer.top anchors.top: replyContainer.top
anchors.bottom: replyContainer.bottom anchors.bottom: replyContainer.bottom
width: 4 width: 4
color: TimelineManager.userColor(reply.modelData.userId, colors.window) color: TimelineManager.userColor(reply.modelData.userId, Nheko.colors.window)
} }
Column { Column {

View File

@ -9,7 +9,7 @@ MatrixText {
property string formatted: model.data.formattedBody property string formatted: model.data.formattedBody
property string copyText: selectedText ? getText(selectionStart, selectionEnd) : model.data.body property string copyText: selectedText ? getText(selectionStart, selectionEnd) : model.data.body
text: "<style type=\"text/css\">a { color:" + colors.link + ";}\ncode { background-color: " + colors.alternateBase + ";}</style>" + formatted.replace("<pre>", "<pre style='white-space: pre-wrap; background-color: " + colors.alternateBase + "'>") text: "<style type=\"text/css\">a { color:" + Nheko.colors.link + ";}\ncode { background-color: " + Nheko.colors.alternateBase + ";}</style>" + formatted.replace("<pre>", "<pre style='white-space: pre-wrap; background-color: " + Nheko.colors.alternateBase + "'>")
width: parent ? parent.width : undefined width: parent ? parent.width : undefined
height: isReply ? Math.round(Math.min(timelineRoot.height / 8, implicitHeight)) : undefined height: isReply ? Math.round(Math.min(timelineRoot.height / 8, implicitHeight)) : undefined
clip: isReply clip: isReply

View File

@ -21,7 +21,7 @@ Pane {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: qsTr("Waiting for other side to complete verification.") text: qsTr("Waiting for other side to complete verification.")
color: colors.text color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }

View File

@ -16,7 +16,7 @@ ApplicationWindow {
title: stack.currentItem.title title: stack.currentItem.title
flags: Qt.Dialog flags: Qt.Dialog
modality: Qt.WindowModal modality: Qt.WindowModal
palette: colors palette: Nheko.colors
height: stack.implicitHeight height: stack.implicitHeight
width: stack.implicitWidth width: stack.implicitWidth
x: MainWindow.x + (MainWindow.width / 2) - (width / 2) x: MainWindow.x + (MainWindow.width / 2) - (width / 2)

View File

@ -19,7 +19,7 @@ Pane {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: qsTr("Please verify the following digits. You should see the same numbers on both sides. If they differ, please press 'They do not match!' to abort verification!") text: qsTr("Please verify the following digits. You should see the same numbers on both sides. If they differ, please press 'They do not match!' to abort verification!")
color: colors.text color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@ -29,19 +29,19 @@ Pane {
Label { Label {
font.pixelSize: Qt.application.font.pixelSize * 2 font.pixelSize: Qt.application.font.pixelSize * 2
text: flow.sasList[0] text: flow.sasList[0]
color: colors.text color: Nheko.colors.text
} }
Label { Label {
font.pixelSize: Qt.application.font.pixelSize * 2 font.pixelSize: Qt.application.font.pixelSize * 2
text: flow.sasList[1] text: flow.sasList[1]
color: colors.text color: Nheko.colors.text
} }
Label { Label {
font.pixelSize: Qt.application.font.pixelSize * 2 font.pixelSize: Qt.application.font.pixelSize * 2
text: flow.sasList[2] text: flow.sasList[2]
color: colors.text color: Nheko.colors.text
} }
} }

View File

@ -19,7 +19,7 @@ Pane {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: qsTr("Please verify the following emoji. You should see the same emoji on both sides. If they differ, please press 'They do not match!' to abort verification!") text: qsTr("Please verify the following emoji. You should see the same emoji on both sides. If they differ, please press 'They do not match!' to abort verification!")
color: colors.text color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@ -374,13 +374,13 @@ Pane {
text: col.emoji.emoji text: col.emoji.emoji
font.pixelSize: Qt.application.font.pixelSize * 2 font.pixelSize: Qt.application.font.pixelSize * 2
font.family: Settings.emojiFont font.family: Settings.emojiFont
color: colors.text color: Nheko.colors.text
} }
Label { Label {
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
text: col.emoji.description text: col.emoji.description
color: colors.text color: Nheko.colors.text
} }
} }

View File

@ -38,7 +38,7 @@ Pane {
return "Unknown verification error."; return "Unknown verification error.";
} }
} }
color: colors.text color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }

View File

@ -35,7 +35,7 @@ Pane {
return qsTr("Your device (%1) has requested to be verified.").arg(flow.deviceId); return qsTr("Your device (%1) has requested to be verified.").arg(flow.deviceId);
} }
} }
color: colors.text color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }

View File

@ -20,7 +20,7 @@ Pane {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: qsTr("Verification successful! Both sides verified their devices!") text: qsTr("Verification successful! Both sides verified their devices!")
color: colors.text color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }

View File

@ -30,13 +30,13 @@ Pane {
return qsTr("Waiting for other side to complete the verification process."); return qsTr("Waiting for other side to complete the verification process.");
} }
} }
color: colors.text color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
BusyIndicator { BusyIndicator {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
palette: colors palette: Nheko.colors
} }
RowLayout { RowLayout {

View File

@ -18,9 +18,9 @@ Menu {
property alias model: gridView.model property alias model: gridView.model
property var textArea property var textArea
property string emojiCategory: "people" property string emojiCategory: "people"
property real highlightHue: colors.highlight.hslHue property real highlightHue: Nheko.colors.highlight.hslHue
property real highlightSat: colors.highlight.hslSaturation property real highlightSat: Nheko.colors.highlight.hslSaturation
property real highlightLight: colors.highlight.hslLightness property real highlightLight: Nheko.colors.highlight.hslLightness
function show(showAt, callback) { function show(showAt, callback) {
console.debug("Showing emojiPicker"); console.debug("Showing emojiPicker");
@ -80,7 +80,7 @@ Menu {
id: clearSearch id: clearSearch
visible: emojiSearch.text !== '' visible: emojiSearch.text !== ''
icon.source: "image://colorimage/:/icons/icons/ui/round-remove-button.png?" + (clearSearch.hovered ? colors.highlight : colors.buttonText) icon.source: "image://colorimage/:/icons/icons/ui/round-remove-button.png?" + (clearSearch.hovered ? Nheko.colors.highlight : Nheko.colors.buttonText)
focusPolicy: Qt.NoFocus focusPolicy: Qt.NoFocus
onClicked: emojiSearch.clear() onClicked: emojiSearch.clear()
@ -146,7 +146,7 @@ Menu {
background: Rectangle { background: Rectangle {
anchors.fill: parent anchors.fill: parent
color: hovered ? colors.highlight : 'transparent' color: hovered ? Nheko.colors.highlight : 'transparent'
radius: 5 radius: 5
} }
@ -163,7 +163,7 @@ Menu {
visible: emojiSearch.text === '' visible: emojiSearch.text === ''
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 1 Layout.preferredHeight: 1
color: emojiPopup.colors.alternateBase color: emojiPopup.Nheko.colors.alternateBase
} }
// Category picker row // Category picker row
@ -265,14 +265,14 @@ Menu {
fillMode: Image.Pad fillMode: Image.Pad
sourceSize.width: 32 sourceSize.width: 32
sourceSize.height: 32 sourceSize.height: 32
source: "image://colorimage/" + model.image + "?" + (hovered ? colors.highlight : colors.buttonText) source: "image://colorimage/" + model.image + "?" + (hovered ? Nheko.colors.highlight : Nheko.colors.buttonText)
} }
background: Rectangle { background: Rectangle {
anchors.fill: parent anchors.fill: parent
color: emojiPopup.model.category === model.category ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.2) : 'transparent' color: emojiPopup.model.category === model.category ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.2) : 'transparent'
radius: 5 radius: 5
border.color: emojiPopup.model.category === model.category ? colors.highlight : 'transparent' border.color: emojiPopup.model.category === model.category ? Nheko.colors.highlight : 'transparent'
} }
} }

View File

@ -9,7 +9,7 @@ import im.nheko 1.0
Popup { Popup {
modal: true modal: true
palette: colors palette: Nheko.colors
// only set the anchors on Qt 5.12 or higher // only set the anchors on Qt 5.12 or higher
// see https://doc.qt.io/qt-5/qml-qtquick-controls2-popup.html#anchors.centerIn-prop // see https://doc.qt.io/qt-5/qml-qtquick-controls2-popup.html#anchors.centerIn-prop
Component.onCompleted: { Component.onCompleted: {
@ -31,7 +31,7 @@ Popup {
Image { Image {
Layout.preferredWidth: 22 Layout.preferredWidth: 22
Layout.preferredHeight: 22 Layout.preferredHeight: 22
source: "image://colorimage/:/icons/icons/ui/microphone-unmute.png?" + colors.windowText source: "image://colorimage/:/icons/icons/ui/microphone-unmute.png?" + Nheko.colors.windowText
} }
ComboBox { ComboBox {
@ -49,7 +49,7 @@ Popup {
Image { Image {
Layout.preferredWidth: 22 Layout.preferredWidth: 22
Layout.preferredHeight: 22 Layout.preferredHeight: 22
source: "image://colorimage/:/icons/icons/ui/video-call.png?" + colors.windowText source: "image://colorimage/:/icons/icons/ui/video-call.png?" + Nheko.colors.windowText
} }
ComboBox { ComboBox {
@ -81,8 +81,8 @@ Popup {
} }
background: Rectangle { background: Rectangle {
color: colors.window color: Nheko.colors.window
border.color: colors.windowText border.color: Nheko.colors.windowText
} }
} }

View File

@ -12,7 +12,7 @@ Popup {
closePolicy: Popup.NoAutoClose closePolicy: Popup.NoAutoClose
width: parent.width width: parent.width
height: parent.height height: parent.height
palette: colors palette: Nheko.colors
Component { Component {
id: deviceError id: deviceError
@ -41,7 +41,7 @@ Popup {
Layout.topMargin: msgView.height / 25 Layout.topMargin: msgView.height / 25
text: CallManager.callParty text: CallManager.callParty
font.pointSize: fontMetrics.font.pointSize * 2 font.pointSize: fontMetrics.font.pointSize * 2
color: colors.windowText color: Nheko.colors.windowText
} }
Avatar { Avatar {
@ -62,14 +62,14 @@ Popup {
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: msgView.height / 10 Layout.preferredWidth: msgView.height / 10
Layout.preferredHeight: msgView.height / 10 Layout.preferredHeight: msgView.height / 10
source: "image://colorimage/" + image + "?" + colors.windowText source: "image://colorimage/" + image + "?" + Nheko.colors.windowText
} }
Label { Label {
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
text: CallManager.callType == CallType.VIDEO ? qsTr("Video Call") : qsTr("Voice Call") text: CallManager.callType == CallType.VIDEO ? qsTr("Video Call") : qsTr("Voice Call")
font.pointSize: fontMetrics.font.pointSize * 2 font.pointSize: fontMetrics.font.pointSize * 2
color: colors.windowText color: Nheko.colors.windowText
} }
} }
@ -88,7 +88,7 @@ Popup {
Image { Image {
Layout.preferredWidth: deviceCombos.imageSize Layout.preferredWidth: deviceCombos.imageSize
Layout.preferredHeight: deviceCombos.imageSize Layout.preferredHeight: deviceCombos.imageSize
source: "image://colorimage/:/icons/icons/ui/microphone-unmute.png?" + colors.windowText source: "image://colorimage/:/icons/icons/ui/microphone-unmute.png?" + Nheko.colors.windowText
} }
ComboBox { ComboBox {
@ -107,7 +107,7 @@ Popup {
Image { Image {
Layout.preferredWidth: deviceCombos.imageSize Layout.preferredWidth: deviceCombos.imageSize
Layout.preferredHeight: deviceCombos.imageSize Layout.preferredHeight: deviceCombos.imageSize
source: "image://colorimage/:/icons/icons/ui/video-call.png?" + colors.windowText source: "image://colorimage/:/icons/icons/ui/video-call.png?" + Nheko.colors.windowText
} }
ComboBox { ComboBox {
@ -194,8 +194,8 @@ Popup {
} }
background: Rectangle { background: Rectangle {
color: colors.window color: Nheko.colors.window
border.color: colors.windowText border.color: Nheko.colors.windowText
} }
} }

View File

@ -88,7 +88,7 @@ Rectangle {
Layout.rightMargin: 4 Layout.rightMargin: 4
icon.source: CallManager.callType == CallType.VIDEO ? "qrc:/icons/icons/ui/video-call.png" : "qrc:/icons/icons/ui/place-call.png" icon.source: CallManager.callType == CallType.VIDEO ? "qrc:/icons/icons/ui/video-call.png" : "qrc:/icons/icons/ui/place-call.png"
text: qsTr("Accept") text: qsTr("Accept")
palette: colors palette: Nheko.colors
onClicked: { onClicked: {
if (CallManager.mics.length == 0) { if (CallManager.mics.length == 0) {
var dialog = deviceError.createObject(timelineRoot, { var dialog = deviceError.createObject(timelineRoot, {
@ -121,7 +121,7 @@ Rectangle {
Layout.rightMargin: 16 Layout.rightMargin: 16
icon.source: "qrc:/icons/icons/ui/end-call.png" icon.source: "qrc:/icons/icons/ui/end-call.png"
text: qsTr("Decline") text: qsTr("Decline")
palette: colors palette: Nheko.colors
onClicked: { onClicked: {
CallManager.hangUp(); CallManager.hangUp();
} }

View File

@ -24,19 +24,19 @@ Popup {
Image { Image {
Layout.preferredWidth: 16 Layout.preferredWidth: 16
Layout.preferredHeight: 16 Layout.preferredHeight: 16
source: "image://colorimage/" + image + "?" + colors.windowText source: "image://colorimage/" + image + "?" + Nheko.colors.windowText
} }
Label { Label {
text: errorString text: errorString
color: colors.windowText color: Nheko.colors.windowText
} }
} }
background: Rectangle { background: Rectangle {
color: colors.window color: Nheko.colors.window
border.color: colors.windowText border.color: Nheko.colors.windowText
} }
} }

View File

@ -17,7 +17,7 @@ Popup {
anchors.centerIn = parent; anchors.centerIn = parent;
} }
palette: colors palette: Nheko.colors
Component { Component {
id: deviceError id: deviceError
@ -46,7 +46,7 @@ Popup {
Label { Label {
text: qsTr("Place a call to %1?").arg(TimelineManager.timeline.roomName) text: qsTr("Place a call to %1?").arg(TimelineManager.timeline.roomName)
color: colors.windowText color: Nheko.colors.windowText
} }
Item { Item {
@ -139,7 +139,7 @@ Popup {
Image { Image {
Layout.preferredWidth: 22 Layout.preferredWidth: 22
Layout.preferredHeight: 22 Layout.preferredHeight: 22
source: "image://colorimage/:/icons/icons/ui/microphone-unmute.png?" + colors.windowText source: "image://colorimage/:/icons/icons/ui/microphone-unmute.png?" + Nheko.colors.windowText
} }
ComboBox { ComboBox {
@ -160,7 +160,7 @@ Popup {
Image { Image {
Layout.preferredWidth: 22 Layout.preferredWidth: 22
Layout.preferredHeight: 22 Layout.preferredHeight: 22
source: "image://colorimage/:/icons/icons/ui/video-call.png?" + colors.windowText source: "image://colorimage/:/icons/icons/ui/video-call.png?" + Nheko.colors.windowText
} }
ComboBox { ComboBox {
@ -177,8 +177,8 @@ Popup {
} }
background: Rectangle { background: Rectangle {
color: colors.window color: Nheko.colors.window
border.color: colors.windowText border.color: Nheko.colors.windowText
} }
} }

View File

@ -18,7 +18,7 @@ Popup {
frameRateCombo.currentIndex = frameRateCombo.find(Settings.screenShareFrameRate); frameRateCombo.currentIndex = frameRateCombo.find(Settings.screenShareFrameRate);
} }
palette: colors palette: Nheko.colors
ColumnLayout { ColumnLayout {
Label { Label {
@ -28,7 +28,7 @@ Popup {
Layout.rightMargin: 8 Layout.rightMargin: 8
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: qsTr("Share desktop with %1?").arg(TimelineManager.timeline.roomName) text: qsTr("Share desktop with %1?").arg(TimelineManager.timeline.roomName)
color: colors.windowText color: Nheko.colors.windowText
} }
RowLayout { RowLayout {
@ -39,7 +39,7 @@ Popup {
Label { Label {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: qsTr("Window:") text: qsTr("Window:")
color: colors.windowText color: Nheko.colors.windowText
} }
ComboBox { ComboBox {
@ -59,7 +59,7 @@ Popup {
Label { Label {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: qsTr("Frame rate:") text: qsTr("Frame rate:")
color: colors.windowText color: Nheko.colors.windowText
} }
ComboBox { ComboBox {
@ -161,8 +161,8 @@ Popup {
} }
background: Rectangle { background: Rectangle {
color: colors.window color: Nheko.colors.window
border.color: colors.windowText border.color: Nheko.colors.windowText
} }
} }

View File

@ -32,6 +32,7 @@
#include "emoji/Provider.h" #include "emoji/Provider.h"
#include "ui/NhekoCursorShape.h" #include "ui/NhekoCursorShape.h"
#include "ui/NhekoDropArea.h" #include "ui/NhekoDropArea.h"
#include "ui/NhekoGlobalObject.h"
Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents) Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents)
Q_DECLARE_METATYPE(std::vector<DeviceInfo>) Q_DECLARE_METATYPE(std::vector<DeviceInfo>)
@ -221,6 +222,10 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
"im.nheko", 1, 0, "Clipboard", [](QQmlEngine *, QJSEngine *) -> QObject * { "im.nheko", 1, 0, "Clipboard", [](QQmlEngine *, QJSEngine *) -> QObject * {
return new Clipboard(); return new Clipboard();
}); });
qmlRegisterSingletonType<Nheko>(
"im.nheko", 1, 0, "Nheko", [](QQmlEngine *, QJSEngine *) -> QObject * {
return new Nheko();
});
qRegisterMetaType<mtx::events::collections::TimelineEvents>(); qRegisterMetaType<mtx::events::collections::TimelineEvents>();
qRegisterMetaType<std::vector<DeviceInfo>>(); qRegisterMetaType<std::vector<DeviceInfo>>();

View File

@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "NhekoGlobalObject.h"
#include "UserSettingsPage.h"
Nheko::Nheko()
{
connect(
UserSettings::instance().get(), &UserSettings::themeChanged, this, &Nheko::colorsChanged);
}
QPalette
Nheko::colors() const
{
return QPalette();
}
QPalette
Nheko::inactiveColors() const
{
QPalette p;
p.setCurrentColorGroup(QPalette::ColorGroup::Inactive);
return p;
}

View File

@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QObject>
#include <QPalette>
class Nheko : public QObject
{
Q_OBJECT
Q_PROPERTY(QPalette colors READ colors NOTIFY colorsChanged)
Q_PROPERTY(QPalette inactiveColors READ inactiveColors NOTIFY colorsChanged)
public:
Nheko();
QPalette colors() const;
QPalette inactiveColors() const;
signals:
void colorsChanged();
};