some tinkering
This commit is contained in:
parent
c966d95058
commit
ed1ed9fb49
10 changed files with 230 additions and 229 deletions
12
qml/Forms/CMakeLists.txt
Normal file
12
qml/Forms/CMakeLists.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
qt_add_qml_module(magpieForms
|
||||
URI "qml.Forms"
|
||||
VERSION 1.0
|
||||
STATIC
|
||||
RESOURCE_PREFIX /
|
||||
NO_PLUGIN
|
||||
QML_FILES
|
||||
Login.qml
|
||||
Register.qml
|
||||
)
|
||||
|
||||
target_link_libraries(magpie PRIVATE magpieForms)
|
74
qml/Forms/Login.qml
Normal file
74
qml/Forms/Login.qml
Normal file
|
@ -0,0 +1,74 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import magpie.API
|
||||
|
||||
Column {
|
||||
signal register()
|
||||
|
||||
spacing: 10
|
||||
|
||||
Label {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: qsTr("Please, log in to your account")
|
||||
font {
|
||||
pixelSize: 14
|
||||
}
|
||||
}
|
||||
|
||||
Grid {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
columns: 2
|
||||
columnSpacing: 10
|
||||
rowSpacing: 5
|
||||
verticalItemAlignment: Grid.AlignVCenter
|
||||
horizontalItemAlignment: Grid.AlignRight
|
||||
|
||||
Label {
|
||||
text: qsTr("Login") + ":";
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: login
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Password") + ":";
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: password
|
||||
echoMode: TextField.Password
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: qsTr("Login")
|
||||
onClicked: function () {
|
||||
console.log("Not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: 5
|
||||
topPadding: 10
|
||||
|
||||
Label {
|
||||
text: qsTr("Don't have account?")
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Sign up") + "!"
|
||||
font {
|
||||
italic: true
|
||||
underline: true
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: register()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
77
qml/Forms/Register.qml
Normal file
77
qml/Forms/Register.qml
Normal file
|
@ -0,0 +1,77 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import magpie.API
|
||||
|
||||
Column {
|
||||
signal login()
|
||||
|
||||
spacing: 10
|
||||
|
||||
Label {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: qsTr("Please, chose login and password")
|
||||
font {
|
||||
pixelSize: 14
|
||||
}
|
||||
}
|
||||
|
||||
Grid {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
columns: 2
|
||||
columnSpacing: 10
|
||||
rowSpacing: 5
|
||||
verticalItemAlignment: Grid.AlignVCenter
|
||||
horizontalItemAlignment: Grid.AlignRight
|
||||
|
||||
Label {
|
||||
text: qsTr("Login") + ":";
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: newLogin
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Password") + ":";
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: newPassword
|
||||
echoMode: TextField.Password
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: qsTr("Register")
|
||||
onClicked: API.sendRegister(newLogin.text, newPassword.text, function (err, result) {
|
||||
if (err)
|
||||
console.error("err")
|
||||
|
||||
console.log(result);
|
||||
})
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: 5
|
||||
topPadding: 10
|
||||
|
||||
Label {
|
||||
text: qsTr("Already have an account?")
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Log in") + "!"
|
||||
font {
|
||||
italic: true
|
||||
underline: true
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: login()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue