mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
[traff_assessment_tool] Refactor TrafficModel constructor
Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
@@ -317,11 +317,7 @@ void MainWindow::CreateTrafficPanel()
|
|||||||
{
|
{
|
||||||
if (!m_trafficModel)
|
if (!m_trafficModel)
|
||||||
{
|
{
|
||||||
// TODO simplify the call, almost everything depends on m_framework
|
m_trafficModel = new TrafficModel(m_framework, *this);
|
||||||
m_trafficModel = new TrafficModel(m_framework, m_framework.GetDataSource(),
|
|
||||||
std::make_unique<TrafficDrawerDelegate>(m_framework),
|
|
||||||
std::make_unique<PointsControllerDelegate>(m_framework),
|
|
||||||
*this);
|
|
||||||
|
|
||||||
connect(m_mapWidget, &MapWidget::TrafficMarkupClick,
|
connect(m_mapWidget, &MapWidget::TrafficMarkupClick,
|
||||||
m_trafficModel, &TrafficModel::OnClick);
|
m_trafficModel, &TrafficModel::OnClick);
|
||||||
|
|||||||
@@ -298,16 +298,14 @@ QVariant GetDescription(TraffMessage const & message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TrafficModel -------------------------------------------------------------------------------------
|
// TrafficModel -------------------------------------------------------------------------------------
|
||||||
TrafficModel::TrafficModel(Framework & framework, DataSource const & dataSource,
|
TrafficModel::TrafficModel(Framework & framework,
|
||||||
std::unique_ptr<TrafficDrawerDelegateBase> drawerDelegate, // TODO do we need that?
|
|
||||||
std::unique_ptr<PointsControllerDelegateBase> pointsDelegate, // TODO do we need that?
|
|
||||||
MainWindow & mainWindow,
|
MainWindow & mainWindow,
|
||||||
QObject * parent)
|
QObject * parent)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
, m_framework(framework)
|
, m_framework(framework)
|
||||||
, m_dataSource(dataSource)
|
, m_dataSource(framework.GetDataSource())
|
||||||
, m_drawerDelegate(std::move(drawerDelegate))
|
, m_drawerDelegate(std::make_unique<TrafficDrawerDelegate>(framework))
|
||||||
, m_pointsDelegate(std::move(pointsDelegate))
|
, m_pointsDelegate(std::make_unique<PointsControllerDelegate>(framework))
|
||||||
, m_mainWindow(mainWindow)
|
, m_mainWindow(mainWindow)
|
||||||
{
|
{
|
||||||
framework.GetTrafficManager().SetTrafficUpdateCallbackFn([this, &framework](bool final) {
|
framework.GetTrafficManager().SetTrafficUpdateCallbackFn([this, &framework](bool final) {
|
||||||
|
|||||||
@@ -70,9 +70,7 @@ class TrafficModel : public QAbstractTableModel
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// TODO(mgsergio): Check we are on the right mwm. I.e. right mwm version and everything.
|
// TODO(mgsergio): Check we are on the right mwm. I.e. right mwm version and everything.
|
||||||
TrafficModel(Framework & framework, DataSource const & dataSource,
|
TrafficModel(Framework & framework,
|
||||||
std::unique_ptr<TrafficDrawerDelegateBase> drawerDelegate,
|
|
||||||
std::unique_ptr<PointsControllerDelegateBase> pointsDelegate,
|
|
||||||
MainWindow & mainWindow,
|
MainWindow & mainWindow,
|
||||||
QObject * parent = Q_NULLPTR);
|
QObject * parent = Q_NULLPTR);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user