Skip to content
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

UI Only Custom Datadir Display #397

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

D33r-Gee
Copy link
Contributor

@D33r-Gee D33r-Gee commented Apr 11, 2024

This pull request builds upon #392 and introduces enhancements to display the data directory information within the UI. This functionality encompasses both default and custom data directory paths, fulfilling the UI requirements for user-defined data directory selection initiated in #273.

Also the custom datadir is not persistent at the moment it will be once the back end wiring is added.

Ubuntu 22.04 Screenshots

datadir_desktop

Android Screenshots

datadir_mobile_720

As a potential follow-up enhancement, consider incorporating mechanisms for saving the data directory path. This could be achieved through:

  • Double-click functionality: Allow users to save the displayed path by simply double-clicking on it. This provides a convenient and intuitive method for desktop environments.

  • Dedicated button: For mobile use cases or scenarios where double-clicking might not be feasible, introduce a dedicated "Save Path" button. This ensures a clear and accessible action for users on various devices.

Copy link
Contributor

@johnny9 johnny9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on both the figma and the web prototype, the path should only be displayed on the custom selection after the user has made a choice.

https://lively-kashata-cfde7e.netlify.app/screen/first-use/storage-location?state=default

src/qml/controls/OptionButton.qml Outdated Show resolved Hide resolved
src/qml/models/options_model.cpp Outdated Show resolved Hide resolved
src/qml/models/options_model.cpp Outdated Show resolved Hide resolved
src/qml/models/options_model.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 0025e91

  • Noticed the same as @johnny9, proposed a change below (1) which also fixes the prefix of the customDir "file://" before the file dialog gets open or if the user cancels it.

    • screenshot

      Screenshot from 2024-04-12 20-36-30

  • Currently when the user cancels to set a custom datadir the custom option is still checked when perhaps we should go back to the default datadir being checked. So I proposed another change to that (2) with a caveat where if the user sets the custom, then wants to change it again but cancels it, it remains there in the custom checked.

  • We need to tackle the double click issue at some point. I spent some time with it but couldn't solved it yet.

  • First time I run it I got the crash reported by @MarnixCroes on DRAFT: Custom Datadir Wiring #390, and more often I get another errors related with Gtk image in the console, which I reported (3.) already in DRAFT: Custom Datadir Wiring #390 as well, both errors are produced as soon as I open the file dialog.

    • crash error

      ** Gtk:ERROR:../../../../gtk/gtkpathbar.c:1342:set_button_image_get_info_cb: assertion failed: (cancellable == data->button_data->cancellable) Bail out! Gtk:ERROR:../../../../gtk/gtkpathbar.c:1342:set_button_image_get_info_cb: assertion failed: (cancellable == data->button_data->cancellable) Aborted (core dumped)

    • Gtk image warning

      (bitcoin-qt:1496162): Gtk-CRITICAL **: 20:32:43.950: gtk_image_set_from_gicon: assertion 'GTK_IS_IMAGE (image)' failed

src/qml/components/StorageLocations.qml Outdated Show resolved Hide resolved
src/qml/components/StorageLocations.qml Show resolved Hide resolved
src/qml/components/StorageLocations.qml Show resolved Hide resolved
src/qml/components/StorageLocations.qml Show resolved Hide resolved
@D33r-Gee
Copy link
Contributor Author

Based on both the figma and the web prototype, the path should only be displayed on the custom selection after the user has made a choice.

https://lively-kashata-cfde7e.netlify.app/screen/first-use/storage-location?state=default

To be clear we don't want to display the default datadir path here, correct?

However do we want to display the default path in StorageSettings.qml?

@pablomartin4btc
Copy link
Contributor

Based on both the figma and the web prototype, the path should only be displayed on the custom selection after the user has made a choice.
https://lively-kashata-cfde7e.netlify.app/screen/first-use/storage-location?state=default

To be clear we don't want to display the default datadir path here, correct?

As of figma, and the web prototype (link above) no, but it won't hurt to show it, I'm not sure.

