- polished login page
- added refresh date to events (api version 0.01.15)
This commit is contained in:
parent
a2577e9ce4
commit
0e8f574dee
9 changed files with 85 additions and 52 deletions
|
@ -1,5 +1,5 @@
|
|||
<?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">
|
||||
<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">
|
||||
|
|
|
@ -59,6 +59,8 @@ private:
|
|||
|
||||
ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData);
|
||||
|
||||
QList<int> apiVersion = {0,1,15};
|
||||
|
||||
private slots:
|
||||
|
||||
void setState(QString state);
|
||||
|
|
|
@ -26,10 +26,19 @@ Button {
|
|||
property string image
|
||||
property real imageScale: 1
|
||||
|
||||
|
||||
scale: control.pressed ? 0.8:1
|
||||
|
||||
Behavior on scale {
|
||||
PropertyAnimation {
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
|
||||
background: Item {
|
||||
id: controlBackgroundContainer
|
||||
|
||||
scale: control.pressed ? 0.8:1
|
||||
|
||||
|
||||
Behavior on scale {
|
||||
PropertyAnimation {
|
||||
|
@ -68,12 +77,6 @@ Button {
|
|||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
scale: control.imageScale
|
||||
|
||||
Behavior on scale {
|
||||
PropertyAnimation {
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,11 +35,15 @@ Page {
|
|||
|
||||
Image {
|
||||
id: bigLogo
|
||||
source: "qrc:/favicon.png"
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: window.height * 0.01
|
||||
source: "qrc:/graphics/images/FannyIcon.png"
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: window.height * 0.01
|
||||
}
|
||||
|
||||
height: window.height * 0.2
|
||||
fillMode: Image.PreserveAspectFit
|
||||
mipmap: true
|
||||
|
@ -48,7 +52,7 @@ Page {
|
|||
|
||||
Label {
|
||||
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>"
|
||||
wrapMode: Text.Wrap
|
||||
onLinkActivated: {
|
||||
|
@ -66,13 +70,14 @@ Page {
|
|||
|
||||
Column {
|
||||
spacing: ( height - 100 ) * 0.1
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: infoText.bottom
|
||||
bottom: parent.bottom
|
||||
topMargin: window.height * 0.02
|
||||
bottomMargin: window.height * 0.2
|
||||
topMargin: root.height * 0.02
|
||||
bottomMargin: root.height * 0.2
|
||||
}
|
||||
|
||||
TextField {
|
||||
|
@ -91,7 +96,6 @@ Page {
|
|||
|
||||
TextField {
|
||||
id: tipasswd
|
||||
echoMode: passwordHideShow.state === "visible" ? TextInput.Normal:TextInput.Password
|
||||
placeholderText: "Passwort"
|
||||
Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked)
|
||||
|
||||
|
@ -102,8 +106,6 @@ Page {
|
|||
rightMargin: root.width * 0.05
|
||||
}
|
||||
|
||||
|
||||
|
||||
MouseArea {
|
||||
id: passwordHideShow
|
||||
anchors {
|
||||
|
@ -125,19 +127,23 @@ Page {
|
|||
state: "invisible"
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "visible"
|
||||
PropertyChanges {
|
||||
target: visibleIcon
|
||||
scale: 0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: invisibleIcon
|
||||
scale: 1
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "invisible"
|
||||
PropertyChanges {
|
||||
target: visibleIcon
|
||||
scale: 0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: invisibleIcon
|
||||
scale: 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: tipasswd
|
||||
echoMode: TextInput.Password
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "visible"
|
||||
PropertyChanges {
|
||||
target: visibleIcon
|
||||
scale: 1
|
||||
|
@ -146,17 +152,9 @@ Page {
|
|||
target: invisibleIcon
|
||||
scale: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "*"
|
||||
to: "*"
|
||||
NumberAnimation {
|
||||
properties: "scale,opacity"
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 200
|
||||
PropertyChanges {
|
||||
target: tipasswd
|
||||
echoMode: TextInput.Normal
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -169,7 +167,7 @@ Page {
|
|||
bottom: parent.bottom
|
||||
right: parent.right
|
||||
|
||||
bottomMargin: parent.height * 0.2
|
||||
bottomMargin: parent.height * 0.25
|
||||
topMargin: anchors.bottomMargin
|
||||
}
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
@ -204,14 +202,17 @@ Page {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Button {
|
||||
FancyButton {
|
||||
id: loginButton
|
||||
objectName: "loginButton"
|
||||
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
left: parent.left
|
||||
margins: window.width * 0.05
|
||||
}
|
||||
|
||||
text: qsTr("Anmelden")
|
||||
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)
|
||||
}
|
||||
Label {
|
||||
|
@ -254,11 +255,7 @@ Page {
|
|||
app.state = "loggedIn"
|
||||
}
|
||||
else{
|
||||
// if it wasn't -> reset the stored credentinals
|
||||
_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
|
||||
// if it wasn't -> set the error label to the error short description of the retuned error code
|
||||
laStatus.text = app.getErrorInfo(ret)[1]
|
||||
}
|
||||
}
|
||||
|
|
11
qml/main.qml
11
qml/main.qml
|
@ -95,6 +95,12 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
FontLoader {
|
||||
id: fontAwesome
|
||||
name: "fontawesome"
|
||||
source: "qrc:/fonts/fontawesome-webfont.ttf"
|
||||
}
|
||||
|
||||
function getErrorInfo(errorCode) {
|
||||
|
||||
var infoLevel
|
||||
|
@ -141,6 +147,11 @@ ApplicationWindow {
|
|||
errorString = "Ungültiger Aufruf"
|
||||
errorDescription = "Die aufgerufene Funktion ist momentan nicht verfügbar, bitte versuche es später erneut."
|
||||
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:
|
||||
infoLevel = 2
|
||||
errorString = "Unerwarteter Fehler ("+errorCode+")"
|
||||
|
|
BIN
shared/fonts/fontawesome-webfont.ttf
Normal file
BIN
shared/fonts/fontawesome-webfont.ttf
Normal file
Binary file not shown.
BIN
shared/graphics/images/FannyIcon.png
Normal file
BIN
shared/graphics/images/FannyIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 76 KiB |
|
@ -20,5 +20,7 @@
|
|||
<file>sampleEventData/sample.pdf</file>
|
||||
<file>sampleEventData/sample.txt</file>
|
||||
<file>sampleEventData/sample.json</file>
|
||||
<file>fonts/fontawesome-webfont.ttf</file>
|
||||
<file>graphics/images/FannyIcon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -84,6 +84,10 @@ int ServerConn::login(QString username, QString password, bool permanent)
|
|||
else {
|
||||
// if not 200 was returned -> error -> return the return code
|
||||
this->setState("notLoggedIn");
|
||||
// -> reset the stored credentinals
|
||||
pGlobalAppSettings->writeSetting("permanent", "0");
|
||||
pGlobalAppSettings->writeSetting("username", "");
|
||||
pGlobalAppSettings->writeSetting("password", "");
|
||||
return(ret.status_code);
|
||||
}
|
||||
}
|
||||
|
@ -180,9 +184,23 @@ int ServerConn::getEvents(QString day)
|
|||
|
||||
// get the version of the json format
|
||||
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
|
||||
tmpEventHeader.append(dataArray.value("targetDate").toString());
|
||||
tmpEventHeader.append(dataArray.value("refreshDate").toString());
|
||||
tmpEventHeader.append(dataArray.value("stewardingClass").toString());
|
||||
|
||||
// expand the length of the header list to seven to prevent list out of range errors
|
||||
|
|
Reference in a new issue