Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use material icon for folders. #6114

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<file>src/gui/tray/CallNotificationDialog.qml</file>
<file>src/gui/tray/EditFileLocallyLoadingDialog.qml</file>
<file>src/gui/tray/NCBusyIndicator.qml</file>
<file>src/gui/tray/NCIconWithBackgroundImage.qml</file>
<file>src/gui/tray/NCToolTip.qml</file>
<file>src/gui/tray/NCProgressBar.qml</file>
<file>src/gui/tray/EnforcedPlainTextLabel.qml</file>
Expand Down
37 changes: 37 additions & 0 deletions src/gui/tray/NCIconWithBackgroundImage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2023 by Oleksandr Zolotov <[email protected]>
*
* 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

Image {
id: root

property alias icon: icon

cache: true
mipmap: true
fillMode: Image.PreserveAspectFit

Image {
id: icon

anchors.centerIn: parent

cache: true
mipmap: true
fillMode: Image.PreserveAspectFit
visible: source !== ""
}
}
19 changes: 11 additions & 8 deletions src/gui/tray/TrayFolderListItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -45,13 +46,12 @@ MenuItem {
anchors.rightMargin: Style.trayWindowMenuEntriesMargin
spacing: Style.trayHorizontalMargin

Image {
source: root.iconSource
cache: true
sourceSize.width: root.height * Style.smallIconScaleFactor
sourceSize.height: root.height * Style.smallIconScaleFactor
verticalAlignment: Qt.AlignVCenter
horizontalAlignment: Qt.AlignHCenter
NCIconWithBackgroundImage {
source: root.backgroundIconSource

icon.source: root.iconSource
icon.height: height * Style.smallIconScaleFactor
icon.width: icon.height

Layout.preferredHeight: root.height * Style.smallIconScaleFactor
Layout.preferredWidth: root.height * Style.smallIconScaleFactor
Expand All @@ -64,7 +64,10 @@ MenuItem {

spacing: Style.extraSmallSpacing

Layout.alignment: Qt.AlignVCenter

Layout.fillWidth: true

}
}
}
14 changes: 10 additions & 4 deletions src/gui/tray/TrayFoldersMenuButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions theme.qrc.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<file>theme/white/state-sync-64.png</file>
<file>theme/white/state-sync-128.png</file>
<file>theme/white/state-sync-256.png</file>
<file>theme/black/account-group.svg</file>
<file>theme/black/change.svg</file>
<file>theme/black/clear.svg</file>
<file>theme/black/comment.svg</file>
Expand Down
1 change: 1 addition & 0 deletions theme/black/account-group.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion theme/black/folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion theme/white/folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading