GODT-919 GODT-1022 GODT-947 Logs and signals

+ Added startup logs
+ Added wait group for update notifications
+ Changed hooks in debug and trace level
This commit is contained in:
Jakub
2021-02-08 14:47:40 +01:00
committed by Michal Horejsek
parent bcef1c36ba
commit c6107dbd4b
21 changed files with 93 additions and 37 deletions

View File

@ -97,6 +97,9 @@ type FrontendQt struct {
// saving most up-to-date update info to install it manually
updateInfo updater.VersionInfo
initializing sync.WaitGroup
initializationDone sync.Once
}
// New returns a new Qt frontend for the bridge.
@ -132,6 +135,10 @@ func New(
restarter: restarter,
}
// Initializing.Done is only called sync.Once. Please keep the increment
// set to 1
tmp.initializing.Add(1)
// Nicer string for OS.
currentOS := core.QSysInfo_PrettyProductName()
bridge.SetCurrentOS(currentOS)
@ -180,6 +187,8 @@ func (s *FrontendQt) NotifySilentUpdateError(err error) {
}
func (s *FrontendQt) watchEvents() {
s.WaitUntilFrontendIsReady()
errorCh := s.getEventChannel(events.ErrorEvent)
credentialsErrorCh := s.getEventChannel(events.CredentialsErrorEvent)
outgoingNoEncCh := s.getEventChannel(events.OutgoingNoEncEvent)
@ -683,3 +692,14 @@ func (s *FrontendQt) startManualUpdate() {
}
}()
}
func (s *FrontendQt) WaitUntilFrontendIsReady() {
s.initializing.Wait()
}
// setGUIIsReady unlocks the WaitFrontendIsReady.
func (s *FrontendQt) setGUIIsReady() {
s.initializationDone.Do(func() {
s.initializing.Done()
})
}