forked from bitcoin-core/gui-qml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin-core#400: Introduce Tooltip for the BlockClock navbar b…
…utton 8f8341f qml: Introduce Tooltip for the BlockClock navbar button (johnny9) Pull request description: The Tooltip will appear when hovering over the BlockClock tab button in the desktop navigation bar. It will show the current state of IBD. Two things are different than the figma. The wording for remaining blocks matches what is shown on the BlockClock instead of what the figma shows and After sync, Blockheight is shown instead. Looking for opinions on both during review.  [](https://github.com/bitcoin-core/gui-qml/actions/runs/9012143092?pr=400) ACKs for top commit: D33r-Gee: tACK 8f8341f on WSL Ubuntu 22.04 LGTM pablomartin4btc: re-tACK 8f8341f Tree-SHA512: c61980b31eed9d4a632dbccc59e4b7ef3effb019e70eea06597f908ba59f83322e49d9cd1c57ec51267e9af32976d63c8ce9deea8b2b89b5c3858ea5f81f0223
- Loading branch information
Showing
13 changed files
with
172 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) 2024 The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
import QtQuick 2.15 | ||
import QtQuick.Controls 2.15 | ||
|
||
import "../controls" | ||
|
||
Item { | ||
id: root | ||
|
||
property alias text: tooltipText.text | ||
|
||
Rectangle { | ||
id: tooltipBg | ||
color: Theme.color.neutral0 | ||
border.color: Theme.color.neutral4 | ||
radius: 5 | ||
border.width: 1 | ||
width: tooltipText.width + 30 | ||
height: tooltipText.height + 20 | ||
anchors.top: arrow.bottom | ||
anchors.right: arrow.right | ||
anchors.rightMargin: -10 | ||
anchors.topMargin: -1 | ||
} | ||
|
||
Image { | ||
id: arrow | ||
source: Theme.image.tooltipArrow | ||
width: 22 | ||
height: 10 | ||
anchors.horizontalCenter: root.horizontalCenter | ||
anchors.top: root.top | ||
} | ||
|
||
CoreText { | ||
id: tooltipText | ||
text: "" | ||
wrapMode: Text.NoWrap | ||
anchors.centerIn: tooltipBg | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) 2024 The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
// utils.js | ||
|
||
function formatRemainingSyncTime(milliseconds) { | ||
var minutes = Math.floor(milliseconds / 60000); | ||
var seconds = Math.floor((milliseconds % 60000) / 1000); | ||
var weeks = Math.floor(minutes / 10080); | ||
minutes %= 10080; | ||
var days = Math.floor(minutes / 1440); | ||
minutes %= 1440; | ||
var hours = Math.floor(minutes / 60); | ||
minutes %= 60; | ||
var result = ""; | ||
var estimatingStatus = false; | ||
|
||
if (weeks > 0) { | ||
return { | ||
text: "~" + weeks + (weeks === 1 ? " week" : " weeks") + " left", | ||
estimating: false | ||
}; | ||
} | ||
if (days > 0) { | ||
return { | ||
text: "~" + days + (days === 1 ? " day" : " days") + " left", | ||
estimating: false | ||
}; | ||
} | ||
if (hours >= 5) { | ||
return { | ||
text: "~" + hours + (hours === 1 ? " hour" : " hours") + " left", | ||
estimating: false | ||
}; | ||
} | ||
if (hours > 0) { | ||
return { | ||
text: "~" + hours + "h " + minutes + "m" + " left", | ||
estimating: false | ||
}; | ||
} | ||
if (minutes >= 5) { | ||
return { | ||
text: "~" + minutes + (minutes === 1 ? " minute" : " minutes") + " left", | ||
estimating: false | ||
}; | ||
} | ||
if (minutes > 0) { | ||
return { | ||
text: "~" + minutes + "m " + seconds + "s" + " left", | ||
estimating: false | ||
}; | ||
} | ||
if (seconds > 0) { | ||
return { | ||
text: "~" + seconds + (seconds === 1 ? " second" : " seconds") + " left", | ||
estimating: false | ||
}; | ||
} else { | ||
return { | ||
text: "Estimating", | ||
estimating: true | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.