Skip to content

Commit

Permalink
feature: added country selection on home page drawer (#1215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nethius authored Nov 12, 2024
1 parent 23806e1 commit aa871bd
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 24 deletions.
6 changes: 3 additions & 3 deletions client/ui/qml/Components/ShareConnectionDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ DrawerType2 {
Layout.topMargin: 16

text: qsTr("Share")
imageSource: "qrc:/images/controls/share-2.svg"
leftImageSource: "qrc:/images/controls/share-2.svg"

KeyNavigation.tab: copyConfigTextButton

Expand Down Expand Up @@ -120,7 +120,7 @@ DrawerType2 {
borderWidth: 1

text: qsTr("Copy")
imageSource: "qrc:/images/controls/copy.svg"
leftImageSource: "qrc:/images/controls/copy.svg"

Keys.onReturnPressed: { copyConfigTextButton.clicked() }
Keys.onEnterPressed: { copyConfigTextButton.clicked() }
Expand All @@ -143,7 +143,7 @@ DrawerType2 {
borderWidth: 1

text: qsTr("Copy config string")
imageSource: "qrc:/images/controls/copy.svg"
leftImageSource: "qrc:/images/controls/copy.svg"

KeyNavigation.tab: showSettingsButton
}
Expand Down
22 changes: 14 additions & 8 deletions client/ui/qml/Controls2/BasicButtonType.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ Button {
property int borderWidth: 0
property int borderFocusedWidth: 1

property string imageSource
property string leftImageSource
property string rightImageSource
property string leftImageColor: textColor
property string leftImageColor
property bool changeLeftImageSize: true

property bool squareLeftSide: false

Expand Down Expand Up @@ -127,18 +128,23 @@ Button {
anchors.centerIn: parent

Image {
Layout.preferredHeight: 20
Layout.preferredWidth: 20

source: root.imageSource
visible: root.imageSource === "" ? false : true
id: leftImage
source: root.leftImageSource
visible: root.leftImageSource === "" ? false : true

layer {
enabled: true
enabled: leftImageColor !== "" ? true : false
effect: ColorOverlay {
color: leftImageColor
}
}

Component.onCompleted: {
if (root.changeLeftImageSize) {
leftImage.Layout.preferredHeight = 20
leftImage.Layout.preferredWidth = 20
}
}
}

ButtonTextType {
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Controls2/TextFieldWithHeaderType.qml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Item {

focusPolicy: Qt.NoFocus
text: root.buttonText
imageSource: root.buttonImageSource
leftImageSource: root.buttonImageSource

anchors.top: content.top
anchors.bottom: content.bottom
Expand Down
41 changes: 31 additions & 10 deletions client/ui/qml/Pages2/PageHome.qml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ PageType {
pressedColor: AmneziaStyle.color.sheerWhite
disabledColor: AmneziaStyle.color.mutedGray
textColor: AmneziaStyle.color.mutedGray
leftImageColor: AmneziaStyle.color.transparent
borderWidth: 0

buttonTextLabel.lineHeight: 20
Expand All @@ -110,7 +109,7 @@ PageType {

text: isSplitTunnelingEnabled ? qsTr("Split tunneling enabled") : qsTr("Split tunneling disabled")

imageSource: isSplitTunnelingEnabled ? "qrc:/images/controls/split-tunneling.svg" : ""
leftImageSource: isSplitTunnelingEnabled ? "qrc:/images/controls/split-tunneling.svg" : ""
rightImageSource: "qrc:/images/controls/chevron-down.svg"

Keys.onEnterPressed: splitTunnelingButton.clicked()
Expand Down Expand Up @@ -166,6 +165,7 @@ PageType {

anchors.left: parent.left
anchors.right: parent.right
spacing: 0

Component.onCompleted: {
drawer.collapsedHeight = collapsed.implicitHeight
Expand Down Expand Up @@ -267,18 +267,39 @@ PageType {

RowLayout {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.bottomMargin: drawer.isCollapsed ? 44 : ServersModel.isDefaultServerFromApi ? 89 : 44
Layout.topMargin: 8
Layout.bottomMargin: drawer.isCollapsed ? 44 : ServersModel.isDefaultServerFromApi ? 61 : 16
spacing: 0

Image {
Layout.rightMargin: 8
visible: source !== ""
source: ServersModel.defaultServerImagePathCollapsed
}
BasicButtonType {
enabled: (ServersModel.defaultServerImagePathCollapsed !== "") && drawer.isCollapsed
hoverEnabled: enabled

implicitHeight: 36

leftPadding: 16
rightPadding: 16

defaultColor: AmneziaStyle.color.transparent
hoveredColor: AmneziaStyle.color.translucentWhite
pressedColor: AmneziaStyle.color.sheerWhite
disabledColor: AmneziaStyle.color.transparent
textColor: AmneziaStyle.color.mutedGray

buttonTextLabel.lineHeight: 16
buttonTextLabel.font.pixelSize: 13
buttonTextLabel.font.weight: 400

LabelTextType {
id: collapsedServerMenuDescription
text: drawer.isCollapsed ? ServersModel.defaultServerDescriptionCollapsed : ServersModel.defaultServerDescriptionExpanded
leftImageSource: ServersModel.defaultServerImagePathCollapsed
changeLeftImageSize: false

rightImageSource: hoverEnabled ? "qrc:/images/controls/chevron-down.svg" : ""

onClicked: {
ServersModel.processedIndex = ServersModel.defaultIndex
PageController.goToPage(PageEnum.PageSettingsServerInfo)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageShare.qml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ PageType {
visible: accessTypeSelector.currentIndex === 0

text: qsTr("Share")
imageSource: "qrc:/images/controls/share-2.svg"
leftImageSource: "qrc:/images/controls/share-2.svg"

Keys.onTabPressed: lastItemTabClicked(focusItem)

Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageShareFullAccess.qml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ PageType {
Layout.topMargin: 40

text: qsTr("Share")
imageSource: "qrc:/images/controls/share-2.svg"
leftImageSource: "qrc:/images/controls/share-2.svg"

Keys.onTabPressed: lastItemTabClicked(focusItem)

Expand Down

0 comments on commit aa871bd

Please sign in to comment.