- polished login page

- added refresh date to events (api version 0.01.15)
This commit is contained in:
Dorian Zedler 2019-01-27 20:47:36 +01:00
parent a2577e9ce4
commit 0e8f574dee
9 changed files with 85 additions and 52 deletions

View file

@ -1,5 +1,5 @@
<?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.9.4" android:versionCode="13" android:installLocation="auto"> <manifest package="com.itsblue.flgvertretungtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.9.4" android:versionCode="13" android:installLocation="auto">
<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="com.itsblue.flgvertretung.MainActivity" 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="com.itsblue.flgvertretung.MainActivity" android:label="fannyapp" android:screenOrientation="unspecified" android:launchMode="singleTop">

View file

@ -59,6 +59,8 @@ private:
ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData); ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData);
QList<int> apiVersion = {0,1,15};
private slots: private slots:
void setState(QString state); void setState(QString state);

View file

@ -26,10 +26,19 @@ Button {
property string image property string image
property real imageScale: 1 property real imageScale: 1
scale: control.pressed ? 0.8:1
Behavior on scale {
PropertyAnimation {
duration: 100
}
}
background: Item { background: Item {
id: controlBackgroundContainer id: controlBackgroundContainer
scale: control.pressed ? 0.8:1
Behavior on scale { Behavior on scale {
PropertyAnimation { PropertyAnimation {
@ -68,12 +77,6 @@ Button {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
scale: control.imageScale scale: control.imageScale
Behavior on scale {
PropertyAnimation {
duration: 100
}
}
} }
} }
} }

View file

@ -35,11 +35,15 @@ Page {
Image { Image {
id: bigLogo id: bigLogo
source: "qrc:/favicon.png" source: "qrc:/graphics/images/FannyIcon.png"
anchors.top: parent.top
anchors.left: parent.left anchors {
anchors.right: parent.right top: parent.top
anchors.margins: window.height * 0.01 left: parent.left
right: parent.right
margins: window.height * 0.01
}
height: window.height * 0.2 height: window.height * 0.2
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
mipmap: true mipmap: true
@ -48,7 +52,7 @@ Page {
Label { Label {
id: infoText id: infoText
text: "<html>Bitte melde dich mit den Anmeldedaten an, die du für den Vertretungsplan erhalten hast. text: "<html>Bitte melde dich mit den Anmeldedaten der Fanny-Webseite an.
<a href='http://www.fanny-leicht.de/j34/index.php/aktuelles/vertretungsplan'>Weitere Informationen</a></html>" <a href='http://www.fanny-leicht.de/j34/index.php/aktuelles/vertretungsplan'>Weitere Informationen</a></html>"
wrapMode: Text.Wrap wrapMode: Text.Wrap
onLinkActivated: { onLinkActivated: {
@ -66,13 +70,14 @@ Page {
Column { Column {
spacing: ( height - 100 ) * 0.1 spacing: ( height - 100 ) * 0.1
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
top: infoText.bottom top: infoText.bottom
bottom: parent.bottom bottom: parent.bottom
topMargin: window.height * 0.02 topMargin: root.height * 0.02
bottomMargin: window.height * 0.2 bottomMargin: root.height * 0.2
} }
TextField { TextField {
@ -91,7 +96,6 @@ Page {
TextField { TextField {
id: tipasswd id: tipasswd
echoMode: passwordHideShow.state === "visible" ? TextInput.Normal:TextInput.Password
placeholderText: "Passwort" placeholderText: "Passwort"
Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked) Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked)
@ -102,8 +106,6 @@ Page {
rightMargin: root.width * 0.05 rightMargin: root.width * 0.05
} }
MouseArea { MouseArea {
id: passwordHideShow id: passwordHideShow
anchors { anchors {
@ -125,19 +127,23 @@ Page {
state: "invisible" state: "invisible"
states: [ states: [
State {
name: "visible"
PropertyChanges {
target: visibleIcon
scale: 0
}
PropertyChanges {
target: invisibleIcon
scale: 1
}
},
State { State {
name: "invisible" name: "invisible"
PropertyChanges {
target: visibleIcon
scale: 0
}
PropertyChanges {
target: invisibleIcon
scale: 1
}
PropertyChanges {
target: tipasswd
echoMode: TextInput.Password
}
},
State {
name: "visible"
PropertyChanges { PropertyChanges {
target: visibleIcon target: visibleIcon
scale: 1 scale: 1
@ -146,17 +152,9 @@ Page {
target: invisibleIcon target: invisibleIcon
scale: 0 scale: 0
} }
} PropertyChanges {
] target: tipasswd
echoMode: TextInput.Normal
transitions: [
Transition {
from: "*"
to: "*"
NumberAnimation {
properties: "scale,opacity"
easing.type: Easing.InOutQuad
duration: 200
} }
} }
] ]
@ -169,7 +167,7 @@ Page {
bottom: parent.bottom bottom: parent.bottom
right: parent.right right: parent.right
bottomMargin: parent.height * 0.2 bottomMargin: parent.height * 0.25
topMargin: anchors.bottomMargin topMargin: anchors.bottomMargin
} }
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@ -204,14 +202,17 @@ Page {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
Button { FancyButton {
id: loginButton id: loginButton
objectName: "loginButton"
anchors {
horizontalCenter: parent.horizontalCenter
left: parent.left
margins: window.width * 0.05
}
text: qsTr("Anmelden") text: qsTr("Anmelden")
enabled: tiuname.length > 0 & tipasswd.length > 0 enabled: tiuname.length > 0 & tipasswd.length > 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.left: parent.left
anchors.margins: window.width * 0.05
onClicked: login(tiuname.text, tipasswd.text, cBperm.checked) onClicked: login(tiuname.text, tipasswd.text, cBperm.checked)
} }
Label { Label {
@ -254,11 +255,7 @@ Page {
app.state = "loggedIn" app.state = "loggedIn"
} }
else{ else{
// if it wasn't -> reset the stored credentinals // if it wasn't -> set the error label to the error short description of the retuned error code
_cppAppSettings.writeSetting("permanent", "0")
_cppAppSettings.writeSetting("username", "")
_cppAppSettings.writeSetting("password", "")
// and set the error label to the error short description of the retuned error code
laStatus.text = app.getErrorInfo(ret)[1] laStatus.text = app.getErrorInfo(ret)[1]
} }
} }

View file

@ -95,6 +95,12 @@ ApplicationWindow {
} }
} }
FontLoader {
id: fontAwesome
name: "fontawesome"
source: "qrc:/fonts/fontawesome-webfont.ttf"
}
function getErrorInfo(errorCode) { function getErrorInfo(errorCode) {
var infoLevel var infoLevel
@ -141,6 +147,11 @@ ApplicationWindow {
errorString = "Ungültiger Aufruf" errorString = "Ungültiger Aufruf"
errorDescription = "Die aufgerufene Funktion ist momentan nicht verfügbar, bitte versuche es später erneut." errorDescription = "Die aufgerufene Funktion ist momentan nicht verfügbar, bitte versuche es später erneut."
break break
case 904:
infoLevel = 2
errorString = "Inkompatible API"
errorDescription = "Die Version der API auf dem Server ist zu neu und kann daher nicht verarbeitet werden. Bitte aktualisiere die App auf die aktuellste Version."
break
default: default:
infoLevel = 2 infoLevel = 2
errorString = "Unerwarteter Fehler ("+errorCode+")" errorString = "Unerwarteter Fehler ("+errorCode+")"

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View file

@ -20,5 +20,7 @@
<file>sampleEventData/sample.pdf</file> <file>sampleEventData/sample.pdf</file>
<file>sampleEventData/sample.txt</file> <file>sampleEventData/sample.txt</file>
<file>sampleEventData/sample.json</file> <file>sampleEventData/sample.json</file>
<file>fonts/fontawesome-webfont.ttf</file>
<file>graphics/images/FannyIcon.png</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -84,6 +84,10 @@ int ServerConn::login(QString username, QString password, bool permanent)
else { else {
// if not 200 was returned -> error -> return the return code // if not 200 was returned -> error -> return the return code
this->setState("notLoggedIn"); this->setState("notLoggedIn");
// -> reset the stored credentinals
pGlobalAppSettings->writeSetting("permanent", "0");
pGlobalAppSettings->writeSetting("username", "");
pGlobalAppSettings->writeSetting("password", "");
return(ret.status_code); return(ret.status_code);
} }
} }
@ -180,9 +184,23 @@ int ServerConn::getEvents(QString day)
// get the version of the json format // get the version of the json format
QString version = dataArray.value("version").toString(); QString version = dataArray.value("version").toString();
QStringList versionList = version.split(".");
if(versionList.length() < 3){
return(900);
}
int versionMajor = version.split(".")[0].toInt();
int versionMinor = version.split(".")[1].toInt();
int versionRevision = version.split(".")[2].toInt();
if(versionMajor > this->apiVersion[0] || versionMinor > this->apiVersion[1]){
return(904);
}
// get the header data // get the header data
tmpEventHeader.append(dataArray.value("targetDate").toString()); tmpEventHeader.append(dataArray.value("targetDate").toString());
tmpEventHeader.append(dataArray.value("refreshDate").toString());
tmpEventHeader.append(dataArray.value("stewardingClass").toString()); tmpEventHeader.append(dataArray.value("stewardingClass").toString());
// expand the length of the header list to seven to prevent list out of range errors // expand the length of the header list to seven to prevent list out of range errors