From 7f127b0febbb42f23609f30147b8d2c28e278531 Mon Sep 17 00:00:00 2001 From: dorian Date: Mon, 24 Dec 2018 21:37:32 +0100 Subject: [PATCH] - further implementation of the event parser and view - clean up of qml and c++ code --- headers/serverconn.h | 2 - qml/Components/EventDisplay.qml | 156 --- qml/Components/EventView.qml | 76 ++ qml/Components/FoodPlanDisplay.qml | 157 --- qml/Components/FoodPlanView.qml | 134 +++ qml/Forms/EventForm.qml | 2 +- qml/Forms/FoodPlanForm.qml | 2 +- qml/qml.qrc | 4 +- shared/samplehtml/.Download File.txt.swp | Bin 0 -> 1024 bytes shared/samplehtml/Download File.html | 1358 ++++++++++++++-------- shared/samplehtml/Download File.txt | 74 ++ shared/samplehtml/prefix.xml | 455 ++++++++ shared/shared.qrc | 1 + sources/appsettings.cpp | 2 +- sources/eventmodel.cpp | 6 +- sources/foodplanmodel.cpp | 2 +- sources/serverconn.cpp | 201 ++-- 17 files changed, 1734 insertions(+), 898 deletions(-) delete mode 100644 qml/Components/EventDisplay.qml create mode 100644 qml/Components/EventView.qml delete mode 100644 qml/Components/FoodPlanDisplay.qml create mode 100644 qml/Components/FoodPlanView.qml create mode 100644 shared/samplehtml/.Download File.txt.swp create mode 100644 shared/samplehtml/Download File.txt create mode 100644 shared/samplehtml/prefix.xml diff --git a/headers/serverconn.h b/headers/serverconn.h index e68787a..1d4f812 100644 --- a/headers/serverconn.h +++ b/headers/serverconn.h @@ -42,9 +42,7 @@ public: Q_INVOKABLE int checkConn(); Q_INVOKABLE float getProgress(); Q_INVOKABLE int getFoodPlan(); - Q_INVOKABLE QVariantMap getEventData(int index); Q_INVOKABLE int getEvents(QString day); - Q_INVOKABLE int getEventCount(); ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData); QList> m_weekplan; diff --git a/qml/Components/EventDisplay.qml b/qml/Components/EventDisplay.qml deleted file mode 100644 index 8ff3c75..0000000 --- a/qml/Components/EventDisplay.qml +++ /dev/null @@ -1,156 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.4 -import Backend 1.0 - -Item { - id: control -/* - 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 + text.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 - font.pixelSize: date.font.pixelSize * 1.5 - 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 - id: date - text: _cppServerConn.getEventData(index).hour + " | " - + _cppServerConn.getEventData(index).replace + " | " - + _cppServerConn.getEventData(index).subject + " | " - + _cppServerConn.getEventData(index).room + " | " - - width: parent.width - 10 - wrapMode: Label.Wrap - } - - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: date.bottom - anchors.topMargin: cust_spacing - font.pixelSize: date.font.pixelSize * 2 - font.bold: true - id: text - text: _cppServerConn.getEventData(index).to + " " + _cppServerConn.getEventData(index).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) )){ - return("Morgen") - } - else { - return(Qt.formatDateTime(_cppServerConn.getEventData(index).date, "dddd, d.M.yy")) - } - - } - function isDayVisible(index){ - return(true) - } - } - } -*/ - ListView { - id: eventList - - anchors.fill: parent - anchors.margins: 10 - - model: EventModel { - id: foodPlanModel - } - - delegate: Button { - width: listView.width - id: delegate - height: visible ? cookteam.height + date.height + text.height + cust_spacing*9 + 5:0 - visible: listView.isDayVisible(index) - - property int cust_spacing: 5 - - Label { - id: cookteam - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: parent.top - anchors.topMargin: 10 - font.bold: true - font.pixelSize: date.font.pixelSize * 1.5 - 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 - id: date - text: _cppServerConn.getEventData(index).hour + " | " - + _cppServerConn.getEventData(index).replace + " | " - + _cppServerConn.getEventData(index).subject + " | " - + _cppServerConn.getEventData(index).room + " | " - - width: parent.width - 10 - wrapMode: Label.Wrap - } - - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: date.bottom - anchors.topMargin: cust_spacing - font.pixelSize: date.font.pixelSize * 2 - font.bold: true - id: text - text: _cppServerConn.getEventData(index).to + " " + _cppServerConn.getEventData(index).text - } - } - } - -} - diff --git a/qml/Components/EventView.qml b/qml/Components/EventView.qml new file mode 100644 index 0000000..1f18445 --- /dev/null +++ b/qml/Components/EventView.qml @@ -0,0 +1,76 @@ +import Backend 1.0 +import QtQuick 2.9 +import QtQuick.Controls 2.4 + +ListView { + id: eventList + + anchors.fill: parent + anchors.margins: 10 + + model: EventModel { + id: foodPlanModel + } + + delegate: Button { + id: delegate + + width: eventList.width + height: contentCol.height + 10 + + Column { + id: contentCol + + anchors { + top: parent.top + left: parent.left + right: parent.right + margins: 10 + } + + height: childrenRect.height + 10 + + spacing: 1 + + Label { + id: gradeLa + // label for the grade + + font.bold: true + font.pixelSize: hourReplaceSubjectRoomLa.font.pixelSize * 1.5 + + width: parent.width - 10 + wrapMode: Label.Wrap + + text: grade + } + + Label { + id: hourReplaceSubjectRoomLa + // label for the hour, replacement, subject and room + + width: parent.width - 10 + wrapMode: Label.Wrap + + text: hour + " | " + + replace + " | " + + subject + " | " + + room + " | " + } + + Label { + id: toTextLa + // label for the new room (to) and the additional text (text) + + width: parent.width - 10 + wrapMode: Label.Wrap + + font.pixelSize: gradeLa.font.pixelSize + font.bold: true + + text: to !== "" && model.text !== "" ? to + " | " + model.text:model.to + model.text + } + } + } +} + diff --git a/qml/Components/FoodPlanDisplay.qml b/qml/Components/FoodPlanDisplay.qml deleted file mode 100644 index 1a87eb0..0000000 --- a/qml/Components/FoodPlanDisplay.qml +++ /dev/null @@ -1,157 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.4 -import QtQuick.Layouts 1.3 -import Backend 1.0 - -Item { - id: control - - ListView { - id: foodList - - anchors.fill: parent - anchors.margins: 10 - - model: FoodPlanModel { - id: foodPlanModel - } - - delegate: Button { - - width: foodList.width - id: delegate - height: visible ? cookteamLa.height + dateLa.height + mainDishLa.height + mainDishVegLa.height + garnishLa.height + dessertLa.height + spacer.height + cust_spacing*9 + 5:0 - visible: true//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: cookteamLa - text: cookteam - width: parent.width - 10 - wrapMode: Label.Wrap - height: text!=""? undefined:0 - } - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: cookteamLa.bottom - font.bold: true - id: dateLa - text: date - width: parent.width - 10 - wrapMode: Label.Wrap - } - Rectangle { - anchors.top: dateLa.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: dateLa.bottom - anchors.topMargin: cust_spacing * 2 - width: parent.width - 10 - wrapMode: Label.Wrap - id: mainDishLa - text: mainDish - height: text!=""? undefined:0 - } - - Rectangle { - anchors.top: mainDishLa.bottom - anchors.topMargin: cust_spacing - anchors.left: parent.left - anchors.leftMargin: 10 - width: parent.width / 10 - height: mainDishVegLa.text!=""? 1:0 - color: "grey" - - } - - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: mainDishLa.bottom - anchors.topMargin: cust_spacing * 2 - id: mainDishVegLa - text: mainDishVeg - width: parent.width - 10 - wrapMode: Label.Wrap - height: text!=""? undefined:0 - } - - Rectangle { - anchors.top: mainDishVegLa.bottom - anchors.topMargin: cust_spacing - anchors.left: parent.left - anchors.leftMargin: 10 - width: parent.width / 10 - height: garnishLa.text!=""? 1:0 - color: "grey" - } - - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: mainDishVegLa.bottom - anchors.topMargin: cust_spacing * 2 - id: garnishLa - text: garnish - width: parent.width - 10 - wrapMode: Label.Wrap - height: text!=""? undefined:0 - } - - Rectangle { - anchors.top: garnishLa.bottom - anchors.topMargin: cust_spacing - anchors.left: parent.left - anchors.leftMargin: 10 - width: parent.width / 10 - height: dessertLa.text!=""? 1:0 - color: "grey" - - } - - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: garnishLa.bottom - anchors.topMargin: cust_spacing * 2 - id: dessertLa - text: dessert - width: parent.width - 10 - wrapMode: Label.Wrap - height: text!=""? undefined:0 - } - - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: dessertLa.bottom - anchors.topMargin: cust_spacing - id: spacer - text: "" - } - } - - } - -} - - - diff --git a/qml/Components/FoodPlanView.qml b/qml/Components/FoodPlanView.qml new file mode 100644 index 0000000..ca7a937 --- /dev/null +++ b/qml/Components/FoodPlanView.qml @@ -0,0 +1,134 @@ +import Backend 1.0 +import QtQuick 2.9 +import QtQuick.Controls 2.4 + +ListView { + id: foodList + + anchors.fill: parent + anchors.margins: 10 + + model: FoodPlanModel { + id: foodPlanModel + } + + delegate: Button { + id: delegate + + width: foodList.width + height: contentCol.height + 10 + + Column { + id: contentCol + + anchors { + top: parent.top + left: parent.left + right: parent.right + margins: 10 + } + + height: childrenRect.height + 10 + + spacing: 2 + + Label { + id: cookteamLa + // label for the cookteam + + width: parent.width + wrapMode: Label.Wrap + + font.bold: true + + text: cookteam + } + + Label { + id: dateLa + // label for the date + + width: parent.width + wrapMode: Label.Wrap + + font.bold: true + + text: date + } + + Rectangle { + width: parent.width + height: 2 + color: "grey" + } + + Label { + id: mainDishLa + // label for the main dish + + width: parent.width + wrapMode: Label.Wrap + + text: mainDish + } + + Rectangle { + width: parent.width / 10 + height: mainDishVegLa.text!=""? 1:0 + color: "grey" + } + + Label { + id: mainDishVegLa + // label for the vegetarian main dish + + width: parent.width + height: text!=""? undefined:0 + + wrapMode: Label.Wrap + + text: mainDishVeg + } + + Rectangle { + width: parent.width / 10 + height: garnishLa.text!=""? 1:0 + color: "grey" + } + + Label { + id: garnishLa + // label for the garnish + + width: parent.width + height: text!=""? undefined:0 + + wrapMode: Label.Wrap + + text: garnish + } + + Rectangle { + width: parent.width / 10 + height: dessertLa.text!=""? 1:0 + color: "grey" + } + + Label { + id: dessertLa + // label for the dessert + + width: parent.width + height: text!=""? undefined:0 + + wrapMode: Label.Wrap + + text: dessert + } + } + } +} + + + + diff --git a/qml/Forms/EventForm.qml b/qml/Forms/EventForm.qml index 6fde6f6..e2eb3d5 100644 --- a/qml/Forms/EventForm.qml +++ b/qml/Forms/EventForm.qml @@ -59,7 +59,7 @@ Page { repeat: false onTriggered: { status = _cppServerConn.getEvents(day) - pageLoader.source = "../Components/EventDisplay.qml" + pageLoader.source = "../Components/EventView.qml" } } diff --git a/qml/Forms/FoodPlanForm.qml b/qml/Forms/FoodPlanForm.qml index 41231c8..a20e0ad 100644 --- a/qml/Forms/FoodPlanForm.qml +++ b/qml/Forms/FoodPlanForm.qml @@ -60,7 +60,7 @@ Page { repeat: false onTriggered: { root.status = _cppServerConn.getFoodPlan() - pageLoader.source = "../Components/FoodPlanDisplay.qml" + pageLoader.source = "../Components/FoodPlanView.qml" } } diff --git a/qml/qml.qrc b/qml/qml.qrc index 5a12ddc..a500861 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -9,9 +9,9 @@ Pages/MainPage.qml Components/FancyButton.qml Forms/HomeForm.qml - Components/FoodPlanDisplay.qml + Components/FoodPlanView.qml Forms/LoadingForm.qml - Components/EventDisplay.qml + Components/EventView.qml Components/InfoArea.qml diff --git a/shared/samplehtml/.Download File.txt.swp b/shared/samplehtml/.Download File.txt.swp new file mode 100644 index 0000000000000000000000000000000000000000..95f3e1502bfab70325aec9f325b998982db0f81d GIT binary patch literal 1024 zcmYc?$V<%2S1{7E)U#kf0!!o=7*g_!G86NV1aUC4N{dTMi*ZOI3A^N%=jG%lrYN{& W=A`PCRFojejWS0=U^E2i9|8ci>kqL2 literal 0 HcmV?d00001 diff --git a/shared/samplehtml/Download File.html b/shared/samplehtml/Download File.html index e1624b0..1a3278b 100644 --- a/shared/samplehtml/Download File.html +++ b/shared/samplehtml/Download File.html @@ -1,497 +1,871 @@ - - + MergedFile - - - - + + - - - - -
-

D-70563 FANNY-LEICHT-GYMN.

-

STUTTGART, F.-LEICHT-STR. 13

-

Schuljahr 2018/19 - 1. Halbjahr
gültig ab 10. September 2018

-

Untis 2017

-

13.12.2018  9:04

-

Klasse  13.12. / Donnerstag Woche-A

-

Ordnungsdienst: Klasse 10a

-

Kl.

-

Std.

-

Vertr. Fach Rau nach

-

Vertretungs-Text

-

5b

-

1

-

Hei

-

D

-

---

-

Entfall

-

5b

-

2

-

Fu

-

D

-

114

-

Hei / Aufgaben, Arbeitsheft!

-

5b

-

3

-

Oe

-

M

-

114

-

Ei / Aufgaben

-

5b

-

4

-

Rm

-

M

-

114

-

Ei / Aufgaben

-

6bc

-

5

-

Sf

-

EvR

-

321

-

Bü / Aufgaben

-

6bc

-

5

-

Dk

-

KR

-

121

-

We / Aufgaben

-

6bc

-

6

-

-

EvR

-

---

-

Entfall

-

6bc

-

6

-

We

-

KR

-

---

-

Entfall

-

6d

-

6

-

Ku

-

Ek

-

---

-

Entfall

-

7b

-

2

-

Ga

-

G

-

414

-

KA Fkr

-

7b

-

8

-

Gg

-

BK

-

---

-

Mi-12.12. / 1

-

7b

-

9

-

Gg

-

BK

-

---

-

Mi-12.12. / 2

-

7c

-

8 - 9

-

Gw

-

G

-

---

-

Entfall

-

7d

-

1

-

Ku

-

D

-

---

-

Entfall

-

7d

-

2

-

Oz

-

D

-

416

-

Ku / Aufgaben

-

8a

-

1 - 2

-

Ei

-

Ch

-

---

-

Entfall

-

KEINE KA

-

9ac

-

8 - 9

-

Lk

-

SpJ

-

---

-

Entfall

-

9c

-

1 - 2

-

Jw

-

Gk

-

322

-

Raum!

-

9c

-

3

-

Hf

-

D

-

220

-

Hei / Aufgaben

-

9c

-

4

-

Bkn

-

D

-

220

-

Hei / Aufgaben

-

9d

-

1

-

Rt

-

Gk

-

---

-

Do-13.12. / 3

-

9d

-

2

-

Rt

-

Gk

-

---

-

Do-13.12. / 4

-

9d

-

3

-

Rt

-

Gk

-

218

-

9d

-

4

-

Rt

-

Gk

-

218

-

9d

-

5

-

Ni

-

BK

-

126

-

9d

-

6

-

Ni

-

BK

-

126

-

9d

-

8

-

Ni

-

BK

-

---

-

Do-13.12. / 5

-

9d

-

9

-

Ni

-

BK

-

---

-

Do-13.12. / 6

-

10b

-

10 - 11

-

Fe

-

Ph

-

---

-

Entfall

-

11

-

3 - 4

-

Ft

-

g4

-

---

-

Entfall

-

11

-

5

-

Ei

-

M1

-

---

-

Entfall

-

11

-

7

-

Gt

-

sem1 324

-

geteilte Gruppen Schwimmen / 

-

11

-

8 - 9

-

Ro

-

sem1 ???

-

11

-

10 - 11

-

Lk

-

sp3

-

---

-

Entfall

-

12

-

1 - 2

-

Ni

-

bk1

-

412

-

Raum!

-

12

-

5

-

Ku

-

D2

-

---

-

Entfall

-

1112 8 - 9

-

Fe

-

vma

-

---

-

Entfall

-
- - - -
-

D-70563 FANNY-LEICHT-GYMN.

-

STUTTGART, F.-LEICHT-STR. 13

-

Schuljahr 2018/19 - 1. Halbjahr
gültig ab 10. September 2018

-

Untis 2017

-

13.12.2018  8:11

-

Klasse  14.12. / Freitag Woche-A

-

Ordnungsdienst: Klasse 10a

-

Kl.

-

Std. Vertr. Fach Rau nach

-

Vertretungs-Text

-

5abc 1

-

We

-

KR

-

---

-

Entfall

-

5a

-

1

-

-

EvR

-

---

-

Entfall

-

5abc 2

-

Jw

-

KR

-

123

-

We / Aufgaben

-

5a

-

2

-

Ng

-

EvR

-

321

-

Bü / Aufgaben

-

5d

-

3

-

Lo

-

D

-

122

-

anstatt 17.12., 1. Std.

-

5d

-

4

-

Lo

-

D

-

122

-

anstatt 19.12., 1 Std.

-

6a

-

6

-

He

-

E

-

---

-

Entfall

-

6acd 7

-

Ft

-

MF

-

---

-

Entfall

-

6c

-

1

-

Ku

-

D

-

---

-

Entfall

-

6c

-

2

-

Sl

-

D

-

121

-

Ku / Aufgaben

-

7a

-

3

-

Di

-

D

-

323

-

Raum

-

7a

-

4

-

Hhn

-

M

-

323

-

7a

-

5

-

Hhn

-

M

-

323

-

7a

-

6

-

Hhn

-

M

-

323

-

findet statt!

-

7b

-

6

-

Rt

-

D

-

---

-

Entfall

-

8a

-

1

-

Ft

-

M

-

---

-

Entfall

-

8a

-

2

-

Li

-

E

-

323

-

statt 18.12.

-

9c

-

5 - 6

-

Hei

-

D

-

---

-

Entfall

-

9d

-

1 - 2 Rm

-

NWT 412

-

Raum

-

9d

-

5 - 6

-

Ft

-

M

-

---

-

Entfall

-

10a

-

3 - 4 Smr

-

E

-

413

-

Hörverstehensklausur

-

10ad 3

-

Ro

-

EvR

-

SH

-

Sport!

-

10ad 3 - 4

-

We

-

KR

-

---

-

Entfall

-

10ad 4

-

Lk

-

EvR

-

SH

-

Sport!

-

10b

-

3 - 4 Ki

-

E

-

414

-

Hörverstehensklausur

-

10b

-

3 - 4

-

He

-

Gk

-

---

-

Entfall für Lehrer

-

10bc 5 - 6

-

We

-

KR

-

---

-

Entfall

-

10c

-

3 - 4

-

Ran

-

M

-

---

-

Entfall

-

alle bei Oe

-

10c

-

3 - 4 Oe

-

E

-

422

-

Hörverstehensklausur

-

10d

-

3 - 4 Wd

-

E

-

416

-

Hörverstehensklausur

-

11

-

3 - 4 At

-

D3

-

121

-

Raum

-

11

-

3 - 4 Sl

-

D2

-

415

-

Raum

-

12

-

1 - 2 Lo

-

Sp1

-

222

-

Theorie

-

12

-

3 - 4 Mf

-

E2

-

218

-

Raum

-

12

-

3 - 4 Sf

-

M3

-

322

-

Raum

-

12

-

3 - 4

-

Ft

-

M2

-

---

-

Entfall

-

12

-

5 - 6

-

Ku

-

ek1

-

---

-

Entfall

-
+ + + + + + + D-70563 + FANNY-LEICHT-GYMN. + + + + + STUTTGART, + F.-LEICHT-STR. + 13 + + + + + + + Schuljahr + 2018/19 + - + 1. + Halbjahr + + + gültig + ab + 10. + September + 2018 + + + + + + + Klasse + 13.12. + / + Donnerstag + Woche-A + + + + + Ordnungsdienst: + Klasse + 10a + + + + + + + Kl. + + + 5b + + + 5b + + + 5b + + + 5b + + + 6bc + + + 6bc + + + 6bc + + + 6bc + + + 6d + + + 7b + + + 7b + + + 7b + + + 7c + + + 7d + + + 7d + + + 8a + + + 9ac + + + 9c + + + 9c + + + 9c + + + 9d + + + 9d + + + 9d + + + 9d + + + 9d + + + 9d + + + 9d + + + 9d + + + 10b + + + 11 + + + 11 + + + 11 + + + 11 + + + 11 + + + 12 + + + 12 + + + 1112 + + + + + + + Std. + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 5 + + + 6 + + + 6 + + + 6 + + + 2 + + + 8 + + + 9 + + + 8 + - + 9 + + + 1 + + + 2 + + + 1 + - + 2 + + + 8 + - + 9 + + + 1 + - + 2 + + + 3 + + + 4 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 8 + + + 9 + + + 10 + - + 11 + + + 3 + - + 4 + + + 5 + + + 7 + + + 8 + - + 9 + + + 10 + - + 11 + + + 1 + - + 2 + + + 5 + + + 8 + - + 9 + + + + + + + Vertr. + + + Hei + + + Fu + + + Oe + + + Rm + + + Sf + + + Dk + + + + + + We + + + Ku + + + Ga + + + Gg + + + Gg + + + Gw + + + Ku + + + Oz + + + Ei + + + Lk + + + Jw + + + Hf + + + Bkn + + + Rt + + + Rt + + + Rt + + + Rt + + + Ni + + + Ni + + + Ni + + + Ni + + + Fe + + + Ft + + + Ei + + + Gt + + + Ro + + + Lk + + + Ni + + + Ku + + + Fe + + + + + + + Fach + + + D + + + D + + + M + + + M + + + EvR + + + KR + + + EvR + + + KR + + + Ek + + + G + + + BK + + + BK + + + G + + + D + + + D + + + Ch + + + SpJ + + + Gk + + + D + + + D + + + Gk + + + Gk + + + Gk + + + Gk + + + BK + + + BK + + + BK + + + BK + + + Ph + + + g4 + + + M1 + + + sem1 + + + sem1 + + + sp3 + + + bk1 + + + D2 + + + vma + + + + + + + Rau + + + --- + + + 114 + + + 114 + + + 114 + + + 321 + + + 121 + + + --- + + + --- + + + --- + + + 414 + + + --- + + + --- + + + --- + + + --- + + + 416 + + + --- + + + --- + + + 322 + + + 220 + + + 220 + + + --- + + + --- + + + 218 + + + 218 + + + 126 + + + 126 + + + --- + + + --- + + + --- + + + --- + + + --- + + + 324 + + + ??? + + + --- + + + 412 + + + --- + + + --- + + + + + + + nach + + + Entfall + + + + + + + Vertretungs-Text + + + + + Hei + / + Aufgaben, + Arbeitsheft! + + + Ei + / + Aufgaben + + + Ei + / + Aufgaben + + + + / + Aufgaben + + + We + / + Aufgaben + + + + + + + Entfall + + + Entfall + + + Entfall + + + + + KA + Fkr + + + + + Mi-12.12. + / + 1 + + + Mi-12.12. + / + 2 + + + Entfall + + + Entfall + + + + + Entfall + + + Entfall + + + + + + + Ku + / + Aufgaben + + + KEINE + KA + + + + + Raum! + + + Hei + / + Aufgaben + + + Hei + / + Aufgaben + + + + + + + Do-13.12. + / + 3 + + + Do-13.12. + / + 4 + + + + + + + Do-13.12. + / + 5 + + + Do-13.12. + / + 6 + + + Entfall + + + Entfall + + + Entfall + + + + + geteilte + Gruppen + Schwimmen + / + + + + + Entfall + + + + + Raum! + + + + + Entfall + + + Entfall + + + + + + + Untis + 2017 + + + + + 13.12.2018 + 9:04 + + + + + + + diff --git a/shared/samplehtml/Download File.txt b/shared/samplehtml/Download File.txt new file mode 100644 index 0000000..a4f7952 --- /dev/null +++ b/shared/samplehtml/Download File.txt @@ -0,0 +1,74 @@ +5b 1 Hei D --- Entfall +5b 2 Fu D 114 Hei / Aufgaben, Arbeitsheft! +5b 3 Oe M 114 Ei / Aufgaben +5b 4 Rm M 114 Ei / Aufgaben +6bc 5 Sf EvR 321 Bü / Aufgaben +6bc 5 Dk KR 121 We / Aufgaben +6bc 6 Bü EvR --- Entfall +6bc 6 We KR --- Entfall +6d 6 Ku Ek --- Entfall +7b 2 Ga G 414 KA Fkr +7b 8 Gg BK --- Mi-12.12. / 1 +7b 9 Gg BK --- Mi-12.12. / 2 +7c 8-9 Gw G --- Entfall +7d 1 Ku D --- Entfall +7d 2 Oz D 416 Ku / Aufgaben +8a 1-2 Ei Ch --- Entfall KEINE KA +9ac 8-9 Lk SpJ --- Entfall +9c 1-2 Jw Gk 322 Raum! +9c 3 Hf D 220 Hei / Aufgaben +9c 4 Bkn D 220 Hei / Aufgaben +9d 1 Rt Gk --- Do-13.12. / 3 +9d 2 Rt Gk --- Do-13.12. / 4 +9d 3 Rt Gk 218 +9d 4 Rt Gk 218 +9d 5 Ni BK 126 +9d 6 Ni BK 126 +9d 8 Ni BK --- Do-13.12. / 5 +9d 9 Ni BK --- Do-13.12. / 6 +10b 10 - 11 Fe Ph --- Entfall +11 3-4 Ft g4 --- Entfall +11 5 Ei M1 --- Entfall +11 7 Gt sem1 324 geteilte Gruppen Schwimmen / +11 8-9 Ro sem1 ??? +11 10 - 11 Lk sp3 --- Entfall +12 1-2 Ni bk1 412 Raum! +12 5 Ku D2 --- Entfall +1112 8-9 Fe vma --- Entfall +5abc 1 We KR --- Entfall +5a 1 Bü EvR --- Entfall +5abc 2 Jw KR 123 We / Aufgaben +5a 2 Ng EvR 321 Bü / Aufgaben +5d 3 Lo D 122 anstatt 17.12., 1. Std. +5d 4 Lo D 122 anstatt 19.12., 1 Std. +6a 6 He E --- Entfall +6acd 7 Ft MF --- Entfall +6c 1 Ku D --- Entfall +6c 2 Sl D 121 Ku / Aufgaben +7a 3 Di D 323 Raum +7a 4 Hhn M 323 +7a 5 Hhn M 323 +7a 6 Hhn M 323 findet statt! +7b 6 Rt D --- Entfall +8a 1 Ft M --- Entfall +8a 2 Li E 323 statt 18.12. +9c 5-6 Hei D --- Entfall +9d 1-2 Rm NWT 412 Raum +9d 5-6 Ft M --- Entfall +10a 3-4 Smr E 413 Hörverstehensklausur +10ad 3 Ro EvR SH Sport! +10ad 3-4 We KR --- Entfall +10ad 4 Lk EvR SH Sport! +10b 3-4 Ki E 414 Hörverstehensklausur +10b 3-4 He Gk --- Entfall für Lehrer +10bc 5-6 We KR --- Entfall +10c 3-4 Ran M --- Entfall alle bei Oe +10c 3-4 Oe E 422 Hörverstehensklausur +10d 3-4 Wd E 416 Hörverstehensklausur +11 3-4 At D3 121 Raum +11 3-4 Sl D2 415 Raum +12 1-2 Lo Sp1 222 Theorie +12 3-4 Mf E2 218 Raum +12 3-4 Sf M3 322 Raum +12 3-4 Ft M2 --- Entfall +12 5-6 Ku ek1 --- Entfall diff --git a/shared/samplehtml/prefix.xml b/shared/samplehtml/prefix.xml new file mode 100644 index 0000000..3f8ea63 --- /dev/null +++ b/shared/samplehtml/prefix.xml @@ -0,0 +1,455 @@ + + + + + + + + + + +D-70563 FANNY-LEICHT-GYMN. +STUTTGART, F.-LEICHT-STR. 13 +Schuljahr 2018/19 - 1. Halbjahr +gültig ab 10. September 2018 +Untis 2017 +13.12.2018 9:04 +Klasse 13.12. / Donnerstag Woche-A +Ordnungsdienst: Klasse 10a +Kl. +Std. +Vertr. Fach Rau nach +Vertretungs-Text +5b +1 +Hei +D +--- +Entfall +5b +2 +Fu +D +114 +Hei / Aufgaben, Arbeitsheft! +5b +3 +Oe +M +114 +Ei / Aufgaben +5b +4 +Rm +M +114 +Ei / Aufgaben +6bc +5 +Sf +EvR +321 +Bü / Aufgaben +6bc +5 +Dk +KR +121 +We / Aufgaben +6bc +6 + +EvR +--- +Entfall +6bc +6 +We +KR +--- +Entfall +6d +6 +Ku +Ek +--- +Entfall +7b +2 +Ga +G +414 +KA Fkr +7b +8 +Gg +BK +--- +Mi-12.12. / 1 +7b +9 +Gg +BK +--- +Mi-12.12. / 2 +7c +8 - 9 +Gw +G +--- +Entfall +7d +1 +Ku +D +--- +Entfall +7d +2 +Oz +D +416 +Ku / Aufgaben +8a +1 - 2 +Ei +Ch +--- +Entfall +KEINE KA +9ac +8 - 9 +Lk +SpJ +--- +Entfall +9c +1 - 2 +Jw +Gk +322 +Raum! +9c +3 +Hf +D +220 +Hei / Aufgaben +9c +4 +Bkn +D +220 +Hei / Aufgaben +9d +1 +Rt +Gk +--- +Do-13.12. / 3 +9d +2 +Rt +Gk +--- +Do-13.12. / 4 +9d +3 +Rt +Gk +218 +9d +4 +Rt +Gk +218 +9d +5 +Ni +BK +126 +9d +6 +Ni +BK +126 +9d +8 +Ni +BK +--- +Do-13.12. / 5 +9d +9 +Ni +BK +--- +Do-13.12. / 6 +10b +10 - 11 +Fe +Ph +--- +Entfall +11 +3 - 4 +Ft +g4 +--- +Entfall +11 +5 +Ei +M1 +--- +Entfall +11 +7 +Gt +sem1 324 +geteilte Gruppen Schwimmen / +11 +8 - 9 +Ro +sem1 ??? +11 +10 - 11 +Lk +sp3 +--- +Entfall +12 +1 - 2 +Ni +bk1 +412 +Raum! +12 +5 +Ku +D2 +--- +Entfall +1112 8 - 9 +Fe +vma +--- +Entfall + + +D-70563 FANNY-LEICHT-GYMN. +STUTTGART, F.-LEICHT-STR. 13 +Schuljahr 2018/19 - 1. Halbjahr +gültig ab 10. September 2018 +Untis 2017 +13.12.2018 8:11 +Klasse 14.12. / Freitag Woche-A +Ordnungsdienst: Klasse 10a +Kl. +Std. Vertr. Fach Rau nach +Vertretungs-Text +5abc 1 +We +KR +--- +Entfall +5a +1 + +EvR +--- +Entfall +5abc 2 +Jw +KR +123 +We / Aufgaben +5a +2 +Ng +EvR +321 +Bü / Aufgaben +5d +3 +Lo +D +122 +anstatt 17.12., 1. Std. +5d +4 +Lo +D +122 +anstatt 19.12., 1 Std. +6a +6 +He +E +--- +Entfall +6acd 7 +Ft +MF +--- +Entfall +6c +1 +Ku +D +--- +Entfall +6c +2 +Sl +D +121 +Ku / Aufgaben +7a +3 +Di +D +323 +Raum +7a +4 +Hhn +M +323 +7a +5 +Hhn +M +323 +7a +6 +Hhn +M +323 +findet statt! +7b +6 +Rt +D +--- +Entfall +8a +1 +Ft +M +--- +Entfall +8a +2 +Li +E +323 +statt 18.12. +9c +5 - 6 +Hei +D +--- +Entfall +9d +1 - 2 Rm +NWT 412 +Raum +9d +5 - 6 +Ft +M +--- +Entfall +10a +3 - 4 Smr +E +413 +Hörverstehensklausur +10ad 3 +Ro +EvR +SH +Sport! +10ad 3 - 4 +We +KR +--- +Entfall +10ad 4 +Lk +EvR +SH +Sport! +10b +3 - 4 Ki +E +414 +Hörverstehensklausur +10b +3 - 4 +He +Gk +--- +Entfall für Lehrer +10bc 5 - 6 +We +KR +--- +Entfall +10c +3 - 4 +Ran +M +--- +Entfall +alle bei Oe +10c +3 - 4 Oe +E +422 +Hörverstehensklausur +10d +3 - 4 Wd +E +416 +Hörverstehensklausur +11 +3 - 4 At +D3 +121 +Raum +11 +3 - 4 Sl +D2 +415 +Raum +12 +1 - 2 Lo +Sp1 +222 +Theorie +12 +3 - 4 Mf +E2 +218 +Raum +12 +3 - 4 Sf +M3 +322 +Raum +12 +3 - 4 +Ft +M2 +--- +Entfall +12 +5 - 6 +Ku +ek1 +--- +Entfall + + diff --git a/shared/shared.qrc b/shared/shared.qrc index e6796e7..bbe63ed 100644 --- a/shared/shared.qrc +++ b/shared/shared.qrc @@ -23,5 +23,6 @@ graphics/icons/logoutRed.png graphics/icons/settingsBlack.png graphics/icons/backDark.png + samplehtml/Download File.txt diff --git a/sources/appsettings.cpp b/sources/appsettings.cpp index eefda45..6e75da1 100644 --- a/sources/appsettings.cpp +++ b/sources/appsettings.cpp @@ -1,6 +1,6 @@ #include "headers/appsettings.h" -AppSettings * pGlobalAppSettings = NULL; +AppSettings * pGlobalAppSettings = nullptr; AppSettings::AppSettings(QObject* parent) :QObject(parent) diff --git a/sources/eventmodel.cpp b/sources/eventmodel.cpp index f879e92..600f188 100644 --- a/sources/eventmodel.cpp +++ b/sources/eventmodel.cpp @@ -2,13 +2,13 @@ EventModel::EventModel(QObject *parent) : QAbstractListModel(parent) { - // foodplan constructor - // is called when the Foodplan Display is loaded + // event constructor + // is called when the EventView is loaded // list m_events.clear(); - // convert the stringlist from the serverconn to a Dish-list + // convert the stringlist from the serverconn to a Day-list foreach(QListday, pGlobalServConn->m_events){ m_events.append({day[0], day[1], day[2], day[3], day[4], day[5], day[6]}); } diff --git a/sources/foodplanmodel.cpp b/sources/foodplanmodel.cpp index da62404..c48e4cb 100644 --- a/sources/foodplanmodel.cpp +++ b/sources/foodplanmodel.cpp @@ -3,7 +3,7 @@ FoodPlanModel::FoodPlanModel(QObject *parent) : QAbstractListModel(parent) { // foodplan constructor - // is called when the Foodplan Display is loaded + // is called when the FoodplanView is loaded // list m_foodPlan.clear(); diff --git a/sources/serverconn.cpp b/sources/serverconn.cpp index 2439e53..0a4b91e 100644 --- a/sources/serverconn.cpp +++ b/sources/serverconn.cpp @@ -21,7 +21,6 @@ ServerConn::~ServerConn() dir.removeRecursively(); } - QString ServerConn::login(QString username, QString password, bool permanent) { // QUrlQuery pdata; @@ -89,7 +88,6 @@ QString ServerConn::getDay(QString day) QNetworkRequest request; request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/" + day + ".pdf" ) ); - // Pack in credentials // Pack in credentials QString concatenatedCredentials = this->username + ":" + this->password; QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64(); @@ -138,7 +136,6 @@ QString ServerConn::getDay(QString day) } } - int ServerConn::checkConn() { // Create request @@ -184,6 +181,7 @@ float ServerConn::getProgress() } int ServerConn::getEvents(QString day){ + /* this->progress = 0; ReturnData_t ret; //this is a custom type to store the returned data @@ -216,6 +214,59 @@ int ServerConn::getEvents(QString day){ QString eventString = reply->readAll(); */ + qDebug() << "reading text file"; + QFile * textFile = new QFile(":/samplehtml/Download File.txt"); + if (!textFile->open(QIODevice::ReadOnly | QIODevice::Text)) { + qDebug() << "Load XML File Problem Couldn't open xmlfile.xml to load settings for download"; + return 900; + } + + QString eventString = textFile->readAll(); + QStringList events = eventString.split("\n"); + + QList tmpEvents; + + // 8a 1-2 Ei Ch --- Entfall KEINE KA + + foreach(QString event, events){ + int spaceCount = 0; + QStringList dayList; + QString tmpString; + for(int i = 0;i < event.length(); i++){ + QCharRef tmpChar = event[i]; + if(tmpChar == " "){ + spaceCount ++; + } + else { + if(spaceCount == 1){ + tmpString.append(" "); + } + spaceCount = 0; + tmpString.append(tmpChar); + } + + if(spaceCount == 2){ + dayList.append(tmpString); + tmpString = ""; + } + + qDebug() << "char= " << tmpChar << " string= " << tmpString << " list= " << dayList; + } + + dayList.append(tmpString); + + while (dayList.length() < 7) { + dayList.append(""); + } + + tmpEvents.append(dayList); + + } + + this->m_events = tmpEvents; + qDebug() << tmpEvents; + +/* qDebug() << "reading xml file"; QFile * xmlFile = new QFile(":/samplehtml/Download File.xml"); if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -228,6 +279,10 @@ int ServerConn::getEvents(QString day){ //qDebug() << xmlFile->readAll(); QList tmpEvents; QStringList dayList; + while (dayList.length() < 7) { + dayList.append(""); + } + int currTop = 0; /* @@ -238,16 +293,24 @@ int ServerConn::getEvents(QString day){ --- Entfall KEINE KA - */ - #define eventXmlPosGrade 3 - #define eventXmlPosHour 55 - #define eventXmlPosReplace 123 - #define eventXmlPosSubject 178 - #define eventXmlPosRoom 233 - #define eventXmlPosTo 275 - #define eventXmlPosText 391 +5abc 1 +We +KR +--- +Entfall + +#define eventXmlPosGrade 3 +#define eventXmlPosHour 55 +#define eventXmlPosReplace 123 +#define eventXmlPosSubject 178 +#define eventXmlPosRoom 233 +#define eventXmlPosTo 275 +#define eventXmlPosText 391 + + QList eventXmlPositions = {eventXmlPosGrade,eventXmlPosHour,eventXmlPosReplace,eventXmlPosSubject,eventXmlPosRoom,eventXmlPosTo,eventXmlPosText}; + qDebug() << "start xml parsing"; //Parse the XML until we reach end of it while(!xmlReader->atEnd()) { if (xmlReader->readNextStartElement()) { @@ -272,7 +335,7 @@ int ServerConn::getEvents(QString day){ // new line started if(currTop > 175){ - // ignore the header + // if not header -> append qDebug() << dayList; tmpEvents.append(dayList); } @@ -283,48 +346,54 @@ int ServerConn::getEvents(QString day){ } currTop = top; } - else { - // no new line - if(attributes.hasAttribute("left")){ - int left = attributes.value("left").toInt(); - QString text = xmlReader->readElementText(QXmlStreamReader::IncludeChildElements); - if(abs(left - eventXmlPosGrade) < 3){ - // position tells the text is the grade - dayList[0] = text; - } - else if (abs(left - eventXmlPosHour) < 3) { - // position tells the text is the grade - dayList[1] = text; + if(attributes.hasAttribute("left")){ + int left = attributes.value("left").toInt(); + QString text = xmlReader->readElementText(QXmlStreamReader::IncludeChildElements); + qDebug() << text; + for(int i = 0;i<7;i++){ + //qDebug() << i << left << abs(left - eventXmlPositions[i]); + if(abs(left - eventXmlPositions[i]) < 30){ + dayList[i] = text; + //qDebug() << i << left << text << dayList << left << abs(left - eventXmlPositions[i]); } } } + + else { + qDebug() << " no left"; + } + + } + else { + qDebug() << " no top"; } } - - //qDebug() << qPrintable(xmlReader->name().toString()) << text << attribute_value << dayList; } } -} -qDebug() << tmpEvents; + this->m_events = tmpEvents; -this->m_events = tmpEvents; + if(xmlReader->hasError()) { + qDebug() << "xmlFile.xml Parse Error" << xmlReader->errorString(); + //return(900); + } -if(xmlReader->hasError()) { - qDebug() << "xmlFile.xml Parse Error" << xmlReader->errorString(); - //return(900); -} + //close reader and flush file + xmlReader->clear(); + xmlFile->close(); + */ -//close reader and flush file -xmlReader->clear(); -//xmlFile->close(); + foreach(QListday, this->m_events){ + qDebug() << day; + } -return(200); + return(200); } int ServerConn::getFoodPlan() { + // set the progress to 0 this->progress = 0; // Call the webservice @@ -332,30 +401,35 @@ int ServerConn::getFoodPlan() request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - // send a POST request with the given url and data to the server + // send a GET request to the treffpunkt fanny server QNetworkReply* reply; + reply = this->networkManager->get(request); - QUrlQuery pdata; - reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); - + // update the progress during the request connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateProgress(qint64, qint64))); - // wait until the request has finished + // loop to wait until the request has finished before processing the data QEventLoop loop; + // timer to cancel the request after 3 seconds QTimer timer; - timer.setSingleShot(true); - // quit the loop when the timer times out - loop.connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + + // quit the loop when the request finised loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); + // or the timer timed out + loop.connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + // start the timer timer.start(2000); + // start the loop loop.exec(); // get the status code QVariant status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); + // set the progress to 1 this->progress = 1; if(status_code != 200){ + // if the request didn't result in a success, return the error code return(status_code.toInt()); } @@ -539,43 +613,6 @@ int ServerConn::getFoodPlan() return(200); } -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<=6;i++){ - - if(m_events.size() > index){ - //qDebug() << i << m_weekplan[index].size(); - if(m_events[index].size() > i){ - ret.append(m_events[index][i]); - //qDebug() << i << m_weekplan[index][i]; - } - else { - ret.append(nullptr); - } - } - else { - ret.append(nullptr); - } - } - if(ret.length() < 7){ - ret.append(""); - } - 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]}, {"text", ret[6]} }; -} - -int ServerConn::getEventCount(){ - return (m_events.length()); -} - ReturnData_t ServerConn::senddata(QUrl serviceUrl, QUrlQuery pdata) {