Commit cfcda926 authored by Volker Krause's avatar Volker Krause

Clean up variant-based API

This is no longer used directly by QML, so we can use real types now.
parent 88e95360
......@@ -104,14 +104,14 @@ void LiveDataManager::setPollingEnabled(bool pollingEnabled)
}
}
QVariant LiveDataManager::arrival(const QString &resId)
KPublicTransport::Departure LiveDataManager::arrival(const QString &resId)
{
return QVariant::fromValue(m_arrivals.value(resId).change);
return m_arrivals.value(resId).change;
}
QVariant LiveDataManager::departure(const QString &resId)
KPublicTransport::Departure LiveDataManager::departure(const QString &resId)
{
return QVariant::fromValue(m_departures.value(resId).change);
return m_departures.value(resId).change;
}
void LiveDataManager::checkForUpdates()
......
......@@ -53,8 +53,8 @@ public:
void setPollingEnabled(bool pollingEnabled);
Q_INVOKABLE QVariant arrival(const QString &resId);
Q_INVOKABLE QVariant departure(const QString &resId);
KPublicTransport::Departure arrival(const QString &resId);
KPublicTransport::Departure departure(const QString &resId);
public Q_SLOTS:
/** Checks all applicable elements for updates. */
......
......@@ -185,7 +185,7 @@ KPublicTransport::Departure TimelineDelegateController::arrival() const
if (!m_liveDataMgr || m_batchId.isEmpty()) {
return {};
}
return m_liveDataMgr->arrival(m_batchId).value<KPublicTransport::Departure>();
return m_liveDataMgr->arrival(m_batchId);
}
KPublicTransport::Departure TimelineDelegateController::departure() const
......@@ -193,7 +193,7 @@ KPublicTransport::Departure TimelineDelegateController::departure() const
if (!m_liveDataMgr || m_batchId.isEmpty()) {
return {};
}
return m_liveDataMgr->departure(m_batchId).value<KPublicTransport::Departure>();
return m_liveDataMgr->departure(m_batchId);
}
void TimelineDelegateController::checkForUpdate(const QString& batchId)
......@@ -238,7 +238,7 @@ QDateTime TimelineDelegateController::relevantStartDateTime(const QVariant &res)
QDateTime TimelineDelegateController::liveStartDateTime(const QVariant& res) const
{
if (m_liveDataMgr) {
const auto dep = m_liveDataMgr->departure(m_batchId).value<KPublicTransport::Departure>();
const auto dep = m_liveDataMgr->departure(m_batchId);
if (dep.expectedDepartureTime().isValid()) {
return dep.expectedDepartureTime();
}
......@@ -249,7 +249,7 @@ QDateTime TimelineDelegateController::liveStartDateTime(const QVariant& res) con
QDateTime TimelineDelegateController::liveEndDateTime(const QVariant& res) const
{
if (m_liveDataMgr) {
const auto arr = m_liveDataMgr->arrival(m_batchId).value<KPublicTransport::Departure>();
const auto arr = m_liveDataMgr->arrival(m_batchId);
if (arr.expectedArrivalTime().isValid()) {
return arr.expectedArrivalTime();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment