[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/poetaster/fahrplan</param>
<param name="branch">master</param>
- <param name="revision">2.0.35</param>
+ <param name="revision">2.0.36</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2-2.0.36.tar.bz2/fahrplan2.pro
^
|
@@ -2,7 +2,7 @@
APP_NAME = Fahrplan
# Define Version
-VERSION = 2.0.35-1
+VERSION = 2.0.36-1
# Switch for jolla to separate harbour and openrepo version
openrepos {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2-2.0.36.tar.bz2/src/gui/sailfishos/pages/JourneyDetailsResultsPage.qml
^
|
@@ -23,6 +23,7 @@
import "../delegates"
Page {
+ property bool debug: true
id: journeyDetailsResultsPage
property JourneyDetailResultList currentResult;
@@ -149,16 +150,19 @@
onAddCalendarEntryComplete: {
addToCalendar.enabled = true;
pushUpMenu.busy = false;
- console.log("Calendar success");
- console.log(success);
+ if (debug) console.log("Calendar success");
+ if (debug) console.log(success);
}
onParserJourneyDetailsResult: {
currentResult = result;
- console.log("Got detail results");
- console.log(result.count);
+ if (debug) console.log("Got detail results");
+ if (debug) console.log(result.count);
if (result.count > 0) {
+ if (debug) console.log(result.departureStation)
+ if (debug) console.log(result.arrivalStation)
+
journeyStations.title = result.viaStation.length == 0 ? qsTr("<b>%1</b> to <b>%2</b>").arg(result.departureStation).arg(result.arrivalStation) : qsTr("<b>%1</b> via <b>%3</b> to <b>%2</b>").arg(result.departureStation).arg(result.arrivalStation).arg(result.viaStation);
var departureDate = Qt.formatDate(result.departureDateTime);
var arrivalDate = Qt.formatDate(result.arrivalDateTime);
@@ -172,7 +176,6 @@
arrivalDate + " " + Qt.formatTime(result.arrivalDateTime, Qt.DefaultLocaleShortDate);
lbljourneyDuration.text = qsTr("Dur.: %1").arg(result.duration);
-
journeyDetailResultModel.clear();
for (var i = 0; i < result.count; i++) {
var item = result.getItem(i);
@@ -181,22 +184,21 @@
if (i < result.count -1) {
nextItem = result.getItem(i+1);
}
-
- /*
+ /*if (debug) {
console.log("-------------" + i);
console.log(item.departureStation);
console.log(item.train);
console.log(item.arrivalStation);
+ console.log(item.duration);
if (nextItem) {
console.log(nextItem.departureStation);
console.log(nextItem.train);
console.log(nextItem.arrivalStation);
+ console.log(item.duration);
}
- */
-
+ }*/
var isStart = (i == 0);
var isStop = (i == result.count -1);
-
//Add first departure Station and the train
if (isStart) {
journeyDetailResultModel.append({
@@ -214,7 +216,6 @@
});
}
-
//Add arrival station
if (isStop) {
journeyDetailResultModel.append({
@@ -232,21 +233,17 @@
});
}
-
//Add one Station
if (nextItem) {
var stationInfo = item.arrivalInfo;
var stationName = item.arrivalStation;
-
if (stationInfo.length > 0 && nextItem.departureInfo) {
stationInfo = stationInfo + " / ";
}
if (nextItem.departureStation != item.arrivalStation) {
stationName += " / " + nextItem.departureStation;
}
-
stationInfo = stationInfo + nextItem.departureInfo;
-
journeyDetailResultModel.append({
"isStart" : false,
"isStop" : false,
@@ -262,7 +259,6 @@
});
}
-
}
indicator.visible = false;
} else {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2-2.0.36.tar.bz2/src/parser/parser_ninetwo.cpp
^
|
@@ -1,26 +1,29 @@
/****************************************************************************
-**
-** This file is a part of Fahrplan.
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License along
-** with this program. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
+ * *
+ ** This file is a part of Fahrplan.
+ **
+ ** This program is free software; you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation; either version 2 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License along
+ ** with this program. If not, see <http://www.gnu.org/licenses/>.
+ **
+ ****************************************************************************/
#include "parser_ninetwo.h"
#include <QUrl>
#include <QNetworkReply>
+#include <QDomDocument>
+#include <QTextStream>
+#include <memory>
#ifdef BUILD_FOR_QT5
# include <QUrlQuery>
#else
@@ -28,7 +31,7 @@
#endif
#include <qmath.h>
-#define BASE_URL "https://api.9292.nl/0.1/"
+#define BASE_URL "https://9292.nl/en"
inline qreal deg2rad(qreal deg)
{
@@ -62,11 +65,11 @@
{
QUrl uri(QString(BASE_URL "/locations/%1/departure-times").arg(currentStation.id.toString()));
-#if defined(BUILD_FOR_QT5)
+ #if defined(BUILD_FOR_QT5)
QUrlQuery query;
-#else
+ #else
QUrl query;
-#endif
+ #endif
query.addQueryItem("lang", "en-GB");
uri.setQuery(query);
@@ -78,34 +81,38 @@
void ParserNinetwo::findStationsByName(const QString &stationName)
{
- qDebug() << "FINDBYNAME";
- QUrl uri(BASE_URL "locations");
+ // TODO: do a bogus search, and use the "did you perhapss mean ..." response
+ // bacause it seems that some places do not get suggested
+ QUrl url(BASE_URL "/suggest");
+ qDebug() << "FINDBYNAME" << stationName << url;
-#if defined(BUILD_FOR_QT5)
+ #if defined(BUILD_FOR_QT5)
QUrlQuery query;
-#else
+ #else
QUrl query;
-#endif
- query.addQueryItem("lang", "en-GB");
- query.addQueryItem("q", stationName);
- uri.setQuery(query);
+ #endif
+ query.addQueryItem("userInput", stationName);
+ url.setQuery(query);
- sendHttpRequest(uri);
+ sendHttpRequest(url);
currentRequestState=FahrplanNS::stationsByNameRequest;
}
void ParserNinetwo::findStationsByCoordinates(qreal longitude, qreal latitude)
{
+ // No longer supported.
+ // TODO: use a free geocoding api, and then search on
+ // postal code
+
QUrl uri(BASE_URL "locations");
-#if defined(BUILD_FOR_QT5)
+ #if defined(BUILD_FOR_QT5)
QUrlQuery query;
-#else
+ #else
QUrl query;
-#endif
+ #endif
query.addQueryItem("lang", "en-GB");
- query.addQueryItem("type", "station,stop");
query.addQueryItem("latlong", QString("%1,%2").arg(latitude).arg(longitude));
query.addQueryItem("includestation", "true");
uri.setQuery(query);
@@ -129,47 +136,72 @@
lastsearch.to=arrivalStation;
lastsearch.restrictions=trainrestrictions;
lastsearch.via=viaStation;
- QUrl uri(BASE_URL "journeys");
-
-#if defined(BUILD_FOR_QT5)
- QUrlQuery query;
-#else
- QUrl query;
-#endif
- query.addQueryItem("lang", "en-GB");
- query.addQueryItem("before", "1");
- query.addQueryItem("from", departureStation.id.toString());
- if(viaStation.valid)
- query.addQueryItem("via", viaStation.id.toString());
- query.addQueryItem("to", arrivalStation.id.toString());
- query.addQueryItem("sequence", "1");
- query.addQueryItem("dateTime", dateTime.toString("yyyy-MM-ddTHHmm"));
- switch(trainrestrictions){
- default:
- case all:
- query.addQueryItem("byFerry", "true");
- case noFerry:
- query.addQueryItem("byBus", "true");
- query.addQueryItem("byTram", "true");
- query.addQueryItem("bySubway", "true");
- case trainsOnly:
- query.addQueryItem("byTrain", "true");
- }
- query.addQueryItem("searchtype", mode==Departure?"departure":"arrival");
+ QUrl url(BASE_URL "/journeyadvice");
- //TODO: make transport types work
- query.addQueryItem("after", "5");
+ #if defined(BUILD_FOR_QT5)
+ QUrlQuery postData;
+ #else
+ QUrl postData;
+ #endif
- uri.setQuery(query);
- sendHttpRequest(uri);
+ /*
+ // this is for /journeyadvice-page
+ query.addQueryItem("from", departureStation.id.toString());
+ query.addQueryItem("to", arrivalStation.id.toString());
+ query.addQueryItem("searchType", mode == Mode::Arrival ? "arrival" : "departure");
+ query.addQueryItem("dateTime", dateTime.toString("yyyy-MM-ddThhmm"));
+ query.addQueryItem("extraInterchangeTime", 0);
+ query.addQueryItem("flexStop", "False");
+ query.addQueryItem("flexAddress", "False");
+ query.addQueryItem("before", QString::number(-1));
+ query.addQueryItem("bfter", QString::number(5));
+ */
+
+ // This post request is inconsistent AF. here and there it uses "true"/"false"
+ // and other places it uses "on"/"off"
+
+ static const char* const o[] = {"off", "on"};
+ postData.addQueryItem("fromText","");
+ postData.addQueryItem("fromLock","false");
+ postData.addQueryItem("fromOriginal","");
+ postData.addQueryItem("fromRef",departureStation.id.toString());
+ postData.addQueryItem("fromRefOriginal","");
+ postData.addQueryItem("viaText", viaStation.valid ? viaStation.name : "");
+ postData.addQueryItem("viaOriginal","");
+ postData.addQueryItem("viaRef", viaStation.valid ? viaStation.id.toString() : "");
+ postData.addQueryItem("viaRefOriginal","");
+ postData.addQueryItem("toText","");
+ postData.addQueryItem("toLock","false");
+ postData.addQueryItem("toOriginal","");
+ postData.addQueryItem("toRef",arrivalStation.id.toString());
+ postData.addQueryItem("toRefOriginal","");
+ postData.addQueryItem("date",dateTime.toString("dd-MM-yyyy"));
+ postData.addQueryItem("time",dateTime.toString("hh:mm"));
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2-2.0.36.tar.bz2/src/parser/parser_ninetwo.h
^
|
@@ -68,17 +68,26 @@
virtual QString shortName() { return "9292ov.nl"; }
public slots:
- void getTimeTableForStation(const Station ¤tStation, const Station &directionStation, const QDateTime &dateTtime, ParserAbstract::Mode mode, int trainrestrictions);
+ void getTimeTableForStation(const Station ¤tStation,
+ const Station &directionStation,
+ const QDateTime &dateTtime,
+ ParserAbstract::Mode mode,
+ int trainrestrictions);
void findStationsByName(const QString &stationName);
void findStationsByCoordinates(qreal longitude, qreal latitude);
- void searchJourney(const Station &departureStation,const Station &viaStation,const Station &arrivalStation,const QDateTime &dateTime,const ParserAbstract::Mode mode, int trainrestrictions);
+ void searchJourney(const Station &departureStation,
+ const Station &viaStation,
+ const Station &arrivalStation,
+ const QDateTime &dateTime,
+ const ParserAbstract::Mode mode,
+ int trainrestrictions);
void searchJourneyLater();
void searchJourneyEarlier();
void getJourneyDetails(const QString &id);
- bool supportsGps() { return true; }
- bool supportsVia() { return true; }
- bool supportsTimeTable() { return true; }
- bool supportsTimeTableDirection() { return false; }
+ bool supportsGps() final { return false; }
+ bool supportsVia() final { return false; }
+ bool supportsTimeTable() final { return false; }
+ bool supportsTimeTableDirection() final { return false; }
QStringList getTrainRestrictions();
protected:
@@ -91,8 +100,20 @@
void parseJourneyDetails(QNetworkReply *networkReply);
QMap<QString, JourneyDetailResultList*> cachedResults;
+ // from resrobot
+ QList<JourneyDetailResultItem*> parseJourneySegments(const QVariantMap &journeyData);
+ QHash<QString, QString> hafasAttributes;
+ QHash<QString, QString> specificTransportModes;
+ QHash<QString, QString> generalTransportModes;
+ QHash<QString, QString> transportModeStrings;
+
+
private:
- void parseJourneyOption(const QVariantMap &object);
+ JourneyResultItem* parseJourneyICS(QString const & ics);
+ JourneyResultItem* parseJourneyJson(QString const & json);
+
};
+
#endif // PARSER_NINETWO_H
+
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2-2.0.36.tar.bz2/src/parser/parser_xmlnri.cpp
^
|
@@ -22,9 +22,9 @@
ParserXmlNri::ParserXmlNri(QObject *parent) :
ParserHafasXml(parent)
{
- baseXmlUrl = "http://hafas.websrv05.reiseinfo.no/bin/dev/nri/query.exe";
- baseSTTableUrl = "http://hafas.websrv05.reiseinfo.no/bin/dev/nri/stboard.exe/en";
- baseUrl = "http://hafas.websrv05.reiseinfo.no/bin/dev/nri/query.exe";
+ baseXmlUrl = "https://hafas.websrv05.reiseinfo.no/bin/dev/nri/query.exe";
+ baseSTTableUrl = "https://hafas.websrv05.reiseinfo.no/bin/dev/nri/stboard.exe/en";
+ baseUrl = "https://hafas.websrv05.reiseinfo.no/bin/dev/nri/query.exe";
STTableMode = 1;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2-2.0.36.tar.bz2/src/parser/parser_xmloebbat.cpp
^
|
@@ -20,12 +20,12 @@
#include "parser_xmloebbat.h"
ParserXmlOebbAt::ParserXmlOebbAt(QObject *parent)
- : ParserHafasBinary(parent)
+ : ParserHafasXml(parent)
{
- baseXmlUrl = "http://fahrplan.oebb.at/bin/query.exe";
- baseSTTableUrl = "http://fahrplan.oebb.at/bin/stboard.exe/en";
- baseUrl = "http://fahrplan.oebb.at/bin/query.exe";
- baseBinaryUrl = "http://fahrplan.oebb.at/bin/query.exe/en";
+
+ baseXmlUrl = "https://fahrplan.oebb.at/bin/query.exe";
+ baseSTTableUrl = "https://fahrplan.oebb.at/bin/stboard.exe/en";
+ baseUrl = "https://fahrplan.oebb.at/bin/query.exe";
STTableMode = 1;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2-2.0.36.tar.bz2/src/parser/parser_xmloebbat.h
^
|
@@ -21,8 +21,8 @@
#define PARSER_XMLOEBBAT_H
#include "parser_hafasbinary.h"
-
-class ParserXmlOebbAt: public ParserHafasBinary
+//class ParserXmlOebbAt: public ParserHafasBinary
+class ParserXmlOebbAt: public ParserHafasXml
{
Q_OBJECT
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2-2.0.36.tar.bz2/src/parser/parser_xmlrejseplanendk.cpp
^
|
@@ -22,9 +22,9 @@
ParserXmlRejseplanenDk::ParserXmlRejseplanenDk(QObject *parent) :
ParserHafasXml(parent)
{
- baseXmlUrl = "http://www.rejseplanen.dk/bin/query.exe";
- baseSTTableUrl = "http://mobil.rejseplanen.dk/mobil-bin/stboard.exe/en";
- baseUrl = "http://www.rejseplanen.dk/bin/query.exe";
+ baseXmlUrl = "https://www.rejseplanen.dk/bin/query.exe";
+ baseSTTableUrl = "https://mobil.rejseplanen.dk/mobil-bin/stboard.exe/en";
+ baseUrl = "https://www.rejseplanen.dk/bin/query.exe";
STTableMode = 1;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fahrplan2-2.0.36.tar.bz2/src/parser/parser_xmlsbbch.cpp
^
|
@@ -24,8 +24,8 @@
ParserXmlSbbCh::ParserXmlSbbCh(QObject *parent) :
ParserHafasXml(parent)
{
- baseXmlUrl = "http://fahrplan.sbb.ch/bin/extxml.exe";
- baseUrl = "http://fahrplan.sbb.ch/bin/query.exe";
+ baseXmlUrl = "https://fahrplan.sbb.ch/bin/extxml.exe";
+ baseUrl = "https://fahrplan.sbb.ch/bin/query.exe";
userAgent = "SBBMobile/4.8 CFNetwork/609.1.4 Darwin/13.0.0";
hafasHeader.accessid = "YJpyuPISerpXNNRTo50fNMP0yVu7L6IMuOaBgS0Xz89l3f6I3WhAjnto4kS9oz1";
|