forked from Silverfish/proton-bridge
GODT-1507: Enable autostart after Qt setup.
This commit is contained in:
@ -108,10 +108,6 @@ func New(
|
|||||||
if err := b.SendMetric(metrics.New(metrics.Setup, metrics.FirstStart, metrics.Label(constants.Version))); err != nil {
|
if err := b.SendMetric(metrics.New(metrics.Setup, metrics.FirstStart, metrics.Label(constants.Version))); err != nil {
|
||||||
logrus.WithError(err).Error("Failed to send metric")
|
logrus.WithError(err).Error("Failed to send metric")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := b.EnableAutostart(); err != nil {
|
|
||||||
log.WithError(err).Error("Failed to enable autostart")
|
|
||||||
}
|
|
||||||
setting.SetBool(settings.FirstStartKey, false)
|
setting.SetBool(settings.FirstStartKey, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,6 +61,7 @@ type FrontendQt struct {
|
|||||||
log *logrus.Entry
|
log *logrus.Entry
|
||||||
initializing sync.WaitGroup
|
initializing sync.WaitGroup
|
||||||
initializationDone sync.Once
|
initializationDone sync.Once
|
||||||
|
firstTimeAutostart sync.Once
|
||||||
|
|
||||||
app *widgets.QApplication
|
app *widgets.QApplication
|
||||||
engine *qml.QQmlEngine
|
engine *qml.QQmlEngine
|
||||||
|
|||||||
@ -44,6 +44,8 @@ func (f *FrontendQt) initiateQtApplication() error {
|
|||||||
|
|
||||||
core.QCoreApplication_SetApplicationName(f.programName)
|
core.QCoreApplication_SetApplicationName(f.programName)
|
||||||
core.QCoreApplication_SetApplicationVersion(f.programVersion)
|
core.QCoreApplication_SetApplicationVersion(f.programVersion)
|
||||||
|
core.QCoreApplication_SetOrganizationName("Proton AG")
|
||||||
|
core.QCoreApplication_SetOrganizationDomain("proton.ch")
|
||||||
|
|
||||||
// High DPI scaling for windows.
|
// High DPI scaling for windows.
|
||||||
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, false)
|
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, false)
|
||||||
|
|||||||
@ -76,6 +76,15 @@ func (f *FrontendQt) changeLocalCache(enableDiskCache bool, diskCachePath *core.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *FrontendQt) setIsAutostartOn() {
|
func (f *FrontendQt) setIsAutostartOn() {
|
||||||
|
// GODT-1507 Windows: autostart needs to be created after Qt is initialized.
|
||||||
|
f.firstTimeAutostart.Do(func() {
|
||||||
|
if !f.bridge.IsFirstStart() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := f.bridge.EnableAutostart(); err != nil {
|
||||||
|
f.log.WithError(err).Error("Failed to enable autostart")
|
||||||
|
}
|
||||||
|
})
|
||||||
f.qml.SetIsAutostartOn(f.bridge.IsAutostartEnabled())
|
f.qml.SetIsAutostartOn(f.bridge.IsAutostartEnabled())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user