diff options
47 files changed, 226 insertions, 169 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 96948827..5155af40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -284,11 +284,13 @@ set(SRC_FILES src/ui/LoadingIndicator.cpp src/ui/NhekoCursorShape.cpp src/ui/NhekoDropArea.cpp + src/ui/NhekoGlobalObject.cpp src/ui/OverlayModal.cpp src/ui/OverlayWidget.cpp src/ui/RaisedButton.cpp src/ui/Ripple.cpp src/ui/RippleOverlay.cpp + src/ui/RoomSettings.cpp src/ui/SnackBar.cpp src/ui/TextField.cpp src/ui/TextLabel.cpp @@ -296,7 +298,6 @@ set(SRC_FILES src/ui/ThemeManager.cpp src/ui/ToggleButton.cpp src/ui/UserProfile.cpp - src/ui/RoomSettings.cpp # Generic notification stuff src/notifications/Manager.cpp @@ -500,26 +501,27 @@ qt5_wrap_cpp(MOC_HEADERS # UI components src/ui/Avatar.h src/ui/Badge.h - src/ui/LoadingIndicator.h - src/ui/InfoMessage.h src/ui/FlatButton.h - src/ui/Label.h src/ui/FloatingButton.h + src/ui/InfoMessage.h + src/ui/Label.h + src/ui/LoadingIndicator.h src/ui/Menu.h src/ui/NhekoCursorShape.h src/ui/NhekoDropArea.h + src/ui/NhekoGlobalObject.h src/ui/OverlayWidget.h - src/ui/SnackBar.h src/ui/RaisedButton.h src/ui/Ripple.h src/ui/RippleOverlay.h + src/ui/RoomSettings.h + src/ui/SnackBar.h src/ui/TextField.h src/ui/TextLabel.h - src/ui/ToggleButton.h src/ui/Theme.h src/ui/ThemeManager.h + src/ui/ToggleButton.h src/ui/UserProfile.h - src/ui/RoomSettings.h src/notifications/Manager.h diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml index 108bb768..84c22da1 100644 --- a/resources/qml/Avatar.qml +++ b/resources/qml/Avatar.qml @@ -20,7 +20,7 @@ Rectangle { width: 48 height: 48 radius: Settings.avatarCircles ? height / 2 : 3 - color: colors.alternateBase + color: Nheko.colors.alternateBase Component.onCompleted: { mouseArea.clicked.connect(clicked); } @@ -33,7 +33,7 @@ Rectangle { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter visible: img.status != Image.Ready - color: colors.text + color: Nheko.colors.text } Image { @@ -55,7 +55,7 @@ Rectangle { Ripple { 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) } } diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml index d648553f..2609371b 100644 --- a/resources/qml/Completer.qml +++ b/resources/qml/Completer.qml @@ -100,7 +100,7 @@ Popup { delegate: Rectangle { 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 implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4 @@ -119,7 +119,7 @@ Popup { Ripple { 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 { text: model.displayName - color: model.index == popup.currentIndex ? colors.highlightedText : colors.text + color: model.index == popup.currentIndex ? Nheko.colors.highlightedText : Nheko.colors.text } Label { 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 { 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 } Label { 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 { text: model.roomName 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 { text: model.roomName - color: model.index == popup.currentIndex ? colors.highlightedText : colors.text + color: model.index == popup.currentIndex ? Nheko.colors.highlightedText : Nheko.colors.text } Label { 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 { - color: colors.base + color: Nheko.colors.base implicitHeight: popup.contentHeight implicitWidth: popup.contentWidth - border.color: colors.mid + border.color: Nheko.colors.mid } } diff --git a/resources/qml/EncryptionIndicator.qml b/resources/qml/EncryptionIndicator.qml index 1e5d4d38..52d2eeed 100644 --- a/resources/qml/EncryptionIndicator.qml +++ b/resources/qml/EncryptionIndicator.qml @@ -20,7 +20,7 @@ Image { case Crypto.Verified: return "image://colorimage/:/icons/icons/ui/lock.png?green"; 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: return "image://colorimage/:/icons/icons/ui/lock.png?#dd3d3d"; } diff --git a/resources/qml/ForwardCompleter.qml b/resources/qml/ForwardCompleter.qml index 408cab12..1ec18540 100644 --- a/resources/qml/ForwardCompleter.qml +++ b/resources/qml/ForwardCompleter.qml @@ -19,7 +19,7 @@ Popup { x: Math.round(parent.width / 2 - width / 2) y: Math.round(parent.height / 2 - height / 2) modal: true - palette: colors + palette: Nheko.colors parent: Overlay.overlay width: implicitWidth >= (timelineRoot.width * 0.8) ? implicitWidth : (timelineRoot.width * 0.8) height: implicitHeight + completerPopup.height + padding * 2 @@ -44,7 +44,7 @@ Popup { text: qsTr("Forward Message") font.bold: true bottomPadding: 10 - color: colors.text + color: Nheko.colors.text } Reply { @@ -52,14 +52,14 @@ Popup { modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : { } - userColor: TimelineManager.userColor(modelData.userId, colors.window) + userColor: TimelineManager.userColor(modelData.userId, Nheko.colors.window) } MatrixTextField { id: roomTextInput width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 - color: colors.text + color: Nheko.colors.text onTextEdited: { completerPopup.completer.searchString = text; } @@ -107,11 +107,11 @@ Popup { } background: Rectangle { - color: colors.window + color: Nheko.colors.window } 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) } } diff --git a/resources/qml/ImageButton.qml b/resources/qml/ImageButton.qml index 76cc0b42..60954bfd 100644 --- a/resources/qml/ImageButton.qml +++ b/resources/qml/ImageButton.qml @@ -12,8 +12,8 @@ AbstractButton { property alias cursor: mouseArea.cursorShape property string image: undefined - property color highlightColor: colors.highlight - property color buttonTextColor: colors.buttonText + property color highlightColor: Nheko.colors.highlight + property color buttonTextColor: Nheko.colors.buttonText property bool changeColorOnHover: true focusPolicy: Qt.NoFocus diff --git a/resources/qml/MatrixText.qml b/resources/qml/MatrixText.qml index 7cfa6735..fa1cd98c 100644 --- a/resources/qml/MatrixText.qml +++ b/resources/qml/MatrixText.qml @@ -13,7 +13,7 @@ TextEdit { wrapMode: Text.Wrap selectByMouse: !Settings.mobileMode enabled: selectByMouse - color: colors.text + color: Nheko.colors.text onLinkActivated: TimelineManager.openLink(link) ToolTip.visible: hoveredLink ToolTip.text: hoveredLink diff --git a/resources/qml/MatrixTextField.qml b/resources/qml/MatrixTextField.qml index 3bcc9675..42ea33be 100644 --- a/resources/qml/MatrixTextField.qml +++ b/resources/qml/MatrixTextField.qml @@ -9,14 +9,14 @@ import QtQuick.Layouts 1.12 TextField { id: input - palette: colors + palette: Nheko.colors Rectangle { id: blueBar anchors.top: parent.bottom anchors.horizontalCenter: parent.horizontalCenter - color: colors.highlight + color: Nheko.colors.highlight height: 1 width: parent.width @@ -27,7 +27,7 @@ TextField { anchors.horizontalCenter: parent.horizontalCenter height: parent.height + 1 width: 0 - color: colors.text + color: Nheko.colors.text states: State { name: "focused" @@ -60,7 +60,7 @@ TextField { } background: Rectangle { - color: colors.base + color: Nheko.colors.base } } diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml index c5dfbfa3..f4e253ad 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml @@ -12,7 +12,7 @@ import im.nheko 1.0 Rectangle { id: inputBar - color: colors.window + color: Nheko.colors.window Layout.fillWidth: true Layout.preferredHeight: row.implicitHeight Layout.minimumHeight: 40 @@ -69,7 +69,7 @@ Rectangle { Rectangle { anchors.fill: parent - color: colors.window + color: Nheko.colors.window visible: TimelineManager.timeline && TimelineManager.timeline.input.uploading NhekoBusyIndicator { @@ -116,8 +116,8 @@ Rectangle { selectByMouse: true placeholderText: qsTr("Write a message...") - placeholderTextColor: colors.buttonText - color: colors.text + placeholderTextColor: Nheko.colors.buttonText + color: Nheko.colors.text width: textInput.width wrapMode: TextEdit.Wrap padding: 8 @@ -357,7 +357,7 @@ Rectangle { anchors.centerIn: parent visible: TimelineManager.timeline ? (!TimelineManager.timeline.permissions.canSend(MtxEvent.TextMessage)) : false text: qsTr("You don't have permission to send messages in this room") - color: colors.text + color: Nheko.colors.text } } diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 7dbe7e12..0da1dff3 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -13,7 +13,7 @@ import im.nheko 1.0 ScrollView { clip: false - palette: colors + palette: Nheko.colors padding: 8 ScrollBar.horizontal.visible: false @@ -51,8 +51,8 @@ ScrollView { z: 10 height: row.implicitHeight + padding * 2 width: row.implicitWidth + padding * 2 - color: colors.window - border.color: colors.buttonText + color: Nheko.colors.window + border.color: Nheko.colors.buttonText border.width: 1 radius: padding @@ -74,7 +74,7 @@ ScrollView { id: editButton visible: !!row.model && row.model.isEditable - buttonTextColor: colors.buttonText + buttonTextColor: Nheko.colors.buttonText width: 16 hoverEnabled: true image: ":/icons/icons/ui/edit.png" @@ -220,7 +220,7 @@ ScrollView { anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined visible: modelData && modelData.previousMessageDay !== modelData.day text: modelData ? chat.model.formatDateSeparator(modelData.timestamp) : "" - color: colors.text + color: Nheko.colors.text height: Math.round(fontMetrics.height * 1.4) width: contentWidth * 1.2 horizontalAlignment: Text.AlignHCenter @@ -228,7 +228,7 @@ ScrollView { background: Rectangle { radius: parent.height / 2 - color: colors.window + color: Nheko.colors.window } } @@ -267,7 +267,7 @@ ScrollView { id: 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 ToolTip.visible: displayNameHover.hovered ToolTip.text: modelData ? modelData.userId : "" @@ -288,7 +288,7 @@ ScrollView { } Label { - color: colors.buttonText + color: Nheko.colors.buttonText text: modelData ? TimelineManager.userStatus(modelData.userId) : "" textFormat: Text.PlainText elide: Text.ElideRight @@ -317,7 +317,7 @@ ScrollView { opacity: 0 visible: true anchors.fill: timelinerow - color: colors.highlight + color: Nheko.colors.highlight states: State { name: "revealed" diff --git a/resources/qml/NhekoBusyIndicator.qml b/resources/qml/NhekoBusyIndicator.qml index 917e11dc..82dd26dd 100644 --- a/resources/qml/NhekoBusyIndicator.qml +++ b/resources/qml/NhekoBusyIndicator.qml @@ -5,6 +5,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 +import im.nheko 1.0 BusyIndicator { id: control @@ -38,7 +39,7 @@ BusyIndicator { implicitWidth: radius * 2 implicitHeight: radius * 2 radius: item.height / 6 - color: colors.text + color: Nheko.colors.text opacity: (index + 2) / (repeater.count + 2) transform: [ Translate { diff --git a/resources/qml/QuickSwitcher.qml b/resources/qml/QuickSwitcher.qml index 166c788d..a6373b1c 100644 --- a/resources/qml/QuickSwitcher.qml +++ b/resources/qml/QuickSwitcher.qml @@ -19,7 +19,7 @@ Popup { modal: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside parent: Overlay.overlay - palette: colors + palette: Nheko.colors onOpened: { completerPopup.open(); roomTextInput.forceActiveFocus(); @@ -34,7 +34,7 @@ Popup { anchors.fill: parent font.pixelSize: Math.ceil(quickSwitcher.textHeight * 0.6) padding: textMargin - color: colors.text + color: Nheko.colors.text onTextEdited: { completerPopup.completer.searchString = text; } diff --git a/resources/qml/Reactions.qml b/resources/qml/Reactions.qml index f53c89ad..064df543 100644 --- a/resources/qml/Reactions.qml +++ b/resources/qml/Reactions.qml @@ -12,9 +12,9 @@ Flow { id: reactionFlow // highlight colors for selfReactedEvent background - property real highlightHue: colors.highlight.hslHue - property real highlightSat: colors.highlight.hslSaturation - property real highlightLight: colors.highlight.hslLightness + property real highlightHue: Nheko.colors.highlight.hslHue + property real highlightSat: Nheko.colors.highlight.hslSaturation + property real highlightLight: Nheko.colors.highlight.hslLightness property string eventId property alias reactions: repeater.model @@ -59,7 +59,7 @@ Flow { anchors.baseline: reactionCounter.baseline text: textMetrics.elidedText + (textMetrics.elidedText == modelData.key ? "" : "…") font.family: Settings.emojiFont - color: reaction.hovered ? colors.highlight : colors.text + color: reaction.hovered ? Nheko.colors.highlight : Nheko.colors.text maximumLineCount: 1 } @@ -68,7 +68,7 @@ Flow { height: Math.floor(reactionCounter.implicitHeight * 1.4) width: 1 - color: (reaction.hovered || modelData.selfReactedEvent !== '') ? colors.highlight : colors.text + color: (reaction.hovered || modelData.selfReactedEvent !== '') ? Nheko.colors.highlight : Nheko.colors.text } Text { @@ -77,7 +77,7 @@ Flow { anchors.verticalCenter: divider.verticalCenter text: modelData.count 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 implicitWidth: reaction.implicitWidth implicitHeight: reaction.implicitHeight - border.color: (reaction.hovered || modelData.selfReactedEvent !== '') ? colors.highlight : colors.text - color: modelData.selfReactedEvent !== '' ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.2) : colors.window + border.color: (reaction.hovered || modelData.selfReactedEvent !== '') ? Nheko.colors.highlight : Nheko.colors.text + color: modelData.selfReactedEvent !== '' ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.2) : Nheko.colors.window border.width: 1 radius: reaction.height / 2 } diff --git a/resources/qml/ReplyPopup.qml b/resources/qml/ReplyPopup.qml index 37b6f6cc..1d85acb0 100644 --- a/resources/qml/ReplyPopup.qml +++ b/resources/qml/ReplyPopup.qml @@ -17,7 +17,7 @@ Rectangle { visible: room && (room.reply || room.edit) // Height of child, plus margins, plus border implicitHeight: (room && room.reply ? replyPreview.height : closeEditButton.height) + 10 - color: colors.window + color: Nheko.colors.window z: 3 Reply { @@ -31,7 +31,7 @@ Rectangle { anchors.bottom: parent.bottom modelData: room ? room.getDump(room.reply, room.id) : { } - userColor: TimelineManager.userColor(modelData.userId, colors.window) + userColor: TimelineManager.userColor(modelData.userId, Nheko.colors.window) } ImageButton { diff --git a/resources/qml/RoomSettings.qml b/resources/qml/RoomSettings.qml index 58567916..ba577f33 100644 --- a/resources/qml/RoomSettings.qml +++ b/resources/qml/RoomSettings.qml @@ -18,8 +18,8 @@ ApplicationWindow { y: MainWindow.y + (MainWindow.height / 2) - (height / 2) minimumWidth: 420 minimumHeight: 650 - palette: colors - color: colors.window + palette: Nheko.colors + color: Nheko.colors.window modality: Qt.WindowModal flags: Qt.Dialog title: qsTr("Room Settings") @@ -126,7 +126,7 @@ ApplicationWindow { readOnly: true background: null selectByMouse: true - color: colors.text + color: Nheko.colors.text horizontalAlignment: TextEdit.AlignHCenter onLinkActivated: TimelineManager.openLink(link) diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml index 09a55e60..bae3e5a3 100644 --- a/resources/qml/TimelineRow.qml +++ b/resources/qml/TimelineRow.qml @@ -16,7 +16,7 @@ Item { height: row.height Rectangle { - color: (Settings.messageHoverHighlight && hoverHandler.hovered) ? colors.alternateBase : "transparent" + color: (Settings.messageHoverHighlight && hoverHandler.hovered) ? Nheko.colors.alternateBase : "transparent" anchors.fill: row } |