From 5d7cca3572d74af881b04a068f22d029534c62c4 Mon Sep 17 00:00:00 2001 From: dorian Date: Mon, 25 Jun 2018 08:07:05 +0200 Subject: [PATCH] 0.03.1 --- android-sources/AndroidManifest.xml | 2 +- fannyapp.pro.user | 2 +- qml/MainPage.qml | 1 + qml/main.qml | 33 +++++++++++++++++++++-------- source/serverconn.cpp | 3 ++- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/android-sources/AndroidManifest.xml b/android-sources/AndroidManifest.xml index ed686a9..36c041e 100644 --- a/android-sources/AndroidManifest.xml +++ b/android-sources/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/fannyapp.pro.user b/fannyapp.pro.user index 864f934..374053c 100644 --- a/fannyapp.pro.user +++ b/fannyapp.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/qml/MainPage.qml b/qml/MainPage.qml index 90c0939..36e860f 100644 --- a/qml/MainPage.qml +++ b/qml/MainPage.qml @@ -3,6 +3,7 @@ import QtQuick.Controls 2.2 Page { id: root + objectName: "MainPage" anchors.fill: parent header: AppToolBar { contentHeight: toolButton.implicitHeight diff --git a/qml/main.qml b/qml/main.qml index 80e6905..9e052ae 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -10,20 +10,30 @@ ApplicationWindow { property bool is_error property string error property bool initdone: false + property bool firstinitdone: false + + onBeforeRendering: { + if(!firstinitdone){ + var isinit = _cppAppSettings.loadSetting("init") + console.log("getinit"); + console.log(isinit); + if(isinit === "0"){ + stackView.push("qrc:/LoginPage.qml", {}); + } + } + firstinitdone = true + } Timer { //runs only one time at applictaion lauch + property bool finished: true id: initTimer - interval: 1; - running: true - repeat: initdone === false + interval: 10; + running: initdone === false + repeat: finished onTriggered: { + finished = false var init = _cppAppSettings.loadSetting("init") - if(init !== "1"){ - stackView.push("qrc:/LoginPage.qml") - initdone = true - return - } var perm = _cppAppSettings.loadSetting("permanent") console.log("checkoldlogin", perm); @@ -32,11 +42,15 @@ ApplicationWindow { var ret = _cppServerConn.login(_cppAppSettings.loadSetting("username"), _cppAppSettings.loadSetting("password"), true); if(ret === "OK"){ _cppAppSettings.writeSetting("init", 1); + if(stackView.currentItem.objectName !== "MainPage"){ + stackView.push("qrc:/MainPage.qml", {}); + } window.is_error = false; } else if(ret === "Keine Verbindung zum Server."){ handleError(0) - initTimer.interval = 100 + //initTimer.interval = 1000 + finished = true return } @@ -48,6 +62,7 @@ ApplicationWindow { else { stackView.push("qrc:/LoginPage.qml") } + finished = true initdone = true } } diff --git a/source/serverconn.cpp b/source/serverconn.cpp index 7bd6442..cdbc074 100644 --- a/source/serverconn.cpp +++ b/source/serverconn.cpp @@ -186,6 +186,7 @@ float ServerConn::getProgress() int ServerConn::getFoodPlan() { + this->progress = 0; ReturnData_t ret; //this is a custom type to store the returned data // Call the webservice @@ -209,7 +210,7 @@ int ServerConn::getFoodPlan() //get the status code QVariant status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); - + this->progress = 1; if(status_code != 200){ return(status_code.toInt()); }