From eb118bc094f545bcb40814768ab3181bace43fb3 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 14 Oct 2018 18:39:09 +0200 Subject: [PATCH] Anfang der in-app Anzeige des vertretungsplanes --- android-sources/AndroidManifest.xml | 2 +- fannyapp.pro.user.736334c | 336 ----------- fannyapp.pro.user.a7af30b | 882 ---------------------------- headers/serverconn.h | 4 + qml/EventForm.qml | 215 +++++++ qml/MainPage.qml | 14 + qml/qml.qrc | 1 + source/serverconn.cpp | 100 +++- 8 files changed, 332 insertions(+), 1222 deletions(-) delete mode 100644 fannyapp.pro.user.736334c delete mode 100644 fannyapp.pro.user.a7af30b create mode 100644 qml/EventForm.qml diff --git a/android-sources/AndroidManifest.xml b/android-sources/AndroidManifest.xml index 0f0918a..0c8dc9b 100644 --- a/android-sources/AndroidManifest.xml +++ b/android-sources/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/fannyapp.pro.user.736334c b/fannyapp.pro.user.736334c deleted file mode 100644 index 6dbd4e2..0000000 --- a/fannyapp.pro.user.736334c +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - EnvironmentId - {736334c7-59b9-42fb-bb64-0bbe827a8b2c} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.10.1 clang 64bit - Desktop Qt 5.10.1 clang 64bit - qt.qt5.5101.clang_64_kit - 2 - 0 - 0 - - /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deployment - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deployment-Konfiguration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - fannyapp - - Qt4ProjectManager.Qt4RunConfiguration:/Users/dorian/Documents/git/fanny-app/fannyapp.pro - true - - fannyapp.pro - false - - /Users/dorian/Documents/git/build-fannyapp-Desktop_Qt_5_10_1_clang_64bit-Profile/fannyapp.app/Contents/MacOS - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/fannyapp.pro.user.a7af30b b/fannyapp.pro.user.a7af30b deleted file mode 100644 index df12bab..0000000 --- a/fannyapp.pro.user.a7af30b +++ /dev/null @@ -1,882 +0,0 @@ - - - - - - EnvironmentId - {a7af30b9-cb0f-45fd-9894-328c8b8b2887} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.10.1 MSVC2017 64bit - Desktop Qt 5.10.1 MSVC2017 64bit - qt.qt5.5101.win64_msvc2017_64_kit - 1 - 0 - 0 - - D:/Documents/Git/build-fannyapp-Desktop_Qt_5_10_1_MSVC2017_64bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - D:/Documents/Git/build-fannyapp-Desktop_Qt_5_10_1_MSVC2017_64bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - D:/Documents/Git/build-fannyapp-Desktop_Qt_5_10_1_MSVC2017_64bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deployment - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deployment-Konfiguration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - fannyapp - - Qt4ProjectManager.Qt4RunConfiguration:D:/Documents/Git/fanny-app/fannyapp.pro - true - - fannyapp.pro - false - - D:/Documents/Git/build-fannyapp-Desktop_Qt_5_10_1_MSVC2017_64bit-Release - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.Target.1 - - Qt 5.10.1 for UWP 32bit (MSVC 2017) - Qt 5.10.1 for UWP 32bit (MSVC 2017) - qt.qt5.5101.win64_msvc2017_winrt_x86_kit - 0 - 0 - 0 - - D:/Documents/Git/build-fannyapp-Qt_5_10_1_for_UWP_32bit_MSVC_2017-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - D:/Documents/Git/build-fannyapp-Qt_5_10_1_for_UWP_32bit_MSVC_2017-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - D:/Documents/Git/build-fannyapp-Qt_5_10_1_for_UWP_32bit_MSVC_2017-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - - true - - windeployqt ausführen - WinRt.BuildStep.Deploy - --qmldir D:\Documents\Git\fanny-app - - 1 - Deployment - - ProjectExplorer.BuildSteps.Deploy - - 1 - windeployqt ausführen - - WinRTAppxDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - App-Paket ausführen - WinRt.WinRtRunConfiguration:D:/Documents/Git/fanny-app/fannyapp.pro - 3768 - false - true - false - false - true - - false - - 1 - - - - ProjectExplorer.Project.Target.2 - - Android für armeabi-v7a (GCC 4.9, Qt 5.10.1 for Android armv7) - Android für armeabi-v7a (GCC 4.9, Qt 5.10.1 for Android armv7) - {944fd98d-a247-470d-994b-ce639c60daa2} - 0 - 0 - 0 - - D:/Documents/Git/build-fannyapp-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_10_1_for_Android_armv7-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - - true - Anwendungsdaten kopieren - - Qt4ProjectManager.AndroidPackageInstallationStep - - - android-27 - - true - Android-APK erstellen - - QmakeProjectManager.AndroidBuildApkStep - false - false - - 4 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - D:/Documents/Git/build-fannyapp-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_10_1_for_Android_armv7-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - - true - Anwendungsdaten kopieren - - Qt4ProjectManager.AndroidPackageInstallationStep - - - android-27 - - true - Android-APK erstellen - - QmakeProjectManager.AndroidBuildApkStep - false - false - - 4 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - D:/Documents/Git/build-fannyapp-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_10_1_for_Android_armv7-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - - true - Anwendungsdaten kopieren - - Qt4ProjectManager.AndroidPackageInstallationStep - - - android-27 - - true - Android-APK erstellen - - QmakeProjectManager.AndroidBuildApkStep - false - false - - 4 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - - true - Deployment auf Android-Gerät - - Qt4ProjectManager.AndroidDeployQtStep - false - - 1 - Deployment - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deployment auf Android-Gerät - - Qt4ProjectManager.AndroidDeployConfiguration2 - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - - - fannyapp - fannyapp - Qt4ProjectManager.AndroidRunConfiguration:D:/Documents/Git/fanny-app/fannyapp.pro - fannyapp.pro - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 3 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/headers/serverconn.h b/headers/serverconn.h index 6c09106..e5fd142 100644 --- a/headers/serverconn.h +++ b/headers/serverconn.h @@ -37,6 +37,9 @@ public: Q_INVOKABLE float getProgress(); Q_INVOKABLE int getFoodPlan(); Q_INVOKABLE QVariantMap getFoodPlanData(int index); + Q_INVOKABLE QVariantMap getEventData(int index); + Q_INVOKABLE int getEvents(); + Q_INVOKABLE int getEventCount(); ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData); signals: @@ -57,6 +60,7 @@ struct Day }; QList> m_weekplan; +QList m_eventlist; }; diff --git a/qml/EventForm.qml b/qml/EventForm.qml new file mode 100644 index 0000000..6c19ad1 --- /dev/null +++ b/qml/EventForm.qml @@ -0,0 +1,215 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import QtGraphicalEffects 1.0 + +Page { + id:root + //anchors.fill: parent + property bool cookplanChanged + title: qsTr("Vertretungsplan") + property string icon: "qrc:/graphics/FannyLogo_small.png" + property string link: "http://www.fanny-leicht.de/j34" + +// Image{ +// source: "qrc:/graphics/chat_background.jpg"; +// height: parent.height +// width: parent.width +// fillMode: Image.Tile +// horizontalAlignment: Image.AlignLeft +// verticalAlignment: Image.AlignTop +// } +// LinearGradient { +// anchors.fill: parent +// start: Qt.point(0, 0) +// end: Qt.point(0, parent.height) +// gradient: Gradient { +// GradientStop { position: 0.0; color: "#4db2b3" } +// GradientStop { position: 1.0; color: "#8f4dae" } +// } +// } + + Timer { + id: firstLoadTimer + interval: 1; + running: true + repeat: false + + onTriggered: { + _cppServerConn.getFoodPlan() + cookplanChanged = true + } + } + + ScrollView { + id:scroll + anchors.fill: parent + ListView { + id: listView + //width: 514 + model: _cppServerConn.getEventCount() + spacing: 0 + property var today: new Date + anchors { + right: parent.right + left: parent.left + top: parent.top + bottom: parent.bottom + leftMargin: 5 + rightMargin: 5 + topMargin: 3 + } + + delegate: Button { + + width: listView.width + id: delegate + height: visible ? cookteam.height + date.height + main_dish.height + main_dish_veg.height + garnish.height + dessert.height + spacer.height + cust_spacing*9 + 5:0 + visible: listView.isDayVisible(index) + + property int cust_spacing: 5 + + Label { + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + font.bold: true + id: cookteam + text: _cppServerConn.getEventData(index).grade + width: parent.width - 10 + wrapMode: Label.Wrap + height: text!=""? undefined:0 + } + Label { + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: cookteam.bottom + font.bold: true + id: date + text: _cppServerConn.getEventData(index).hour + width: parent.width - 10 + wrapMode: Label.Wrap + } + Rectangle { + anchors.top: date.bottom + anchors.topMargin: cust_spacing + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 10 + height: 2 + color: "grey" + + } + + Label { + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: date.bottom + anchors.topMargin: cust_spacing * 2 + width: parent.width - 10 + wrapMode: Label.Wrap + id: main_dish + text: _cppServerConn.getEventData(index).replace + height: text!=""? undefined:0 + } + + Rectangle { + anchors.top: main_dish.bottom + anchors.topMargin: cust_spacing + anchors.left: parent.left + anchors.leftMargin: 10 + width: parent.width / 10 + height: main_dish_veg.text!=""? 1:0 + color: "grey" + + } + + Label { + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: main_dish.bottom + anchors.topMargin: cust_spacing * 2 + id: main_dish_veg + text: _cppServerConn.getEventData(index).subject + width: parent.width - 10 + wrapMode: Label.Wrap + height: text!=""? undefined:0 + } + + Rectangle { + anchors.top: main_dish_veg.bottom + anchors.topMargin: cust_spacing + anchors.left: parent.left + anchors.leftMargin: 10 + width: parent.width / 10 + height: garnish.text!=""? 1:0 + color: "grey" + } + + Label { + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: main_dish_veg.bottom + anchors.topMargin: cust_spacing * 2 + id: garnish + text: _cppServerConn.getEventData(index).room + width: parent.width - 10 + wrapMode: Label.Wrap + height: text!=""? undefined:0 + } + + Rectangle { + anchors.top: garnish.bottom + anchors.topMargin: cust_spacing + anchors.left: parent.left + anchors.leftMargin: 10 + width: parent.width / 10 + height: dessert.text!=""? 1:0 + color: "grey" + + } + + Label { + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: garnish.bottom + anchors.topMargin: cust_spacing * 2 + id: dessert + text: _cppServerConn.getEventData(index).to + width: parent.width - 10 + wrapMode: Label.Wrap + height: text!=""? undefined:0 + } + + Label { + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: dessert.bottom + anchors.topMargin: cust_spacing + id: spacer + text: "" + } + } + + function getDateString(index){ + var date = _cppServerConn.getEventData(index).date + console.log(date.getTime()) + console.log(today.getTime()) + if(date.getDate() === today.getDate()){ + return("Heute") + } + else if(date.getTime() < (today.getTime() + (24 * 60 * 60 * 1000) )/*date.getDate() === today.getDate() + 1 || (date.getDate() === 1 && date.getMonth() === today.getMonth() + 1)*/){ + return("Morgen") + } + else { + return(Qt.formatDateTime(_cppServerConn.getEventData(index).date, "dddd, d.M.yy")) + } + + } + function isDayVisible(index){ + return(true) + } + } + } +} diff --git a/qml/MainPage.qml b/qml/MainPage.qml index 6e0806e..a36a987 100644 --- a/qml/MainPage.qml +++ b/qml/MainPage.qml @@ -132,6 +132,20 @@ Page { } } + ItemDelegate { + text: qsTr("Vertretungsplan") + width: parent.width + onClicked: { + busyDialog.open() + var ret = _cppServerConn.getEvents(); + drawer.close() + busyDialog.close() + if(ret === 200 || _cppServerConn.getEventData(0).grade !== ""){ + stackView.push("qrc:/EventForm.qml") + } + } + } + ItemDelegate { text: qsTr("Speiseplan") width: parent.width diff --git a/qml/qml.qrc b/qml/qml.qrc index f33724f..bd22266 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -9,5 +9,6 @@ WebsitePage.qml FoodPlanForm.qml ProgressCircle.qml + EventForm.qml diff --git a/source/serverconn.cpp b/source/serverconn.cpp index 81caa2c..527eca8 100644 --- a/source/serverconn.cpp +++ b/source/serverconn.cpp @@ -178,6 +178,63 @@ float ServerConn::getProgress() return(this->progress); } +int ServerConn::getEvents(){ + this->progress = 0; + ReturnData_t ret; //this is a custom type to store the returned data + // Call the webservice + + QNetworkRequest request(QUrl("https://api.itsblue.de/fanny/vertretung.php?uname=ZedlerDo&passwd=LxyJQB&day=smorgen&agree=true")); + request.setHeader(QNetworkRequest::ContentTypeHeader, + "application/x-www-form-urlencoded"); + + //set ssl configuration + //send a POST request with the given url and data to the server + QNetworkReply* reply; + + QUrlQuery pdata; + reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); + + connect(reply, SIGNAL(downloadProgress(qint64, qint64)), + this, SLOT(updateProgress(qint64, qint64))); + //wait until the request has finished + QEventLoop loop; + loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); + loop.exec(); + + //get the status code + QVariant status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); + this->progress = 1; + if(status_code != 200){ + return(status_code.toInt()); + } + + QString eventString = reply->readAll(); + eventString.replace(" - ", "-"); + eventString.replace(" / ", "/"); + eventString.replace("
", "");
+    eventString.replace("
", ""); + eventString.replace("Entfall für Lehrer", "Entfall_für_Lehrer"); + + QStringList tmp = eventString.split("\f"); + QStringList rawEvents; + QList tmpEvents; + for(int i=0; iprogress = 0; @@ -219,6 +276,7 @@ int ServerConn::getFoodPlan() ret.text.replace("\n",""); //remove unnecessary stuff ret.text.replace("\r",""); ret.text.replace("\t",""); + ret.text.replace("style=\"width: 25%;\"", "width=\"25%\""); QStringList stringlist_0 = ret.text.split( "" ); //split the @@ -246,6 +304,7 @@ int ServerConn::getFoodPlan() QStringList weeklist = table1list + table2list; //put both weeks into one big list + for (int i = 0; i <=7; i ++){ QString temp = weeklist[i]; //store item temporarly to edit it weeklist[i] = temp.left(temp.length()-5); //remove "" at the and of the Item @@ -279,6 +338,7 @@ int ServerConn::getFoodPlan() //qDebug() << temp_weekplan; + this->m_weekplan = temp_weekplan; //write changes to global foodplan qDebug() << temp_weekplan; @@ -308,14 +368,48 @@ QVariantMap ServerConn::getFoodPlanData(int index) } } QString date_string_on_db = ret[1]; - QDate Date = QDate::fromString(date_string_on_db,"dd.MM.yyyy"); + QDate Date = QDate::fromString(date_string_on_db," dd.MM.yyyy"); //date_string_on_db - //qDebug() << Date; - //qDebug() << ret; + qDebug() << Date; + qDebug() << ret; return { {"cookteam", ret[0]}, {"date", Date}, {"main_dish", ret[2]}, {"main_dish_veg", ret[3]}, {"garnish", ret[4]}, {"dessert", ret[5]} }; } +QVariantMap ServerConn::getEventData(int index) +{ + //cookteam, date, main dish, vagi main dish, garnish(Beilage) and Dessert. + + QStringList ret; //list to return + //qDebug() << index; + for(int i=0;i<=5;i++){ + + if(m_eventlist.size() > index){ + //qDebug() << i << m_weekplan[index].size(); + if(m_eventlist[index].size() > i){ + ret.append(m_eventlist[index][i]); + //qDebug() << i << m_weekplan[index][i]; + } + else { + ret.append(NULL); + } + } + else { + ret.append(NULL); + } + } + QString date_string_on_db = ret[1]; + QDate Date = QDate::fromString(date_string_on_db," dd.MM.yyyy"); + //date_string_on_db + qDebug() << Date; + qDebug() << ret; + return { {"grade", ret[0]}, {"hour", ret[1]}, {"replace", ret[2]}, {"subject", ret[3]}, {"room", ret[4]}, {"to", ret[5]} }; +} + +int ServerConn::getEventCount(){ + return (m_eventlist.length()); +} + ReturnData_t ServerConn::senddata(QUrl serviceUrl, QUrlQuery pdata) {