mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 08:12:38 +00:00
Introduce the BlockClock control #148
No reviewers
Labels
No labels
Android
Bug
Build system
Design suggestion
Doc
Needs design review
Needs rebase
Stage
UX
Up for grabs
Upstream
Wallet
duplicate
enhancement
good first issue
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin-core/gui-qml!148
Loading…
Reference in a new issue
No description provided.
Delete branch "220806-the_block_clock"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Screenshot:
Things to note for the current implementation:
Since this is the prototype for the Block clock, I focused on the implementation part and took some liberties with the nuances, which I would like to document here.
this is a component. not a control
instead of canvas, this should be the simpler ShapePath: https://doc.qt.io/qt-6/qml-qtquick-shapes-shapepath.html
The next update of my PR intends to make the
BlockClock.qmlfile a purely abstract structure and introduce a component file that uses it to paint different states of the block clock as needed. So I think movingBlockClock.qmlto components now would be a wasted effort.Should you still think I shall move the
BlockClock.qmlto controls, or if there is a better approach for achieving the final BlockClock state, I would love to hear that.I looked through using the ShapePath to paint the BlockClock. However, using this would require us to introduce a new dependency,
qml-module-qtquick-shapesfor building the GUI.So I think this suggestion needs further discussion before implementing it.
A friendly ping, @hebasto
What do you think about this suggestion?
Unfortunately, from my experiments,
ShapePathand related items have issues. The most annoying issue happens with small curves where tessellation yields bad curve smoothness. Another issue is that with complex drawings you end up with lots of items and bindings everywhere (especially with Repeaters), which is also not that performant.Going forward a stack/composition of Canvas is the best option, like photoshop layers. For instance, the Canvas on the bottom could be static or updated less often than the one on the top.
Thanks, @promag, for sharing your thoughts and suggestion for using Canvas.
I think this would be good optimization. However, I might be putting a temporary hold on this optimization suggestion for now, as I am currently getting the Block Clock to display the block tracker, which involves some significant changes to the Canvas as well. So I shall be taking up this suggestion along with the other suggestion that shall come forth with the updated branch.
Updated from 96311e31aff4361055dcfe3fa38920aed3d3b525 to 055e0c08c9dc2a34e8bdba34430d6d1ce25a2376 (pr148.01 -> pr148.02)
Changes:
Screenshot:

