1
0

feat: early access

This commit is contained in:
James Houlahan
2020-12-03 15:36:02 +01:00
parent eccad4bbfd
commit d2066173f0
22 changed files with 235 additions and 72 deletions

View File

@ -137,6 +137,7 @@ Dialog {
spacing: Style.dialog.spacing
ButtonRounded {
id:buttonNo
visible: root.state != "toggleEarlyAccess"
color_main: Style.dialog.text
fa_icon: Style.fa.times
text: qsTr("No")
@ -148,7 +149,7 @@ Dialog {
color_minor: Style.main.textBlue
isOpaque: true
fa_icon: Style.fa.check
text: qsTr("Yes")
text: root.state == "toggleEarlyAccess" ? qsTr("Ok") : qsTr("Yes")
onClicked : {
currentIndex=1
root.confirmed()
@ -292,6 +293,17 @@ Dialog {
}
}
},
State {
name: "toggleEarlyAccess"
PropertyChanges {
target: root
currentIndex : 0
question : qsTr("Do you want to be the first to get the latest updates? Please keep in mind that early versions may be less stable.")
note : ""
title : qsTr("Enable early access")
answer : qsTr("Enabling early access...")
}
},
State {
name: "noKeychain"
PropertyChanges {
@ -343,8 +355,6 @@ Dialog {
root.visible = true
}
onConfirmed : {
if (state == "quit" || state == "instance exists" ) {
timer.interval = 1000
@ -358,17 +368,18 @@ Dialog {
Connections {
target: timer
onTriggered: {
if ( state == "addressmode" ) { go.switchAddressMode (input) }
if ( state == "clearChain" ) { go.clearKeychain () }
if ( state == "clearCache" ) { go.clearCache () }
if ( state == "deleteUser" ) { go.deleteAccount (input, checkBoxWrapper.isChecked) }
if ( state == "logout" ) { go.logoutAccount (input) }
if ( state == "toggleAutoStart" ) { go.toggleAutoStart () }
if ( state == "toggleAllowProxy" ) { go.toggleAllowProxy () }
if ( state == "quit" ) { Qt.quit () }
if ( state == "instance exists" ) { Qt.quit () }
if ( state == "noKeychain" ) { Qt.quit () }
if ( state == "checkUpdates" ) { }
if ( state == "addressmode" ) { go.switchAddressMode (input) }
if ( state == "clearChain" ) { go.clearKeychain () }
if ( state == "clearCache" ) { go.clearCache () }
if ( state == "deleteUser" ) { go.deleteAccount (input, checkBoxWrapper.isChecked) }
if ( state == "logout" ) { go.logoutAccount (input) }
if ( state == "toggleAutoStart" ) { go.toggleAutoStart () }
if ( state == "toggleAllowProxy" ) { go.toggleAllowProxy () }
if ( state == "toggleEarlyAccess" ) { go.toggleEarlyAccess () }
if ( state == "quit" ) { Qt.quit () }
if ( state == "instance exists" ) { Qt.quit () }
if ( state == "noKeychain" ) { Qt.quit () }
if ( state == "checkUpdates" ) { }
}
}

View File

@ -116,6 +116,30 @@ Item {
}
}
ButtonIconText {
id: earlyAccess
text: qsTr("Early access", "label for toggle that enables and disables early access")
leftIcon.text : Style.fa.star
rightIcon {
font.pointSize : Style.settings.toggleSize * Style.pt
text : go.isEarlyAccess!=false ? Style.fa.toggle_on : Style.fa.toggle_off
color : go.isEarlyAccess!=false ? Style.main.textBlue : Style.main.textDisabled
}
Accessible.description: (
go.isEarlyAccess == false ?
qsTr("Enable" , "Click to enable early access") :
qsTr("Disable" , "Click to disable early access")
) + " " + text
onClicked: {
if (go.isEarlyAccess == true) {
go.toggleEarlyAccess()
} else {
dialogGlobal.state="toggleEarlyAccess"
dialogGlobal.show()
}
}
}
ButtonIconText {
id: advancedSettings
property bool isAdvanced : !go.isDefaultPort
@ -196,7 +220,6 @@ Item {
dialogGlobal.show()
}
}
}
}
}

View File

@ -267,6 +267,7 @@ Window {
property bool isAutoStart : true
property bool isAutoUpdate : false
property bool isEarlyAccess : false
property bool isProxyAllowed : false
property bool isFirstStart : false
property bool isFreshVersion : false
@ -336,6 +337,7 @@ Window {
signal processFinished()
signal toggleAutoStart()
signal toggleEarlyAccess()
signal toggleAutoUpdate()
signal notifyBubble(int tabIndex, string message)
signal silentBubble(int tabIndex, string message)
@ -627,6 +629,12 @@ Window {
isAutoUpdate = (isAutoUpdate!=false) ? false : true
console.log (" Test: onToggleAutoUpdate "+isAutoUpdate)
}
onToggleEarlyAccess: {
workAndClose()
isEarlyAccess = (isEarlyAccess!=false) ? false : true
console.log (" Test: onToggleEarlyAccess "+isEarlyAccess)
}
}
}

View File

@ -370,6 +370,12 @@ func (s *FrontendQt) qtExecute(Procedure func(*FrontendQt) error) error {
s.Qml.SetIsProxyAllowed(false)
}
if updater.UpdateChannel(s.settings.Get(settings.UpdateChannelKey)) == updater.BetaChannel {
s.Qml.SetIsEarlyAccess(true)
} else {
s.Qml.SetIsEarlyAccess(false)
}
s.eventListener.RetryEmit(events.TLSCertIssue)
s.eventListener.RetryEmit(events.ErrorEvent)
@ -548,6 +554,18 @@ func (s *FrontendQt) toggleAutoUpdate() {
}
}
func (s *FrontendQt) toggleEarlyAccess() {
defer s.Qml.ProcessFinished()
if updater.UpdateChannel(s.settings.Get(settings.UpdateChannelKey)) == updater.BetaChannel {
s.settings.Set(settings.UpdateChannelKey, string(updater.LiveChannel))
s.Qml.SetIsEarlyAccess(false)
} else {
s.settings.Set(settings.UpdateChannelKey, string(updater.BetaChannel))
s.Qml.SetIsEarlyAccess(true)
}
}
func (s *FrontendQt) toggleAllowProxy() {
defer s.Qml.ProcessFinished()

View File

@ -35,6 +35,7 @@ type GoQMLInterface struct {
_ bool `property:"isAutoStart"`
_ bool `property:"isAutoUpdate"`
_ bool `property:"isEarlyAccess"`
_ bool `property:"isProxyAllowed"`
_ string `property:"currentAddress"`
_ string `property:"goos"`
@ -94,6 +95,7 @@ type GoQMLInterface struct {
_ func() `slot:"toggleAutoStart"`
_ func() `slot:"toggleAutoUpdate"`
_ func() `slot:"toggleEarlyAccess"`
_ func() `slot:"toggleAllowProxy"`
_ func() `slot:"loadAccounts"`
_ func() `slot:"openLogs"`
@ -157,6 +159,7 @@ func (s *GoQMLInterface) init() {}
// SetFrontend connects all slots and signals from Go to QML.
func (s *GoQMLInterface) SetFrontend(f *FrontendQt) {
s.ConnectToggleAutoStart(f.toggleAutoStart)
s.ConnectToggleEarlyAccess(f.toggleEarlyAccess)
s.ConnectToggleAutoUpdate(f.toggleAutoUpdate)
s.ConnectToggleAllowProxy(f.toggleAllowProxy)
s.ConnectLoadAccounts(f.loadAccounts)