소스 검색

can switch between login and signup

Cyamond 5 년 전
부모
커밋
6bb3438ec9
1개의 변경된 파일115개의 추가작업 그리고 82개의 파일을 삭제
  1. 115 82
      gui/src/IpPopupForm.ui.qml

+ 115 - 82
gui/src/IpPopupForm.ui.qml

@@ -4,7 +4,7 @@ import QtQuick.Layouts 1.3
 
 Popup {
     id: popup
-    height: 400
+    height: 450
     dim: true
     clip: false
     width: 400
@@ -22,100 +22,133 @@ Popup {
         }
     }
 
-    ColumnLayout {
+    Page {
         anchors.fill: parent
 
-        Text {
-            Layout.alignment: Qt.AlignCenter
-            id: ipPopupTitle
-            color: "#ffffff"
-            text: qsTr("Enter the IP to connect:")
-            horizontalAlignment: Text.AlignHCenter
-            verticalAlignment: Text.AlignVCenter
-            font.pixelSize: 20
-        }
+        header: TabBar {
+            id: header
+            currentIndex: swipeView.currentIndex
+            contentHeight: 50
 
-        TextField {
-            Layout.alignment: Qt.AlignCenter
-            id: ipPopupIpInput
-            selectByMouse: true
-            focus: true
-            text: qsTr("")
-            placeholderText: "IP-Address"
-            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]))$/
+            TabButton {
+                text: qsTr("Login")
             }
-            // @disable-check M222
-            Keys.onReturnPressed: ipPopupConnectButton.activate()
-            // @disable-check M222
-            Keys.onEnterPressed: ipPopupConnectButton.activate()
-        }
 
-        TextField {
-            Layout.alignment: Qt.AlignCenter
-            id: ipPopupUsernameInput
-            selectByMouse: true
-            focus: true
-            text: qsTr("")
-            placeholderText: "Username"
-            horizontalAlignment: Text.AlignHCenter
-            // @disable-check M222
-            Keys.onReturnPressed: ipPopupConnectButton.activate()
-            // @disable-check M222
-            Keys.onEnterPressed: ipPopupConnectButton.activate()
+            TabButton {
+                text: qsTr("Signup")
+            }
         }
 
-        TextField {
-            Layout.alignment: Qt.AlignCenter
-            id: ipPopupPasswordInput
-            selectByMouse: true
-            focus: true
-            text: qsTr("")
-            placeholderText: "Password"
-            horizontalAlignment: Text.AlignHCenter
-            // @disable-check M222
-            Keys.onReturnPressed: ipPopupConnectButton.activate()
-            // @disable-check M222
-            Keys.onEnterPressed: ipPopupConnectButton.activate()
-            echoMode: TextInput.Password
-        }
+        SwipeView {
+            id: swipeView
+            anchors.fill: parent
+            currentIndex: header.currentIndex
+            clip: true
 
-        Text {
-            id: ipPopupStatusText
-            color: "#df3f3f"
-            text: qsTr("")
-            horizontalAlignment: Text.AlignHCenter
-            verticalAlignment: Text.AlignVCenter
-            Layout.alignment: Qt.AlignCenter
-            font.pixelSize: 20
-        }
+            Page {
+                ColumnLayout {
+                    anchors.fill: parent
+
+                    Text {
+                        Layout.alignment: Qt.AlignCenter
+                        id: ipPopupTitle
+                        color: "#ffffff"
+                        text: qsTr("Login")
+                        horizontalAlignment: Text.AlignHCenter
+                        verticalAlignment: Text.AlignVCenter
+                        font.pixelSize: 20
+                    }
+
+                    TextField {
+                        Layout.alignment: Qt.AlignCenter
+                        id: ipPopupIpInput
+                        selectByMouse: true
+                        focus: true
+                        text: qsTr("")
+                        placeholderText: "IP-Address"
+                        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: ipPopupConnectButton.activate()
+                        // @disable-check M222
+                        Keys.onEnterPressed: ipPopupConnectButton.activate()
+                    }
 
-        Button {
-            Layout.alignment: Qt.AlignCenter
-            id: ipPopupConnectButton
-            text: qsTr("Connect")
-            enabled: (ipPopupIpInput.acceptableInput && ipPopupUsernameInput.text != "" && ipPopupPasswordInput.text != "")
-            font.pointSize: 16
-            // @disable-check M223
-            onClicked: {
-                // @disable-check M222
-                ipPopupConnectButton.activate()
+                    TextField {
+                        Layout.alignment: Qt.AlignCenter
+                        id: ipPopupUsernameInput
+                        selectByMouse: true
+                        focus: true
+                        text: qsTr("")
+                        placeholderText: "Username"
+                        horizontalAlignment: Text.AlignHCenter
+                        // @disable-check M222
+                        Keys.onReturnPressed: ipPopupConnectButton.activate()
+                        // @disable-check M222
+                        Keys.onEnterPressed: ipPopupConnectButton.activate()
+                    }
+
+                    TextField {
+                        Layout.alignment: Qt.AlignCenter
+                        id: ipPopupPasswordInput
+                        selectByMouse: true
+                        focus: true
+                        text: qsTr("")
+                        placeholderText: "Password"
+                        horizontalAlignment: Text.AlignHCenter
+                        // @disable-check M222
+                        Keys.onReturnPressed: ipPopupConnectButton.activate()
+                        // @disable-check M222
+                        Keys.onEnterPressed: ipPopupConnectButton.activate()
+                        echoMode: TextInput.Password
+                    }
+
+                    Text {
+                        id: ipPopupStatusText
+                        color: "#df3f3f"
+                        text: qsTr("")
+                        horizontalAlignment: Text.AlignHCenter
+                        verticalAlignment: Text.AlignVCenter
+                        Layout.alignment: Qt.AlignCenter
+                        font.pixelSize: 20
+                    }
+
+                    Button {
+                        Layout.alignment: Qt.AlignCenter
+                        id: ipPopupConnectButton
+                        text: qsTr("Connect")
+                        enabled: (ipPopupIpInput.acceptableInput
+                                  && ipPopupUsernameInput.text != ""
+                                  && ipPopupPasswordInput.text != "")
+                        font.pointSize: 16
+                        // @disable-check M223
+                        onClicked: {
+                            // @disable-check M222
+                            ipPopupConnectButton.activate()
+                        }
+
+                        // @disable-check M222
+                        function activate() {
+                            // @disable-check M223
+                            if (ipPopupConnectButton.enabled) {
+                                // @disable-check M222
+                                _qmlHandler.onIpPopupConnectButton(
+                                            ipPopupIpInput.text,
+                                            ipPopupUsernameInput.text,
+                                            ipPopupUsernameInput.text)
+                            }
+                        }
+                    }
+                }
             }
 
-            // @disable-check M222
-            function activate() {
-                // @disable-check M223
-                if (ipPopupConnectButton.enabled) {
-                    // @disable-check M222
-                    _qmlHandler.onIpPopupConnectButton(ipPopupIpInput.text, ipPopupUsernameInput.text, ipPopupUsernameInput.text)
+            Page {
+                Button {
+                    text: qsTr("HallO")
                 }
             }
         }
     }
 }
-
-/*##^## Designer {
-    D{i:0;autoSize:true;height:480;width:640}
-}
- ##^##*/