minor bugfixes

This commit is contained in:
Dorian Zedler 2018-12-21 23:56:10 +01:00
parent 2db43a1f76
commit 4cec1f2ba4
4 changed files with 26 additions and 24 deletions

View file

@ -1,4 +1,4 @@
QT += qml quick quickcontrols2 xml widgets webview QT += qml quick quickcontrols2 xml widgets #webview
CONFIG += c++11 CONFIG += c++11
# The following define makes your compiler emit warnings if you use # The following define makes your compiler emit warnings if you use
@ -16,7 +16,7 @@ TEMPLATE = app
TARGET = fannyapp TARGET = fannyapp
ICON = favicon.icns ICON = favicon.icns
RC_ICONS = favicon.ico RC_ICONS = shared/favicon.ico
SOURCES += \ SOURCES += \
sources/serverconn.cpp \ sources/serverconn.cpp \

View file

@ -143,7 +143,7 @@ Page {
drawer.close() drawer.close()
busyDialog.close() busyDialog.close()
if(ret === 200 || _cppServerConn.getEventData(0).grade !== ""){ if(ret === 200 || _cppServerConn.getEventData(0).grade !== ""){
stackView.push("qrc:/EventForm.qml") stackView.push("qrc:/Forms/EventForm.qml")
} }
} }
} }

View file

@ -25,6 +25,8 @@ ApplicationWindow {
property string background_color: "white" property string background_color: "white"
property string toolbar_color: "#312f38" property string toolbar_color: "#312f38"
state: "loggedIn"
states: [ states: [
State { State {
name: "notLoggedIn" name: "notLoggedIn"
@ -70,12 +72,12 @@ ApplicationWindow {
console.log("Perm") console.log("Perm")
var ret = _cppServerConn.login(_cppAppSettings.loadSetting("username"), _cppAppSettings.loadSetting("password"), true); var ret = _cppServerConn.login(_cppAppSettings.loadSetting("username"), _cppAppSettings.loadSetting("password"), true);
if(ret === "OK"){ if(ret === "OK"){
initdone = true app.initdone = true
_cppAppSettings.writeSetting("init", 1); _cppAppSettings.writeSetting("init", 1);
if(app.state !== "loggedIn"){ if(app.state !== "loggedIn"){
app.state = "loggedIn" app.state = "loggedIn"
} }
window.is_error = false; app.is_error = false;
} }
else if(ret === "Keine Verbindung zum Server."){ else if(ret === "Keine Verbindung zum Server."){
handleError(0) handleError(0)
@ -102,11 +104,11 @@ ApplicationWindow {
Timer { Timer {
id: refreshTimer id: refreshTimer
interval: 1000; interval: 1000;
running: app.initdone && stackView.currentItem.objectName !== "LoginPage" running: app.initdone && app.state !== "notLoggedIn"
repeat: true repeat: true
onTriggered: { onTriggered: {
var ret = _cppServerConn.checkConn() var ret = _cppServerConn.checkConn()
handleError(ret) app.handleError(ret)
} }
} }
@ -121,7 +123,7 @@ ApplicationWindow {
mainStack.replace(currPage) mainStack.replace(currPage)
} }
initialItem: mainPage //initialItem: mainPage
Component { Component {
id: loginPage id: loginPage
@ -136,8 +138,8 @@ ApplicationWindow {
function handleError(error_code){ function handleError(error_code){
if(error_code === 200){ if(error_code === 200){
window.is_error = false; app.is_error = false;
window.error = ""; app.error = "";
} }
else if(error_code === 401){ else if(error_code === 401){
console.warn("401") console.warn("401")
@ -148,28 +150,28 @@ ApplicationWindow {
console.log("switching to login page") console.log("switching to login page")
stackView.push("./Pages/LoginPage.qml"); stackView.push("./Pages/LoginPage.qml");
} }
window.is_error = true; app.is_error = true;
window.error = "Nicht angemeldet!!"; app.error = "Nicht angemeldet!!";
} }
else if(error_code === 500){ else if(error_code === 500){
window.is_error = true; app.is_error = true;
window.error = "Interner Server Fehler!"; app.error = "Interner Server Fehler!";
} }
else if(error_code === 0){ else if(error_code === 0){
window.is_error = true; app.is_error = true;
window.error = "Keine Verbindung zum Server!"; app.error = "Keine Verbindung zum Server!";
} }
else if(error_code === 404){ else if(error_code === 404){
//the testcon function calls a non existent file to be fast, so no error here //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){ else if(error_code === 111){
window.is_error = true; app.is_error = true;
window.error = "Unbekannter interner Fehler!"; app.error = "Unbekannter interner Fehler!";
} }
else { else {
window.is_error = true; app.is_error = true;
window.error = "Unbekannter Fehler! ("+error_code+")"; app.error = "Unbekannter Fehler! ("+error_code+")";
} }
} }

View file

@ -1,4 +1,4 @@
#include <QtWebView/QtWebView> //#include <QtWebView/QtWebView>
#include <QMessageBox> #include <QMessageBox>
#include <QGuiApplication> #include <QGuiApplication>
@ -21,7 +21,7 @@
#include <QScreen> #include <QScreen>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QtQml/QQmlContext> #include <QtQml/QQmlContext>
#include <QtWebView> //#include <QtWebView>
#include "headers/serverconn.h" #include "headers/serverconn.h"
#include "headers/appsettings.h" #include "headers/appsettings.h"
@ -37,7 +37,7 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
QtWebView::initialize(); //QtWebView::initialize();
QQuickStyle::setStyle("Material"); QQuickStyle::setStyle("Material");
QQmlApplicationEngine engine; QQmlApplicationEngine engine;