added "show password" functionality and fixed some layout and compiling issues

This commit is contained in:
Dorian Zedler 2018-12-07 23:10:51 +01:00
parent 98e913a134
commit 58f5d4835b
6 changed files with 132 additions and 22 deletions

View file

@ -1,8 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<manifest package="com.itsblue.flgvertretung" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.04.1" android:versionCode="8" android:installLocation="auto"> <manifest package="com.itsblue.flgvertretungtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.04.1" android:versionCode="8" android:installLocation="auto">
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="fannyapp" android:icon="@drawable/icon"> <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="fannyapp" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="fannyapp" android:screenOrientation="unspecified" android:launchMode="singleTop"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="fannyapp" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter> <intent-filter>
@ -68,7 +66,7 @@
</application> </application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.

BIN
graphics/icons/hide.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
graphics/icons/view.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -1,12 +1,15 @@
import QtQuick 2.0 import QtQuick 2.11
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
Page { Page {
id: root id: root
//anchors.fill: parent
objectName: "LoginPage"; objectName: "LoginPage";
onHeightChanged: {
console.log(height)
}
header: AppToolBar { header: AppToolBar {
Label { Label {
text: "Anmeldung" text: "Anmeldung"
@ -24,6 +27,8 @@ Page {
anchors.margins: window.height * 0.01 anchors.margins: window.height * 0.01
height: window.height * 0.2 height: window.height * 0.2
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
} }
Label { Label {
@ -44,33 +49,138 @@ Page {
} }
} }
ColumnLayout { Column {
spacing: ( height - 100 ) * 0.1
spacing: 40 anchors {
width: parent.width left: parent.left
anchors.fill: parent right: parent.right
anchors.topMargin: bigLogo.height + infoText.height + window.height * 0.02 top: infoText.bottom
anchors.bottomMargin: window.height * 0.2 bottom: parent.bottom
topMargin: window.height * 0.02
bottomMargin: window.height * 0.2
}
TextField { TextField {
id: tiuname id: tiuname
placeholderText: "Benutzername" placeholderText: "Benutzername"
anchors.horizontalCenter: parent.horizontalCenter
Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked) Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked)
anchors.left: parent.left
anchors.margins: window.width * 0.05 anchors {
left: parent.left
leftMargin: root.width * 0.05
right: parent.right
rightMargin: root.width * 0.05
}
} }
TextField { TextField {
id: tipasswd id: tipasswd
echoMode: TextInput.Password echoMode: passwordHideShow.state === "visible" ? TextInput.Normal:TextInput.Password
placeholderText: "Passwort" placeholderText: "Passwort"
anchors.horizontalCenter: parent.horizontalCenter
Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked) Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked)
anchors.left: parent.left
anchors.margins: window.width * 0.05 anchors {
left: parent.left
leftMargin: root.width * 0.05
right: parent.right
rightMargin: root.width * 0.05
}
MouseArea {
id: passwordHideShow
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
}
width: visibleIcon.width
onClicked: {
if(state === "visible"){
state = "invisible"
}
else {
state = "visible"
}
}
state: "invisible"
states: [
State {
name: "visible"
PropertyChanges {
target: visibleIcon
scale: 0
}
PropertyChanges {
target: invisibleIcon
scale: 1
}
},
State {
name: "invisible"
PropertyChanges {
target: visibleIcon
scale: 1
}
PropertyChanges {
target: invisibleIcon
scale: 0
}
}
]
transitions: [
Transition {
from: "*"
to: "*"
NumberAnimation {
properties: "scale,opacity"
easing.type: Easing.InOutQuad
duration: 200
}
}
]
Image {
id: visibleIcon
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
bottomMargin: parent.height * 0.3
topMargin: bottomMargin
}
fillMode: Image.PreserveAspectFit
smooth: true
mipmap: true
source: "qrc:/graphics/icons/view.png"
}
Image {
id: invisibleIcon
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
bottomMargin: parent.height * 0.35
topMargin: bottomMargin
}
fillMode: Image.PreserveAspectFit
smooth: true
mipmap: true
source: "qrc:/graphics/icons/hide.png"
}
}
} }
CheckDelegate { CheckDelegate {

View file

@ -10,5 +10,7 @@
<file>graphics/icons/drawer.png</file> <file>graphics/icons/drawer.png</file>
<file>graphics/icons/menu.png</file> <file>graphics/icons/menu.png</file>
<file>graphics/FannyLogo_small.png</file> <file>graphics/FannyLogo_small.png</file>
<file>graphics/icons/hide.png</file>
<file>graphics/icons/view.png</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -183,7 +183,7 @@ int ServerConn::getEvents(){
ReturnData_t ret; //this is a custom type to store the returned data ReturnData_t ret; //this is a custom type to store the returned data
// Call the webservice // Call the webservice
QNetworkRequest request(QUrl("https://api.itsblue.de/fanny/vertretung.php?uname=ZedlerDo&passwd=LxyJQB&day=smorgen&agree=true")); QNetworkRequest request(QUrl("http://api.itsblue.de/fanny/vertretung.php?uname=ZedlerDo&passwd=LxyJQB&day=smorgen&agree=true"));
request.setHeader(QNetworkRequest::ContentTypeHeader, request.setHeader(QNetworkRequest::ContentTypeHeader,
"application/x-www-form-urlencoded"); "application/x-www-form-urlencoded");