Also, sorry if I'm adding confusion here but on a previous PR #390 there was a "Recommended" highlighted label on the default choice when I reviewed it, was that dropped (if ever discussed)?

image

However do we want to display the default path in StorageSettings.qml?

I think so, whatever it is set default or custom.

cc @GBKS

@D33r-Gee
Copy link
Contributor Author

To be clear we don't want to display the default datadir path here, correct?

As of figma, and the web prototype (link above) no, but it won't hurt to show it, I'm not sure.

@GBKS and @johnny9 what your thoughts regarding the above?

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch 2 times, most recently from 36467ea to dfc0023 Compare April 16, 2024 20:06
@johnny9
Copy link
Contributor

johnny9 commented Apr 17, 2024

To be clear we don't want to display the default datadir path here, correct?

As of figma, and the web prototype (link above) no, but it won't hurt to show it, I'm not sure.

@GBKS and @johnny9 what your thoughts regarding the above?

I don't have a strong opinion about this so i would defer to the current figma.

I do think the "Recommended" highlight is redundant as "Default" has the same meaning so I would remove that to match the figma

@GBKS
Copy link
Contributor

GBKS commented Apr 17, 2024

Just tested on desktop (Mac) and mobile (Android).

image

I agree with Johnny's rationale about ditching the Recommended label.

Something I noticed is that the directory display of the custom option disappears if I select the default one again (center). It feels unexpected, could we keep that visible?

I could go either way on showing the default directory. Might be more consistent if we just show it, so users know what they are changing from.

For the rightmost screenshot, could we switch to a vertical layout for the directory field? So the directory goes underneath the label? It's a bit awkward to have it squeezed on the right side.

@mouxdesign
Copy link

Storage error message: What would be the error message that a user would see if they choose to proceed but their device does not have sufficient storage?

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re tACK dfc0023

Verified my previous feedback got addressed. Usability seems more consistent.

Some observations (perhaps we need to address them with a new "onboarding related" PR):

  • Storage space estimation looks wrong during onboarding (e.g. starting the app simply with bitcoin-qt vs. bitcoin-qt -signet, please expand to see the screenshots) - Also, should we keep "Recommended" highlighted here?
    • bitcoin-qt ("Reduce storage" looks wrong)

      Screenshot from 2024-04-23 12-23-04

    • bitcoin-qt signet ("Store all data" looks wrong)

      Screenshot from 2024-04-23 12-24-39

  • Using -datadir behaviour doesn't trigger the onboarding (neither combined with -chain= option - e.g. -signet with no -datadir triggers the onboarding when signet subdir doesn't exist on default datadir structure but setting -datadir option + -signet with no subdire doesn't) and it should when that custom datadir is empty otherwise:

    ./src/qt/bitcoin-qt -datadir="/home/pablo/custom"
    Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
    Running initialization in thread
    Warning: Disk space for "/home/pablo/custom/blocks" may not accommodate the block files. Approximately 540 GB of data will be stored in this directory.
    
    
    

@D33r-Gee, could you please try to investigate root of the crash mentioned at the end of my previous review? It seems it happens at the very first time you run bitcoin-qt (need to remove datadir and bitcoin config dir) using the file dialog of course, otherwise it doesn't happen. Most of the time the user would get this error message in the terminal:

(bitcoin-qt:756208): Gtk-CRITICAL **: 10:57:38.210: gtk_image_set_from_gicon: assertion 'GTK_IS_IMAGE (image)' failed

@pablomartin4btc
Copy link
Contributor

Just tested on desktop (Mac) and mobile (Android).

@GBKS for future reference, please add the commit version you've tested if possible so we can verify if it's the latest or a previous one.

I agree with Johnny's rationale about ditching the Recommended label.

Ok, please check the next page when user has to select the amount of space to store, there's also a "Recommended" highlighted label.

Something I noticed is that the directory display of the custom option disappears if I select the default one again (center). It feels unexpected, could we keep that visible?

