From: Claudio Cambra Date: Mon, 18 Jul 2022 15:22:56 +0000 (+0200) Subject: Replace unified search text field busy indicator with custom indicator X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~15^2~71^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b1deb6cd1d43c99e554014007c66bc86dbb5eb6a;p=nextcloud-desktop.git Replace unified search text field busy indicator with custom indicator Signed-off-by: Claudio Cambra --- diff --git a/resources.qrc b/resources.qrc index 870ea27c3..6aeb159b3 100644 --- a/resources.qrc +++ b/resources.qrc @@ -33,5 +33,6 @@ src/gui/tray/ActivityItemContent.qml src/gui/tray/TalkReplyTextField.qml src/gui/tray/CallNotificationDialog.qml + src/gui/tray/NCBusyIndicator.qml diff --git a/src/gui/tray/NCBusyIndicator.qml b/src/gui/tray/NCBusyIndicator.qml new file mode 100644 index 000000000..c489e5f39 --- /dev/null +++ b/src/gui/tray/NCBusyIndicator.qml @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 by Claudio Cambra + * + * 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 QtQuick.Controls 2.15 +import Style 1.0 + +BusyIndicator { + id: root + + property color color: Style.ncSecondaryTextColor + property string imageSource: "image://svgimage-custom-color/change.svg/" + + contentItem: Image { + id: contentImage + + property bool colourableImage: root.color && root.imageSource.startsWith("image://svgimage-custom-color/") + + horizontalAlignment: Image.AlignHCenter + verticalAlignment: Image.AlignVCenter + + source: colourableImage ? root.imageSource + root.color : root.imageSource + sourceSize.width: 64 + sourceSize.height: 64 + fillMode: Image.PreserveAspectFit + + mipmap: true + + RotationAnimator { + target: contentImage + running: root.running + onRunningChanged: contentImage.rotation = 0 + from: 0 + to: 360 + loops: Animation.Infinite + duration: 3000 + } + } +} diff --git a/src/gui/tray/SyncStatus.qml b/src/gui/tray/SyncStatus.qml index 5964c60db..bae630a4d 100644 --- a/src/gui/tray/SyncStatus.qml +++ b/src/gui/tray/SyncStatus.qml @@ -17,7 +17,7 @@ RowLayout { id: syncStatus } - Image { + NCBusyIndicator { id: syncIcon property int size: Style.trayListItemIconSize * 0.6 property int whiteSpace: (Style.trayListItemIconSize - size) @@ -31,19 +31,10 @@ RowLayout { Layout.bottomMargin: 16 Layout.leftMargin: Style.trayHorizontalMargin + (whiteSpace * (0.5 - Style.thumbnailImageSizeReduction)) - source: syncStatus.syncIcon - sourceSize.width: 64 - sourceSize.height: 64 - rotation: syncStatus.syncing ? 0 : 0 - } - - RotationAnimator { - target: syncIcon - running: syncStatus.syncing - from: 0 - to: 360 - loops: Animation.Infinite - duration: 3000 + padding: 0 + + imageSource: syncStatus.syncIcon + running: syncStatus.syncing } ColumnLayout { diff --git a/src/gui/tray/UnifiedSearchInputContainer.qml b/src/gui/tray/UnifiedSearchInputContainer.qml index cb5687530..6dc0e17a7 100644 --- a/src/gui/tray/UnifiedSearchInputContainer.qml +++ b/src/gui/tray/UnifiedSearchInputContainer.qml @@ -58,10 +58,9 @@ TextField { sourceSize: Qt.size(parent.height * parent.textFieldIconsScaleFactor, parent.height * parent.textFieldIconsScaleFactor) } - BusyIndicator { - id: trayWindowUnifiedSearchTextFieldIconInProgress - running: visible - visible: trayWindowUnifiedSearchTextField.isSearchInProgress + NCBusyIndicator { + id: busyIndicator + anchors { left: trayWindowUnifiedSearchTextField.left bottom: trayWindowUnifiedSearchTextField.bottom @@ -70,7 +69,11 @@ TextField { bottomMargin: 4 verticalCenter: trayWindowUnifiedSearchTextField.verticalCenter } + width: height + color: trayWindowUnifiedSearchTextField.textFieldIconsColor + visible: trayWindowUnifiedSearchTextField.isSearchInProgress + running: visible } Image {