Note:
Currently, the time tracking is happening according to GMT and doesn't update with the locale. I am going to address this with the next update.
The main focus of this update is to get a general review of the approach I have taken for implementation.
Branch doesn't build
This is the implementation of the block clock, and the file residing at
src/qml/components/BlockClockComponent.qmlis just a controller for this. A better architecture is to have a controller that loads the different states the block clock can be in.You'd be able to split up this file, as it is very long, between a simple circular progress bar that shows the verification progress while in IBD, then another dial like progress bar for the blocks. Then load these into the controller.
isn't this recreating our header component?
Yeah this is definitely too low level for us to be passing around here
this is too low level of an object to be handling here when we have
interfaces::chainwhy should the nodemodel, a proxy class for our internal node, keep something like a blocklist?
Updated from 621eae1074365116d5bfd5e58eff2696eaf6a846 to 1f134fdb3bcc29213b55658a69d1d8bf72079554 (pr148.02 -> pr148.03, diff)
Addressed @jarolrod comment
Update:
Let me take a look into replacing this low-level object handling with interfaces::chain
Considering your previous suggestion about using the
interfaces::chain, I think I can create a separate .cpp file handling chain-related parameters such as blockTimeListLet me try rephrasing your suggestion to ensure I understood it correctly.
You suggest I create a separate
componentfile for each block clock state, create a controller file inqml/control, and switch to loading different block clock component files based on the requirement.Have I understood it correctly?
Yes, it is. Thanks for pointing that out. I shall fix this with the next update of the PR.
Let me experiment with
interfaces::chainand devise an approach that avoids low-level object handling.Updated from 23f8a833b57bbdad3177ff23751ec0cdfb8d5b09 to 621eae1074365116d5bfd5e58eff2696eaf6a846 (pr148.03 -> pr148.04)
Changes:
Here is the demo of the latest iteration of the block clock:
https://user-images.githubusercontent.com/85434418/204341167-fe8cb5a4-7189-4cbd-b2f8-1db93be3cf3d.mov
Updated from 621eae1074365116d5bfd5e58eff2696eaf6a846 to 2a5e9983bebab10ce7be79eebdaf6104a992ca32 (pr148.04 -> pr148.05)
Changes:
Demo:
https://user-images.githubusercontent.com/85434418/207072355-c7371de4-fdd5-4dbe-bfee-db74e9a61818.mov
Thanks for the updates. It looks like the artifacts are not building due a lint issue (the Android build is only 22 bytes). Could you please address this? I'd love to get hands-on with this update.
To fix the lint task, suggesting the patch as follows:
Why is this file required?
This should be using the bitcoin circle icon introduced in https://github.com/bitcoin-core/gui-qml/pull/176. That's what is specified in the design files
When running this branch, I see the following in my terminal:
Updated from 2a5e9983bebab10ce7be79eebdaf6104a992ca32 to 0f5461eef14e3ac0739d9b3e3448dd78c94ebff7 (pr148.05 -> pr148.06)
Addressed @hebasto @jarolrod @GBKS comments.
Changes:
QObject::moveToThread: Cannot move objects with a parentwarning.Screenshots:
The file has been removed in 0f5461e
Fixed in 0f5461e
Addressed in 0f5461e.
Updated from 0f5461eef14e3ac0739d9b3e3448dd78c94ebff7 to 0fbe6c809eadabde0ca4c6f443dea60feae3fb34 (pr148.06 -> pr148.07)
Updated from 0fbe6c8 to 29f019e
Updated from 29f019e4a5278a4e7b5aaf56a49bee309bcc4d2a to 8173bf6838997dce6dc6e908a54801fdcb5e0ad8 (pr148.08 -> pr148.09)
Differences as explained in #212 Description:
Views look nice and render correctly. Tested pause/unpause as well as a full sync on signet at got the following results.
A few QML errors when running that need to be resolved before merging. I've left comments for those errors at the corresponding line numbers.
tail -f debug.log | grep GUIto watch for issues when running bitcoin-qt."No newline at end of file"
"No newline at end of file"
QML error appears when shutting down.
The following error appears when going into the paused state.
Small style comment, operators should have space before/after for easier readability.
Should be able to remove the ColumnLayout containing the BlockClockComponent and just define the BlockClockComponent as the content to this Page. When you do this, also remove the
anchors.fill: parentandspacing: 0in this file.Updated from 8173bf6838997dce6dc6e908a54801fdcb5e0ad8 to bcbc80b6666e43aa07ee46e09289b4a34f3fa30b (pr148.09 -> pr148.10)
Addressed @johnny9 comments.
Changes:
The CI lint task error:
looks a bit weird as I failed to find a branch the c4e1ce262ffb5e6956a7b912f2dcf7560823682e commit belongs to.
I hope rebasing will help.
@shaavan And please make sure your local branch does not contain any merge commits.
Updated from bcbc80b6666e43aa07ee46e09289b4a34f3fa30b to 68fa33b202e528ff0eae839f7163be8a7f939392 (pr148.10 -> pr148.11)
QML error when going into the paused state still exists. Other issues are resolved.
Still getting
2022-12-19T23:10:24Z GUI: qrc:/qml/controls/BlockClock.qml:95: TypeError: Value is undefined and could not be converted to an objectwhen going to the paused state. i think doingif (parent.blockList) {should resolve it.Updated from 68fa33b202e528ff0eae839f7163be8a7f939392 to 20b4ed55f1b9417fa0a1457736be1b6c1c54f1dd (pr148.11 -> pr148.12, diff)
Addressed @johnny9 comment.
Fixed
TypeError: Value is undefined and could not be converted to an objecterror.Also addressed one formatting issue, present in displaying Block Counter.
Explaination:
For example, for the block count of 122010, difference:
Updated from 20b4ed55f1b9417fa0a1457736be1b6c1c54f1dd to abb0bef2460b4ba98cf02758dedd052efe4ec722 (pr148.12 -> pr148.13, diff)
timeRatioListso that blockClock start displaying from the "0" point.Screenshot:
Addressed in bcbc80b6666e43aa07ee46e09289b4a34f3fa30b.
Addressed in bcbc80b6666e43aa07ee46e09289b4a34f3fa30b
Addressed in bcbc80b6666e43aa07ee46e09289b4a34f3fa30b
Addressed in bcbc80b6666e43aa07ee46e09289b4a34f3fa30b
Addressed in 20b4ed55f1b9417fa0a1457736be1b6c1c54f1dd
Addressed in 20b4ed55f1b9417fa0a1457736be1b6c1c54f1dd
Thanks for all of your reviews!
Good work on this Shashwat. All of the QML errors appear to be resolved now. Views render as expected
fec6a0e9c7In
Chaininterface, probably better to use a type-safeCBlockIndex::Time()github.com/bitcoin-core/gui-qml@fd4e57f636/src/chain.h (L279-L282)Anyway, it will take a broader discussion when it will about to merge into the main repo.
a287f9e44660b80349defa8f34f14c8b9f0d8b78
Sorry, if I missed any previous discussion about that, but why is calling of
ChainModel::setCurrentTimeRatioimplemented like that?a287f9e44660b80349defa8f34f14c8b9f0d8b78
nit: Naming convention?
a287f9e44660b80349defa8f34f14c8b9f0d8b78
nit: Naming convention?
a287f9e44660b80349defa8f34f14c8b9f0d8b78
nit: Naming convention?
a287f9e44660b80349defa8f34f14c8b9f0d8b78
Naming convention:
a287f9e44660b80349defa8f34f14c8b9f0d8b78
Maybe add a descriptive comment?
The currentTimeRatio represents the ratio of 12 hours that has been passed.
So, for example, at 4 am or pm, the currenTimeRatio would be 0.3.
We need to update this information in the blockClock each second so that the blockClock always shows the correct blockTime.
So that's why I created a separate 1-sec timer thread to call this function each second and update the currentTimeRatio.
Sure, let me look through it.
Let me include that, along with other future suggestions for this file.
Updated from abb0bef2460b4ba98cf02758dedd052efe4ec722 to
67d12a6753(pr148.13 -> pr148.14, diff)Addressed @hebasto comments.
Changes:
globalprivate member variable to a local variable.m_time_ratio_list, and the values it stores.Addressed in
67d12a6753Addressed in
67d12a6753Addressed in
67d12a6753Addressed in
67d12a6753Addressed in
67d12a6753Since this timer didn't need to be a private member variable, I changed it to a local variable.
Closing in favor of #220.