Share page refactoring part 1
This commit is contained in:
parent
ed26706ee7
commit
a89104127a
32 changed files with 985 additions and 569 deletions
33
client/ui/qml/Controls/ContextMenu.qml
Normal file
33
client/ui/qml/Controls/ContextMenu.qml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import Qt.labs.platform 1.0
|
||||
|
||||
Menu {
|
||||
property var textObj
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("C&ut")
|
||||
shortcut: StandardKey.Cut
|
||||
enabled: textObj.selectedText
|
||||
onTriggered: textObj.cut()
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("&Copy")
|
||||
shortcut: StandardKey.Copy
|
||||
enabled: textObj.selectedText
|
||||
onTriggered: textObj.copy()
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("&Paste")
|
||||
shortcut: StandardKey.Paste
|
||||
enabled: textObj.canPaste
|
||||
onTriggered: textObj.paste()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("&SelectAll")
|
||||
shortcut: StandardKey.SelectAll
|
||||
enabled: textObj.length > 0
|
||||
onTriggered: textObj.selectAll()
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import QtQuick.Controls 2.12
|
|||
|
||||
BasicButtonType {
|
||||
id: root
|
||||
height: 40
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 4
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@ import QtGraphicalEffects 1.12
|
|||
Item {
|
||||
id: root
|
||||
property bool active: false
|
||||
property Component content: undefined
|
||||
property string text: ""
|
||||
width: 360
|
||||
height: active ? contentLoader.item.height + 40 + 5 * 2 : 40
|
||||
signal clicked()
|
||||
|
||||
|
|
@ -64,12 +62,5 @@ Item {
|
|||
onClicked: root.clicked()
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
x: 0
|
||||
y: 40 + 5
|
||||
id: contentLoader
|
||||
sourceComponent: root.content
|
||||
visible: root.active
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
51
client/ui/qml/Controls/TextAreaType.qml
Normal file
51
client/ui/qml/Controls/TextAreaType.qml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import Qt.labs.platform 1.0
|
||||
|
||||
Flickable
|
||||
{
|
||||
property alias textArea: root
|
||||
id: flickable
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
clip: true
|
||||
TextArea.flickable:
|
||||
|
||||
TextArea {
|
||||
id: root
|
||||
property bool error: false
|
||||
|
||||
width: parent.width - 80
|
||||
height: 40
|
||||
anchors.topMargin: 5
|
||||
selectByMouse: false
|
||||
|
||||
|
||||
selectionColor: "darkgray"
|
||||
font.pixelSize: 16
|
||||
color: "#333333"
|
||||
background: Rectangle {
|
||||
implicitWidth: 200
|
||||
implicitHeight: 40
|
||||
border.width: 1
|
||||
color: {
|
||||
if (root.error) {
|
||||
return Qt.rgba(213, 40, 60, 255)
|
||||
}
|
||||
return root.enabled ? "#F4F4F4" : Qt.rgba(127, 127, 127, 255)
|
||||
}
|
||||
border.color: {
|
||||
if (!root.enabled) {
|
||||
return Qt.rgba(127, 127, 127, 255)
|
||||
}
|
||||
if (root.error) {
|
||||
return Qt.rgba(213, 40, 60, 255)
|
||||
}
|
||||
if (root.focus) {
|
||||
return "#A7A7A7"
|
||||
}
|
||||
return "#A7A7A7"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -44,29 +44,8 @@ TextField {
|
|||
onClicked: contextMenu.open()
|
||||
}
|
||||
|
||||
Menu {
|
||||
ContextMenu {
|
||||
id: contextMenu
|
||||
|
||||
onAboutToShow: console.log("aboutToShow")
|
||||
onAboutToHide: console.log("aboutToHide")
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("C&ut")
|
||||
shortcut: StandardKey.Cut
|
||||
enabled: root.selectedText
|
||||
onTriggered: root.cut()
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("&Copy")
|
||||
shortcut: StandardKey.Copy
|
||||
enabled: root.selectedText
|
||||
onTriggered: root.copy()
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("&Paste")
|
||||
shortcut: StandardKey.Paste
|
||||
enabled: root.canPaste
|
||||
onTriggered: root.paste()
|
||||
}
|
||||
textObj: root
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Dialogs 1.1
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtGraphicalEffects 1.12
|
||||
import SortFilterProxyModel 0.2
|
||||
import ContainerProps 1.0
|
||||
import ProtocolProps 1.0
|
||||
import PageEnum 1.0
|
||||
import ProtocolEnum 1.0
|
||||
import "./"
|
||||
import "../Controls"
|
||||
import "../Config"
|
||||
|
|
@ -13,403 +20,543 @@ PageBase {
|
|||
BackButton {
|
||||
id: back
|
||||
}
|
||||
ScrollView {
|
||||
x: 10
|
||||
y: 40
|
||||
width: 360
|
||||
height: 580
|
||||
Item {
|
||||
id: ct
|
||||
width: parent.width
|
||||
height: childrenRect.height + 10
|
||||
property var contentList: [
|
||||
full_access,
|
||||
share_amezia,
|
||||
share_openvpn,
|
||||
share_shadowshock,
|
||||
share_cloak
|
||||
]
|
||||
property int currentIndex: ShareConnectionLogic.toolBoxShareConnectionCurrentIndex
|
||||
onCurrentIndexChanged: {
|
||||
ShareConnectionLogic.toolBoxShareConnectionCurrentIndex = currentIndex
|
||||
for (let i = 0; i < contentList.length; ++i) {
|
||||
if (i == currentIndex) {
|
||||
contentList[i].active = true
|
||||
} else {
|
||||
contentList[i].active = false
|
||||
}
|
||||
|
||||
Caption {
|
||||
id: caption
|
||||
text: qsTr("Share protocol config")
|
||||
width: undefined
|
||||
}
|
||||
|
||||
|
||||
Flickable {
|
||||
clip: true
|
||||
width: parent.width
|
||||
anchors.top: caption.bottom
|
||||
anchors.bottom: root.bottom
|
||||
contentHeight: col.height
|
||||
|
||||
Column {
|
||||
id: col
|
||||
anchors {
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
}
|
||||
topPadding: 20
|
||||
spacing: 10
|
||||
|
||||
// Caption {
|
||||
// id: cap1
|
||||
// text: qsTr("Installed Protocols and Services")
|
||||
// font.pixelSize: 20
|
||||
|
||||
// }
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: proxyProtocolsModel
|
||||
sourceModel: UiLogic.protocolsModel
|
||||
filters: ValueFilter {
|
||||
roleName: "is_installed_role"
|
||||
value: true
|
||||
}
|
||||
}
|
||||
|
||||
function clearActive() {
|
||||
for (let i = 0; i < contentList.length; ++i) {
|
||||
contentList[i].active = false
|
||||
}
|
||||
currentIndex = -1;
|
||||
|
||||
ShareConnectionContent {
|
||||
x: 10
|
||||
text: qsTr("Share for Amnezia")
|
||||
height: 40
|
||||
width: tb_c.width - 10
|
||||
}
|
||||
Column {
|
||||
spacing: 5
|
||||
ShareConnectionContent {
|
||||
id: full_access
|
||||
x: 0
|
||||
text: qsTr("Full access")
|
||||
visible: ShareConnectionLogic.pageShareFullAccessVisible
|
||||
content: Component {
|
||||
Item {
|
||||
width: 360
|
||||
height: 380
|
||||
Text {
|
||||
x: 10
|
||||
y: 250
|
||||
width: 341
|
||||
height: 111
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
font.pixelSize: 16
|
||||
color: "#181922"
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: qsTr("Anyone who logs in with this code will have the same permissions to use VPN and your server as you. \nThis code includes your server credentials!\nProvide this code only to TRUSTED users.")
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 130
|
||||
width: 341
|
||||
height: 40
|
||||
text: ShareConnectionLogic.pushButtonShareFullCopyText
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareFullCopyClicked()
|
||||
}
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 180
|
||||
width: 341
|
||||
height: 40
|
||||
text: qsTr("Save file")
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareFullSaveClicked()
|
||||
}
|
||||
}
|
||||
TextFieldType {
|
||||
x: 10
|
||||
y: 10
|
||||
width: 341
|
||||
height: 100
|
||||
verticalAlignment: Text.AlignTop
|
||||
text: ShareConnectionLogic.textEditShareFullCodeText
|
||||
onEditingFinished: {
|
||||
ShareConnectionLogic.textEditShareFullCodeText = text
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (active) {
|
||||
ct.currentIndex = -1
|
||||
} else {
|
||||
ct.clearActive()
|
||||
ct.currentIndex = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
ShareConnectionContent {
|
||||
id: share_amezia
|
||||
x: 0
|
||||
text: qsTr("Share for Amnezia client")
|
||||
visible: ShareConnectionLogic.pageShareAmneziaVisible
|
||||
content: Component {
|
||||
Item {
|
||||
width: 360
|
||||
height: 380
|
||||
Text {
|
||||
x: 10
|
||||
y: 280
|
||||
width: 341
|
||||
height: 111
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
font.pixelSize: 16
|
||||
color: "#181922"
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: qsTr("Anyone who logs in with this code will be able to connect to this VPN server. \nThis code does not include server credentials.")
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 180
|
||||
width: 341
|
||||
height: 40
|
||||
text: ShareConnectionLogic.pushButtonShareAmneziaCopyText
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareAmneziaCopyClicked()
|
||||
}
|
||||
enabled: ShareConnectionLogic.pushButtonShareAmneziaCopyEnabled
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 130
|
||||
width: 341
|
||||
height: 40
|
||||
text: ShareConnectionLogic.pushButtonShareAmneziaGenerateText
|
||||
enabled: ShareConnectionLogic.pushButtonShareAmneziaGenerateEnabled
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareAmneziaGenerateClicked()
|
||||
}
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 230
|
||||
width: 341
|
||||
height: 40
|
||||
text: qsTr("Save file")
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareAmneziaSaveClicked()
|
||||
}
|
||||
}
|
||||
TextFieldType {
|
||||
x: 10
|
||||
y: 10
|
||||
width: 341
|
||||
height: 100
|
||||
verticalAlignment: Text.AlignTop
|
||||
text: ShareConnectionLogic.textEditShareAmneziaCodeText
|
||||
onEditingFinished: {
|
||||
ShareConnectionLogic.textEditShareAmneziaCodeText = text
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (active) {
|
||||
ct.currentIndex = -1
|
||||
} else {
|
||||
ct.clearActive()
|
||||
ct.currentIndex = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
ShareConnectionContent {
|
||||
id: share_openvpn
|
||||
x: 0
|
||||
text: qsTr("Share for OpenVPN client")
|
||||
visible: ShareConnectionLogic.pageShareOpenVpnVisible
|
||||
content: Component {
|
||||
Item {
|
||||
width: 360
|
||||
height: 380
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 180
|
||||
width: 341
|
||||
height: 40
|
||||
text: ShareConnectionLogic.pushButtonShareOpenVpnCopyText
|
||||
enabled: ShareConnectionLogic.pushButtonShareOpenVpnCopyEnabled
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareOpenVpnCopyClicked()
|
||||
}
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 130
|
||||
width: 341
|
||||
height: 40
|
||||
text: ShareConnectionLogic.pushButtonShareOpenVpnGenerateText
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareOpenVpnGenerateClicked()
|
||||
}
|
||||
enabled: ShareConnectionLogic.pushButtonShareOpenVpnGenerateEnabled
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 230
|
||||
width: 341
|
||||
height: 40
|
||||
text: qsTr("Save file")
|
||||
enabled: ShareConnectionLogic.pushButtonShareOpenVpnSaveEnabled
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareOpenVpnSaveClicked()
|
||||
}
|
||||
}
|
||||
TextFieldType {
|
||||
x: 10
|
||||
y: 10
|
||||
width: 341
|
||||
height: 100
|
||||
verticalAlignment: Text.AlignTop
|
||||
text: ShareConnectionLogic.textEditShareOpenVpnCodeText
|
||||
onEditingFinished: {
|
||||
ShareConnectionLogic.textEditShareOpenVpnCodeText = text
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (active) {
|
||||
ct.currentIndex = -1
|
||||
} else {
|
||||
ct.clearActive()
|
||||
ct.currentIndex = 2
|
||||
}
|
||||
}
|
||||
}
|
||||
ShareConnectionContent {
|
||||
id: share_shadowshock
|
||||
x: 0
|
||||
text: qsTr("Share for ShadowSocks client")
|
||||
visible: ShareConnectionLogic.pageShareShadowSocksVisible
|
||||
content: Component {
|
||||
Item {
|
||||
width: 360
|
||||
height: 380
|
||||
LabelType {
|
||||
x: 10
|
||||
y: 70
|
||||
width: 100
|
||||
height: 20
|
||||
text: qsTr("Password")
|
||||
}
|
||||
LabelType {
|
||||
x: 10
|
||||
y: 10
|
||||
width: 100
|
||||
height: 20
|
||||
text: qsTr("Server:")
|
||||
}
|
||||
LabelType {
|
||||
x: 10
|
||||
y: 50
|
||||
width: 100
|
||||
height: 20
|
||||
text: qsTr("Encryption:")
|
||||
}
|
||||
LabelType {
|
||||
x: 10
|
||||
y: 30
|
||||
width: 100
|
||||
height: 20
|
||||
text: qsTr("Port:")
|
||||
}
|
||||
LabelType {
|
||||
x: 10
|
||||
y: 100
|
||||
width: 191
|
||||
height: 20
|
||||
text: qsTr("Connection string")
|
||||
}
|
||||
LabelType {
|
||||
x: 130
|
||||
y: 70
|
||||
width: 100
|
||||
height: 20
|
||||
text: ShareConnectionLogic.labelShareShadowSocksPasswordText
|
||||
}
|
||||
LabelType {
|
||||
x: 130
|
||||
y: 10
|
||||
width: 100
|
||||
height: 20
|
||||
text: ShareConnectionLogic.labelShareShadowSocksServerText
|
||||
}
|
||||
LabelType {
|
||||
x: 130
|
||||
y: 50
|
||||
width: 100
|
||||
height: 20
|
||||
text: ShareConnectionLogic.labelShareShadowSocksMethodText
|
||||
}
|
||||
LabelType {
|
||||
x: 130
|
||||
y: 30
|
||||
width: 100
|
||||
height: 20
|
||||
text: ShareConnectionLogic.labelShareShadowSocksPortText
|
||||
}
|
||||
Image {
|
||||
id: label_share_ss_qr_code
|
||||
x: 85
|
||||
y: 235
|
||||
width: 200
|
||||
height: 200
|
||||
source: ShareConnectionLogic.labelShareShadowSocksQrCodeText === "" ? "" : "data:image/png;base64," + UiLogic.labelShareShadowSocksQrCodeText
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 180
|
||||
width: 331
|
||||
height: 40
|
||||
text: ShareConnectionLogic.pushButtonShareShadowSocksCopyText
|
||||
enabled: ShareConnectionLogic.pushButtonShareShadowSocksCopyEnabled
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareShadowSocksCopyClicked()
|
||||
}
|
||||
}
|
||||
TextFieldType {
|
||||
x: 10
|
||||
y: 130
|
||||
width: 331
|
||||
height: 100
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: ShareConnectionLogic.lineEditShareShadowSocksStringText
|
||||
onEditingFinished: {
|
||||
ShareConnectionLogic.lineEditShareShadowSocksStringText = text
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (active) {
|
||||
ct.currentIndex = -1
|
||||
} else {
|
||||
ct.clearActive()
|
||||
ct.currentIndex = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
ShareConnectionContent {
|
||||
id: share_cloak
|
||||
x: 0
|
||||
text: qsTr("Share for Cloak client")
|
||||
visible: ShareConnectionLogic.pageShareCloakVisible
|
||||
content: Component {
|
||||
Item {
|
||||
width: 360
|
||||
height: 380
|
||||
ShareConnectionButtonType {
|
||||
x: 10
|
||||
y: 290
|
||||
width: 331
|
||||
height: 40
|
||||
text: ShareConnectionLogic.pushButtonShareCloakCopyText
|
||||
enabled: ShareConnectionLogic.pushButtonShareCloakCopyEnabled
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareCloakCopyClicked()
|
||||
}
|
||||
}
|
||||
TextInput {
|
||||
x: 10
|
||||
y: 30
|
||||
width: 331
|
||||
height: 100
|
||||
text: ShareConnectionLogic.plainTextEditShareCloakText
|
||||
onEditingFinished: {
|
||||
ShareConnectionLogic.plainTextEditShareCloakText = text
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (active) {
|
||||
ct.currentIndex = -1
|
||||
} else {
|
||||
ct.clearActive()
|
||||
ct.currentIndex = 4
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: tb_c
|
||||
x: 10
|
||||
width: parent.width - 10
|
||||
height: tb_c.contentItem.height
|
||||
currentIndex: -1
|
||||
spacing: 10
|
||||
clip: true
|
||||
interactive: false
|
||||
model: proxyProtocolsModel
|
||||
|
||||
delegate: Item {
|
||||
implicitWidth: tb_c.width - 10
|
||||
implicitHeight: c_item.height
|
||||
|
||||
ShareConnectionContent {
|
||||
id: c_item
|
||||
text: qsTr("Share for ") + name_role
|
||||
height: 40
|
||||
width: tb_c.width - 10
|
||||
onClicked: UiLogic.onGotoShareProtocolPage(proxyProtocolsModel.mapToSource(index))
|
||||
|
||||
}
|
||||
|
||||
// Rectangle {
|
||||
// id: c_item
|
||||
// x: 0
|
||||
// y: 0
|
||||
// width: parent.width
|
||||
// height: 40
|
||||
// color: "transparent"
|
||||
// clip: true
|
||||
// radius: 2
|
||||
// LinearGradient {
|
||||
// anchors.fill: parent
|
||||
// start: Qt.point(0, 0)
|
||||
// end: Qt.point(0, height)
|
||||
// gradient: Gradient {
|
||||
// GradientStop { position: 0.0; color: "#E1E1E1" }
|
||||
// GradientStop { position: 0.4; color: "#DDDDDD" }
|
||||
// GradientStop { position: 0.5; color: "#D8D8D8" }
|
||||
// GradientStop { position: 1.0; color: "#D3D3D3" }
|
||||
// }
|
||||
// }
|
||||
// Image {
|
||||
// anchors.verticalCenter: parent.verticalCenter
|
||||
// anchors.left: parent.left
|
||||
// anchors.leftMargin: 10
|
||||
// source: "qrc:/images/share.png"
|
||||
// }
|
||||
// Rectangle {
|
||||
// anchors.left: parent.left
|
||||
// anchors.right: parent.right
|
||||
// anchors.bottom: parent.bottom
|
||||
// height: 2
|
||||
// color: "#148CD2"
|
||||
// visible: ms.containsMouse ? true : false
|
||||
// }
|
||||
// Text {
|
||||
// x: 40
|
||||
// anchors.verticalCenter: parent.verticalCenter
|
||||
// font.family: "Lato"
|
||||
// font.styleName: "normal"
|
||||
// font.pixelSize: 18
|
||||
// color: "#100A44"
|
||||
// font.bold: true
|
||||
// text: name_role
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// verticalAlignment: Text.AlignVCenter
|
||||
// wrapMode: Text.Wrap
|
||||
// }
|
||||
// MouseArea {
|
||||
// id: ms
|
||||
// anchors.fill: parent
|
||||
// hoverEnabled: true
|
||||
// onClicked: UiLogic.onGotoShareProtocolPage(proxyProtocolsModel.mapToSource(index))
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Item {
|
||||
// id: c_item
|
||||
// width: parent.width
|
||||
// height: row_container.height
|
||||
// anchors.left: parent.left
|
||||
// Rectangle {
|
||||
// anchors.top: parent.top
|
||||
// width: parent.width
|
||||
// height: 1
|
||||
// color: "lightgray"
|
||||
// visible: index !== tb_c.currentIndex
|
||||
// }
|
||||
// Rectangle {
|
||||
// anchors.top: row_container.top
|
||||
// anchors.bottom: row_container.bottom
|
||||
// anchors.left: parent.left
|
||||
// anchors.right: parent.right
|
||||
|
||||
// color: "#63B4FB"
|
||||
// visible: index === tb_c.currentIndex
|
||||
// }
|
||||
|
||||
// RowLayout {
|
||||
// id: row_container
|
||||
// //width: parent.width
|
||||
// anchors.left: parent.left
|
||||
// anchors.right: parent.right
|
||||
|
||||
//// anchors.top: lb_container_name.top
|
||||
//// anchors.bottom: lb_container_name.bottom
|
||||
|
||||
// Text {
|
||||
// id: lb_container_name
|
||||
// text: name_role
|
||||
// font.pixelSize: 17
|
||||
// //font.bold: true
|
||||
// color: "#100A44"
|
||||
// topPadding: 5
|
||||
// bottomPadding: 5
|
||||
// leftPadding: 10
|
||||
// verticalAlignment: Text.AlignVCenter
|
||||
// wrapMode: Text.WordWrap
|
||||
// Layout.fillWidth: true
|
||||
|
||||
// MouseArea {
|
||||
// enabled: col.visible
|
||||
// anchors.top: lb_container_name.top
|
||||
// anchors.bottom: lb_container_name.bottom
|
||||
// anchors.left: parent.left
|
||||
// anchors.right: parent.right
|
||||
// propagateComposedEvents: true
|
||||
// onClicked: {
|
||||
// if (tb_c.currentIndex === index) tb_c.currentIndex = -1
|
||||
// else tb_c.currentIndex = index
|
||||
|
||||
// UiLogic.protocolsModel.setSelectedDockerContainer(proxyContainersModel.mapToSource(index))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ScrollView {
|
||||
// x: 10
|
||||
// y: 40
|
||||
// width: 360
|
||||
// height: 580
|
||||
// Item {
|
||||
// id: ct
|
||||
// width: parent.width
|
||||
// height: childrenRect.height + 10
|
||||
// property var contentList: [
|
||||
// full_access,
|
||||
// share_amezia,
|
||||
// share_openvpn,
|
||||
// share_shadowshock,
|
||||
// share_cloak
|
||||
// ]
|
||||
// property int currentIndex: ShareConnectionLogic.toolBoxShareConnectionCurrentIndex
|
||||
// onCurrentIndexChanged: {
|
||||
// ShareConnectionLogic.toolBoxShareConnectionCurrentIndex = currentIndex
|
||||
// for (let i = 0; i < contentList.length; ++i) {
|
||||
// if (i == currentIndex) {
|
||||
// contentList[i].active = true
|
||||
// } else {
|
||||
// contentList[i].active = false
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// function clearActive() {
|
||||
// for (let i = 0; i < contentList.length; ++i) {
|
||||
// contentList[i].active = false
|
||||
// }
|
||||
// currentIndex = -1;
|
||||
// }
|
||||
// Column {
|
||||
// spacing: 5
|
||||
// ShareConnectionContent {
|
||||
// id: full_access
|
||||
// x: 0
|
||||
// text: qsTr("Full access")
|
||||
// visible: ShareConnectionLogic.pageShareFullAccessVisible
|
||||
// content: Component {
|
||||
// Item {
|
||||
// width: 360
|
||||
// height: 380
|
||||
// Text {
|
||||
// x: 10
|
||||
// y: 250
|
||||
// width: 341
|
||||
// height: 111
|
||||
// font.family: "Lato"
|
||||
// font.styleName: "normal"
|
||||
// font.pixelSize: 16
|
||||
// color: "#181922"
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// verticalAlignment: Text.AlignVCenter
|
||||
// wrapMode: Text.Wrap
|
||||
// text: qsTr("Anyone who logs in with this code will have the same permissions to use VPN and your server as you. \nThis code includes your server credentials!\nProvide this code only to TRUSTED users.")
|
||||
// }
|
||||
// ShareConnectionButtonType {
|
||||
// x: 10
|
||||
// y: 130
|
||||
// width: 341
|
||||
// height: 40
|
||||
// text: ShareConnectionLogic.pushButtonShareFullCopyText
|
||||
// onClicked: {
|
||||
// ShareConnectionLogic.onPushButtonShareFullCopyClicked()
|
||||
// }
|
||||
// }
|
||||
// ShareConnectionButtonType {
|
||||
// x: 10
|
||||
// y: 180
|
||||
// width: 341
|
||||
// height: 40
|
||||
// text: qsTr("Save file")
|
||||
// onClicked: {
|
||||
// ShareConnectionLogic.onPushButtonShareFullSaveClicked()
|
||||
// }
|
||||
// }
|
||||
// TextFieldType {
|
||||
// x: 10
|
||||
// y: 10
|
||||
// width: 341
|
||||
// height: 100
|
||||
// verticalAlignment: Text.AlignTop
|
||||
// text: ShareConnectionLogic.textEditShareFullCodeText
|
||||
// onEditingFinished: {
|
||||
// ShareConnectionLogic.textEditShareFullCodeText = text
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// onClicked: {
|
||||
// if (active) {
|
||||
// ct.currentIndex = -1
|
||||
// } else {
|
||||
// ct.clearActive()
|
||||
// ct.currentIndex = 0
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ShareConnectionContent {
|
||||
// id: share_amezia
|
||||
// x: 0
|
||||
// text: qsTr("Share for Amnezia client")
|
||||
// visible: ShareConnectionLogic.pageShareAmneziaVisible
|
||||
// content: Component {
|
||||
// Item {
|
||||
// width: 360
|
||||
// height: 380
|
||||
// Text {
|
||||
// x: 10
|
||||
// y: 280
|
||||
// width: 341
|
||||
// height: 111
|
||||
// font.family: "Lato"
|
||||
// font.styleName: "normal"
|
||||
// font.pixelSize: 16
|
||||
// color: "#181922"
|
||||
// horizontalAlignment: Text.AlignLeft
|
||||
// verticalAlignment: Text.AlignVCenter
|
||||
// wrapMode: Text.Wrap
|
||||
// text: qsTr("Anyone who logs in with this code will be able to connect to this VPN server. \nThis code does not include server credentials.")
|
||||
// }
|
||||
// ShareConnectionButtonType {
|
||||
// x: 10
|
||||
// y: 180
|
||||
// width: 341
|
||||
// height: 40
|
||||
// text: ShareConnectionLogic.pushButtonShareAmneziaCopyText
|
||||
// onClicked: {
|
||||
// ShareConnectionLogic.onPushButtonShareAmneziaCopyClicked()
|
||||
// }
|
||||
// enabled: ShareConnectionLogic.pushButtonShareAmneziaCopyEnabled
|
||||
// }
|
||||
// ShareConnectionButtonType {
|
||||
// x: 10
|
||||
// y: 130
|
||||
// width: 341
|
||||
// height: 40
|
||||
// text: ShareConnectionLogic.pushButtonShareAmneziaGenerateText
|
||||
// enabled: ShareConnectionLogic.pushButtonShareAmneziaGenerateEnabled
|
||||
// onClicked: {
|
||||
// ShareConnectionLogic.onPushButtonShareAmneziaGenerateClicked()
|
||||
// }
|
||||
// }
|
||||
// ShareConnectionButtonType {
|
||||
// x: 10
|
||||
// y: 230
|
||||
// width: 341
|
||||
// height: 40
|
||||
// text: qsTr("Save file")
|
||||
// onClicked: {
|
||||
// ShareConnectionLogic.onPushButtonShareAmneziaSaveClicked()
|
||||
// }
|
||||
// }
|
||||
// TextFieldType {
|
||||
// x: 10
|
||||
// y: 10
|
||||
// width: 341
|
||||
// height: 100
|
||||
// verticalAlignment: Text.AlignTop
|
||||
// text: ShareConnectionLogic.textEditShareAmneziaCodeText
|
||||
// onEditingFinished: {
|
||||
// ShareConnectionLogic.textEditShareAmneziaCodeText = text
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// onClicked: {
|
||||
// if (active) {
|
||||
// ct.currentIndex = -1
|
||||
// } else {
|
||||
// ct.clearActive()
|
||||
// ct.currentIndex = 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// ShareConnectionContent {
|
||||
// id: share_shadowshock
|
||||
// x: 0
|
||||
// text: qsTr("Share for ShadowSocks client")
|
||||
// visible: ShareConnectionLogic.pageShareShadowSocksVisible
|
||||
// content: Component {
|
||||
// Item {
|
||||
// width: 360
|
||||
// height: 380
|
||||
// LabelType {
|
||||
// x: 10
|
||||
// y: 70
|
||||
// width: 100
|
||||
// height: 20
|
||||
// text: qsTr("Password")
|
||||
// }
|
||||
// LabelType {
|
||||
// x: 10
|
||||
// y: 10
|
||||
// width: 100
|
||||
// height: 20
|
||||
// text: qsTr("Server:")
|
||||
// }
|
||||
// LabelType {
|
||||
// x: 10
|
||||
// y: 50
|
||||
// width: 100
|
||||
// height: 20
|
||||
// text: qsTr("Encryption:")
|
||||
// }
|
||||
// LabelType {
|
||||
// x: 10
|
||||
// y: 30
|
||||
// width: 100
|
||||
// height: 20
|
||||
// text: qsTr("Port:")
|
||||
// }
|
||||
// LabelType {
|
||||
// x: 10
|
||||
// y: 100
|
||||
// width: 191
|
||||
// height: 20
|
||||
// text: qsTr("Connection string")
|
||||
// }
|
||||
// LabelType {
|
||||
// x: 130
|
||||
// y: 70
|
||||
// width: 100
|
||||
// height: 20
|
||||
// text: ShareConnectionLogic.labelShareShadowSocksPasswordText
|
||||
// }
|
||||
// LabelType {
|
||||
// x: 130
|
||||
// y: 10
|
||||
// width: 100
|
||||
// height: 20
|
||||
// text: ShareConnectionLogic.labelShareShadowSocksServerText
|
||||
// }
|
||||
// LabelType {
|
||||
// x: 130
|
||||
// y: 50
|
||||
// width: 100
|
||||
// height: 20
|
||||
// text: ShareConnectionLogic.labelShareShadowSocksMethodText
|
||||
// }
|
||||
// LabelType {
|
||||
// x: 130
|
||||
// y: 30
|
||||
// width: 100
|
||||
// height: 20
|
||||
// text: ShareConnectionLogic.labelShareShadowSocksPortText
|
||||
// }
|
||||
// Image {
|
||||
// id: label_share_ss_qr_code
|
||||
// x: 85
|
||||
// y: 235
|
||||
// width: 200
|
||||
// height: 200
|
||||
// source: ShareConnectionLogic.labelShareShadowSocksQrCodeText === "" ? "" : "data:image/png;base64," + UiLogic.labelShareShadowSocksQrCodeText
|
||||
// }
|
||||
// ShareConnectionButtonType {
|
||||
// x: 10
|
||||
// y: 180
|
||||
// width: 331
|
||||
// height: 40
|
||||
// text: ShareConnectionLogic.pushButtonShareShadowSocksCopyText
|
||||
// enabled: ShareConnectionLogic.pushButtonShareShadowSocksCopyEnabled
|
||||
// onClicked: {
|
||||
// ShareConnectionLogic.onPushButtonShareShadowSocksCopyClicked()
|
||||
// }
|
||||
// }
|
||||
// TextFieldType {
|
||||
// x: 10
|
||||
// y: 130
|
||||
// width: 331
|
||||
// height: 100
|
||||
// horizontalAlignment: Text.AlignHCenter
|
||||
// text: ShareConnectionLogic.lineEditShareShadowSocksStringText
|
||||
// onEditingFinished: {
|
||||
// ShareConnectionLogic.lineEditShareShadowSocksStringText = text
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// onClicked: {
|
||||
// if (active) {
|
||||
// ct.currentIndex = -1
|
||||
// } else {
|
||||
// ct.clearActive()
|
||||
// ct.currentIndex = 3
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ShareConnectionContent {
|
||||
// id: share_cloak
|
||||
// x: 0
|
||||
// text: qsTr("Share for Cloak client")
|
||||
// visible: ShareConnectionLogic.pageShareCloakVisible
|
||||
// content: Component {
|
||||
// Item {
|
||||
// width: 360
|
||||
// height: 380
|
||||
|
||||
// }
|
||||
// }
|
||||
// onClicked: {
|
||||
// if (active) {
|
||||
// ct.currentIndex = -1
|
||||
// } else {
|
||||
// ct.clearActive()
|
||||
// ct.currentIndex = 4
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
50
client/ui/qml/Pages/Share/PageShareProtoCloak.qml
Normal file
50
client/ui/qml/Pages/Share/PageShareProtoCloak.qml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.15
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.Cloak
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
Caption {
|
||||
id: caption
|
||||
text: qsTr("Share Cloak Settings")
|
||||
}
|
||||
|
||||
|
||||
TextAreaType {
|
||||
anchors.top: caption.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.bottom: pb_save.top
|
||||
anchors.bottomMargin: 20
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
|
||||
textArea.readOnly: true
|
||||
|
||||
textArea.text: ShareConnectionLogic.plainTextEditShareCloakText
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
id: pb_save
|
||||
anchors.bottom: root.bottom
|
||||
anchors.bottomMargin: 10
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
text: ShareConnectionLogic.pushButtonShareCloakCopyText
|
||||
enabled: ShareConnectionLogic.pushButtonShareCloakCopyEnabled
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareCloakCopyClicked()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
80
client/ui/qml/Pages/Share/PageShareProtoOpenVPN.qml
Normal file
80
client/ui/qml/Pages/Share/PageShareProtoOpenVPN.qml
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.15
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.OpenVpn
|
||||
logic: ShareConnectionLogic
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
Caption {
|
||||
id: caption
|
||||
text: qsTr("Share OpenVPN Settings")
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
anchors.top: caption.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.bottom: pb_gen.top
|
||||
anchors.bottomMargin: 20
|
||||
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
|
||||
textArea.readOnly: true
|
||||
|
||||
textArea.verticalAlignment: Text.AlignTop
|
||||
textArea.text: ShareConnectionLogic.textEditShareOpenVpnCodeText
|
||||
}
|
||||
|
||||
|
||||
ShareConnectionButtonType {
|
||||
id: pb_gen
|
||||
anchors.bottom: pb_copy.top
|
||||
anchors.bottomMargin: 10
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
|
||||
text: ShareConnectionLogic.pushButtonShareOpenVpnGenerateText
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareOpenVpnGenerateClicked()
|
||||
}
|
||||
enabled: ShareConnectionLogic.pushButtonShareOpenVpnGenerateEnabled
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
id: pb_copy
|
||||
anchors.bottom: pb_save.top
|
||||
anchors.bottomMargin: 10
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
|
||||
text: ShareConnectionLogic.pushButtonShareOpenVpnCopyText
|
||||
enabled: ShareConnectionLogic.pushButtonShareOpenVpnCopyEnabled
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareOpenVpnCopyClicked()
|
||||
}
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
id: pb_save
|
||||
anchors.bottom: root.bottom
|
||||
anchors.bottomMargin: 10
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
|
||||
text: qsTr("Save file")
|
||||
enabled: ShareConnectionLogic.pushButtonShareOpenVpnSaveEnabled
|
||||
onClicked: {
|
||||
ShareConnectionLogic.onPushButtonShareOpenVpnSaveClicked()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
22
client/ui/qml/Pages/Share/PageShareProtoSftp.qml
Normal file
22
client/ui/qml/Pages/Share/PageShareProtoSftp.qml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.Sftp
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
|
||||
Caption {
|
||||
id: caption
|
||||
text: qsTr("Share SFTF settings")
|
||||
}
|
||||
|
||||
}
|
||||
48
client/ui/qml/Pages/Share/PageShareProtoShadowSocks.qml
Normal file
48
client/ui/qml/Pages/Share/PageShareProtoShadowSocks.qml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.15
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.ShadowSocks
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
Caption {
|
||||
id: caption
|
||||
text: qsTr("Share ShadowSocks Settings")
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: fl
|
||||
width: root.width
|
||||
anchors.top: caption.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 20
|
||||
anchors.left: root.left
|
||||
anchors.leftMargin: 30
|
||||
anchors.right: root.right
|
||||
anchors.rightMargin: 30
|
||||
|
||||
contentHeight: content.height
|
||||
clip: true
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
21
client/ui/qml/Pages/Share/PageShareProtoTorWebSite.qml
Normal file
21
client/ui/qml/Pages/Share/PageShareProtoTorWebSite.qml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.TorWebSite
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
|
||||
Caption {
|
||||
id: caption
|
||||
text: qsTr("Share TOR Web site")
|
||||
}
|
||||
}
|
||||
13
client/ui/qml/Pages/Share/PageShareProtocolBase.qml
Normal file
13
client/ui/qml/Pages/Share/PageShareProtocolBase.qml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import PageEnum 1.0
|
||||
import ProtocolEnum 1.0
|
||||
import "./.."
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageBase {
|
||||
id: root
|
||||
property var protocol: ProtocolEnum.Any
|
||||
page: PageEnum.ProtocolSettings
|
||||
}
|
||||
|
|
@ -3,17 +3,20 @@ import QtQuick.Window 2.14
|
|||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import PageEnum 1.0
|
||||
import PageType 1.0
|
||||
import Qt.labs.platform 1.1
|
||||
import Qt.labs.folderlistmodel 2.12
|
||||
import QtQuick.Dialogs 1.1
|
||||
import "./"
|
||||
import "Pages"
|
||||
import "Pages/Protocols"
|
||||
import "Pages/Share"
|
||||
import "Config"
|
||||
|
||||
Window {
|
||||
property var pages: ({})
|
||||
property var protocolPages: ({})
|
||||
property var sharePages: ({})
|
||||
|
||||
id: root
|
||||
visible: true
|
||||
|
|
@ -28,73 +31,28 @@ Window {
|
|||
//flags: Qt.FramelessWindowHint
|
||||
title: "AmneziaVPN"
|
||||
|
||||
function gotoPage(page, reset, slide) {
|
||||
function gotoPage(type, page, reset, slide) {
|
||||
|
||||
let p_obj;
|
||||
if (type === PageType.Basic) p_obj = pages[page]
|
||||
else if (type === PageType.Proto) p_obj = protocolPages[page]
|
||||
else if (type === PageType.ShareProto) p_obj = sharePages[page]
|
||||
else return
|
||||
|
||||
console.debug("QML gotoPage " + type + " " + page + " " + p_obj)
|
||||
|
||||
|
||||
if (slide) {
|
||||
pageLoader.push(p_obj, {}, StackView.PushTransition)
|
||||
} else {
|
||||
pageLoader.push(p_obj, {}, StackView.Immediate)
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
if (page === PageEnum.ServerSettings) {
|
||||
ServerSettingsLogic.onUpdatePage();
|
||||
}
|
||||
if (page === PageEnum.ShareConnection) {
|
||||
}
|
||||
if (page === PageEnum.Wizard) {
|
||||
WizardLogic.radioButtonMediumChecked = true
|
||||
}
|
||||
if (page === PageEnum.WizardHigh) {
|
||||
WizardLogic.onUpdatePage();
|
||||
}
|
||||
if (page === PageEnum.ServerConfiguringProgress) {
|
||||
ServerConfiguringProgressLogic.progressBarValue = 0;
|
||||
}
|
||||
if (page === PageEnum.GeneralSettings) {
|
||||
GeneralSettingsLogic.onUpdatePage();
|
||||
}
|
||||
if (page === PageEnum.ServersList) {
|
||||
ServerListLogic.onUpdatePage();
|
||||
}
|
||||
if (page === PageEnum.Start) {
|
||||
StartPageLogic.pushButtonBackFromStartVisible = !pageLoader.empty
|
||||
StartPageLogic.onUpdatePage();
|
||||
}
|
||||
if (page === PageEnum.NewServerProtocols) {
|
||||
NewServerProtocolsLogic.onUpdatePage()
|
||||
}
|
||||
if (page === PageEnum.ServerContainers) {
|
||||
ServerContainersLogic.onUpdatePage()
|
||||
}
|
||||
if (page === PageEnum.AppSettings) {
|
||||
AppSettingsLogic.onUpdatePage()
|
||||
}
|
||||
if (page === PageEnum.NetworkSettings) {
|
||||
NetworkSettingsLogic.onUpdatePage()
|
||||
}
|
||||
if (page === PageEnum.Sites) {
|
||||
SitesLogic.updateSitesPage()
|
||||
}
|
||||
if (page === PageEnum.Vpn) {
|
||||
VpnLogic.updateVpnPage()
|
||||
}
|
||||
p_obj.logic.onUpdatePage();
|
||||
}
|
||||
|
||||
if (slide) {
|
||||
pageLoader.push(pages[page], {}, StackView.PushTransition)
|
||||
} else {
|
||||
pageLoader.push(pages[page], {}, StackView.Immediate)
|
||||
}
|
||||
|
||||
pages[page].activated(reset)
|
||||
}
|
||||
|
||||
function gotoProtocolPage(protocol, reset, slide) {
|
||||
if (reset && protocolPages[protocol] !== "undefined") {
|
||||
protocolPages[protocol].logic.onUpdatePage();
|
||||
}
|
||||
|
||||
if (slide) {
|
||||
pageLoader.push(protocolPages[protocol], {}, StackView.PushTransition)
|
||||
} else {
|
||||
pageLoader.push(protocolPages[protocol], {}, StackView.Immediate)
|
||||
}
|
||||
|
||||
protocolPages[protocol].activated(reset)
|
||||
p_obj.activated(reset)
|
||||
}
|
||||
|
||||
function close_page() {
|
||||
|
|
@ -146,6 +104,8 @@ Window {
|
|||
color: "white"
|
||||
}
|
||||
|
||||
//PageShareProtoCloak {}
|
||||
|
||||
StackView {
|
||||
id: pageLoader
|
||||
y: GC.isDesktop() ? titleBar.height : 0
|
||||
|
|
@ -157,6 +117,10 @@ Window {
|
|||
UiLogic.currentPageValue = currentItem.page
|
||||
}
|
||||
|
||||
onDepthChanged: {
|
||||
UiLogic.pagesStackDepth = depth
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
UiLogic.keyPressEvent(event.key)
|
||||
event.accepted = true
|
||||
|
|
@ -171,7 +135,7 @@ Window {
|
|||
|
||||
onStatusChanged: if (status == FolderListModel.Ready) {
|
||||
for (var i=0; i<folderModelPages.count; i++) {
|
||||
createPagesObjects(folderModelPages.get(i, "filePath"), false);
|
||||
createPagesObjects(folderModelPages.get(i, "filePath"), PageType.Basic);
|
||||
}
|
||||
UiLogic.initalizeUiLogic()
|
||||
}
|
||||
|
|
@ -185,40 +149,56 @@ Window {
|
|||
|
||||
onStatusChanged: if (status == FolderListModel.Ready) {
|
||||
for (var i=0; i<folderModelProtocols.count; i++) {
|
||||
createPagesObjects(folderModelProtocols.get(i, "filePath"), true);
|
||||
createPagesObjects(folderModelProtocols.get(i, "filePath"), PageType.Proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createPagesObjects(file, isProtocol) {
|
||||
FolderListModel {
|
||||
id: folderModelShareProtocols
|
||||
folder: "qrc:/ui/qml/Pages/Share/"
|
||||
nameFilters: ["*.qml"]
|
||||
showDirs: false
|
||||
|
||||
onStatusChanged: if (status == FolderListModel.Ready) {
|
||||
for (var i=0; i<folderModelShareProtocols.count; i++) {
|
||||
createPagesObjects(folderModelShareProtocols.get(i, "filePath"), PageType.ShareProto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createPagesObjects(file, type) {
|
||||
if (file.indexOf("Base") !== -1) return; // skip Base Pages
|
||||
//console.debug("Creating compenent " + file + " for " + type);
|
||||
|
||||
var c = Qt.createComponent("qrc" + file);
|
||||
|
||||
var finishCreation = function (component){
|
||||
if (component.status == Component.Ready) {
|
||||
if (component.status === Component.Ready) {
|
||||
var obj = component.createObject(root);
|
||||
if (obj == null) {
|
||||
if (obj === null) {
|
||||
console.debug("Error creating object " + component.url);
|
||||
}
|
||||
else {
|
||||
obj.visible = false
|
||||
if (isProtocol) {
|
||||
protocolPages[obj.protocol] = obj
|
||||
}
|
||||
else {
|
||||
if (type === PageType.Basic) {
|
||||
pages[obj.page] = obj
|
||||
}
|
||||
else if (type === PageType.Proto) {
|
||||
protocolPages[obj.protocol] = obj
|
||||
}
|
||||
else if (type === PageType.ShareProto) {
|
||||
sharePages[obj.protocol] = obj
|
||||
}
|
||||
|
||||
|
||||
|
||||
//console.debug("Created compenent " + component.url + " for " + type);
|
||||
}
|
||||
} else if (component.status == Component.Error) {
|
||||
} else if (component.status === Component.Error) {
|
||||
console.debug("Error loading component:", component.errorString());
|
||||
}
|
||||
}
|
||||
|
||||
if (c.status == Component.Ready)
|
||||
if (c.status === Component.Ready)
|
||||
finishCreation(c);
|
||||
else {
|
||||
console.debug("Warning: Pages components are not ready");
|
||||
|
|
@ -228,13 +208,19 @@ Window {
|
|||
Connections {
|
||||
target: UiLogic
|
||||
function onGoToPage(page, reset, slide) {
|
||||
console.debug("Connections onGoToPage " + page);
|
||||
root.gotoPage(page, reset, slide)
|
||||
console.debug("Qml Connections onGoToPage " + page);
|
||||
root.gotoPage(PageType.Basic, page, reset, slide)
|
||||
}
|
||||
function onGoToProtocolPage(protocol, reset, slide) {
|
||||
console.debug("Connections onGoToProtocolPage " + protocol);
|
||||
root.gotoProtocolPage(protocol, reset, slide)
|
||||
console.debug("Qml Connections onGoToProtocolPage " + protocol);
|
||||
root.gotoPage(PageType.Proto, protocol, reset, slide)
|
||||
}
|
||||
function onGoToShareProtocolPage(protocol, reset, slide) {
|
||||
console.debug("Qml Connections onGoToShareProtocolPage " + protocol);
|
||||
root.gotoPage(PageType.ShareProto, protocol, reset, slide)
|
||||
}
|
||||
|
||||
|
||||
function onClosePage() {
|
||||
root.close_page()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue