GODT-1272: Ultimate fix for MacOS transparency

This commit is contained in:
Alexander Bilyak
2021-10-11 16:37:15 +02:00
committed by Jakub
parent e49d2e1be7
commit 10da4f284c
2 changed files with 309 additions and 289 deletions

View File

@ -43,7 +43,12 @@ Window {
flags : Qt.Window | Qt.Dialog flags : Qt.Window | Qt.Dialog
visible : true visible : true
title : "Bridge Test GUI" title : "Bridge Test GUI"
color : colorScheme.background_norm
// This is needed because on MacOS if first window shown is not transparent -
// all other windows of application will not have transparent background (black
// instead of transparency). In our case that mean that if BridgeTest will be
// shown before StatusWindow - StatusWindow will not have transparent corners.
color: "transparent"
function getCursorPos() { function getCursorPos() {
return BridgePreview.getCursorPos() return BridgePreview.getCursorPos()
@ -272,364 +277,373 @@ Window {
} }
} }
StackLayout { Rectangle {
color: root.colorScheme.background_norm
anchors.top: tabBar.bottom anchors.top: tabBar.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
currentIndex: tabBar.currentIndex implicitHeight: children[0].contentHeight + children[0].anchors.topMargin + children[0].anchors.bottomMargin
implicitWidth: children[0].contentWidth + children[0].anchors.leftMargin + children[0].anchors.rightMargin
anchors.margins: 10 StackLayout {
anchors.fill: parent
RowLayout { currentIndex: tabBar.currentIndex
id: globalTab
spacing : 5
ColumnLayout { anchors.margins: 10
RowLayout {
id: globalTab
spacing : 5 spacing : 5
Label { ColumnLayout {
colorScheme: root.colorScheme spacing : 5
text: "Global settings"
}
ButtonGroup { Label {
id: styleRadioGroup colorScheme: root.colorScheme
} text: "Global settings"
RadioButton {
colorScheme: root.colorScheme
Layout.fillWidth: true
text: "Light UI"
checked: ProtonStyle.currentStyle === ProtonStyle.lightStyle
ButtonGroup.group: styleRadioGroup
onCheckedChanged: {
if (checked && ProtonStyle.currentStyle !== ProtonStyle.lightStyle) {
ProtonStyle.currentStyle = ProtonStyle.lightStyle
}
} }
}
RadioButton { ButtonGroup {
colorScheme: root.colorScheme id: styleRadioGroup
Layout.fillWidth: true }
text: "Dark UI" RadioButton {
checked: ProtonStyle.currentStyle === ProtonStyle.darkStyle colorScheme: root.colorScheme
ButtonGroup.group: styleRadioGroup Layout.fillWidth: true
onCheckedChanged: { text: "Light UI"
if (checked && ProtonStyle.currentStyle !== ProtonStyle.darkStyle) { checked: ProtonStyle.currentStyle === ProtonStyle.lightStyle
ProtonStyle.currentStyle = ProtonStyle.darkStyle ButtonGroup.group: styleRadioGroup
onCheckedChanged: {
if (checked && ProtonStyle.currentStyle !== ProtonStyle.lightStyle) {
ProtonStyle.currentStyle = ProtonStyle.lightStyle
}
} }
} }
RadioButton {
colorScheme: root.colorScheme
Layout.fillWidth: true
} text: "Dark UI"
checked: ProtonStyle.currentStyle === ProtonStyle.darkStyle
ButtonGroup.group: styleRadioGroup
CheckBox { onCheckedChanged: {
id: showOnStartupCheckbox if (checked && ProtonStyle.currentStyle !== ProtonStyle.darkStyle) {
colorScheme: root.colorScheme ProtonStyle.currentStyle = ProtonStyle.darkStyle
text: "Show on startup" }
checked: root.showOnStartup }
onCheckedChanged: {
root.showOnStartup = checked
}
CheckBox {
id: showOnStartupCheckbox
colorScheme: root.colorScheme
text: "Show on startup"
checked: root.showOnStartup
onCheckedChanged: {
root.showOnStartup = checked
}
}
Button {
colorScheme: root.colorScheme
//Layout.fillWidth: true
text: "Open Bridge"
enabled: bridge === undefined || bridge === null
onClicked: {
bridge = bridgeComponent.createObject()
}
}
Button {
colorScheme: root.colorScheme
//Layout.fillWidth: true
text: "Close Bridge"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge.destroy()
}
}
Item {
Layout.fillHeight: true
} }
} }
Button { ColumnLayout {
colorScheme: root.colorScheme spacing : 5
//Layout.fillWidth: true
text: "Open Bridge" Label {
enabled: bridge === undefined || bridge === null colorScheme: root.colorScheme
onClicked: { text: "Notifications"
bridge = bridgeComponent.createObject() }
Button {
colorScheme: root.colorScheme
text: "Notify: danger"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge.mainWindow.notifyOnlyPaidUsers()
}
}
Button {
colorScheme: root.colorScheme
text: "Notify: warning"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge.mainWindow.notifyUpdateManually()
}
}
Button {
colorScheme: root.colorScheme
text: "Notify: success"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge.mainWindow.notifyUserAdded()
}
}
Item {
Layout.fillHeight: true
} }
} }
}
Button { RowLayout {
colorScheme: root.colorScheme id: usersTab
//Layout.fillWidth: true UserList {
id: usersListView
text: "Close Bridge"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge.destroy()
}
}
Item {
Layout.fillHeight: true Layout.fillHeight: true
colorScheme: root.colorScheme
backend: root
}
UserControl {
colorScheme: root.colorScheme
backend: root
user: ((root.usersTest.count > usersListView.currentIndex) && usersListView.currentIndex != -1) ? root.usersTest.get(usersListView.currentIndex) : undefined
} }
} }
ColumnLayout { RowLayout {
spacing : 5 id: notificationsTab
Label {
colorScheme: root.colorScheme
text: "Notifications"
}
Button {
colorScheme: root.colorScheme
text: "Notify: danger"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge.mainWindow.notifyOnlyPaidUsers()
}
}
Button {
colorScheme: root.colorScheme
text: "Notify: warning"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge.mainWindow.notifyUpdateManually()
}
}
Button {
colorScheme: root.colorScheme
text: "Notify: success"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge.mainWindow.notifyUserAdded()
}
}
Item {
Layout.fillHeight: true
}
}
}
RowLayout {
id: usersTab
UserList {
id: usersListView
Layout.fillHeight: true
colorScheme: root.colorScheme
backend: root
}
UserControl {
colorScheme: root.colorScheme
backend: root
user: ((root.usersTest.count > usersListView.currentIndex) && usersListView.currentIndex != -1) ? root.usersTest.get(usersListView.currentIndex) : undefined
}
}
RowLayout {
id: notificationsTab
spacing: 5
ColumnLayout {
spacing: 5 spacing: 5
Switch { ColumnLayout {
text: "Internet connection" spacing: 5
colorScheme: root.colorScheme
checked: true
onCheckedChanged: {
checked ? root.internetOn() : root.internetOff()
}
}
Button { Switch {
text: "Update manual ready" text: "Internet connection"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { checked: true
root.updateManualReady("3.14.1592") onCheckedChanged: {
checked ? root.internetOn() : root.internetOff()
}
} }
}
Button { Button {
text: "Update manual done" text: "Update manual ready"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.updateManualRestartNeeded() root.updateManualReady("3.14.1592")
}
} }
}
Button { Button {
text: "Update manual error" text: "Update manual done"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.updateManualError() root.updateManualRestartNeeded()
}
} }
}
Button { Button {
text: "Update force" text: "Update manual error"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.updateForce("3.14.1592") root.updateManualError()
}
} }
}
Button { Button {
text: "Update force error" text: "Update force"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.updateForceError() root.updateForce("3.14.1592")
}
} }
}
Button { Button {
text: "Update silent done" text: "Update force error"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.updateSilentRestartNeeded() root.updateForceError()
}
} }
}
Button { Button {
text: "Update silent error" text: "Update silent done"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.updateSilentError() root.updateSilentRestartNeeded()
}
} }
}
Button { Button {
text: "Update is latest version" text: "Update silent error"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.updateIsLatestVersion() root.updateSilentError()
}
} }
}
Button { Button {
text: "Bug report send OK" text: "Update is latest version"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.reportBugFinished() root.updateIsLatestVersion()
root.bugReportSendSuccess() }
} }
}
Button { Button {
text: "Bug report send error" text: "Bug report send OK"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.reportBugFinished() root.reportBugFinished()
root.bugReportSendError() root.bugReportSendSuccess()
}
} }
}
Button { Button {
text: "Cache anavailable" text: "Bug report send error"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.cacheUnavailable() root.reportBugFinished()
root.bugReportSendError()
}
} }
}
Button { Button {
text: "Cache can't move" text: "Cache anavailable"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.cacheCantMove() root.cacheUnavailable()
}
} }
}
Button { Button {
text: "Cache location change success" text: "Cache can't move"
onClicked: { colorScheme: root.colorScheme
root.cacheLocationChangeSuccess() onClicked: {
root.cacheCantMove()
}
} }
colorScheme: root.colorScheme
}
Button { Button {
text: "Disk full" text: "Cache location change success"
colorScheme: root.colorScheme onClicked: {
onClicked: { root.cacheLocationChangeSuccess()
root.diskFull() }
colorScheme: root.colorScheme
}
Button {
text: "Disk full"
colorScheme: root.colorScheme
onClicked: {
root.diskFull()
}
} }
} }
} }
}
TextArea { TextArea {
id: logTextArea id: logTextArea
colorScheme: root.colorScheme colorScheme: root.colorScheme
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: 400 Layout.preferredWidth: 400
Layout.preferredHeight: 200 Layout.preferredHeight: 200
textFormat: TextEdit.RichText textFormat: TextEdit.RichText
//readOnly: true //readOnly: true
} }
ScrollView { ScrollView {
id: settingsTab id: settingsTab
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
Label {colorScheme: root.colorScheme; text: "Automatic updates:"} Label {colorScheme: root.colorScheme; text: "Automatic updates:"}
Toggle {colorScheme: root.colorScheme; checked: root.isAutomaticUpdateOn; onClicked: root.isAutomaticUpdateOn = !root.isAutomaticUpdateOn} Toggle {colorScheme: root.colorScheme; checked: root.isAutomaticUpdateOn; onClicked: root.isAutomaticUpdateOn = !root.isAutomaticUpdateOn}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "Autostart:"}
Toggle {colorScheme: root.colorScheme; checked: root.isAutostartOn; onClicked: root.isAutostartOn = !root.isAutostartOn}
Button {colorScheme: root.colorScheme; text: "Toggle finished"; onClicked: root.toggleAutostartFinished()}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "Beta:"}
Toggle {colorScheme: root.colorScheme; checked: root.isBetaEnabled; onClicked: root.isBetaEnabled = !root.isBetaEnabled}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "DoH:"}
Toggle {colorScheme: root.colorScheme; checked: root.isDoHEnabled; onClicked: root.isDoHEnabled = !root.isDoHEnabled}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "Ports:"}
TextField {
colorScheme:root.colorScheme
label: "IMAP"
text: root.portIMAP
onEditingFinished: root.portIMAP = this.text*1
validator: IntValidator {bottom: 1; top: 65536}
} }
TextField { RowLayout {
colorScheme:root.colorScheme Label {colorScheme: root.colorScheme; text: "Autostart:"}
label: "SMTP" Toggle {colorScheme: root.colorScheme; checked: root.isAutostartOn; onClicked: root.isAutostartOn = !root.isAutostartOn}
text: root.portSMTP Button {colorScheme: root.colorScheme; text: "Toggle finished"; onClicked: root.toggleAutostartFinished()}
onEditingFinished: root.portSMTP = this.text*1
validator: IntValidator {bottom: 1; top: 65536}
} }
Button {colorScheme: root.colorScheme; text: "Change finished"; onClicked: root.changePortFinished()} RowLayout {
} Label {colorScheme: root.colorScheme; text: "Beta:"}
RowLayout { Toggle {colorScheme: root.colorScheme; checked: root.isBetaEnabled; onClicked: root.isBetaEnabled = !root.isBetaEnabled}
Label {colorScheme: root.colorScheme; text: "SMTP using SSL:"} }
Toggle {colorScheme: root.colorScheme; checked: root.useSSLforSMTP; onClicked: root.useSSLforSMTP = !root.useSSLforSMTP} RowLayout {
} Label {colorScheme: root.colorScheme; text: "DoH:"}
RowLayout { Toggle {colorScheme: root.colorScheme; checked: root.isDoHEnabled; onClicked: root.isDoHEnabled = !root.isDoHEnabled}
Label {colorScheme: root.colorScheme; text: "Local cache:"} }
Toggle {colorScheme: root.colorScheme; checked: root.isDiskCacheEnabled; onClicked: root.isDiskCacheEnabled = !root.isDiskCacheEnabled} RowLayout {
TextField { Label {colorScheme: root.colorScheme; text: "Ports:"}
colorScheme:root.colorScheme TextField {
label: "Path" colorScheme:root.colorScheme
text: root.diskCachePath label: "IMAP"
implicitWidth: 160 text: root.portIMAP
onEditingFinished: root.diskCachePath = this.text onEditingFinished: root.portIMAP = this.text*1
validator: IntValidator {bottom: 1; top: 65536}
}
TextField {
colorScheme:root.colorScheme
label: "SMTP"
text: root.portSMTP
onEditingFinished: root.portSMTP = this.text*1
validator: IntValidator {bottom: 1; top: 65536}
}
Button {colorScheme: root.colorScheme; text: "Change finished"; onClicked: root.changePortFinished()}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "SMTP using SSL:"}
Toggle {colorScheme: root.colorScheme; checked: root.useSSLforSMTP; onClicked: root.useSSLforSMTP = !root.useSSLforSMTP}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "Local cache:"}
Toggle {colorScheme: root.colorScheme; checked: root.isDiskCacheEnabled; onClicked: root.isDiskCacheEnabled = !root.isDiskCacheEnabled}
TextField {
colorScheme:root.colorScheme
label: "Path"
text: root.diskCachePath
implicitWidth: 160
onEditingFinished: root.diskCachePath = this.text
}
Button {colorScheme: root.colorScheme; text: "Change finished:"; onClicked: root.changeLocalCacheFinished()}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "Reset:"}
Button {colorScheme: root.colorScheme; text: "Finished"; onClicked: root.resetFinished()}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "Check update:"}
Button {colorScheme: root.colorScheme; text: "Finished"; onClicked: root.checkUpdatesFinished()}
} }
Button {colorScheme: root.colorScheme; text: "Change finished:"; onClicked: root.changeLocalCacheFinished()}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "Reset:"}
Button {colorScheme: root.colorScheme; text: "Finished"; onClicked: root.resetFinished()}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "Check update:"}
Button {colorScheme: root.colorScheme; text: "Finished"; onClicked: root.checkUpdatesFinished()}
} }
} }
} }

View File

@ -41,6 +41,12 @@ ApplicationWindow {
property var backend property var backend
property var notifications property var notifications
// This is needed because on MacOS if first window shown is not transparent -
// all other windows of application will not have transparent background (black
// instead of transparency). In our case that mean that if MainWindow will be
// shown before StatusWindow - StatusWindow will not have transparent corners.
color: "transparent"
// show Setup Guide on every new user // show Setup Guide on every new user
Connections { Connections {
target: root.backend.users target: root.backend.users