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
# 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 \

View file

@ -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")
}
}
}

View file

@ -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+")";
}
}

View file

@ -1,4 +1,4 @@
#include <QtWebView/QtWebView>
//#include <QtWebView/QtWebView>
#include <QMessageBox>
#include <QGuiApplication>
@ -21,7 +21,7 @@
#include <QScreen>
#include <QQmlApplicationEngine>
#include <QtQml/QQmlContext>
#include <QtWebView>
//#include <QtWebView>
#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;