I've proposed to hide it when a user goes back to default datadir to avoid confusion, as in when a user sees the page for the first time won't see the custom datadir until the user clicks on it and set it. Is it necessary if that's not the datadir that's going to be used?

I could go either way on showing the default directory. Might be more consistent if we just show it, so users know what they are changing from.

I'd show it but I've also thought if we can add an external link, not sure if with an information icon or something, to the bitcoin datadir documentation.

@pablomartin4btc
Copy link
Contributor

Storage error message: What would be the error message that a user would see if they choose to proceed but their device does not have sufficient storage?

I think that should be after accepting (clicking on next) the following page "Reduce store"/ "Store all data" (before starting the initial download sync).

@GBKS
Copy link
Contributor

GBKS commented Apr 24, 2024

How about one of these two options for the error message?

image

@pablomartin4btc
Copy link
Contributor

How about one of these two options for the error message?

As discussed on the designers call today, just keep in mind that the validation should be on the next page:

image

(crossed 9GB in red as it's incorrect)

@GBKS
Copy link
Contributor

GBKS commented Apr 25, 2024

Can we detect how much space is available on each location and show it? And can we estimate the required space needed (the mock-up uses 500GB as a placeholder, which is meant to be replaced with something accurate).

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from dfc0023 to 2fbb27a Compare May 1, 2024 14:31
@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented May 1, 2024

Rebased over main dfc0023 to 2fbb27a

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from 2fbb27a to 8e8aadf Compare May 1, 2024 17:45
@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented May 1, 2024

@GBKS and @pablomartin4btc Thanks for the feedback regarding the storage amount and the error messaging.
those will be addressed in a different PR since this is only for datadir display

Meanwhile please me know your thoughts on the latest update 8e8aadf?

Copy link
Contributor

@MarnixCroes MarnixCroes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8e8aadf
I cannot repro the double-click issue anymore #399
friendly ping @pablomartin4btc


one issue/inconsistency:
the selected custom data dir is not updated/displayed correctly during the onboarding, but it as at settings:
onboarding -> select custom data dir -> next -> click Detailed settings -> default data dir is displayed -> next -> next -> arrive at home screen -> go to settings -> storage -> data directory displays the custom data dir

@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented May 1, 2024

8e8aadf I cannot repro the double-click issue anymore #399 friendly ping @pablomartin4btc

That's great to hear...

one issue/inconsistency: the selected custom data dir is not updated/displayed correctly during the onboarding, but it as at settings: onboarding -> select custom data dir -> next -> click Detailed settings -> default data dir is displayed -> next -> next -> arrive at home screen -> go to settings -> storage -> data directory displays the custom data dir

Could you post a screenshot please?

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8e8aadf I cannot repro the double-click issue anymore #399 friendly ping @pablomartin4btc

Ok, thanks for letting me know... I'll do another test on the latest version of this PR.

@MarnixCroes
Copy link
Contributor

Could you post a screenshot please?

during onboarding:

Screenshot from 2024-05-01 23-45-12

Screenshot from 2024-05-01 23-45-19

after onboarding, at settings
Screenshot from 2024-05-01 23-45-28

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from 2a301e1 to 61e775b Compare May 7, 2024 17:15
@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented May 7, 2024

Thanks @pablomartin4btc for testing and reviewing

I noticed another bug which is: if the user clicks on custom...

addressed this with the latest push from 2a301e1 to 61e775b

Now when a user cancels after having picked a custom datadir it reverts back to default

@GBKS
Copy link
Contributor

GBKS commented May 8, 2024

Just tested the latest build, which I believe is 61e775b , on MacOS and Android.

image

Nice to see this come together. Just have some small comments:

  • Tapping anywhere in the directory option should activate it. This does not seem to work when tapping the light grey directory display box inside the item. Does it maybe intercept the click/tap event and prevent it from propagating to its parent?
  • On the settings page, the directory name seems to have the wrong color and too much spacing to the option title above it

Regarding the point about consistency for showing the directory box, I'd show it if it has a value. The default one can always be visible. And if the user has set one for the custom option, it can also be shown independent of whether that option is still selected or not. And if the user goes to the directory picker and cancels out of it, the previously picked option can remain active. That seems intuitive to me.

Quite the long thread, hope I didn't miss anything. Maybe good to address things like the error message in a separate PR to keep things manageable.

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from 61e775b to b941932 Compare May 8, 2024 16:05
@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented May 8, 2024

Thanks @GBKS for testing and reviewing...

This:

Tapping anywhere in the directory option should activate it. This does not seem to work when tapping the light grey directory display box inside the item. Does it maybe intercept the click/tap event and prevent it from propagating to its parent?

Is addressed with the latest push b941932

On the settings page, the directory name seems to have the wrong color

what would be the correct color?

And if the user goes to the directory picker and cancels out of it, the previously picked option can remain active. That seems intuitive to me.

this use case may be problematic since if the user cancels it currently reverts back to default, are you suggesting that if there was a previously selected folder then the custom option should remain selected even after the user cancels a secondary attempt at setting the custom datadir?

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from b941932 to 0c46cae Compare May 10, 2024 15:51
@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented May 10, 2024

with the latest push from b941932 to 0c46cae addressed @GBKS comment regarding the proper color for datadir display, by adding a new state ("DIRECTORY") in ValueInput.qml

Next is addressing this:

And if the user goes to the directory picker and cancels out of it, the previously picked option can remain active. That seems intuitive to me.

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from 0c46cae to 855cea5 Compare May 10, 2024 16:08
@D33r-Gee
Copy link
Contributor Author

new commit 855cea5 addressing this use case

And if the user goes to the directory picker and cancels out of it, the previously picked option can remain active. That seems intuitive to me.

Now when the user has picked/accepted a custom datadir and then decides to change it but cancels the selection it stays with the custom datadir previously selected unless they click on the default option

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from 855cea5 to ce6866a Compare May 16, 2024 17:29
@D33r-Gee
Copy link
Contributor Author

rebased new head is ce6866a

Copy link
Contributor

@johnny9 johnny9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't overload ValueInput for non input items. Just use CoreText or Label

src/qml/models/options_model.h Outdated Show resolved Hide resolved
src/qml/models/options_model.h Outdated Show resolved Hide resolved
src/qml/models/options_model.cpp Show resolved Hide resolved
src/qml/components/StorageSettings.qml Outdated Show resolved Hide resolved
src/qml/controls/ValueInput.qml Outdated Show resolved Hide resolved
@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from ce6866a to 2e2fe79 Compare May 20, 2024 22:24
@D33r-Gee
Copy link
Contributor Author

Updated from ce6866a to 2e2fe79

Main changes were implementing @johnny9 and @pablomartin4btc feedback...

RE: customDataDir bool, decided to go with a dynamic setting of dataDir since the bool options was giving me grief...

Please let me know your thoughts?

Copy link
Contributor

@johnny9 johnny9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be an issue with building the Android target

"qml/models/options_model.cpp:186:55: error: no matching member function for call to 'replace'
m_custom_datadir_string = m_custom_datadir_string.replace("content://com.android.externalstorage.documents/tree/primary%3A", "/storage/self/primary/");"

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from 2e2fe79 to 7341bdf Compare May 21, 2024 18:03
@D33r-Gee
Copy link
Contributor Author

Seems to be an issue with building the Android target

"qml/models/options_model.cpp:186:55: error: no matching member function for call to 'replace' m_custom_datadir_string = m_custom_datadir_string.replace("content://com.android.externalstorage.documents/tree/primary%3A", "/storage/self/primary/");"

Thanks for discovering this... Found the cause of the problem, I mistakenly left the added const to the getter function. I removed them and now it builds properly for both Android and Linux

Copy link
Contributor

@johnny9 johnny9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7341bdf

Copy link
Contributor

@MarnixCroes MarnixCroes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested lgtm 7341bdf

one nit/UX thing: select/have a custom data dir -> select default data dir -> select custom data dir -> it prompts the folder location selection again.
for me it would be more intuitive to not prompt the storage location for one click -> only when double-clicking. when clicking on the custom datadir again

@MarnixCroes
Copy link
Contributor

FTR, can repro the double-click in background issue on latest commit. not sure why previously I couldn't repro #397 (review)

@GBKS
Copy link
Contributor

GBKS commented May 22, 2024

The MacOS workflow runs seem to fail for this PR (also for 401). Would it be possible to fix those to simplify testing?

@D33r-Gee
Copy link
Contributor Author

one nit/UX thing: select/have a custom data dir -> select default data dir -> select custom data dir -> it prompts the folder location selection again. for me it would be more intuitive to not prompt the storage location for one click -> only when double-clicking. when clicking on the custom datadir again

Thanks for testing and the feedback. That's a good point, will add it to the polishing features alongside the error messaging. One thing to keep in mind is that on mobile "double-tapping" is uncommon so we'll have to play with it to see what feels most natural.

@D33r-Gee
Copy link
Contributor Author

The MacOS workflow runs seem to fail for this PR (also for 401). Would it be possible to fix those to simplify testing?

Hmmm... well that's problematic... will discuss with the other devs and see what can be done... Thanks for pointing it out!

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 7341bdf

Another UX nit: when a user selects a custom datadir and accepts it, clicks again on custom datadir to open the file dialog, creates a different custom dir but cancels the dialog, it goes wrongly to tick/ check the default datadir. Perhaps we can correct that on a follow-up.

Standing issues to follow-up:

  • Custom Datadir double click (check workaround at Bugfix custom datadir doubleClick - Follow-up #392 #399).
  • custom data dir -> select default data dir -> select custom data dir -> it prompts the folder location selection again (reported by @MarnixCroes)
    • not sure about differentiation between 1 click (for just tick the custom dir) or double to open a file dialog, perhaps adding a button/ icon to open the dialog but would break this design, I'd leave this to the design experts.

I still get this error the first time I run QT and open the File Dialog... could be something related with my initial env, after the first time it's not reproducible, leaving the comment here to follow-up later.

@@ -156,11 +158,46 @@ QUrl OptionsQmlModel::getDefaultDataDirectory()
return QUrl::fromLocalFile(path);
}

void OptionsQmlModel::setCustomDataDirArgs(QString path)
bool OptionsQmlModel::setCustomDataDirArgs(QString path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what the Args suffix in setCustomDataDirArgs stands for? Also because we have the option -datadir passed from the command line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Args suffix will come in play when the actual backend is connected since it will modify the gArgs so that the new datadir is set properly.

{
if (new_data_dir != m_dataDir) {
m_dataDir = new_data_dir;
if (!getCustomDataDirString().isEmpty() && (new_data_dir != getDefaultDataDirString())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why not having something like proposed here? It'd be easier to follow I think.

Suggested change
if (!getCustomDataDirString().isEmpty() && (new_data_dir != getDefaultDataDirString())) {
if (!isCustomDataDirSet) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your suggestion... after testing it became clear that not depending on a new bool would be the way to go. And so implemented yours and Johnny9 suggestions as part of a new dataDir variable.

@pablomartin4btc
Copy link
Contributor

Regarding the point about consistency for showing the directory box, I'd show it if it has a value. The default one can always be visible. And if the user has set one for the custom option, it can also be shown independent of whether that option is still selected or not. And if the user goes to the directory picker and cancels out of it, the previously picked option can remain active. That seems intuitive to me.

@GBKS: Agreed. Just found another case (ref.: "Another UX nit").

@D33r-Gee D33r-Gee force-pushed the qml-custom-datadir-display branch from 2a56d6b to c2e73b2 Compare May 27, 2024 18:01
@D33r-Gee
Copy link
Contributor Author

c2e73b2 rebased over main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants