stellarium icon indicating copy to clipboard operation
stellarium copied to clipboard

Oculars plugin: Introduce a 5-value pluginMode property

Open gzotti opened this issue 3 years ago • 70 comments

Description

The mode switching and zooming code in the Oculars plugin is hard to follow, with a series of intermingled side effects. This work here should consolidate the state switching. However, it seems the menu buttons in the top-right GUI panel still need boolean properties. I have moved those as "slave properties" with private getters/setters.

  • better understandable mode switching with one centralized method.
  • no more entangled side effects
  • cleanup not finished yet. For now I have commented away the previous functions for easier comparison.
  • Any missing switching, storage and re-setting of main program settings should be done in the setPluginMode().

The other, even larger restructuring is the introduction of a dedicated Finder mode which replaces the hybrid isBinocular() from Ocular mode. This adds a button to the menu bar. However, Binoculars and Finders are collected in the same class "Finder" given that their properties are specified in the same way.

Fixes #1509, #356

Screenshots (if appropriate):

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to change)
  • [x] This change requires a documentation update

How Has This Been Tested?

Test Configuration:

  • Operating system: Windows 10
  • Graphics Card: irrelevant

Checklist:

  • [ ] My code follows the code style of this project.
  • [ ] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules

gzotti avatar Feb 21 '21 20:02 gzotti

2021: Restore Main App's settings

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L306-L311


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: "Module disabled" is printed but not visible here. Change message or set ocularMode=OcNone?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L375-L380


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: AVOID THIS LIKE HELL! All state switching only in the master state switcher

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L693-L698


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: consider extending the constructor with an OcularMode argument?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L753-L758


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: This was 2011... why/what to fix?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L782-L787


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: consider extending the constructor with an OcularMode argument?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L794-L799


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: Switching both possible modes off was the original logic. But what if we have an Ocular that is isBinocular()?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L850-L855


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: Write here as comment why no instrument update (emit ***Changed()) is necessary? It seems this should change things like auto-determined visibility limits?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L884-L887


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

NEW 2021: only [0...360] OK? then delete the commented section below and this comment.

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L1320-L1325


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

NEW 2021: only [0...360] OK? then delete the commented section below and this comment.

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L1337-L1342


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

BM: Make this an on-screen message and/or disable the button

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L1395-L1400


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

Finish the disentanglement of switching modes.

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2252-L2257


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: Decide if this is really useful? We only de-activate a red zero-magnification finder. Why revert to another view direction?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2287-L2292


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

switch out Ocular-specific settings

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2294-L2299


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

The next 3 should likewise actually restore previously stored settings

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2318-L2323


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

Make sure zoom() has no side effect about ocularMode / flagOcularShow.

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2336-L2341


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

switch out Sensor-specific settings. Part of previous enableOcular()

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2356-L2361


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: Required?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2358-L2363


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: restore a stored setting instead?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2369-L2374


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

switch in Ocular-specific settings

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2402-L2407


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

Test: leave the switch statement prematurely.

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2428-L2433


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: What are the side effects of this?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2454-L2459


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: Make sure to handle toggling gridlines correctly in addition, while OcOcular is active.

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2469-L2474


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: Store these settings first, and restore on leaving OcOcular mode above!

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2508-L2513


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

prepare Sensor-specific settings?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2517-L2522


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

BM: Make this an on-screen message and/or disable the button

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2522-L2527


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: Decide if this is really useful? We only activate a red zero-magnification finder where we need it. Why revert to another view direction?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2554-L2559


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: While we are at it, shall activating the Telrad center on a selected object?

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2557-L2562


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

Investigate which, and actually avoid them if possible (easier maintenance!)

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2600-L2605


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]

2021: Decide whether "show=false" should do nothing if the respective mode is not enabled.

https://github.com/Stellarium/stellarium/blob/b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8/plugins/Oculars/src/Oculars.cpp#L2604-L2609


This comment was generated by todo based on a TODO comment in b2601a66f250d1b6dcb7f5c0aaebe60af274f7b8 in #1521. cc @Stellarium.

todo[bot] avatar Feb 21 '21 20:02 todo[bot]