GUI: rethink usage of globally accessed SessionData
SessionData* is a globally accessed pointer that, in turn, provides access to InstrumentLibrary and ProjectDocument.
InstrumentLibrary is needed only in few places so it can be passed locally.
-
pass InstrumentLibraryexplicitly, as constructor argument, not throughgSessionData*
Should we keep access to ProjectDocument global?
It is used (in different parts of code through gSessionData*)
- to get
userExportDir()for saving files - to get access to
InstrumentModelfor finding instrument by its id - to call
setModified()method - to get access to
JobModeland check if there are unfinished jobs on BA closing
and so on.
Is it better to make global ProjectDocument itself, without wrapping into SessionData and stop passing ProjectDocument* as argument to constructors?
Edited by Mikhail Svechnikov