added header to the event view, showing:

- creation date
- target date
- cleaning class

added one event block underneath the header indicating what the different fields contain
This commit is contained in:
Dorian Zedler 2018-12-26 23:44:24 +01:00
parent 963da066af
commit f7d5a111d0
10 changed files with 152 additions and 43 deletions

View file

@ -4,8 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [0.9.0 - 0.9.1] - ALPHA - 2018-12
## [0.9.0] - ALPHA - 2018-12-25
### Geändert ### Geändert
- Komplett neues Design - Komplett neues Design
- der Vertretungsplan wird jetzt innerhalb der App angezeigt - der Vertretungsplan wird jetzt innerhalb der App angezeigt
@ -15,6 +14,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Behoben ### Behoben
- Viele interne Verbesserungen, die zu besserer performance führen - Viele interne Verbesserungen, die zu besserer performance führen
### Hinzugefügt
- Jetzt kompatibel mit der neusten android API und IOS Geräten
## [0.04] - 2018-07-19 ## [0.04] - 2018-07-19
### Behoben ### Behoben
- Fehler beim Speiseplan, der dafür sorgte, dass der letzte Tag fehlerhaft (zu dünn) angezeigt wurde, wenn nurnoch ein Tag angezeigt wurde - Fehler beim Speiseplan, der dafür sorgte, dass der letzte Tag fehlerhaft (zu dünn) angezeigt wurde, wenn nurnoch ein Tag angezeigt wurde

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<manifest package="com.itsblue.flgvertretung" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.9.0" android:versionCode="9" android:installLocation="auto"> <manifest package="com.itsblue.flgvertretungtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.9.1" android:versionCode="9" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="fannyapp" android:icon="@drawable/icon"> <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="fannyapp" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="com.itsblue.flgvertretung.MainActivity" android:label="fannyapp" android:screenOrientation="unspecified" android:launchMode="singleTop"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="com.itsblue.flgvertretung.MainActivity" android:label="fannyapp" android:screenOrientation="unspecified" android:launchMode="singleTop">

View file

@ -60,5 +60,6 @@ DISTFILES += \
android-sources/res/drawable-hdpi/icon.png \ android-sources/res/drawable-hdpi/icon.png \
android-sources/res/drawable-ldpi/icon.png \ android-sources/res/drawable-ldpi/icon.png \
android-sources/res/drawable-mdpi/icon.png \ android-sources/res/drawable-mdpi/icon.png \
android-sources/res/xml/provider_paths.xml android-sources/res/xml/provider_paths.xml \
CHANGELOG.md

View file

@ -27,6 +27,8 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QHash<int, QByteArray> roleNames() const; QHash<int, QByteArray> roleNames() const;
Q_INVOKABLE QStringList getHeader();
Q_INVOKABLE QVariantMap get(int row) const; Q_INVOKABLE QVariantMap get(int row) const;
private: private:

View file

@ -68,6 +68,7 @@ signals:
public: public:
QList<QList<QString>> m_weekplan; QList<QList<QString>> m_weekplan;
QList<QStringList> m_events; QList<QStringList> m_events;
QStringList m_eventHeader;
}; };

View file

@ -52,10 +52,10 @@ ListView {
width: parent.width - 10 width: parent.width - 10
wrapMode: Label.Wrap wrapMode: Label.Wrap
text: hour + " | " text: hour + ( replace === "" ? "": ( " | "
+ replace + " | " + replace + ( subject === "" ? "": ( " | "
+ subject + " | " + subject + ( room === "" ? "": ( " | "
+ room + " | " + room ) ) ) ) ) )
} }
Label { Label {
@ -68,9 +68,12 @@ ListView {
font.pixelSize: gradeLa.font.pixelSize font.pixelSize: gradeLa.font.pixelSize
font.bold: true font.bold: true
visible: text !== ""
text: to !== "" && model.text !== "" ? to + " | " + model.text:model.to + model.text text: to !== "" && model.text !== "" ? to + " | " + model.text:model.to + model.text
} }
} }
} }
} }

View file

