diff --git a/resources.qrc b/resources.qrc index afe9e7836f046..fc65956940bf4 100644 --- a/resources.qrc +++ b/resources.qrc @@ -48,6 +48,7 @@ src/gui/tray/CallNotificationDialog.qml src/gui/tray/EditFileLocallyLoadingDialog.qml src/gui/tray/NCBusyIndicator.qml + src/gui/tray/NCIconWithBackgroundImage.qml src/gui/tray/NCToolTip.qml src/gui/tray/NCProgressBar.qml src/gui/tray/EnforcedPlainTextLabel.qml diff --git a/src/gui/tray/NCIconWithBackgroundImage.qml b/src/gui/tray/NCIconWithBackgroundImage.qml new file mode 100644 index 0000000000000..df243d2d1bda6 --- /dev/null +++ b/src/gui/tray/NCIconWithBackgroundImage.qml @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2023 by Oleksandr Zolotov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +import QtQuick 2.15 +import Style 1.0 + +Item { + id: root + + property alias source: icon.source + property alias sourceSize: icon.sourceSize + property alias backgroundIconSource: backgroundImage.source + + implicitWidth: backgroundImage.source !== "" ? backgroundImage.implicitWidth : icon.implicitWidth + implicitHeight: backgroundImage.source !== "" ? backgroundImage.implicitHeight : icon.implicitHeight + + Image { + id: backgroundImage + + anchors.fill: parent + + cache: true + mipmap: true + + sourceSize { + width: root.width + height: root.height + } + + fillMode: Image.PreserveAspectFit + visible: source !== "" + } + + Image { + id: icon + + anchors.centerIn: parent + + cache: true + mipmap: true + + fillMode: Image.PreserveAspectFit + visible: source !== "" + } +} diff --git a/src/gui/tray/TrayFolderListItem.qml b/src/gui/tray/TrayFolderListItem.qml index 60fd21570ecb8..e2e08878689b1 100644 --- a/src/gui/tray/TrayFolderListItem.qml +++ b/src/gui/tray/TrayFolderListItem.qml @@ -21,7 +21,8 @@ MenuItem { id: root property string subline: "" - property string iconSource: "image://svgimage-custom-color/folder-group.svg/" + palette.buttonText + property string iconSource: "image://svgimage-custom-color/account-group.svg/" + palette.buttonText + property string backgroundIconSource: value property string toolTipText: root.text NCToolTip { @@ -45,13 +46,12 @@ MenuItem { anchors.rightMargin: Style.trayWindowMenuEntriesMargin spacing: Style.trayHorizontalMargin - Image { + NCIconWithBackgroundImage { source: root.iconSource - cache: true - sourceSize.width: root.height * Style.smallIconScaleFactor - sourceSize.height: root.height * Style.smallIconScaleFactor - verticalAlignment: Qt.AlignVCenter - horizontalAlignment: Qt.AlignHCenter + sourceSize.width: root.height * 0.25 + sourceSize.height: root.height * 0.25 + + backgroundIconSource: root.backgroundIconSource Layout.preferredHeight: root.height * Style.smallIconScaleFactor Layout.preferredWidth: root.height * Style.smallIconScaleFactor diff --git a/src/gui/tray/TrayFoldersMenuButton.qml b/src/gui/tray/TrayFoldersMenuButton.qml index 2953ae12ab3ca..1b6d07e189db5 100644 --- a/src/gui/tray/TrayFoldersMenuButton.qml +++ b/src/gui/tray/TrayFoldersMenuButton.qml @@ -100,9 +100,14 @@ HeaderButton { Image { id: openLocalFolderButtonIcon - cache: false + cache: true source: "image://svgimage-custom-color/folder.svg/" + Style.currentUserHeaderTextColor + sourceSize { + width: Style.headerButtonIconSize + height: Style.headerButtonIconSize + } + verticalAlignment: Qt.AlignCenter Accessible.role: Accessible.Graphic @@ -185,9 +190,10 @@ HeaderButton { subline: model.modelData.parentPath width: foldersMenuListView.width height: Style.standardPrimaryButtonHeight - iconSource: !isGroupFolder ? - "image://svgimage-custom-color/folder.svg/" + palette.buttonText : - "image://svgimage-custom-color/folder-group.svg/" + palette.buttonText + backgroundIconSource: "image://svgimage-custom-color/folder.svg/" + palette.buttonText + iconSource: isGroupFolder + ? "image://svgimage-custom-color/account-group.svg/" + palette.brightText + : "" onTriggered: { foldersMenu.close(); diff --git a/theme.qrc.in b/theme.qrc.in index 60f25c4fca1ba..e8d88fc8a1b0c 100644 --- a/theme.qrc.in +++ b/theme.qrc.in @@ -44,6 +44,7 @@ theme/white/state-sync-64.png theme/white/state-sync-128.png theme/white/state-sync-256.png + theme/black/account-group.svg theme/black/change.svg theme/black/clear.svg theme/black/comment.svg diff --git a/theme/black/account-group.svg b/theme/black/account-group.svg new file mode 100644 index 0000000000000..01159f5f68aeb --- /dev/null +++ b/theme/black/account-group.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/theme/black/folder.svg b/theme/black/folder.svg index 9289fb05d74ce..bc31144b67784 100644 --- a/theme/black/folder.svg +++ b/theme/black/folder.svg @@ -1 +1 @@ - + \ No newline at end of file diff --git a/theme/white/folder.svg b/theme/white/folder.svg index a32ffc8570c2b..f0f077be560fa 100644 --- a/theme/white/folder.svg +++ b/theme/white/folder.svg @@ -1 +1 @@ - + \ No newline at end of file