diff --git a/harbour-london-sail.pro b/harbour-london-sail.pro
index 6513df6..ecfa460 100644
--- a/harbour-london-sail.pro
+++ b/harbour-london-sail.pro
@@ -83,7 +83,8 @@ OTHER_FILES += qml/harbour-london-sail.qml \
qml/pages/MapsPage.qml \
qml/pages/BusMapsPage.qml \
qml/pages/MyMapsPage.qml \
- qml/gui/NotificationWidget.qml
+ qml/gui/NotificationWidget.qml \
+ qml/gui/TrafficSearchHeader.qml
HEADERS += \
src/logic/servicestatuslogic.h \
diff --git a/images/tubemap.png b/images/tubemap.png
index 8121451..a7f5365 100644
Binary files a/images/tubemap.png and b/images/tubemap.png differ
diff --git a/qml/gui/SearchHeader.qml b/qml/gui/SearchHeader.qml
index 27db288..c61fab8 100644
--- a/qml/gui/SearchHeader.qml
+++ b/qml/gui/SearchHeader.qml
@@ -29,20 +29,23 @@ Item {
id: self
property string title: "Title"
property alias text: searchField.text
- property alias searchPlaceholder: searchField.placeholderText
+ property string placeholderText: "Search"
+ property bool readOnly: searchField.readOnly
- signal filterChanged()
- height: header.height + searchField.height + 2*Theme.paddingLarge
+ signal enterClicked()
+
+ height: header.height + searchField.height + 2 * Theme.paddingLarge
anchors {
left: parent.left
right: parent.right
}
- state: ""
+
Label {
id: header
text: title
font.pixelSize: Theme.fontSizeLarge
color: Theme.highlightColor
+ horizontalAlignment: Text.AlignRight
anchors {
top: parent.top
topMargin: Theme.paddingMedium*2
@@ -50,93 +53,47 @@ Item {
rightMargin: Theme.paddingLarge
}
}
+
SearchField {
id: searchField
- width: 480
- opacity: 0
readOnly: true
+ opacity: parent.opacity
anchors {
top: header.bottom
+ topMargin: Theme.paddingMedium*2
left: parent.left
- leftMargin: Theme.paddingLarge
+ leftMargin: Theme.paddingMedium
+ right: parent.right
+ rightMargin: Theme.paddingMedium
}
- placeholderText: "Search/Filter"
+ placeholderText: self.placeholderText
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
EnterKey.onClicked: {
searchField.focus = false
+ self.enterClicked()
}
onClicked: {
forceActiveFocus()
}
-
- onTextChanged: {
- self.filterChanged()
- }
}
states: [
State {
- name: ""
+ name: "invisible"
PropertyChanges {
target: searchField
- opacity: 0
+ visible: false
readOnly: true
}
},
State {
- name: "searchable"
+ name: "visible"
PropertyChanges {
target: searchField
- opacity: 100
- readOnly: false
- }
- },
- State {
- name: "Traffic Disruptions"
- PropertyChanges {
- target: self
- title: "Traffic Disruptions"
- }
- PropertyChanges {
- target: searchField
- opacity: 100
- readOnly: false
- }
- },
- State {
- name: "Scheduled"
- PropertyChanges {
- target: self
- title: "Scheduled"
- }
- PropertyChanges {
- target: searchField
- opacity: 100
- readOnly: false
- }
- },
- State {
- name: "Recurring Works"
- PropertyChanges {
- target: self
- title: "Recurring Works"
- }
- PropertyChanges {
- target: searchField
- opacity: 100
- readOnly: false
- }
- },
- State {
- name: "Recently Cleared"
- PropertyChanges {
- target: self
- title: "Recently Cleared"
- }
- PropertyChanges {
- target: searchField
- opacity: 100
+ visible: true
readOnly: false
}
}
+
]
}
+
diff --git a/qml/gui/StopHeader.qml b/qml/gui/StopHeader.qml
index 29d7804..439713d 100644
--- a/qml/gui/StopHeader.qml
+++ b/qml/gui/StopHeader.qml
@@ -165,6 +165,26 @@ Item {
bottom: stopHeader.bottom
}
}
+ ProgressBar {
+ id: progressBar
+ anchors {
+ left: self.left
+ leftMargin: -65
+ right: self.right
+ rightMargin: -65
+ verticalCenter: parent.bottom
+ }
+
+ minimumValue: 0
+ maximumValue: 100
+ value: 0
+ }
+ Connections {
+ target: arrivalsData
+ onDisplayTimerTicked: {
+ progressBar.value = arrivalsData.getTimerProgress_arrivals()
+ }
+ }
states: [
diff --git a/qml/gui/TrafficSearchHeader.qml b/qml/gui/TrafficSearchHeader.qml
new file mode 100644
index 0000000..7d6c02e
--- /dev/null
+++ b/qml/gui/TrafficSearchHeader.qml
@@ -0,0 +1,112 @@
+/*
+Copyright (C) 2014 Krisztian Olah
+
+ email: fasza2mobile@gmail.com
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Item {
+ id: self
+ property string title: "Title"
+ property alias text: searchHeader.text
+ property string placeholderText: "Search/Filter"
+
+ signal filterChanged()
+ height: searchHeader.height + 2 * Theme.paddingLarge
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ SearchHeader {
+ id: searchHeader
+ title: self.title
+ placeholderText: self.placeholderText
+ state: "invisible"
+
+ onTextChanged: filterChanged()
+ }
+
+ state: ""
+
+ states: [
+ State {
+ name: ""
+ PropertyChanges {
+ target: searchHeader
+ state: "invisible"
+ }
+ },
+ State {
+ name: "searchable"
+ PropertyChanges {
+ target: searchHeader
+ state: "visible"
+ }
+ },
+ State {
+ name: "Traffic Disruptions"
+ PropertyChanges {
+ target: self
+ title: "Traffic Disruptions"
+ }
+ PropertyChanges {
+ target: searchHeader
+ state: "visible"
+ }
+ },
+ State {
+ name: "Scheduled"
+ PropertyChanges {
+ target: self
+ title: "Scheduled"
+ }
+ PropertyChanges {
+ target: searchHeader
+ state: "visible"
+ }
+ },
+ State {
+ name: "Recurring Works"
+ PropertyChanges {
+ target: self
+ title: "Recurring Works"
+ }
+ PropertyChanges {
+ target: searchHeader
+ state: "visible"
+ }
+ },
+ State {
+ name: "Recently Cleared"
+ PropertyChanges {
+ target: self
+ title: "Recently Cleared"
+ }
+ PropertyChanges {
+ target: searchHeader
+ state: "visible"
+ }
+ }
+ ]
+}
diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml
index 39edc73..b9ee041 100644
--- a/qml/pages/AboutPage.qml
+++ b/qml/pages/AboutPage.qml
@@ -59,7 +59,7 @@ Page {
right: parent.right
rightMargin: Theme.paddingLarge
}
- text: "Version: 0.4.3"
+ text: "Version: 0.4.4"
}
Label {
id: descriptionLabel
diff --git a/qml/pages/BusMapsPage.qml b/qml/pages/BusMapsPage.qml
index a669bd3..db1e0b1 100644
--- a/qml/pages/BusMapsPage.qml
+++ b/qml/pages/BusMapsPage.qml
@@ -67,6 +67,7 @@ Page {
loader.item.isLocalFile = mapData.isThereLocalFile(nameData)
label.color = mapData.isThereLocalFile(nameData) ?
Theme.primaryColor : Theme.secondaryColor }
+
function deleteMap() {
remorseItem.execute( itemDelegate ,"Deleting",
function () { mapData.deleteMap(nameData)} )
diff --git a/qml/pages/BusStopPage.qml b/qml/pages/BusStopPage.qml
index 2ffc39b..2aa3076 100644
--- a/qml/pages/BusStopPage.qml
+++ b/qml/pages/BusStopPage.qml
@@ -35,6 +35,7 @@ import "../gui"
Page {
id: page
property string stopID: ""//"74612"//"52727"//"52725"
+ property bool isDownloading: false
allowedOrientations: Orientation.All
onStatusChanged: {
if (status === PageStatus.Active) {
@@ -50,8 +51,10 @@ Page {
}
Connections {
target: arrivalsData
- onDownloadSatateChanged: {
+ onDownloadStateChanged: {
busyIndicator.running = !view.count && (arrivalsData.isDownloadingArrivals() || arrivalsData.isDownloadingStop())
+ pulley.busy = arrivalsData.isDownloadingArrivals() || arrivalsData.isDownloadingStop()
+ refreshMenuItem.enabled = !(arrivalsData.isDownloadingArrivals() || arrivalsData.isDownloadingStop())
}
}
@@ -68,6 +71,18 @@ Page {
property ArrivalsModel arrivalsModel: arrivalsData.getArrivalsModel()
+ PullDownMenu {
+ id: pulley
+ MenuItem {
+ id: refreshMenuItem
+ text: "Refresh"
+ onClicked: {
+ arrivalsData.stopArrivalsUpdate()
+ arrivalsData.startArrivalsUpdate()
+ }
+ }
+ }
+
Connections {
target: view.currentStop
onDataChanged: {
diff --git a/qml/pages/ChangelogPage.qml b/qml/pages/ChangelogPage.qml
index a740488..5f5e875 100644
--- a/qml/pages/ChangelogPage.qml
+++ b/qml/pages/ChangelogPage.qml
@@ -47,6 +47,22 @@ Page {
PageHeader {
title: "Changelog"
}
+ Label {
+ anchors {
+ left: parent.left
+ leftMargin: Theme.paddingLarge
+ right: parent.right
+ rightMargin: Theme.paddingLarge
+ }
+ wrapMode: Text.WordWrap
+ color: Theme.highlightColor
+ textFormat: Text.RichText
+ text: "0.4.4 - New Tube Map.
+*Added new Tube Map: latest tube map as of May 2014. It takes up considerably more space due to higher resolution and better colours.
+*Added Pulley menu to Bus Stop Page: it is now possible to manually refresh the data,
+ added a widget to indicate when the timer would refresh automatically.
+*Fixed bug: cover no longer shows TERMINATED while bus is still on route."
+ }
Label {
anchors {
left: parent.left
diff --git a/qml/pages/DeparturePage.qml b/qml/pages/DeparturePage.qml
index 8b3cb5f..b706090 100644
--- a/qml/pages/DeparturePage.qml
+++ b/qml/pages/DeparturePage.qml
@@ -75,48 +75,21 @@ Page {
}
}
+ VerticalScrollDecorator {
+ flickable: view
+ }
+
SilicaListView {
id: view
anchors.fill: parent
- header: Item {
- height: 150 + pageHeader.height
- anchors {
- left: parent.left
- right: parent.right
- }
- VerticalScrollDecorator {
- flickable: view
- }
- Label {
- id: pageHeader
- text: "Bus Departures"
- color: Theme.highlightColor
- font.pixelSize: Theme.fontSizeLarge
- horizontalAlignment: Text.AlignRight
- anchors {
- top: parent.top
- topMargin: Theme.paddingMedium*2
- right: parent.right
- rightMargin: Theme.paddingLarge
- }
- }
-
- SearchField {
- id: searchfield
- placeholderText: "Code/Stop Name"
- EnterKey.onClicked: readInput(text)
- anchors {
- top: pageHeader.bottom
- topMargin: Theme.paddingMedium*2
- left: parent.left
- leftMargin: Theme.paddingMedium
- right: parent.right
- rightMargin: Theme.paddingMedium
- }
-
- }
+ header: SearchHeader {
+ title: "Bus Departures"
+ placeholderText: "Code/Stop Name"
+ onEnterClicked: readInput(text)
+ state: "visible"
}
+
footer: TflNotice {}
// PullDownMenu {
// id: pulley
diff --git a/qml/pages/JourneyProgressPage.qml b/qml/pages/JourneyProgressPage.qml
index bfa3c15..191adc3 100644
--- a/qml/pages/JourneyProgressPage.qml
+++ b/qml/pages/JourneyProgressPage.qml
@@ -69,7 +69,6 @@ Page {
Connections {
target: arrivalsData
onDownloadStateChanged: {
- console.log("downloadStateChanged")
busyIndicator.running = !view.count && arrivalsData.isDownloadingJourneyProgress()
}
}
@@ -83,8 +82,20 @@ Page {
SilicaListView {
id: view
anchors.fill: parent
+
+ //BUG: after refresh data is not available
+// PullDownMenu {
+// MenuItem {
+// text: "Refresh"
+// onClicked: {
+// arrivalsData.stopJourneyProgressUpdate()
+// arrivalsData.startJourneyProgressUpdate()
+// }
+// }
+// }
+
header: Item {
- height: Theme.paddingMedium*6 + pageHeader.height + destinationLabel.paintedHeight
+ height: Theme.paddingMedium*6 + pageHeader.height + destinationLabel.paintedHeight + Theme.paddingLarge
anchors {
left: parent.left
right: parent.right
@@ -132,6 +143,27 @@ Page {
}
}
+ ProgressBar {
+ id: progressBar
+ minimumValue: 0
+ maximumValue: 100
+ value: 0
+
+ anchors {
+ left: parent.left
+ leftMargin: -65
+ right: parent.right
+ rightMargin: -65
+ verticalCenter: lineNameLabel.bottom
+ verticalCenterOffset: Theme.paddingSmall
+ }
+ }
+ Connections {
+ target: arrivalsData
+ onDisplayTimerTicked: {
+ progressBar.value = arrivalsData.getTimerProgress_journeyProgress()
+ }
+ }
}
footer: TflNotice {}
ViewPlaceholder {
diff --git a/qml/pages/MapsPage.qml b/qml/pages/MapsPage.qml
index 57127ac..4f577b5 100644
--- a/qml/pages/MapsPage.qml
+++ b/qml/pages/MapsPage.qml
@@ -34,6 +34,11 @@ Page {
"Enfield", "Greenwich", "Hackney", "Hammersmith and Fulham", "Haringey", "Harrow", "Havering", "Hillingdon",
"Hounslow", "Islington", "Kensington and Chelsea", "Kingston upon Thames", "Lambeth", "Lewisham", "Merton",
"Newham", "Redbridge", "Richmond", "Southwark", "Sutton", "Tower Hamlets", "Waltham Forest", "Wandsworth", "Westminster"]
+
+ function readInput(text) {
+ pageStack.push(Qt.resolvedUrl("BusMapsPage.qml"), { 'headertitle' : text })
+ }
+
SilicaListView {
id: view
anchors.fill: parent
@@ -49,48 +54,15 @@ Page {
onClicked: pageStack.push(Qt.resolvedUrl("TubeMapPage.qml"))
}
}
- header: Item {
- function readInput(text) {
- pageStack.push(Qt.resolvedUrl("BusMapsPage.qml"), { 'headertitle' : text })
- }
- height: 150 + pageHeader.height
- anchors {
- left: parent.left
- right: parent.right
- }
- VerticalScrollDecorator {
- flickable: view
- }
- Label {
- id: pageHeader
- text: "Bus Maps"
- color: Theme.highlightColor
- font.pixelSize: Theme.fontSizeLarge
- horizontalAlignment: Text.AlignRight
- anchors {
- top: parent.top
- topMargin: Theme.paddingMedium*2
- right: parent.right
- rightMargin: Theme.paddingLarge
- }
- }
-
- SearchField {
- id: searchfield
- placeholderText: "By Route"
- EnterKey.onClicked: readInput(text)
- anchors {
- top: pageHeader.bottom
- topMargin: Theme.paddingMedium*2
- left: parent.left
- leftMargin: Theme.paddingMedium
- right: parent.right
- rightMargin: Theme.paddingMedium
- }
+ header: SearchHeader {
+ title: "Bus Maps"
+ placeholderText: "By Route"
+ state: "visible"
- }
+ onEnterClicked: readInput(text)
}
+
footer: Item {
height: Theme.paddingLarge
width: 1
@@ -109,6 +81,7 @@ Page {
pageStack.push(Qt.resolvedUrl("BusMapsPage.qml"), { 'headertitle' : boroughs[index] })
}
}
+
VerticalScrollDecorator {
flickable: view
}
diff --git a/qml/pages/TrafficPage.qml b/qml/pages/TrafficPage.qml
index 75ba0b8..7584d85 100644
--- a/qml/pages/TrafficPage.qml
+++ b/qml/pages/TrafficPage.qml
@@ -91,7 +91,7 @@ Page {
Connections {
target: trafficData
onDownloadProgress: {
- if(!view.count && disruptionModel.isFilterEmptyString()) {
+ if( !view.count && disruptionModel.isFilterEmptyString()) {
progressLabel.text = value + ' bytes'
}
}
@@ -109,6 +109,7 @@ Page {
}
}
}
+
function setModel(str) {
currentModel = str
view.headerItem.state = str
@@ -118,14 +119,16 @@ Page {
SilicaListView {
id: view
anchors.fill: parent
- header: SearchHeader {
- title: currentModel//"Traffic Disruptions"
+ header: TrafficSearchHeader {
+ id: pageHeader
+ title: currentModel
state: ""
onFilterChanged: { disruptionModel.filter(text) }
}
footer: TflNotice {}
+
PullDownMenu {
id: pulley
MenuItem {
@@ -158,6 +161,7 @@ Page {
onClicked: trafficData.refresh()
}
}
+
PushUpMenu {
id: pushy
enabled: !hasQuickScroll && view.count > fewItems
@@ -179,15 +183,9 @@ Page {
currentUpdate: currentUpdateData
severity: severityData
disruptionID: idData
-
- }
- ListView.onAdd: AddAnimation {
- target: roadDisruptionWiget
- }
- ListView.onRemove: RemoveAnimation {
- target: roadDisruptionWiget
}
+
onCountChanged: {
if (headerItem && headerItem.state === "") {
headerItem.state = count || !disruptionModel.isFilterEmptyString() ? "searchable" : ""
@@ -208,9 +206,12 @@ Page {
text: (view.headerItem.state === "") ? "Pull down to refresh." : "No matches :("
}
}
+
+
RefreshWidget {
id: refreshWidget
}
+
onOrientationChanged: {
//BUG: its seems to be reverted for some reason
refreshWidget.isPortrait = !isPortrait
diff --git a/rpm/harbour-london-sail.spec b/rpm/harbour-london-sail.spec
index 5e4dee9..dfa2522 100644
--- a/rpm/harbour-london-sail.spec
+++ b/rpm/harbour-london-sail.spec
@@ -13,7 +13,7 @@ Name: harbour-london-sail
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: London Sail is commuter application for London.
-Version: 0.4.3
+Version: 0.4.4
Release: 1
Group: Qt/Qt
License: MIT Licence
diff --git a/rpm/harbour-london-sail.yaml b/rpm/harbour-london-sail.yaml
index c883125..a255c21 100644
--- a/rpm/harbour-london-sail.yaml
+++ b/rpm/harbour-london-sail.yaml
@@ -1,6 +1,6 @@
Name: harbour-london-sail
Summary: London Sail is commuter application for London.
-Version: 0.4.3
+Version: 0.4.4
Release: 1
Group: Qt/Qt
URL: http://example.org/
diff --git a/src/logic/arrivals/journeyprogresscontainer.cpp b/src/logic/arrivals/journeyprogresscontainer.cpp
index efc6def..bfbc072 100644
--- a/src/logic/arrivals/journeyprogresscontainer.cpp
+++ b/src/logic/arrivals/journeyprogresscontainer.cpp
@@ -28,7 +28,7 @@ THE SOFTWARE.
#include "arrivalsproxymodel.h"
#include "journeyprogressmodel.h"
-//custom search algorithms because Qt algorithms are not sufficent and labmbdas or bind is not available in C++03 to use std algorithms
+//custom search algorithms because Qt algorithms are not sufficent and lambdas or bind is not available in C++03 to use std algorithms
namespace {
typedef QList > StopList;
StopList::const_iterator find(StopList::const_iterator begin,StopList::const_iterator end, const QString& val) {
@@ -50,11 +50,14 @@ StopList::iterator find(StopList::iterator begin,StopList::iterator end, const Q
//any other case it just returns end() iterator
StopList::const_iterator findNextStop(StopList::const_iterator begin,StopList::const_iterator end, double val, double time) {
for (StopList::const_iterator iter = begin; iter != end; ++iter) {
- if (iter->second - time > 0 && iter->second < val) return iter;
+ if ((iter->second - time > 0)) {
+ //if the original time is in the past and this isn't, then this is still better match,
+ //otherwise only return if it is smaller then given value
+ if (val - time < 0 || iter->second < val) { return iter; }
+ }
}
return end;
}
-
}//end of unnamed namespace
JourneyProgressContainer::JourneyProgressContainer(QObject* parent) : QObject(parent),
@@ -110,7 +113,6 @@ QString JourneyProgressContainer::getNextStop() const {
}
else return smallestSoFar->first;
}
-
else {
return QString("NOT AVAILABLE");
}
diff --git a/src/logic/arrivalslogic.cpp b/src/logic/arrivalslogic.cpp
index 4b81915..d2e8927 100644
--- a/src/logic/arrivalslogic.cpp
+++ b/src/logic/arrivalslogic.cpp
@@ -53,6 +53,7 @@ ArrivalsLogic::ArrivalsLogic(DatabaseManager* dbm, QObject* parent) : QObject(pa
baseUrl("http://countdown.api.tfl.gov.uk/interfaces/ura/instant_V1?"),
databaseManager(dbm),
currentStop(new Stop(databaseManager)),
+ displayTimer(new QTimer(this)),
downloadingArrivals(false),
downloadingJourneyProgress(false),
downloadingListOfStops(false),
@@ -74,6 +75,7 @@ ArrivalsLogic::ArrivalsLogic(DatabaseManager* dbm, QObject* parent) : QObject(pa
connect(arrivalsTimer, SIGNAL(timeout()), this, SLOT(fetchArrivalsData()) );
connect(journeyProgressTimer, SIGNAL(timeout()), this, SLOT(fetchJourneyProgress()) );
connect(journeyProgressContainer, SIGNAL(dataChanged()), this, SLOT(onProgressDataChanged()) );
+ connect(displayTimer, SIGNAL(timeout()), this, SLOT(onDisplayTimerTicked()) );
}
//private:
@@ -298,6 +300,10 @@ void ArrivalsLogic::onBusStopMessageReceived() {
/////////////////////////////////////////////////
}
+void ArrivalsLogic::onDisplayTimerTicked() {
+ emit displayTimerTicked();
+}
+
//gets called when the list of bus stops are downloaded by getBusStopsByName(name)
void ArrivalsLogic::onListOfBusStopsReceived() {
downloadingListOfStops = false;
@@ -410,6 +416,18 @@ QString ArrivalsLogic::getCurrentStopMessages() const {
QString ArrivalsLogic::getCurrentVehicleLine() const { return currentVehicleLine; }
+double ArrivalsLogic::getTimerProgress_arrivals() const {
+ double interval = arrivalsTimer->interval();
+ double remaining = arrivalsTimer->remainingTime();
+ return (interval - remaining) / interval * 100;
+}
+
+double ArrivalsLogic::getTimerProgress_journeyProgress() const {
+ double interval = journeyProgressTimer->interval();
+ double remaining = journeyProgressTimer->remainingTime();
+ return (interval - remaining) / interval * 100;
+}
+
bool ArrivalsLogic::isDownloadingArrivals() const { return downloadingArrivals; }
bool ArrivalsLogic::isDownloadingJourneyProgress() const { return downloadingJourneyProgress; }
@@ -453,6 +471,7 @@ void ArrivalsLogic::setStopsQueryModel(int type) {
void ArrivalsLogic::startArrivalsUpdate() {
fetchArrivalsData();
arrivalsTimer->start(30000);//30 sec
+ displayTimer->start(16);
}
//starts timer to periodically download journey progress data
@@ -461,17 +480,20 @@ void ArrivalsLogic::startJourneyProgressUpdate() {
qDebug() << "***startJourneyProgressUpdate() ***";
fetchJourneyProgress();
journeyProgressTimer->start(30000);//30 sec
+ displayTimer->start(16);
}
//stops timer to download arrivals data
void ArrivalsLogic::stopArrivalsUpdate() {
qDebug() << "updating stopped.";
+ displayTimer->stop();
arrivalsTimer->stop();
clearArrivalsData();
}
//stops timer to download journey progress data
void ArrivalsLogic::stopJourneyProgressUpdate() {
+ displayTimer->stop();
journeyProgressTimer->stop();
clearJourneyProgressData();
}
diff --git a/src/logic/arrivalslogic.h b/src/logic/arrivalslogic.h
index 73cf35b..a32e1f1 100644
--- a/src/logic/arrivalslogic.h
+++ b/src/logic/arrivalslogic.h
@@ -65,6 +65,7 @@ class ArrivalsLogic : public QObject
DatabaseManager* databaseManager;
Stop* currentStop;
QString currentStopMessages;
+ QTimer* displayTimer;
bool downloadingArrivals;
bool downloadingJourneyProgress;
bool downloadingListOfStops;
@@ -82,6 +83,7 @@ class ArrivalsLogic : public QObject
void currentStopMessagesChanged();
void downloadStateChanged();
void nextStopChanged();
+ void displayTimerTicked();
void stopDataChanged();
private:
void clearArrivalsData();
@@ -97,6 +99,7 @@ private slots:
void onBusProgressReceived();
void onBusStopDataReceived();
void onBusStopMessageReceived();
+ void onDisplayTimerTicked();
void onListOfBusStopsReceived();
void onProgressDataChanged();
public slots:
@@ -110,6 +113,8 @@ public slots:
Stop* getCurrentStop();
QString getCurrentStopMessages() const;
QString getCurrentVehicleLine() const;
+ double getTimerProgress_arrivals() const;
+ double getTimerProgress_journeyProgress() const;
bool isDownloadingArrivals() const;
bool isDownloadingJourneyProgress() const;
bool isDownloadingListOfStops() const;