diff --git a/fannyapp.pro b/fannyapp.pro index bf2e553..6e1df68 100644 --- a/fannyapp.pro +++ b/fannyapp.pro @@ -1,4 +1,4 @@ -QT += qml quick quickcontrols2 xml widgets webview +QT += qml quick quickcontrols2 xml widgets #webview CONFIG += c++11 # The following define makes your compiler emit warnings if you use @@ -16,7 +16,7 @@ TEMPLATE = app TARGET = fannyapp ICON = favicon.icns -RC_ICONS = favicon.ico +RC_ICONS = shared/favicon.ico SOURCES += \ sources/serverconn.cpp \ diff --git a/qml/Pages/MainPage.qml b/qml/Pages/MainPage.qml index a0cadde..082d831 100644 --- a/qml/Pages/MainPage.qml +++ b/qml/Pages/MainPage.qml @@ -143,7 +143,7 @@ Page { drawer.close() busyDialog.close() if(ret === 200 || _cppServerConn.getEventData(0).grade !== ""){ - stackView.push("qrc:/EventForm.qml") + stackView.push("qrc:/Forms/EventForm.qml") } } } diff --git a/qml/main.qml b/qml/main.qml index ef9452e..18317ba 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -25,6 +25,8 @@ ApplicationWindow { property string background_color: "white" property string toolbar_color: "#312f38" + state: "loggedIn" + states: [ State { name: "notLoggedIn" @@ -70,12 +72,12 @@ ApplicationWindow { console.log("Perm") var ret = _cppServerConn.login(_cppAppSettings.loadSetting("username"), _cppAppSettings.loadSetting("password"), true); if(ret === "OK"){ - initdone = true + app.initdone = true _cppAppSettings.writeSetting("init", 1); if(app.state !== "loggedIn"){ app.state = "loggedIn" } - window.is_error = false; + app.is_error = false; } else if(ret === "Keine Verbindung zum Server."){ handleError(0) @@ -102,11 +104,11 @@ ApplicationWindow { Timer { id: refreshTimer interval: 1000; - running: app.initdone && stackView.currentItem.objectName !== "LoginPage" + running: app.initdone && app.state !== "notLoggedIn" repeat: true onTriggered: { var ret = _cppServerConn.checkConn() - handleError(ret) + app.handleError(ret) } } @@ -121,7 +123,7 @@ ApplicationWindow { mainStack.replace(currPage) } - initialItem: mainPage + //initialItem: mainPage Component { id: loginPage @@ -136,8 +138,8 @@ ApplicationWindow { function handleError(error_code){ if(error_code === 200){ - window.is_error = false; - window.error = ""; + app.is_error = false; + app.error = ""; } else if(error_code === 401){ console.warn("401") @@ -148,28 +150,28 @@ ApplicationWindow { console.log("switching to login page") stackView.push("./Pages/LoginPage.qml"); } - window.is_error = true; - window.error = "Nicht angemeldet!!"; + app.is_error = true; + app.error = "Nicht angemeldet!!"; } else if(error_code === 500){ - window.is_error = true; - window.error = "Interner Server Fehler!"; + app.is_error = true; + app.error = "Interner Server Fehler!"; } else if(error_code === 0){ - window.is_error = true; - window.error = "Keine Verbindung zum Server!"; + app.is_error = true; + app.error = "Keine Verbindung zum Server!"; } else if(error_code === 404){ //the testcon function calls a non existent file to be fast, so no error here - window.is_error = false; + app.is_error = false; } else if(error_code === 111){ - window.is_error = true; - window.error = "Unbekannter interner Fehler!"; + app.is_error = true; + app.error = "Unbekannter interner Fehler!"; } else { - window.is_error = true; - window.error = "Unbekannter Fehler! ("+error_code+")"; + app.is_error = true; + app.error = "Unbekannter Fehler! ("+error_code+")"; } } diff --git a/sources/main.cpp b/sources/main.cpp index e81b70b..f040052 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -1,4 +1,4 @@ -#include +//#include #include #include @@ -21,7 +21,7 @@ #include #include #include -#include +//#include #include "headers/serverconn.h" #include "headers/appsettings.h" @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); - QtWebView::initialize(); + //QtWebView::initialize(); QQuickStyle::setStyle("Material"); QQmlApplicationEngine engine;