-
Notifications
You must be signed in to change notification settings - Fork 49
The Block Clock #220
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
The Block Clock #220
Conversation
- This method would allow to get the blocktime value of the block at the given height.
90469cb
to
e9b5ddd
Compare
e9b5ddd
to
96e47f8
Compare
96e47f8
to
63792bf
Compare
37b6257
to
8515fdf
Compare
fa214b0
to
26d57ff
Compare
I noticed that these changes require the QtGraphicalEffects module (qml-module-graphicaleffects ubuntu package). I'll likely have to update the depends to include that module or change how the icon is forced into a specific color. Looking for an opinion one way or the other. |
f0cb6dd
to
021cbb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
concept ack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's squash some of the history to have a clean commit record, but also I'm seeing some slight misalignment with the design file.
Below, the more visible layer is the design file, and below that is this PR on signet (hence diff block heights). Looks like the block height, the words "Blocktime" and peers indicator should be a bit higher up. Also fine with leaving this fixup for a follow-up!
8ecfae6
to
76a504e
Compare
76a504e
to
2e5a0d8
Compare
2e5a0d8
to
3fd696d
Compare
Update. Remove a missed trailing whitespace |
3fd696d
to
33eb4af
Compare
The ChainModel is responsible for managing the block information that the gui components need to show. In this case, the ChainModel will provide a list of ratios for the block times of the last 12 hours to be rendered on the block clock's dial. Co-authored-by: shaavan <[email protected]>
Implements a few of the BlockClock dial states. Sync progress while downloading, rendering blocks after sync, and pausing/unpausing the node. An additional Model is added, ChainModel, to provide the dial block information. Changes to NodeModel are also made to support the pausing/unpausing Dial feature. Co-authored-by: shaavan <[email protected]>
4872577
to
6701ad2
Compare
Update branch to 6701ad2:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 6701ad2
This works, with improvements to be made in follow-ups
const QRectF bounds = getBoundsForPen(pen); | ||
painter->setPen(pen); | ||
|
||
QColor confirmationColors[] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in a follow-up all of these colors should be defined in our theme.qml, because the colors would actually be slightly different when on dark or light mode. We'll circle back with @GBKS about these values.
|
||
states: [ | ||
State { | ||
name: "intialBlockDownload"; when: !synced && !paused && conns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer all caps short names for states. in the codebase like, can be changed afterwards
- "IBD"
- "BLOCKCLOCK"
- "PAUSED"
- "CONNECTING"
// Paint blocks | ||
for (int i = 1; i < numberOfBlocks; i++) { | ||
if (numberOfBlocks - i <= 6) { | ||
QPen pen(confirmationColors[numberOfBlocks - i - 1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be initialized outside of the loop, then have its properties updated?
|
||
// The gap is calculated here and is used to create a | ||
// one pixel spacing between each block | ||
double gap = degreesPerPixel(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need to be calculated each time the paintBlocks function is called, or can it be cached when the object is constructed?
update(); | ||
} | ||
|
||
QRectF BlockClockDial::getBoundsForPen(const QPen & pen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be simplified into:
QRectF BlockClockDial::getBoundsForPen(const QPen & pen)
{
const QRectF bounds = boundingRect();
QRectF rect = bounds.marginsRemoved(QMarginsF(pen.widthF() / 2.0, pen.widthF() / 2.0, pen.widthF() / 2.0, pen.widthF() / 2.0));
return rect.toAlignedRect();
}
This PR | My Suggestion |
---|---|
![]() |
![]() |
} | ||
|
||
MouseArea { | ||
anchors.fill: dial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could add, since the paused state is implemented
anchors.fill: dial | |
anchors.fill: dial | |
cursorShape: Qt.PointingHandCursor |
@@ -27,14 +28,60 @@ void NodeModel::setBlockTipHeight(int new_height) | |||
} | |||
} | |||
|
|||
void NodeModel::setRemainingSyncTime(double new_progress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is pretty confusing in general, we'll heavily change this in follow-ups
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably do an early test on new_progress to make sure it's a valid value
int timeDelta = 0; | ||
int remainingMSecs = 0; | ||
double remainingProgress = 1.0 - new_progress; | ||
for (int i = 1; i < m_block_process_time.size(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
starting from 1, isn't it skipping the first value in the list?
for (int i = 1; i < m_block_process_time.size(); i++) { | ||
QPair<int, double> sample = m_block_process_time[i]; | ||
|
||
// take first sample after 500 seconds or last available one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but currentTime
was set in milliseconds in line 33, now we're doing math with seconds values?
} | ||
static const int MAX_SAMPLES = 5000; | ||
if (m_block_process_time.count() > MAX_SAMPLES) { | ||
m_block_process_time.remove(1, m_block_process_time.count() - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why we're removing the first element here; but in follow-ups its better if this is a queue, instead of a vector that we manually remove elements from
759d2f0 qml: move BlockClock confirmation colors into Theme.qml (jarolrod) 0b6d32e qml: capitalize the BlockClock component's state names (jarolrod) fd40538 qml: set BlockClock mouseArea cursorShape to pointing cursor (jarolrod) Pull request description: This implements the following review comments from #220 (review) - Make cursor into pointing cursor when over the BlockClock to make the BlockClock look like it's clickable #220 (comment) - Make BlockClock state names capital #220 (comment) - Move out BlockClock confirmation colors into our Theme.qml #220 (comment) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/250) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/250) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/250) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/250) ACKs for top commit: johnny9: ACK 759d2f0 Tree-SHA512: 7a7919a47f65872656a63fd7cac7cc94d95cfe60bf714d09295995296fd81b11c10e58ff4e7280c67bc74f6df7f3f1aa5c09975fa04e9c71d947fffc3df4b50b
- This method would allow to get the blocktime value of the block at the given height. Github-Pull: bitcoin-core#220 Rebased-From: 1fce853
Github-Pull: bitcoin-core#220 Rebased-From: 094a2c4 Co-authored-by: shaavan <[email protected]>
Additional properties to Header will allow configuring Header's description color and bold values as well as Header's header-text bold value. Github-Pull: bitcoin-core#220 Rebased-From: 8db7f0f Co-authored-by: shaavan <[email protected]>
The properties will allow the gui to show an estimate for the time remaining before the node is synced. Github-Pull: bitcoin-core#220 Rebased-From: eb945ac Co-authored-by: shaavan <[email protected]>
The ChainModel is responsible for managing the block information that the gui components need to show. In this case, the ChainModel will provide a list of ratios for the block times of the last 12 hours to be rendered on the block clock's dial. Github-Pull: bitcoin-core#220 Rebased-From: 60bd8cb Co-authored-by: shaavan <[email protected]>
Implements a few of the BlockClock dial states. Sync progress while downloading, rendering blocks after sync, and pausing/unpausing the node. An additional Model is added, ChainModel, to provide the dial block information. Changes to NodeModel are also made to support the pausing/unpausing Dial feature. Github-Pull: bitcoin-core#220 Rebased-From: 6701ad2 Co-authored-by: shaavan <[email protected]>
- This method would allow to get the blocktime value of the block at the given height. Github-Pull: bitcoin-core#220 Rebased-From: 1fce853
Github-Pull: bitcoin-core#220 Rebased-From: 094a2c4 Co-authored-by: shaavan <[email protected]>
Additional properties to Header will allow configuring Header's description color and bold values as well as Header's header-text bold value. Github-Pull: bitcoin-core#220 Rebased-From: 8db7f0f Co-authored-by: shaavan <[email protected]>
The properties will allow the gui to show an estimate for the time remaining before the node is synced. Github-Pull: bitcoin-core#220 Rebased-From: eb945ac Co-authored-by: shaavan <[email protected]>
The ChainModel is responsible for managing the block information that the gui components need to show. In this case, the ChainModel will provide a list of ratios for the block times of the last 12 hours to be rendered on the block clock's dial. Github-Pull: bitcoin-core#220 Rebased-From: 60bd8cb Co-authored-by: shaavan <[email protected]>
Implements a few of the BlockClock dial states. Sync progress while downloading, rendering blocks after sync, and pausing/unpausing the node. An additional Model is added, ChainModel, to provide the dial block information. Changes to NodeModel are also made to support the pausing/unpausing Dial feature. Github-Pull: bitcoin-core#220 Rebased-From: 6701ad2 Co-authored-by: shaavan <[email protected]>
- This method would allow to get the blocktime value of the block at the given height. Github-Pull: bitcoin-core#220 Rebased-From: 1fce853
Github-Pull: bitcoin-core#220 Rebased-From: 094a2c4 Co-authored-by: shaavan <[email protected]>
Additional properties to Header will allow configuring Header's description color and bold values as well as Header's header-text bold value. Github-Pull: bitcoin-core#220 Rebased-From: 8db7f0f Co-authored-by: shaavan <[email protected]>
The properties will allow the gui to show an estimate for the time remaining before the node is synced. Github-Pull: bitcoin-core#220 Rebased-From: eb945ac Co-authored-by: shaavan <[email protected]>
The ChainModel is responsible for managing the block information that the gui components need to show. In this case, the ChainModel will provide a list of ratios for the block times of the last 12 hours to be rendered on the block clock's dial. Github-Pull: bitcoin-core#220 Rebased-From: 60bd8cb Co-authored-by: shaavan <[email protected]>
Implements a few of the BlockClock dial states. Sync progress while downloading, rendering blocks after sync, and pausing/unpausing the node. An additional Model is added, ChainModel, to provide the dial block information. Changes to NodeModel are also made to support the pausing/unpausing Dial feature. Github-Pull: bitcoin-core#220 Rebased-From: 6701ad2 Co-authored-by: shaavan <[email protected]>
Implements a few of the BlockClock dial states. Sync progress while downloading, rendering blocks after sync, and pausing/unpausing the node. An additional Model is added, ChainModel, to provide the dial block information. Changes to NodeModel are also made to support the pausing/unpausing Dial feature. Github-Pull: bitcoin-core#220 Rebased-From: 6701ad2 Co-authored-by: shaavan <[email protected]>
4f9bfbc qml: introduce the BlockClock (johnny9) e57e7ff qml: introduce ChainModel (johnny9) e38c565 qml: add sync time related properties to NodeModel (johnny9) 9c45b09 qml: add additional properties in Header (johnny9) fcee831 qml: add ability to pause NodeModel (johnny9) 1fce853acd1dd7089d67db58ba572b4fa7acf4f8 Add getBlockTime interface method in src/interfaces/chain.h (shaavan) Pull request description: This is a continuation of #148. The goal of this PR is to get the working features from #148 merged in using a QQuickPainterItem implementation of the dial instead of the javascript canvas. Connection state as well as the animating icon will be implemented in a later PR. Refactoring and clean up from the removal of the Canvas code still remains. [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/220) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/220) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/220) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/220) ACKs for top commit: jarolrod: ACK 4f9bfbc Tree-SHA512: 43b99d1fd69b67b285e91e05d3864c7044917cd6feae97b4c226f3a7b499ca24f6e786575dbc700461b1f6c58c0273746e4ea5834c554fa4dc916868199698df
b395d86 qml: move BlockClock confirmation colors into Theme.qml (jarolrod) ca0a451 qml: capitalize the BlockClock component's state names (jarolrod) 1051c2e qml: set BlockClock mouseArea cursorShape to pointing cursor (jarolrod) Pull request description: This implements the following review comments from bitcoin-core/gui-qml#220 (review) - Make cursor into pointing cursor when over the BlockClock to make the BlockClock look like it's clickable bitcoin-core/gui-qml#220 (comment) - Make BlockClock state names capital bitcoin-core/gui-qml#220 (comment) - Move out BlockClock confirmation colors into our Theme.qml bitcoin-core/gui-qml#220 (comment) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/250) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/250) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/250) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/250) ACKs for top commit: johnny9: ACK b395d86 Tree-SHA512: 7a7919a47f65872656a63fd7cac7cc94d95cfe60bf714d09295995296fd81b11c10e58ff4e7280c67bc74f6df7f3f1aa5c09975fa04e9c71d947fffc3df4b50b
This is a continuation of #148. The goal of this PR is to get the working features from #148 merged in using a QQuickPainterItem implementation of the dial instead of the javascript canvas. Connection state as well as the animating icon will be implemented in a later PR. Refactoring and clean up from the removal of the Canvas code still remains.