LeftPanel: display sync progress in Windows taskbar button

This commit is contained in:
rating89us 2021-12-09 01:00:33 +01:00
parent a959919b8a
commit 8ac58a7347
8 changed files with 94 additions and 0 deletions

View file

@ -150,6 +150,10 @@ if(APPLE)
list(APPEND QT5_LIBRARIES Qt5MacExtras)
endif()
if(WIN32)
list(APPEND QT5_LIBRARIES Qt5WinExtras)
endif()
if(UNIX)
if(NOT CMAKE_PREFIX_PATH AND DEFINED ENV{CMAKE_PREFIX_PATH})
message(STATUS "Using CMAKE_PREFIX_PATH environment variable: '$ENV{CMAKE_PREFIX_PATH}'")

View file

@ -529,6 +529,19 @@ Rectangle {
height: 48
syncType: qsTr("Wallet") + translationManager.emptyString
visible: !appWindow.disconnected
onFillLevelChanged: {
if (progressBar.fillLevel < 100 && networkStatus.connected == Wallet.ConnectionStatus_Connected) {
if (isWindows && taskbarButtonLoader.status == Loader.Ready) {
taskbarButtonLoader.item.progress.visible = true;
taskbarButtonLoader.item.progress.value = progressBar.fillLevel;
}
}
if (progressBar.fillLevel == 100 && networkStatus.connected == Wallet.ConnectionStatus_Connected) {
if (isWindows && taskbarButtonLoader.status == Loader.Ready) {
taskbarButtonLoader.item.progress.visible = false;
}
}
}
}
MoneroComponents.ProgressBar {
@ -539,6 +552,14 @@ Rectangle {
syncType: qsTr("Daemon") + translationManager.emptyString
visible: !appWindow.disconnected
height: 62
onFillLevelChanged: {
if (daemonProgressBar.fillLevel < 100 && networkStatus.connected == Wallet.ConnectionStatus_Connected) {
if (isWindows && taskbarButtonLoader.status == Loader.Ready) {
taskbarButtonLoader.item.progress.visible = true;
taskbarButtonLoader.item.progress.value = daemonProgressBar.fillLevel;
}
}
}
}
MoneroComponents.NetworkStatusItem {
@ -550,7 +571,21 @@ Rectangle {
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
connected: Wallet.ConnectionStatus_Disconnected
onConnectedChanged: {
if (networkStatus.connected != Wallet.ConnectionStatus_Connected) {
if (isWindows && taskbarButtonLoader.status == Loader.Ready)
taskbarButtonLoader.item.progress.stop()
} else {
if (isWindows && taskbarButtonLoader.status == Loader.Ready)
taskbarButtonLoader.item.progress.resume()
}
}
height: 48
}
}
Loader {
id: taskbarButtonLoader
source: isWindows ? "components/WindowsTaskbarButton.qml" : ""
}
}

View file

@ -0,0 +1,50 @@
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtWinExtras 1.15
import moneroComponents.Wallet 1.0
TaskbarButton {
id: taskbarButton
overlay.iconSource: {
if (appWindow.isMining) {
return "qrc:///images/taskbarIconMining.png"
} else if (leftPanel.networkStatus.connected == Wallet.ConnectionStatus_Connected) {
if (leftPanel.progressBar.fillLevel < 100 || leftPanel.daemonProgressBar.fillLevel < 100) {
return "qrc:///images/taskbarIconSyncing.png"
} else {
return "qrc:///images/taskbarIconConnected.png"
}
} else {
return "qrc:///images/taskbarIconDisconnected.png"
}
}
progress.visible: true
progress.minimum: 0
progress.maximum: 100
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

View file

@ -264,5 +264,10 @@
<file>images/ledgerNanoX.png</file>
<file>images/trezor.png</file>
<file>images/trezor@2x.png</file>
<file>images/taskbarIconConnected.png</file>
<file>images/taskbarIconDisconnected.png</file>
<file>images/taskbarIconMining.png</file>
<file>images/taskbarIconSyncing.png</file>
<file>components/WindowsTaskbarButton.qml</file>
</qresource>
</RCC>