Introduce OptionsModel backend, Wire up Storage Amount settings to backend#207
Conversation
| engine.rootContext()->setContextProperty("nodeModel", &node_model); | ||
|
|
||
| OptionsQmlModel options_model{*node}; | ||
| engine.rootContext()->setContextProperty("options", &options_model); |
There was a problem hiding this comment.
Might want a more specfic variable name here since its registered to the root to prevent possible conflicts with other property names. "optionsModel" maybe.
Also, I can't get my head around how this is working now. When hebasto did the previous PR setting a rootContext like this wasn't accessible in any of the sub components but this one is working. All I can think of is that it has something to do with how the StackView in main.qml is implemented now. Possibly due to the Onboarding components being statically defined instead of loading in the files with the Wizard.
There was a problem hiding this comment.
In debug.log, I can observe a few TypeErrors.
% cat debug.log | grep GUI
2022-12-20T13:45:16Z GUI: qrc:/qml/components/StorageSettings.qml:24: TypeError: Cannot read property 'pruneSizeGB' of null
2022-12-20T13:45:16Z GUI: qrc:/qml/components/StorageSettings.qml:16: TypeError: Cannot read property 'prune' of null
The reason for this TypeError is that the OptionsQmlModel is initialized after the engine.
And since objects are destroyed in reverse order of how they are initialized, the OptionsQmlModel is getting destroyed before the QML engine.
The same TypeErrors existed in #184, as pointed out by @johnny9 here.
So you have to initialize the OptionsQmlModel before the engine to solve this.
There was a problem hiding this comment.
will address both of these soon
|
Rebase? |
shaavan
left a comment
There was a problem hiding this comment.
There is one bug in the code due to which the OptionsButton and Setting are not correctly connected.
Steps to reproduce:
- Start GUI.
- Select the "no prune" option.
- Complete onboarding.
- Restart GUI.
Observation:
- The OptionsButton has reset back to the "prune" option, but the prune option is deselected in the detailed setting.
Recording:
Recording.mp4
|
@shaavan technically that can be addressed, but the issue here really is that we just haven't introduced detection of whether or not it's the first time that the user is running the gui. If there is a settings.json in the data directory we're looking in we wouldn't be showing the onboarding process. |
12cbdc9 to
d72ac4c
Compare
|
I've re-run CI. |
| engine.rootContext()->setContextProperty("nodeModel", &node_model); | ||
|
|
||
| OptionsQmlModel options_model{*node}; | ||
| engine.rootContext()->setContextProperty("options", &options_model); |
There was a problem hiding this comment.
| engine.rootContext()->setContextProperty("options", &options_model); | |
| engine.rootContext()->setContextProperty("optionsModel", &options_model); |
| recommended: true | ||
| checked: true | ||
| onClicked: { | ||
| options.prune = true |
There was a problem hiding this comment.
| options.prune = true | |
| optionsModel.prune = true |
| checked: true | ||
| onClicked: { | ||
| options.prune = true | ||
| options.pruneSizeGB = 2 |
There was a problem hiding this comment.
| options.pruneSizeGB = 2 | |
| optionsModel.pruneSizeGB = 2 |
d72ac4c to
cc96bd1
Compare
|
updated from d72ac4c to cc96bd1, compare Changes:
|
|
Please rebase :) |
Wires both the easy and advanced configuration options related to storage amount to the options model backend. Additionally, this removes an unused and unwanted storage location setting from the advanced storage amount settings table.
cc96bd1 to
63162b0
Compare
|
Updated from cc96bd1 to 63162b0 Changes: rebased over main A note on implications of setting the default prune values when the page is loaded and in relation to #219: If we have an approach where we are only loading one page at a time, that means if a user goes back or forwards, the page gets loaded again. This means that if the user had configured a prune target of 8gb as a custom setting, continued on to the next page then decided to go back and change the prune target, the prune target would be reset to 2gb. This can be mitigated with detection of settings already set, which is needed anyways. Alternatively, the logic here can be changed into a form, where when the user finally finishes onboarding, then the settings get written. This is probably preferable anyways, for several cases such as quiting the application during onboarding; if we write settings, we wouldn't show onboarding again, but if we only write settings when onboarding is finished, the onboarding wizard will show on subsequent gui startups until the user completes onboarding. |
Github-Pull: bitcoin-core#207 Rebased-From: 4c6562e
Github-Pull: bitcoin-core#207 Rebased-From: 93f78f8
Wires both the easy and advanced configuration options related to storage amount to the options model backend. Additionally, this removes an unused and unwanted storage location setting from the advanced storage amount settings table. Github-Pull: bitcoin-core#207 Rebased-From: 63162b0
Github-Pull: bitcoin-core#207 Rebased-From: 4c6562e
Github-Pull: bitcoin-core#207 Rebased-From: 93f78f8
Wires both the easy and advanced configuration options related to storage amount to the options model backend. Additionally, this removes an unused and unwanted storage location setting from the advanced storage amount settings table. Github-Pull: bitcoin-core#207 Rebased-From: 63162b0
Github-Pull: bitcoin-core#207 Rebased-From: 4c6562e
Github-Pull: bitcoin-core#207 Rebased-From: 93f78f8
Wires both the easy and advanced configuration options related to storage amount to the options model backend. Additionally, this removes an unused and unwanted storage location setting from the advanced storage amount settings table. Github-Pull: bitcoin-core#207 Rebased-From: 63162b0
…up Storage Amount settings to backend a8266dd qml: Wire Storage amount options to OptionsModel backend (jarolrod) bb49e7e qml: Add "-prune" settings to `OptionsQmlModel` class (Hennadii Stepanov) 2b221d6 qml, build: Add `OptionsQmlModel` class with basic implementation (Hennadii Stepanov) Pull request description: This re-uses bitcoin-core/gui-qml#184, with changes, to introduce an OptionsModel backend, while also wiring the Storage Amount settings; as the first settings to be wired to the options backend. Both the "easy configuration" and "advanced configuration" methods for configuring the storage amount are wired to the backend. While on the fifth view of the onboarding wizard, the view with the header "Storage", if you click on the "Reduce Storage" button, your `Settings.json` file will show: ``` { "prune": 1907 } ``` and if you click on the "Store all data" button, your `Settings.json` file will show: ``` { "prune": 0 } ``` Within "Detailed Settings", you can examine that the prune target specified within the `Settings.json` file will only be non-zero if a non-zero value is set in storage limit and if the "Store recent blocks only" switch is enabled, as it should be. The values you configure while onboarding will then be visible within the NodeSettings view when you click on "Storage". **Note:** This doesn't complete the entire feature set around the setting, enabling, or disabling of this feature. There is still work to be done, this is the initial introduction and wiring. The screenshots below highlight the functionality of this PR. | configuring while onboarding | correct values available within the node settings window | | ---------------------------- | -------------------------------------------------------- | | <img width="752" alt="Screen Shot 2022-12-14 at 4 32 48 AM" src="https://user-images.githubusercontent.com/23396902/207559204-76eeac23-8d6d-4234-8f97-122dc58b2bd5.png"> | <img width="752" alt="Screen Shot 2022-12-14 at 4 32 57 AM" src="https://user-images.githubusercontent.com/23396902/207559250-6d77b672-7d28-4743-9d08-138dcc152c8d.png"> | [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/207) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/207) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/207) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/207) ACKs for top commit: johnny9: ACK a8266dd Tree-SHA512: 2c7559434b8db1bd659fbf91ebfe8c99a709d9e2f438d00c5eff3d9d483c0087a31022f0e20dc4942e25fcdfef65e545714d380e645df50c3c2d5d834db61b38
…up Storage Amount settings to backend a8266ddd5c9ea9d2685c93b77891df1e5bcb9502 qml: Wire Storage amount options to OptionsModel backend (jarolrod) bb49e7e311572bd3cfbd1c59ab1c608497bc9b8b qml: Add "-prune" settings to `OptionsQmlModel` class (Hennadii Stepanov) 2b221d65cb8647157cf865b93f7d41f8a0b63f05 qml, build: Add `OptionsQmlModel` class with basic implementation (Hennadii Stepanov) Pull request description: This re-uses bitcoin-core/gui-qml#184, with changes, to introduce an OptionsModel backend, while also wiring the Storage Amount settings; as the first settings to be wired to the options backend. Both the "easy configuration" and "advanced configuration" methods for configuring the storage amount are wired to the backend. While on the fifth view of the onboarding wizard, the view with the header "Storage", if you click on the "Reduce Storage" button, your `Settings.json` file will show: ``` { "prune": 1907 } ``` and if you click on the "Store all data" button, your `Settings.json` file will show: ``` { "prune": 0 } ``` Within "Detailed Settings", you can examine that the prune target specified within the `Settings.json` file will only be non-zero if a non-zero value is set in storage limit and if the "Store recent blocks only" switch is enabled, as it should be. The values you configure while onboarding will then be visible within the NodeSettings view when you click on "Storage". **Note:** This doesn't complete the entire feature set around the setting, enabling, or disabling of this feature. There is still work to be done, this is the initial introduction and wiring. The screenshots below highlight the functionality of this PR. | configuring while onboarding | correct values available within the node settings window | | ---------------------------- | -------------------------------------------------------- | | <img width="752" alt="Screen Shot 2022-12-14 at 4 32 48 AM" src="https://user-images.githubusercontent.com/23396902/207559204-76eeac23-8d6d-4234-8f97-122dc58b2bd5.png"> | <img width="752" alt="Screen Shot 2022-12-14 at 4 32 57 AM" src="https://user-images.githubusercontent.com/23396902/207559250-6d77b672-7d28-4743-9d08-138dcc152c8d.png"> | [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/207) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/207) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/207) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/207) ACKs for top commit: johnny9: ACK a8266ddd5c9ea9d2685c93b77891df1e5bcb9502 Tree-SHA512: 2c7559434b8db1bd659fbf91ebfe8c99a709d9e2f438d00c5eff3d9d483c0087a31022f0e20dc4942e25fcdfef65e545714d380e645df50c3c2d5d834db61b38
This re-uses #184, with changes, to introduce an OptionsModel backend, while also wiring the Storage Amount settings; as the first settings to be wired to the options backend.
Both the "easy configuration" and "advanced configuration" methods for configuring the storage amount are wired to the backend. While on the fifth view of the onboarding wizard, the view with the header "Storage", if you click on the "Reduce Storage" button, your
Settings.jsonfile will show:and if you click on the "Store all data" button, your
Settings.jsonfile will show:Within "Detailed Settings", you can examine that the prune target specified within the
Settings.jsonfile will only be non-zero if a non-zero value is set in storage limit and if the "Store recent blocks only" switch is enabled, as it should be.The values you configure while onboarding will then be visible within the NodeSettings view when you click on "Storage".
Note: This doesn't complete the entire feature set around the setting, enabling, or disabling of this feature. There is still work to be done, this is the initial introduction and wiring.
The screenshots below highlight the functionality of this PR.