mirror of
https://github.com/amnezia-vpn/DefaultVPN.git
synced 2026-05-17 00:26:23 +03:00
added button for importing config from file
This commit is contained in:
@@ -273,6 +273,7 @@
|
||||
<file>ui/qml/Components/ApiPremV1SubListDrawer.qml</file>
|
||||
<file>ui/qml/Components/OtpCodeDrawer.qml</file>
|
||||
<file>ui/qml/Components/AwgTextField.qml</file>
|
||||
<file>ui/qml/DefaultVpn/Components/BlackButtonWithBorder.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/countriesFlags">
|
||||
<file>images/flagKit/ZW.svg</file>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
import Config 1.0
|
||||
|
||||
import "../Controls/TextTypes"
|
||||
import "../Controls"
|
||||
|
||||
ButtonType {
|
||||
defaultBackgroundColor: Style.color.black
|
||||
defaultBorderColor: Style.color.gray7
|
||||
defaultTextColor: Style.color.white
|
||||
defaultImageColor: Style.color.white
|
||||
|
||||
hoveredBackgroundColor: Style.color.black
|
||||
hoveredBorderColor: Style.color.gray5
|
||||
hoveredTextColor: Style.color.white
|
||||
hoveredImageColor: Style.color.white
|
||||
|
||||
pressedBackgroundColor: Style.color.gray9
|
||||
pressedBorderColor: Style.color.gray5
|
||||
pressedTextColor: Style.color.white
|
||||
pressedImageColor: Style.color.white
|
||||
|
||||
disabledBackgroundColor: Style.color.gray8
|
||||
disabledBorderColor: Style.color.gray9
|
||||
disabledTextColor: Style.color.gray2
|
||||
disabledImageColor: Style.color.gray2
|
||||
|
||||
defaultBorderWidth: 1
|
||||
disabledBorderWidth: 1
|
||||
hoveredBorderWidth: 1
|
||||
}
|
||||
@@ -83,13 +83,13 @@ Page {
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 308
|
||||
Layout.preferredHeight: 240
|
||||
|
||||
placeholderText: qsTr("VPN://")
|
||||
}
|
||||
|
||||
WhiteButtonWithBorder {
|
||||
Layout.topMargin: 24
|
||||
Layout.topMargin: 12
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
Layout.fillWidth: true
|
||||
@@ -103,7 +103,7 @@ Page {
|
||||
}
|
||||
|
||||
BlueButtonNoBorder {
|
||||
Layout.topMargin: 24
|
||||
Layout.topMargin: 12
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
Layout.fillWidth: true
|
||||
@@ -119,6 +119,28 @@ Page {
|
||||
}
|
||||
}
|
||||
|
||||
BlackButtonWithBorder {
|
||||
id: importConfigButton
|
||||
|
||||
Layout.topMargin: 12
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTr("Import config from file")
|
||||
|
||||
onClicked: function() {
|
||||
var nameFilter = !ServersModel.getServersCount() ? "Config or backup files (*.vpn *.ovpn *.conf *.json *.backup)" :
|
||||
"Config files (*.vpn *.ovpn *.conf *.json)"
|
||||
var fileName = SystemController.getFileName(qsTr("Open config file"), nameFilter)
|
||||
if (fileName !== "") {
|
||||
if (ImportController.extractConfigFromFile(fileName)) {
|
||||
ImportController.importConfig()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user