mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 08:03:39 +00:00
WIP: DRAFT: Custom Datadir Wiring #390
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!390
Loading…
Reference in a new issue
No description provided.
Delete branch "qml-intro-custom-datadir"
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?
This pull request introduces the functionality for users to specify a custom data directory (
datadir) during the onboarding process.Ubuntu Screenshots
Prerequisites
For testing this pull request, ensure you have the following Qt modules installed:
Make sure you delete the prior depends folder (i.e.
depends/aarch64-linux-android) and rebuild them.Implementation Details
This enhancement leverages
FileDialogclass for a user-friendly selection experience. Additionally, necessary code updates and adjustments were made to accommodate the delayed node creation until onboarding completion.qml/bitcoin.handcppto manage custom data directory settings.onboardingmodelfiles to oversee the onboarding process, specifically custom data directory configuration and placeholders foroptionsModel.StorageLocations.qmlto incorporate wiring for custom data directory selection and resetting to default.OnboardingCover.qmldue to the postponed node initialization until onboarding completion.onboardingModelinstead ofoptionsModel. Additionally, arguments referencingchainModelwere removed as node initialization now occurs at the end of the onboarding process.Makeprocess was extended to include theonboardingmodelfiles.TODO: will implement a way to display a read only path to the user's custom
datadir, most likely tin the StorageOptions file.Left comments for some obvious code areas that can be cleaned up.
During testing, I was unable to start the app after onboarding. The inital onboarding flow worked, however, It appeared to not find the custom data directory I set on the second time loading the app.
Remove the comments here and fix the formatting
remove comments
remove commented code or add a TODO
remove commented code
chainstate still gets saved in the custom directory i believe so we probably want to keep this as is.
check that there is a newline on all of your new files
whitespace
revert changes in this file?
keep the old way as we want the user to factor in chainstate
done
done
done
done
good to know, thanks
fixed
Thanks @johnny9 for commenting and reviewing!
Was able to reproduce, it seems that if the custom datadir exist but hasn't been fully initialized, meaning the onboarding process didn't finished, it will trigger the error you encountered. Will look into how to mitigate that...
Ok found the problem, I had commented out the gArgs.ClearPathCache(); in qml/bitcoin.cpp, it works now... going to update the commits
how crucial is to have the info on the cover page?
The challenge here is that we don't fully initialize nodeModel and optionsModel, until we finish the Onboarding process, and they are referenced in AboutOptions.qml and DeveloperOptions.qml.
If it's important I will look into a way to accomodate for that, also it could be a follow up PR. What are your thoughts?
addressed it using onboardingModel
addressed using onboardingModel
updated the commits from 87b4d75 to 76f83f2
nit
CI is failing, please fix
Thanks for reviewing! Done...
I think the about page is important but we might need to just disable the options portion until onboarding is completed
sounds good... do you think disabling the options portion should be part of this PR?
updated the file from 31ca4220de68ccf85bf4d2a38ef5d5da06f4e624 to 4580643d48fc9e74f66c44f47f6ea9aed3c26941
Added TODO comments
tACK 22fb833b4ae86eee716d41468d9044c218a7bd9f
Tested on Ubuntu 22.04.
1. Building Issues (dynamic)/ Errors while running
bitcoin-qt(Prerequisites section).I wanted to try first if I needed any of the listed packages in the Prerequisites section in the description or if I have them already in my system.
I've then ran the commands provided by the author of the PR to install them, but it seems I already have them and the same error persisted when I re-try to execute
bitcoin-qt.At the end I found I needed also this one
qml-module-qtquick-dialogs, so please update the section accordingly if you think this is correct.2. On-boarding/ Settings defaults behaviour against #284 and
mainhave changed.Before testing the new feature wanted to check previous (#284/
main) behaviour and I noticed the default values of the settings have changed.Before,
mainand #284 branches screenshot:This PR's branch
D33r-Gee:qml-intro-custom-datadirscreenshot:Not only that,
dbcachesetting value, introduced by #284 (not merged intomainyet), changes every time it's persisted after I delete the default datadir:(e.g. 3rd. or 4th. time)
(e.g. After...)
dbcacheis calculated, there's no (at the moment) field where a user can change its value.Note: the rest of settings are not persisted because all
falseor0(zero) values are not persisted after #284 changes.It seems there is an issue integrating #284 or basing your code on top of it. Please keep in mind that it would be easier for reviewers to check you haven't missed any changes and that these are in the correct order.
Perhaps it's due to this removed line in 1st commit 5cc827339e4c891bcb13f9b41677e4cabab3d981 (?):
3. Testing Custom Datadir Wiring feature.
First time I set the new custom data dir I get these errors:
I checked that
Model size of -23 is less than 0happens once the FileDialog opens.I tried to get the
Gtk-CRITICALagain but only happened to me the very first time I tested the app and never again.Once I've created a custom datadir and it works fine, everything gets saved there (except for the issue with the correct value of settings mentioned in 2.).
Now, second time I run the app the settings displayed and saved are totally messed up:
Another thing I noticed is that once I close the app if I delete the test chain subdirectory of the custom datadir (eg signet), which contains the
settings.jsonfile, when I start the app again still believes I'm on-boarded, don't get asked about the settings and that shouldn't be the case I think.As part of this PR, shouldn't we show the custom datadir that has been selected by the user somewhere? Perhaps as a non editable field in the Storage settings page?
Great catch @pablomartin4btc! Updated the description
In this case the the
customdirectory needs to be deleted as well, since the code cached the top level directory and just the chainstate one (i.e.signet). In other words if you'd like to test onboarding again you'd haverm -r customthat's a good point... will update that along with @johnny9 android patches
Let's make this draft as it still needs a good bit of work. It's a requirement that changes need to work with all builds (dynamic + static)
Why is this needed for this change, an idea early on is that we would avoid a class like this if it's not necessary. I don't see the following changes as necessary for setting the strDataDir Setting
I really don't think any of this is needed, we can just have a flag in our qml options model to not write settings but store their value in memory. When a new setting is added, we then need to update changes in one more place (this file) when it's not exactly necessary.
can a flag in qml options model be set without requiring node init?
the logic behind having a separate class came from qt/bitcoin.h and cpp where the class is set to accomodate member variables... Do you think this can be achieve with just the anymous "namespace" within qml/bitcoin.cpp?
Great... I'll make it a draft...
BTW, @johnny9's patches for android to include the FileDialog functionality also work with the
x86_64-pc-linux-gnustatic build.Regarding the commits, please consider the contributing guidelines about the commit titles (~50 chars max).
2nd commit name/ title should be the same as the original from @johnny9, also should not be at the top?
Perhaps would be easier to make this change independent from #284, making it just the control and the component to work (file dialog, libraries, etc) and later making it persistent as a follow up while #284 gets approved? Just thinking loud about it.
agree with
https://github.com/bitcoin-core/gui-qml/pull/390#pullrequestreview-1940546706
duplicate
edit: some github bug, the other one wasn't visible
agree with
https://github.com/bitcoin-core/gui-qml/pull/390#pullrequestreview-1940546706
it crashed once when clicking Custom at Storage Location. 951387487f0ad187d646f7c4b96f37c1e01d431d
terminal output
haven't been able to repro
@MarnixCroes, thanks for testing and reviewing
Does this mean it the crashing is persisting or that it only happened once?
Also are you testing on Ubuntu? if so what version?
Some minor things still to clean up.
Remove unnecessary comments
whitespace
whitespace
whitespace
I think Jarol is right. This seems like too much duplication with the Options model. The Node in the options model can just be allowed to be null and set later. That way it can gather up the values during onboarding and set them only when the node is setup after onboarding is complete.
it only happened once. can't reproduce yet
This was indeed on ubuntu, 22.04.4 LTS
thanks for finding that!
sounds good
Based on @pablomartin4btc and @johnny9 feedback:
Converted to draft for now and will post follow up PR with only the UI elements for more straight forward reviewing and merging.
makes sense modified the code in a separate branch and will push into new PR once the UI one have been merged.
Ok got the custom datadir to work with an anonymous namespace in separate branch... Will update and push the code in a new PR once the UI ones have been merged
thx
replaced by https://github.com/bitcoin-core/gui-qml/pull/408