diff --git a/dank-qml-common b/dank-qml-common index 55aadfe50..bc8e3e442 160000 --- a/dank-qml-common +++ b/dank-qml-common @@ -1 +1 @@ -Subproject commit 55aadfe506bd491122421aab8c9c0b8bb2501e45 +Subproject commit bc8e3e4421a80e8b76ce2aaae901158b187c6490 diff --git a/flake.lock b/flake.lock index 3e0b4593a..7c516ac27 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "dank-qml-common": { "flake": false, "locked": { - "lastModified": 1788356469, - "narHash": "sha256-Ix5qkwAVJkslauOoRdcvIVyLwOm05kp7Q39cdKwNp2w=", + "lastModified": 1788357544, + "narHash": "sha256-3iKd3Wg2p/1Ii7YVkMpvwwsrn1ttF4Dun/N7Jxwv1Vg=", "owner": "AvengeMedia", "repo": "dank-qml-common", - "rev": "55aadfe506bd491122421aab8c9c0b8bb2501e45", + "rev": "bc8e3e4421a80e8b76ce2aaae901158b187c6490", "type": "github" }, "original": { diff --git a/quickshell/Modules/ControlCenter/Details/NetworkDetail.qml b/quickshell/Modules/ControlCenter/Details/NetworkDetail.qml index 13eaa0cd7..0f9e3d627 100644 --- a/quickshell/Modules/ControlCenter/Details/NetworkDetail.qml +++ b/quickshell/Modules/ControlCenter/Details/NetworkDetail.qml @@ -165,13 +165,13 @@ Rectangle { } } - DankActionButton { + DankRefreshButton { anchors.verticalCenter: parent.verticalCenter - iconName: "refresh" buttonSize: 28 iconSize: 16 iconColor: Theme.surfaceVariantText - visible: currentConnectionType === "wifi" && NetworkService.wifiEnabled && !NetworkService.wifiToggling && !NetworkService.isScanning + visible: currentConnectionType === "wifi" && NetworkService.wifiEnabled && !NetworkService.wifiToggling + busy: NetworkService.isScanning onClicked: NetworkService.scanWifi() } @@ -182,10 +182,10 @@ Rectangle { textSize: Theme.fontSizeSmall readonly property var labelsByType: ({ - "ethernet": I18n.tr("Ethernet"), - "wifi": I18n.tr("WiFi"), - "cellular": I18n.tr("Cellular") - }) + "ethernet": I18n.tr("Ethernet"), + "wifi": I18n.tr("WiFi"), + "cellular": I18n.tr("Cellular") + }) visible: connectionTypes.length > 1 && NetworkService.backend === "networkmanager" && DMSService.apiVersion > 10 model: connectionTypes.map(t => labelsByType[t] || t) diff --git a/quickshell/Modules/DankBar/Popouts/SystemUpdatePopout.qml b/quickshell/Modules/DankBar/Popouts/SystemUpdatePopout.qml index cb58721ea..78898a394 100644 --- a/quickshell/Modules/DankBar/Popouts/SystemUpdatePopout.qml +++ b/quickshell/Modules/DankBar/Popouts/SystemUpdatePopout.qml @@ -176,28 +176,15 @@ DankPopout { color: SystemUpdateService.hasError ? Theme.error : Theme.surfaceVariantText } - DankActionButton { + DankRefreshButton { id: refreshButton buttonSize: 28 - iconName: "refresh" iconSize: 18 iconColor: Theme.surfaceText - enabled: !SystemUpdateService.isChecking && !SystemUpdateService.isUpgrading - opacity: enabled ? 1.0 : 0.5 + busy: SystemUpdateService.isChecking + enabled: !busy && !SystemUpdateService.isUpgrading + opacity: SystemUpdateService.isUpgrading ? 0.5 : 1.0 onClicked: SystemUpdateService.checkForUpdates() - - RotationAnimator on rotation { - from: 0 - to: 360 - duration: 1000 - loops: Animation.Infinite - running: SystemUpdateService.isChecking - - onRunningChanged: { - if (!running) - refreshButton.rotation = 0; - } - } } } } diff --git a/quickshell/Modules/DankDash/WeatherTab.qml b/quickshell/Modules/DankDash/WeatherTab.qml index c6d94daf9..a41abf308 100644 --- a/quickshell/Modules/DankDash/WeatherTab.qml +++ b/quickshell/Modules/DankDash/WeatherTab.qml @@ -155,33 +155,21 @@ Item { anchors.verticalCenter: parent.verticalCenter } - DankActionButton { + DankRefreshButton { id: refreshButtonTwo anchors.verticalCenter: parent.verticalCenter - iconName: isRefreshing ? "" : "refresh" iconColor: Theme.withAlpha(Theme.surfaceText, 0.4) tooltipText: I18n.tr("Refresh Weather") tooltipSide: "left" - enabled: !isRefreshing - - property bool isRefreshing: false - + busy: refreshTimerTwo.running onClicked: { - isRefreshing = true; WeatherService.forceRefresh(); refreshTimerTwo.restart(); } - DankSpinner { - anchors.centerIn: parent - size: refreshButtonTwo.iconSize - visible: refreshButtonTwo.isRefreshing - } - Timer { id: refreshTimerTwo interval: 2000 - onTriggered: refreshButtonTwo.isRefreshing = false } } } @@ -856,34 +844,22 @@ Item { onClicked: SessionData.setWeatherHourlyDetailed(!SessionData.weatherHourlyDetailed) } - DankActionButton { + DankRefreshButton { id: refreshButton anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - iconName: isRefreshing ? "" : "refresh" iconColor: Theme.withAlpha(Theme.surfaceText, 0.4) tooltipText: I18n.tr("Refresh Weather") tooltipSide: "left" - enabled: !isRefreshing - - property bool isRefreshing: false - + busy: refreshTimer.running onClicked: { - isRefreshing = true; WeatherService.forceRefresh(); refreshTimer.restart(); } - DankSpinner { - anchors.centerIn: parent - size: refreshButton.iconSize - visible: refreshButton.isRefreshing - } - Timer { id: refreshTimer interval: 2000 - onTriggered: refreshButton.isRefreshing = false } } } diff --git a/quickshell/Modules/Settings/NetworkWifiTab.qml b/quickshell/Modules/Settings/NetworkWifiTab.qml index 7f04006d5..d2b5f3b58 100644 --- a/quickshell/Modules/Settings/NetworkWifiTab.qml +++ b/quickshell/Modules/Settings/NetworkWifiTab.qml @@ -193,10 +193,10 @@ Item { onClicked: PopoutService.showHiddenNetworkModal() } - DankActionButton { - iconName: "refresh" + DankRefreshButton { buttonSize: 32 - visible: NetworkService.wifiEnabled && !NetworkService.wifiToggling && !NetworkService.isScanning + visible: NetworkService.wifiEnabled && !NetworkService.wifiToggling + busy: NetworkService.isScanning onClicked: NetworkService.scanWifi() } diff --git a/quickshell/Modules/Settings/PrinterTab.qml b/quickshell/Modules/Settings/PrinterTab.qml index fc4b0ab34..a33c44d96 100644 --- a/quickshell/Modules/Settings/PrinterTab.qml +++ b/quickshell/Modules/Settings/PrinterTab.qml @@ -464,21 +464,12 @@ Item { } } - DankActionButton { + DankRefreshButton { id: scanDevicesBtn - iconName: "refresh" buttonSize: 32 anchors.verticalCenter: parent.verticalCenter - enabled: !CupsService.loadingDevices + busy: CupsService.loadingDevices onClicked: CupsService.getDevices() - - RotationAnimator on rotation { - running: CupsService.loadingDevices - loops: Animation.Infinite - from: 0 - to: 360 - duration: 1000 - } } } @@ -745,21 +736,12 @@ Item { } } - DankActionButton { + DankRefreshButton { id: refreshPpdsBtn - iconName: "refresh" buttonSize: 32 anchors.verticalCenter: parent.verticalCenter - enabled: !CupsService.loadingPPDs + busy: CupsService.loadingPPDs onClicked: CupsService.getPPDs() - - RotationAnimator on rotation { - running: CupsService.loadingPPDs - loops: Animation.Infinite - from: 0 - to: 360 - duration: 1000 - } } } diff --git a/quickshell/Modules/Settings/ThemeBrowser.qml b/quickshell/Modules/Settings/ThemeBrowser.qml index c25edb086..409aa458d 100644 --- a/quickshell/Modules/Settings/ThemeBrowser.qml +++ b/quickshell/Modules/Settings/ThemeBrowser.qml @@ -352,12 +352,11 @@ DankFloatingWindow { anchors.verticalCenter: parent.verticalCenter spacing: Theme.spacingXS - DankActionButton { + DankRefreshButton { id: refreshButton - iconName: "refresh" iconSize: 18 iconColor: Theme.primary - visible: !root.isLoading + busy: root.isLoading onClicked: root.refreshThemes() } diff --git a/quickshell/Modules/Settings/TimeWeatherTab.qml b/quickshell/Modules/Settings/TimeWeatherTab.qml index a008c4ad1..58f3d6e4b 100644 --- a/quickshell/Modules/Settings/TimeWeatherTab.qml +++ b/quickshell/Modules/Settings/TimeWeatherTab.qml @@ -749,42 +749,21 @@ Item { width: parent.width height: 70 - DankIcon { + DankRefreshButton { id: refreshButton - name: "refresh" - size: Theme.iconSize - 4 - color: Theme.onSurface_38 anchors.right: parent.right anchors.top: parent.top - smoothTransform: isRefreshing - - property bool isRefreshing: false - enabled: !isRefreshing - - MouseArea { - anchors.fill: parent - hoverEnabled: true - cursorShape: parent.enabled ? Qt.PointingHandCursor : Qt.ForbiddenCursor - onClicked: { - refreshButton.isRefreshing = true; - WeatherService.forceRefresh(); - refreshTimer.restart(); - } - enabled: parent.enabled + iconSize: Theme.iconSize - 4 + iconColor: Theme.onSurface_38 + busy: refreshTimer.running + onClicked: { + WeatherService.forceRefresh(); + refreshTimer.restart(); } Timer { id: refreshTimer interval: 2000 - onTriggered: refreshButton.isRefreshing = false - } - - RotationAnimator on rotation { - running: refreshButton.isRefreshing - from: 0 - to: 360 - duration: 1000 - loops: Animation.Infinite } } diff --git a/quickshell/Widgets/DankRefreshButton.qml b/quickshell/Widgets/DankRefreshButton.qml new file mode 100644 index 000000000..5f7c23e86 --- /dev/null +++ b/quickshell/Widgets/DankRefreshButton.qml @@ -0,0 +1,3 @@ +import qs.DankCommon.Widgets as DankCommon + +DankCommon.DankRefreshButton {}