Merge branch 'dev' into feature/amnezia-wireguard-client-impl

This commit is contained in:
pokamest 2023-10-06 14:22:45 +01:00
commit 135726f177
52 changed files with 4380 additions and 2197 deletions

View file

@ -59,7 +59,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 20
headerText: qsTr("Removing services from ") + name
headerText: qsTr("Removing services from %1").arg(name)
}
ProgressBarType {

View file

@ -26,11 +26,17 @@ PageType {
property string defaultServerHostName: ServersModel.defaultServerHostName
property string defaultContainerName: ContainersModel.defaultContainerName
MouseArea {
anchors.fill: parent
enabled: buttonContent.state === "expanded"
onClicked: {
buttonContent.state = "collapsed"
}
}
Item {
anchors.top: parent.top
anchors.bottom: buttonBackground.top
anchors.right: parent.right
anchors.left: parent.left
anchors.fill: parent
anchors.bottomMargin: buttonContent.collapsedHeight
ConnectButton {
anchors.centerIn: parent
@ -41,17 +47,66 @@ PageType {
target: PageController
function onRestorePageHomeState(isContainerInstalled) {
menu.visible = true
buttonContent.state = "expanded"
if (isContainerInstalled) {
containersDropDown.menuVisible = true
}
}
function onForceCloseDrawer() {
buttonContent.state = "collapsed"
}
}
MouseArea {
id: dragArea
anchors.fill: buttonBackground
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
drag.target: buttonContent
drag.axis: Drag.YAxis
drag.maximumY: root.height - buttonContent.collapsedHeight
drag.minimumY: root.height - root.height * 0.9
/** If drag area is released at any point other than min or max y, transition to the other state */
onReleased: {
if (buttonContent.state === "collapsed" && buttonContent.y < dragArea.drag.maximumY) {
buttonContent.state = "expanded"
return
}
if (buttonContent.state === "expanded" && buttonContent.y > dragArea.drag.minimumY) {
buttonContent.state = "collapsed"
return
}
}
onEntered: {
collapsedButtonChevron.backgroundColor = collapsedButtonChevron.hoveredColor
collapsedButtonHeader.opacity = 0.8
}
onExited: {
collapsedButtonChevron.backgroundColor = collapsedButtonChevron.defaultColor
collapsedButtonHeader.opacity = 1
}
onPressedChanged: {
collapsedButtonChevron.backgroundColor = pressed ? collapsedButtonChevron.pressedColor : entered ? collapsedButtonChevron.hoveredColor : collapsedButtonChevron.defaultColor
collapsedButtonHeader.opacity = 0.7
}
onClicked: {
if (buttonContent.state === "collapsed") {
buttonContent.state = "expanded"
}
}
}
Rectangle {
id: buttonBackground
anchors.fill: buttonContent
anchors { left: buttonContent.left; right: buttonContent.right; top: buttonContent.top }
height: root.height
radius: 16
color: root.defaultColor
border.color: root.borderColor
@ -69,19 +124,99 @@ PageType {
ColumnLayout {
id: buttonContent
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
/** Initial height of button content */
property int collapsedHeight: 0
/** True when expanded objects should be visible */
property bool expandedVisibility: buttonContent.state === "expanded" || (buttonContent.state === "collapsed" && dragArea.drag.active === true)
/** True when collapsed objects should be visible */
property bool collapsedVisibility: buttonContent.state === "collapsed" && dragArea.drag.active === false
Drag.active: dragArea.drag.active
anchors.right: root.right
anchors.left: root.left
y: root.height - buttonContent.height
Component.onCompleted: {
buttonContent.state = "collapsed"
}
/** Set once based on first implicit height change once all children are layed out */
onImplicitHeightChanged: {
if (buttonContent.state === "collapsed" && collapsedHeight == 0) {
collapsedHeight = implicitHeight
}
}
onStateChanged: {
if (buttonContent.state === "collapsed") {
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
}
PageController.drawerClose()
return
}
if (buttonContent.state === "expanded") {
if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(0xFF1C1D21)
}
PageController.drawerOpen()
return
}
}
/** Two states of buttonContent, great place to add any future animations for the drawer */
states: [
State {
name: "collapsed"
PropertyChanges {
target: buttonContent
y: root.height - collapsedHeight
}
},
State {
name: "expanded"
PropertyChanges {
target: buttonContent
y: dragArea.drag.minimumY
}
}
]
transitions: [
Transition {
from: "collapsed"
to: "expanded"
PropertyAnimation {
target: buttonContent
properties: "y"
duration: 200
}
},
Transition {
from: "expanded"
to: "collapsed"
PropertyAnimation {
target: buttonContent
properties: "y"
duration: 200
}
}
]
RowLayout {
Layout.topMargin: 24
Layout.leftMargin: 24
Layout.rightMargin: 24
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: buttonContent.collapsedVisibility
spacing: 0
Header1TextType {
id: collapsedButtonHeader
Layout.maximumWidth: buttonContent.width - 48 - 18 - 12 // todo
maximumLineCount: 2
@ -89,21 +224,40 @@ PageType {
text: root.defaultServerName
horizontalAlignment: Qt.AlignHCenter
Behavior on opacity {
PropertyAnimation { duration: 200 }
}
}
Image {
Layout.preferredWidth: 18
Layout.preferredHeight: 18
ImageButtonType {
id: collapsedButtonChevron
Layout.leftMargin: 12
Layout.leftMargin: 8
source: "qrc:/images/controls/chevron-down.svg"
hoverEnabled: false
image: "qrc:/images/controls/chevron-down.svg"
imageColor: "#d7d8db"
icon.width: 18
icon.height: 18
backgroundRadius: 16
horizontalPadding: 4
topPadding: 4
bottomPadding: 3
onClicked: {
if (buttonContent.state === "collapsed") {
buttonContent.state = "expanded"
}
}
}
}
LabelTextType {
Layout.bottomMargin: 44
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: buttonContent.collapsedVisibility
text: {
var description = ""
@ -122,38 +276,13 @@ PageType {
return description
}
}
}
MouseArea {
anchors.fill: buttonBackground
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: {
menu.visible = true
}
}
DrawerType {
id: menu
interactive: {
if (stackView && stackView.currentItem) {
return (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageHome)) ? true : false
} else {
return false
}
}
dragMargin: buttonBackground.height + 56 // page start tabBar height
width: parent.width
height: parent.height * 0.9
ColumnLayout {
id: serversMenuHeader
anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.left
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
visible: buttonContent.expandedVisibility
Header1TextType {
Layout.fillWidth: true
@ -183,8 +312,10 @@ PageType {
rootButtonImageColor: "#0E0E11"
rootButtonBackgroundColor: "#D7D8DB"
rootButtonBackgroundHoveredColor: Qt.rgba(215, 216, 219, 0.8)
rootButtonBackgroundPressedColor: Qt.rgba(215, 216, 219, 0.65)
rootButtonHoveredBorderColor: "transparent"
rootButtonPressedBorderColor: "transparent"
rootButtonDefaultBorderColor: "transparent"
rootButtonTextTopMargin: 8
rootButtonTextBottomMargin: 8
@ -232,13 +363,14 @@ PageType {
Layout.topMargin: 48
Layout.leftMargin: 16
Layout.rightMargin: 16
visible: buttonContent.expandedVisibility
actionButtonImage: "qrc:/images/controls/plus.svg"
headerText: qsTr("Servers")
actionButtonFunction: function() {
menu.visible = false
buttonContent.state = "collapsed"
connectionTypeSelection.visible = true
}
}
@ -248,10 +380,23 @@ PageType {
}
}
FlickableType {
anchors.top: serversMenuHeader.bottom
anchors.topMargin: 16
Flickable {
id: serversContainer
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
Layout.topMargin: 16
contentHeight: col.implicitHeight
implicitHeight: root.height - (root.height * 0.1) - serversMenuHeader.implicitHeight - 52 //todo 52 is tabbar height
visible: buttonContent.expandedVisibility
clip: true
ScrollBar.vertical: ScrollBar {
id: scrollBar
policy: serversContainer.height >= serversContainer.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
}
Keys.onUpPressed: scrollBar.decrease()
Keys.onDownPressed: scrollBar.increase()
Column {
id: col
@ -346,13 +491,15 @@ PageType {
onClicked: function() {
ServersModel.currentlyProcessedIndex = index
PageController.goToPage(PageEnum.PageSettingsServerInfo)
menu.visible = false
buttonContent.state = "collapsed"
}
}
}
DividerType {
Layout.fillWidth: true
Layout.leftMargin: 0
Layout.rightMargin: 0
}
}
}

View file

@ -173,7 +173,7 @@ PageType {
textColor: "#EB5757"
clickedFunction: function() {
questionDrawer.headerText = qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName() + qsTr(" from server?")
questionDrawer.headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName())
questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it")
questionDrawer.yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel")

View file

@ -63,7 +63,7 @@ PageType {
textColor: "#EB5757"
clickedFunction: function() {
questionDrawer.headerText = qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName() + qsTr(" from server?")
questionDrawer.headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName())
questionDrawer.yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel")

View file

@ -43,6 +43,26 @@ PageType {
headerText: qsTr("Application")
}
SwitcherType {
visible: GC.isMobile()
Layout.fillWidth: true
Layout.margins: 16
text: qsTr("Allow application screenshots")
checked: SettingsController.isScreenshotsEnabled()
onCheckedChanged: {
if (checked !== SettingsController.isScreenshotsEnabled()) {
SettingsController.toggleScreenshotsEnabled(checked)
}
}
}
DividerType {
visible: GC.isMobile()
}
SwitcherType {
visible: !GC.isMobile()

View file

@ -66,7 +66,8 @@ PageType {
Layout.fillWidth: true
Layout.margins: 16
text: qsTr("Use AmneziaDNS if installed on the server")
text: qsTr("Use AmneziaDNS")
descriptionText: qsTr("If AmneziaDNS is installed on the server")
checked: SettingsController.isAmneziaDnsEnabled()
onCheckedChanged: {

View file

@ -53,7 +53,7 @@ PageType {
id: primaryDns
Layout.fillWidth: true
headerText: "Primary DNS"
headerText: qsTr("Primary DNS")
textFieldText: SettingsController.primaryDns
textField.validator: RegularExpressionValidator {
@ -65,7 +65,7 @@ PageType {
id: secondaryDns
Layout.fillWidth: true
headerText: "Secondary DNS"
headerText: qsTr("Secondary DNS")
textFieldText: SettingsController.secondaryDns
textField.validator: RegularExpressionValidator {

View file

@ -105,7 +105,7 @@ PageType {
if (GC.isMobile()) {
fileName = "AmneziaVPN.log"
} else {
fileName = SystemController.getFileName(qsTr("Save logs"),
fileName = SystemController.getFileName(qsTr("Save"),
qsTr("Logs files (*.log)"),
StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/AmneziaVPN",
true,

View file

@ -113,7 +113,7 @@ PageType {
textColor: "#EB5757"
clickedFunction: function() {
questionDrawer.headerText = qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName() + qsTr(" from server?")
questionDrawer.headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName())
questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it")
questionDrawer.yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel")

View file

@ -62,6 +62,7 @@ PageType {
id: header
implicitWidth: parent.width
headerTextMaximumLineCount: 10
headerText: qsTr("What is the level of internet control in your region?")
}
@ -145,14 +146,13 @@ PageType {
Item {
implicitWidth: 1
implicitHeight: 1
implicitHeight: 54
}
BasicButtonType {
id: continueButton
implicitWidth: parent.width
anchors.topMargin: 24
text: qsTr("Continue")
@ -183,6 +183,17 @@ PageType {
textColor: "#D7D8DB"
borderWidth: 1
visible: {
if (PageController.isTriggeredByConnectButton()) {
PageController.setTriggeredBtConnectButton(false)
return ContainersModel.isAnyContainerInstalled()
}
return true
}
text: qsTr("Set up later")
onClicked: function() {

View file

@ -72,7 +72,7 @@ PageType {
Layout.fillWidth: true
headerText: qsTr("Installing ") + name
headerText: qsTr("Installing %1").arg(name)
descriptionText: description
}

View file

@ -219,13 +219,14 @@ PageType {
if (accessTypeSelector.currentIndex !== 0) {
shareConnectionDrawer.headerText = qsTr("Accessing ") + serverSelector.text
shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
shareConnectionDrawer.configContentHeaderText = qsTr("File with accessing settings to ") + serverSelector.text
}
serverSelector.menuVisible = false
}
Component.onCompleted: {
handler()
serverSelector.severSelectorIndexChanged()
}
function handler() {
@ -240,12 +241,14 @@ PageType {
DropDownType {
id: protocolSelector
visible: accessTypeSelector.currentIndex === 0
Layout.fillWidth: true
Layout.topMargin: 16
drawerHeight: 0.5
descriptionText: qsTr("Protocols")
descriptionText: qsTr("Protocol")
headerText: qsTr("Protocol")
listView: ListViewWithRadioButtonType {