@ -51,3 +51,32 @@ Kl. Std. Vertr. Fach Rau nach Vertretungs-Text
12 1-2 Ni bk1 412 Raum! 12 1-2 Ni bk1 412 Raum!
12 5 Ku D2 --- Entfall 12 5 Ku D2 --- Entfall
1112 8-9 Fe vma --- Entfall 1112 8-9 Fe vma --- Entfall
D-70563 FANNY-LEICHT-GYMN. Schuljahr 2018/19 - 1. Halbjahr Untis 2017
STUTTGART, F.-LEICHT-STR. 13 gültig ab 10. September 2018 13.12.2018 9:04
Klasse 13.12. / Donnerstag Woche-A
Ordnungsdienst: Klasse 10a
Kl. Std. Vertr. Fach Rau nach Vertretungs-Text
12ac 8-9 Lk SpJ --- Entfall
13c 1-2 Jw Gk 322 Raum!
13c 3 Hf D 220 Hei / Aufgaben
913c 4 Bkn D 220 Hei / Aufgaben
913d 1 Rt Gk --- Do-13.12. / 3
13d 2 Rt Gk --- Do-13.12. / 4
92d 3 Rt Gk 218
91d 4 Rt Gk 218
92d 5 Ni BK 126
91d 6 Ni BK 126
91d 8 Ni BK --- Do-13.12. / 5
91d 9 Ni BK --- Do-13.12. / 6
130b 10 - 11 Fe Ph --- Entfall
131 3-4 Ft g4 --- Entfall
131 5 Ei M1 --- Entfall
131 7 Gt sem1 324 geteilte Gruppen Schwimmen /
131 8-9 Ro sem1 ???
131 10 - 11 Lk sp3 --- Entfall
123 1-2 Ni bk1 412 Raum!
122 5 Ku D2 --- Entfall
11132 8-9 Fe vma --- Entfall

View file

@ -26,7 +26,7 @@ AppSettings::AppSettings(QObject* parent)
//QList<QStringList> filters = {{"5", "d"}, {"6", "c"}, {"11", ""}}; //QList<QStringList> filters = {{"5", "d"}, {"6", "c"}, {"11", ""}};
//writeFilters(filters); //writeFilters(filters);
qDebug() << readFilters(); //qDebug() << readFilters();
} }
QString AppSettings::loadSetting(const QString &key) QString AppSettings::loadSetting(const QString &key)
@ -55,7 +55,7 @@ QList<QStringList> AppSettings::readFilters() {
this->filtersFile->close(); this->filtersFile->close();
qDebug() << jsonString; //qDebug() << jsonString;
QJsonDocument jsonFilters = QJsonDocument::fromJson(jsonString.toUtf8()); QJsonDocument jsonFilters = QJsonDocument::fromJson(jsonString.toUtf8());
// array with all filters in it // array with all filters in it
QJsonArray filtersArray = jsonFilters.array(); QJsonArray filtersArray = jsonFilters.array();
@ -88,7 +88,7 @@ void AppSettings::writeFilters(QList<QStringList> list) {
} }
QJsonDocument filtersDoc(filtersArray); QJsonDocument filtersDoc(filtersArray);
qDebug() << filtersDoc.toJson(); //qDebug() << filtersDoc.toJson();
this->filtersFile->open(QIODevice::ReadWrite); this->filtersFile->open(QIODevice::ReadWrite);

View file

