Commit e2f4a649 authored by Volker Krause's avatar Volker Krause
Browse files

Give TransferManager access to LiveDataManager directly

This will enable us to consider delays for selecting transfers.
parent 81c08717
......@@ -282,7 +282,7 @@ int main(int argc, char **argv)
transferManager.setReservationManager(&resMgr);
transferManager.setTripGroupManager(&tripGroupMgr);
transferManager.setFavoriteLocationModel(&favLocModel);
transferManager.setPublicTransportManager(liveDataMgr.publicTransportManager());
transferManager.setLiveDataManager(&liveDataMgr);
transferManager.setAutoAddTransfers(settings.autoAddTransfers());
transferManager.setAutoFillTransfers(settings.autoFillTransfers());
QObject::connect(&settings, &Settings::autoAddTransfersChanged, &transferManager, &TransferManager::setAutoAddTransfers);
......
......@@ -7,6 +7,7 @@
#include "transfermanager.h"
#include "logging.h"
#include "favoritelocationmodel.h"
#include "livedatamanager.h"
#include "publictransport.h"
#include "reservationmanager.h"
#include "transferhelper.h"
......@@ -65,9 +66,9 @@ void TransferManager::setFavoriteLocationModel(FavoriteLocationModel *favLocMode
rescan();
}
void TransferManager::setPublicTransportManager(KPublicTransport::Manager *ptMgr)
void TransferManager::setLiveDataManager(LiveDataManager *liveDataMgr)
{
m_ptrMgr = ptMgr;
m_liveDataMgr = liveDataMgr;
}
void TransferManager::setAutoAddTransfers(bool enable)
......@@ -557,7 +558,7 @@ void TransferManager::autoFillTransfer(Transfer &t)
t.setState(Transfer::Searching);
auto reply = m_ptrMgr->queryJourney(journeyRequestForTransfer(t));
auto reply = m_liveDataMgr->publicTransportManager()->queryJourney(journeyRequestForTransfer(t));
const auto batchId = t.reservationId();
const auto alignment = t.alignment();
connect(reply, &KPublicTransport::JourneyReply::finished, this, [this, reply, batchId, alignment]() {
......
......@@ -16,12 +16,9 @@
#include <cmath>
namespace KPublicTransport {
class Manager;
}
class FavoriteLocation;
class FavoriteLocationModel;
class LiveDataManager;
class ReservationManager;
class TripGroupManager;
......@@ -36,7 +33,7 @@ public:
void setReservationManager(ReservationManager *resMgr);
void setTripGroupManager(TripGroupManager *tgMgr);
void setFavoriteLocationModel(FavoriteLocationModel *favLocModel);
void setPublicTransportManager(KPublicTransport::Manager *ptMgr);
void setLiveDataManager(LiveDataManager *liveDataMgr);
void setAutoAddTransfers(bool enabled);
void setAutoFillTransfers(bool enabled);
......@@ -118,7 +115,7 @@ private:
ReservationManager *m_resMgr = nullptr;
TripGroupManager *m_tgMgr = nullptr;
FavoriteLocationModel *m_favLocModel = nullptr;
KPublicTransport::Manager *m_ptrMgr = nullptr;
LiveDataManager *m_liveDataMgr = nullptr;
mutable QHash<QString, Transfer> m_transfers[2];
QDateTime m_nowOverride;
bool m_autoAddTransfers = true;
......
Supports Markdown
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