12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import QtQuick 2.4
- import QtQuick.Controls 2.3
- import QtQuick.Layouts 1.3
- Popup {
- id: popup
- height: 200
- dim: true
- clip: false
- width: 400
- modal: true
- focus: true
- closePolicy: Popup.NoAutoClose
- ColumnLayout {
- anchors.fill: parent
- Text {
- Layout.alignment: Qt.AlignCenter
- id: switchText
- color: "#ffffff"
- text: qsTr("Enter the IP to connect:")
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.pixelSize: 20
- }
- TextField {
- Layout.alignment: Qt.AlignCenter
- id: switchIpInput
- selectByMouse: true
- text: qsTr("")
- placeholderText: "Enter IP"
- horizontalAlignment: Text.AlignHCenter
- validator: RegExpValidator {
- regExp: /^(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))$/
- }
- // @disable-check M222
- Keys.onReturnPressed: switchConnectButton.activate()
- // @disable-check M222
- Keys.onEnterPressed: switchConnectButton.activate()
- }
- Text {
- id: switchStatusText
- color: "#df3f3f"
- text: qsTr("")
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- Layout.alignment: Qt.AlignCenter
- font.pixelSize: 20
- }
- RowLayout {
- Layout.alignment: Qt.AlignCenter
- Button {
- Layout.alignment: Qt.AlignLeft
- id: switchConnectButton
- text: qsTr("Connect")
- rightPadding: 8
- padding: 12
- enabled: switchIpInput.acceptableInput
- font.pointSize: 16
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- switchConnectButton.activate()
- }
- // @disable-check M222
- function activate() {
- // @disable-check M223
- if (switchIpInput.acceptableInput) {
- // @disable-check M222
- _qmlHandler.onSwitchPopupEnterIp(switchIpInput.text)
- // @disable-check M222
- popup.close()
- }
- }
- }
- Button {
- Layout.alignment: Qt.AlignRight
- id: switchCancelButton
- text: qsTr("Cancel")
- font.pointSize: 16
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- popup.close()
- }
- }
- }
- }
- }
|