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 InstrumentLibrary explicitly, as constructor argument, not through gSessionData*

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 InstrumentModel for finding instrument by its id
  • to call setModified() method
  • to get access to JobModel and 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