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

Implement dive-invalid flag. Needs some UI work and fine-tuning. #2440

Merged
merged 8 commits into from Mar 20, 2020

Conversation

bstoeger
Copy link
Collaborator

Describe the pull request:

  • Bug fix
  • Functional change
  • New feature
  • Code cleanup
  • Build system change
  • Documentation change
  • Language translation

Pull request long description:

This implements the "mark dive invalid" feature that has been requested a few times.

This implements the core code. However, the UI code is only a proof of concept: Invalid dives, if shown, are marked by a gray background. This is unfortunate as this is not visible when selected. I'd ask someone else to do the UI part, if there is interest.

The invalid flag is considered for the statistics and when calculating a new dive number. This probably needs some fine-tuning. For example, what about residual N2 in the planner?

Changes made:

  1. Implement invalid-flag
  2. Save/load invalid-flag
  3. Implement undo-command to set/reset the invalid-flag
  4. Update filter when changing the show-invalid-dives preferences
  5. Ignore invalid dives in statistics / when calculating new dive numbers

Related issues:

This feature was suggested as a potential solution for #2154.

Additional information:

Release note:

Let's wait for approval / refinement.

Documentation change:

Should be done, yes.

Mentions:

@dirkhh @willemferguson @atdotde

@bstoeger
Copy link
Collaborator Author

Sorry for the color-explosion-banner. I just scrolled through the tag-list and checked everything that applies. 😛

@dirkhh
Copy link
Collaborator

dirkhh commented Dec 13, 2019

I think this should best be looked at by someone who actually expressed interest in this. I always found this a very strange concept.

@bstoeger
Copy link
Collaborator Author

I'll ask on the mailing list. If there is no interest, we can also remove the stub and the obscure preferences entry. Fine with me.

@bstoeger bstoeger mentioned this pull request Dec 13, 2019
4 tasks
@janiversen
Copy link
Contributor

just for information, we have a case in issue #2555 where the invalid flag could be useful.

Also I think, maybe wrongly, that #2513 might be related to this PR as well, or more correctly some work regarding invalid flag already merged.

Implement reading/writing the flag from/to XML/git.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
@bstoeger
Copy link
Collaborator Author

Rebased on master - that was somewhat painful with all the prefs churn. On the mailing list, there were two or three positive, though not ecstatic, comments and no negatives. In a quick test, the main problem was that if a dive is selected you don't see whether it is invalid or not. So this would need some UI work. Also it is unclear if "invalid" dives should be considered by the planner to calculate remaining gas load, or whatever magic it does. :-P

In any case, I'd really like to come to a decision here. I'd prefer to not have to rebase again.

@bstoeger
Copy link
Collaborator Author

Update: Make the font italicized for invalid dives. Looks absolutely horrid, but at least one now recognized invalid dives when selected. The best I can come up with (apart from writing a custom "delegate", which I really don't feel like doing).

@dirkhh
Copy link
Collaborator

dirkhh commented Mar 19, 2020

I am hoping to find time to play with this today... sorry to not have provided feedback earlier.
Oddly not going out hasn't improved the net number of available hours for Subsurface...

@dirkhh
Copy link
Collaborator

dirkhh commented Mar 19, 2020

OK, played with this.
You are a UI genius. If this professor thing doesn't work for you, consider a career as a visual designer. That use of italics is inspired and game changing. I'm all in.
:-)
The feature seems to work as intended, I wasn't able to break anything or to spot a scenario where it seemed broken. My testing wasn't comprehensive, I'm sure, but I tried what felt like the obvious scenarios.
Hopefully later this afternoon I'll try to come up with something even more inspired concerning the UI, but with that one caveat, I don't have a lot to complain about.
Thank you.

@bstoeger
Copy link
Collaborator Author

bstoeger commented Mar 19, 2020

New attempt: use struck out font instead of italics - I think that's universally understood as "invalid".

@dirkhh
Copy link
Collaborator

dirkhh commented Mar 20, 2020

Looked at your new UI approach. Definitely better. That is indeed intuitive.
One thing that I found strange when playing with it was the "make valid" wasn't the top entry in the context menu for an invalid dive. That's of course a pain because that means having two entries there, exactly one of which is visible at a time - but when I played with this I had the pretty strong feeling that the "make valid" entry should be the first.

Now we need to implement something similar for the mobile UI - but that's not required to merge this part, I guess. Oh - my mobile build is broken with this branch - but it seems to work on GitHub Actions, so I'm guessing it's something that I borked here.
Edited to add: yep, my mobile build directory was completely messed up, no idea how I did that... blew it away and did a clean build, no issues - except that we have no UI support for invalid dives, of course

Copy link
Collaborator

@dirkhh dirkhh left a comment

Choose a reason for hiding this comment

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

I almost clicked merge, then I noticed that the commit message of 0d45e5c may need some work :-)

static QFont struckOutFont()
{
QFont font;
font.setStrikeOut(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

good choice - but doesn't match the commit message :-)

Connect command to context menu.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Hide invalid dives if prefs.display_invalid_dives is false.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Mark invalid dives in the dive list by striking them out
and rendering them with a grey color. The color-change is
not sufficient, because the default model delegate ignores
color hints if the item is selected.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
If the dive the user clicked on is invalid show an option to
make the dive valid.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The user had to restart the application or manually change the filter
if they changed the flag.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Adding dives uses the number of the last dive to create a new
dive number. Ignore invalid dives.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
@dirkhh
Copy link
Collaborator

dirkhh commented Mar 20, 2020

for some reason I no longer get notifications when you push things...
yes, this is good. thanks!

@dirkhh dirkhh merged commit f4f1503 into subsurface:master Mar 20, 2020
@bstoeger bstoeger deleted the invalid branch March 21, 2020 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants