From: Claudio Cambra Date: Thu, 20 Oct 2022 11:41:25 +0000 (+0200) Subject: Create commonly accessible properties for current user colours in Style.qml X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~185^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1a6326ed97d56778ed4560f6e48c8fc081a17581;p=nextcloud-desktop.git Create commonly accessible properties for current user colours in Style.qml Signed-off-by: Claudio Cambra --- diff --git a/src/gui/tray/ActivityActionButton.qml b/src/gui/tray/ActivityActionButton.qml index 2c5a0e57e..7741f4f16 100644 --- a/src/gui/tray/ActivityActionButton.qml +++ b/src/gui/tray/ActivityActionButton.qml @@ -13,16 +13,16 @@ AbstractButton { property string imageSource: "" property string imageSourceHover: "" - property color adjustedHeaderColor: Style.ncBlue + property color adjustedHeaderColor: Style.adjustedCurrentUserHeaderColor property color textColor: primaryButton ? adjustedHeaderColor : Style.ncTextColor - property color textColorHovered: primaryButton ? UserModel.currentUser.headerTextColor : Style.ncTextColor + property color textColorHovered: primaryButton ? Style.currentUserHeaderTextColor : Style.ncTextColor property string verb: "" property bool isTalkReplyButton: false background: NCButtonBackground { - color: UserModel.currentUser.headerColor + color: Style.currentUserHeaderColor hovered: root.hovered visible: root.primaryButton } diff --git a/src/gui/tray/ActivityItem.qml b/src/gui/tray/ActivityItem.qml index 9b67f1e57..020555ed3 100644 --- a/src/gui/tray/ActivityItem.qml +++ b/src/gui/tray/ActivityItem.qml @@ -16,9 +16,6 @@ ItemDelegate { readonly property bool isTalkReplyPossible: model.conversationToken !== "" property bool isTalkReplyOptionVisible: model.messageSent !== "" - property color adjustedHeaderColor: Theme.darkMode ? Qt.lighter(UserModel.currentUser.headerColor, 2) - : Qt.darker(UserModel.currentUser.headerColor, 1.5) - enabled: (model.path !== "" || model.link !== "" || model.links.length > 0 || model.isCurrentUserFileActivity === true) padding: Style.standardSpacing @@ -50,8 +47,6 @@ ItemDelegate { activityData: model - adjustedHeaderColor: root.adjustedHeaderColor - onShareButtonClicked: Systray.openShareDialog(model.displayPath, model.path) onDismissButtonClicked: activityModel.slotTriggerDismiss(model.activityIndex) @@ -92,9 +87,8 @@ ItemDelegate { flickable: root.flickable - adjustedHeaderColor: root.adjustedHeaderColor - onTriggerAction: activityModel.slotTriggerAction(model.activityIndex, actionIndex) + onShowReplyField: root.isTalkReplyOptionVisible = true } } diff --git a/src/gui/tray/ActivityItemActions.qml b/src/gui/tray/ActivityItemActions.qml index 57230cc56..1b7ffc4f9 100644 --- a/src/gui/tray/ActivityItemActions.qml +++ b/src/gui/tray/ActivityItemActions.qml @@ -16,7 +16,6 @@ RowLayout { property bool displayActions: false property color moreActionsButtonColor: "transparent" - property color adjustedHeaderColor: "transparent" property int maxActionButtons: 0 @@ -43,10 +42,10 @@ RowLayout { text: model.modelData.label - adjustedHeaderColor: root.adjustedHeaderColor + adjustedHeaderColor: Style.adjustedCurrentUserHeaderColor - imageSource: model.modelData.imageSource ? model.modelData.imageSource + root.adjustedHeaderColor : "" - imageSourceHover: model.modelData.imageSourceHovered ? model.modelData.imageSourceHovered + UserModel.currentUser.headerTextColor : "" + imageSource: model.modelData.imageSource ? model.modelData.imageSource + Style.adjustedCurrentUserHeaderColor : "" + imageSourceHover: model.modelData.imageSourceHovered ? model.modelData.imageSourceHovered + Style.currentUserHeaderTextColor : "" onClicked: isTalkReplyButton ? root.showReplyField() : root.triggerAction(model.index) } diff --git a/src/gui/tray/ActivityItemContent.qml b/src/gui/tray/ActivityItemContent.qml index 50aa41d5f..51c653312 100644 --- a/src/gui/tray/ActivityItemContent.qml +++ b/src/gui/tray/ActivityItemContent.qml @@ -17,8 +17,6 @@ RowLayout { property bool childHovered: shareButton.hovered || dismissActionButton.hovered - property color adjustedHeaderColor: "transparent" - signal dismissButtonClicked() signal shareButtonClicked() @@ -206,12 +204,12 @@ RowLayout { visible: root.activityData.isShareable - imageSource: "image://svgimage-custom-color/share.svg" + "/" + root.adjustedHeaderColor - imageSourceHover: "image://svgimage-custom-color/share.svg" + "/" + UserModel.currentUser.headerTextColor + imageSource: "image://svgimage-custom-color/share.svg" + "/" + Style.adjustedCurrentUserHeaderColor + imageSourceHover: "image://svgimage-custom-color/share.svg" + "/" + Style.currentUserHeaderTextColor toolTipText: qsTr("Open share dialog") - bgColor: UserModel.currentUser.headerColor + bgColor: Style.currentUserHeaderColor onClicked: root.shareButtonClicked() } diff --git a/src/gui/tray/CustomButton.qml b/src/gui/tray/CustomButton.qml index 97b50b7dd..c132830be 100644 --- a/src/gui/tray/CustomButton.qml +++ b/src/gui/tray/CustomButton.qml @@ -28,6 +28,7 @@ Button { leftPadding: root.text === "" ? 5 : 10 rightPadding: root.text === "" ? 5 : 10 + implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding NCToolTip { text: root.toolTipText diff --git a/src/gui/tray/HeaderButton.qml b/src/gui/tray/HeaderButton.qml index c10118877..f2528c10b 100644 --- a/src/gui/tray/HeaderButton.qml +++ b/src/gui/tray/HeaderButton.qml @@ -26,7 +26,7 @@ Button { Layout.preferredHeight: Style.trayWindowHeaderHeight background: Rectangle { - color: root.hovered || root.visualFocus ? UserModel.currentUser.headerTextColor : "transparent" + color: root.hovered || root.visualFocus ? Style.currentUserHeaderTextColor : "transparent" opacity: 0.2 } } diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 66a5adf6e..94611c647 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -172,7 +172,7 @@ ApplicationWindow { anchors.right: trayWindowMainItem.right anchors.top: trayWindowMainItem.top height: Style.trayWindowHeaderHeight - color: UserModel.currentUser.headerColor + color: Style.currentUserHeaderColor RowLayout { id: trayWindowHeaderLayout @@ -383,7 +383,7 @@ ApplicationWindow { } background: Rectangle { - color: parent.hovered || parent.visualFocus ? UserModel.currentUser.headerTextColor : "transparent" + color: parent.hovered || parent.visualFocus ? Style.currentUserHeaderTextColor : "transparent" opacity: 0.2 } @@ -415,7 +415,7 @@ ApplicationWindow { height: width anchors.bottom: currentAccountAvatar.bottom anchors.right: currentAccountAvatar.right - color: UserModel.currentUser.headerColor + color: Style.currentUserHeaderColor radius: width*0.5 } @@ -427,7 +427,7 @@ ApplicationWindow { height: width anchors.bottom: currentAccountAvatar.bottom anchors.right: currentAccountAvatar.right - color: currentAccountButton.hovered ? UserModel.currentUser.headerTextColor : "transparent" + color: currentAccountButton.hovered ? Style.currentUserHeaderTextColor : "transparent" opacity: 0.2 radius: width*0.5 } @@ -463,7 +463,7 @@ ApplicationWindow { text: UserModel.currentUser.name textFormat: Text.PlainText elide: Text.ElideRight - color: UserModel.currentUser.headerTextColor + color: Style.currentUserHeaderTextColor font.pixelSize: Style.topLinePixelSize font.bold: true @@ -494,7 +494,7 @@ ApplicationWindow { : UserModel.currentUser.server textFormat: Text.PlainText elide: Text.ElideRight - color: UserModel.currentUser.headerTextColor + color: Style.currentUserHeaderTextColor font.pixelSize: Style.subLinePixelSize } } @@ -502,7 +502,7 @@ ApplicationWindow { ColorOverlay { cached: true - color: UserModel.currentUser.headerTextColor + color: Style.currentUserHeaderTextColor width: source.width height: source.height source: Image { @@ -538,7 +538,7 @@ ApplicationWindow { id: openLocalFolderButton visible: UserModel.currentUser.hasLocalFolder icon.source: "qrc:///client/theme/white/folder.svg" - icon.color: UserModel.currentUser.headerTextColor + icon.color: Style.currentUserHeaderTextColor onClicked: UserModel.openCurrentAccountLocalFolder() Image { @@ -563,7 +563,7 @@ ApplicationWindow { width: Style.folderStateIndicatorSize + 2 height: width anchors.centerIn: parent - color: UserModel.currentUser.headerColor + color: Style.currentUserHeaderColor radius: width*0.5 z: -2 } @@ -573,7 +573,7 @@ ApplicationWindow { width: Style.folderStateIndicatorSize + 2 height: width anchors.centerIn: parent - color: openLocalFolderButton.hovered ? UserModel.currentUser.headerTextColor : "transparent" + color: openLocalFolderButton.hovered ? Style.currentUserHeaderTextColor : "transparent" opacity: 0.2 radius: width*0.5 z: -1 @@ -587,7 +587,7 @@ ApplicationWindow { visible: UserModel.currentUser.serverHasTalk icon.source: "qrc:///client/theme/white/talk-app.svg" - icon.color: UserModel.currentUser.headerTextColor + icon.color: Style.currentUserHeaderTextColor onClicked: UserModel.openCurrentAccountTalk() Accessible.role: Accessible.Button @@ -598,7 +598,7 @@ ApplicationWindow { HeaderButton { id: trayWindowAppsButton icon.source: "qrc:///client/theme/white/more-apps.svg" - icon.color: UserModel.currentUser.headerTextColor + icon.color: Style.currentUserHeaderTextColor onClicked: { if(appsMenuListView.count <= 0) { diff --git a/theme/Style/Style.qml b/theme/Style/Style.qml index 3aa6fd835..9214c17ea 100644 --- a/theme/Style/Style.qml +++ b/theme/Style/Style.qml @@ -18,6 +18,11 @@ QtObject { readonly property color backgroundColor: Theme.systemPalette.base readonly property color buttonBackgroundColor: Theme.systemPalette.button + readonly property color currentUserHeaderColor: UserModel.currentUser ? UserModel.currentUser.headerColor : ncBlue + readonly property color currentUserHeaderTextColor: UserModel.currentUser ? UserModel.currentUser.headerTextColor : ncHeaderTextColor + readonly property color adjustedCurrentUserHeaderColor: Theme.darkMode ? Qt.lighter(currentUserHeaderColor, 2) + : Qt.darker(currentUserHeaderColor, 1.5) + // ErrorBox colors readonly property color errorBoxBackgroundColor: Qt.rgba(0.89, 0.18, 0.18, 1) readonly property int errorBoxStripeWidth: 4