@ -55,6 +55,11 @@ QVariantMap EventModel::get(int row) const
return { {"grade", foodPlan.grade}, {"hour", foodPlan.hour}, {"replace", foodPlan.replace}, {"subject", foodPlan.subject}, {"room", foodPlan.room}, {"to", foodPlan.to}, {"text", foodPlan.text} }; return { {"grade", foodPlan.grade}, {"hour", foodPlan.hour}, {"replace", foodPlan.replace}, {"subject", foodPlan.subject}, {"room", foodPlan.room}, {"to", foodPlan.to}, {"text", foodPlan.text} };
} }
QStringList EventModel::getHeader()
{
return(pGlobalServConn->m_eventHeader);
}
EventModel::~EventModel() EventModel::~EventModel()
{ {

View file

@ -265,16 +265,16 @@ int ServerConn::getEvents(QString day){
} }
QString eventString = reply->readAll(); 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(); // 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;
// }
// eventString = textFile->readAll();
// separate all lines into a list // separate all lines into a list
QStringList events = eventString.split("\n"); QStringList events = eventString.split("\n");
@ -282,7 +282,7 @@ int ServerConn::getEvents(QString day){
// a line (one element of the list) looks like this: // a line (one element of the list) looks like this:
// class hour replace subject room to text // class hour replace subject room to text
// 8a 1-2 Ei Ch --- Entfall KEINE KA // 8a 1-2 Ei Ch --- Entfall KEINE KA
// [ ] <-- at least two spaces // [ ] <-- at least two spaces between two blocks
// 'to' and 'text' can be blank // 'to' and 'text' can be blank
for(int i = 0; i < events.length(); i++){ for(int i = 0; i < events.length(); i++){
@ -291,16 +291,29 @@ int ServerConn::getEvents(QString day){
} }
} }
// all pages of the original Event document have a similar header that gets removed by this command
// (only the first one remains)
events.removeDuplicates();
// temporary list to store the events for the given day // temporary list to store the events for the given day
QList<QStringList> tmpEvents; QList<QStringList> tmpEvents;
// temporary list to store the header information
QStringList tmpEventHeader;
// get the filers list for later usage
QList<QStringList> filtersList = pGlobalAppSettings->readFilters();
// go through the list and process every single row // go through the list and process every single row
foreach(QString event, events){ for(int x = 0; x < events.length(); x++){
// store the event string
QString event = events[x];
// value to count spaces between text // value to count spaces between text
int spaceCount = 0; int spaceCount = 0;
// temporary list to store the data of one day // temporary list to store the data of one day
QStringList dayList; QStringList eventList;
// temporary dtring to store the data of one block // temporary dtring to store the data of one block
QString tmpString; QString tmpString;
@ -334,42 +347,95 @@ int ServerConn::getEvents(QString day){
tmpString.append(tmpChar); tmpString.append(tmpChar);
} }
// check if the soace count is 2 // check if the space count is 2
if(spaceCount == 2){ if(spaceCount == 2){
// if so -> break between two blocks // if so -> break between two blocks
// could be: 8a 1 - 2 OR 8a 1 - 2 // could be: 8a 1 - 2
// here ->| // here ->|
// -> append the current tmpString to the dayList // -> append the current tmpString to the eventList
dayList.append(tmpString); eventList.append(tmpString);
// and clear the tmpString // and clear the tmpString
tmpString = ""; tmpString = "";
} }
//qDebug() << "char= " << tmpChar << " string= " << tmpString << " list= " << dayList; //qDebug() << "char= " << tmpChar << " string= " << tmpString << " list= " << eventList;
} }
// append the remaining tmpString to the dayList // append the remaining tmpString to the eventList
dayList.append(tmpString); eventList.append(tmpString);
// fill up the dayList with blanks until it reaches the defined length // fill up the eventList with blanks until it reaches the defined length
while (dayList.length() < 7) { while (eventList.length() < 7) {
dayList.append(""); eventList.append("");
} }
// if the event matches the filter if(x < 6){
QList<QStringList> filtersList = pGlobalAppSettings->readFilters(); // if the event is in the header
if(filtersList.isEmpty()){ // the header could look like this:
tmpEvents.append(dayList); //
// D-70563 FANNY-LEICHT-GYMN. Schuljahr 2018/19 - 1. Halbjahr Untis 2017
// STUTTGART, F.-LEICHT-STR. 13 gültig ab 10. September 2018 (13.12.2018 9:04)
//
//[Klasse 13.12. / Donnerstag Woche-A]
//{Ordnungsdienst: Klasse 10a}
//
// important data:
// () = date and time the document has been created
// [] = date the document is made for
// {} = class that has to clean up the scool :D
// (brackets are not present in the document)
// line 0 and 4 don't contain imporant information -> skip
if (x == 1) {
// the second line contains the creation date
// the creation date is the third block of the line
tmpEventHeader.append(eventList[2]);
}
else if (x == 2) {
// the third line contains the target date of the document
// the target date is the first block of the line
tmpEventHeader.append(eventList[0]);
}
else if (x == 3) {
// the third line contains the cleaning class
// the cleaning class is the first block of the line
tmpEventHeader.append(eventList[0]);
}
else if (x == 4) {
// if the fourth line is reached
// fill the event header
while (tmpEventHeader.length() < 7) {
tmpEventHeader.append("");
}
// swap creation and target date
tmpEventHeader.swap(0,1);
// and append it to the events list
tmpEvents.append(tmpEventHeader);
}
else if (x == 5) {
// the fifth row contains the labels for the different filds
// -> append it to the events list
tmpEvents.append(eventList);
}
}
else if(filtersList.isEmpty()){
// if there are no filters append the event immideatly
tmpEvents.append(eventList);
} }
else { else {
// if there is at least one filter, check if the event matches it
foreach(QStringList filter, filtersList){ foreach(QStringList filter, filtersList){
// go through all filters and check if one of them matches the event // go through all filters and check if one of them matches the event
if((dayList[0].contains(filter[0]) && dayList[0].contains(filter[1]))){ if((eventList[0].contains(filter[0]) && eventList[0].contains(filter[1]))){
// append the dayList to the temporary event list // append the eventList to the temporary event list
tmpEvents.append(dayList); tmpEvents.append(eventList);
// terminate the loop // terminate the loop
break; break;
} }