Skip to content

Commit 37b22c0

Browse files
committed
Use material icon for folders.
Signed-off-by: alex-z <blackslayer4@gmail.com>
1 parent 646baf2 commit 37b22c0

8 files changed

+63
-14
lines changed

resources.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<file>src/gui/tray/CallNotificationDialog.qml</file>
4949
<file>src/gui/tray/EditFileLocallyLoadingDialog.qml</file>
5050
<file>src/gui/tray/NCBusyIndicator.qml</file>
51+
<file>src/gui/tray/NCIconWithBackgroundImage.qml</file>
5152
<file>src/gui/tray/NCToolTip.qml</file>
5253
<file>src/gui/tray/NCProgressBar.qml</file>
5354
<file>src/gui/tray/EnforcedPlainTextLabel.qml</file>
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (C) 2023 by Oleksandr Zolotov <alex@nextcloud.com>
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but
10+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* for more details.
13+
*/
14+
15+
import QtQuick 2.15
16+
import Style 1.0
17+
18+
Image {
19+
id: root
20+
21+
property alias icon: icon
22+
23+
cache: true
24+
mipmap: true
25+
fillMode: Image.PreserveAspectFit
26+
27+
Image {
28+
id: icon
29+
30+
anchors.centerIn: parent
31+
32+
cache: true
33+
mipmap: true
34+
fillMode: Image.PreserveAspectFit
35+
visible: source !== ""
36+
}
37+
}

src/gui/tray/TrayFolderListItem.qml

+11-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ MenuItem {
2121
id: root
2222

2323
property string subline: ""
24-
property string iconSource: "image://svgimage-custom-color/folder-group.svg/" + palette.buttonText
24+
property string iconSource: "image://svgimage-custom-color/account-group.svg/" + palette.buttonText
25+
property string backgroundIconSource: value
2526
property string toolTipText: root.text
2627

2728
NCToolTip {
@@ -45,13 +46,12 @@ MenuItem {
4546
anchors.rightMargin: Style.trayWindowMenuEntriesMargin
4647
spacing: Style.trayHorizontalMargin
4748

48-
Image {
49-
source: root.iconSource
50-
cache: true
51-
sourceSize.width: root.height * Style.smallIconScaleFactor
52-
sourceSize.height: root.height * Style.smallIconScaleFactor
53-
verticalAlignment: Qt.AlignVCenter
54-
horizontalAlignment: Qt.AlignHCenter
49+
NCIconWithBackgroundImage {
50+
source: root.backgroundIconSource
51+
52+
icon.source: root.iconSource
53+
icon.height: height * Style.smallIconScaleFactor
54+
icon.width: icon.height
5555

5656
Layout.preferredHeight: root.height * Style.smallIconScaleFactor
5757
Layout.preferredWidth: root.height * Style.smallIconScaleFactor
@@ -64,7 +64,10 @@ MenuItem {
6464

6565
spacing: Style.extraSmallSpacing
6666

67+
Layout.alignment: Qt.AlignVCenter
68+
6769
Layout.fillWidth: true
70+
6871
}
6972
}
7073
}

src/gui/tray/TrayFoldersMenuButton.qml

+10-4
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,14 @@ HeaderButton {
100100

101101
Image {
102102
id: openLocalFolderButtonIcon
103-
cache: false
103+
cache: true
104104
source: "image://svgimage-custom-color/folder.svg/" + Style.currentUserHeaderTextColor
105105

106+
sourceSize {
107+
width: Style.headerButtonIconSize
108+
height: Style.headerButtonIconSize
109+
}
110+
106111
verticalAlignment: Qt.AlignCenter
107112

108113
Accessible.role: Accessible.Graphic
@@ -185,9 +190,10 @@ HeaderButton {
185190
subline: model.modelData.parentPath
186191
width: foldersMenuListView.width
187192
height: Style.standardPrimaryButtonHeight
188-
iconSource: !isGroupFolder ?
189-
"image://svgimage-custom-color/folder.svg/" + palette.buttonText :
190-
"image://svgimage-custom-color/folder-group.svg/" + palette.buttonText
193+
backgroundIconSource: "image://svgimage-custom-color/folder.svg/" + palette.buttonText
194+
iconSource: isGroupFolder
195+
? "image://svgimage-custom-color/account-group.svg/" + palette.brightText
196+
: ""
191197

192198
onTriggered: {
193199
foldersMenu.close();

theme.qrc.in

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<file>theme/white/state-sync-64.png</file>
4545
<file>theme/white/state-sync-128.png</file>
4646
<file>theme/white/state-sync-256.png</file>
47+
<file>theme/black/account-group.svg</file>
4748
<file>theme/black/change.svg</file>
4849
<file>theme/black/clear.svg</file>
4950
<file>theme/black/comment.svg</file>

theme/black/account-group.svg

+1
Loading

theme/black/folder.svg

+1-1
Loading

theme/white/folder.svg

+1-1
Loading

0 commit comments

Comments
 (0)