[traff_assessment_tool] Show animation while feed is loading

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-10-20 23:44:48 +03:00
parent 6a694c5d3e
commit 1b74062447
4 changed files with 25 additions and 2 deletions

View File

@@ -317,10 +317,11 @@ void MainWindow::CreateTrafficPanel()
{
if (!m_trafficModel)
{
// TODO simplify the call, everything depends on m_framework
// TODO simplify the call, almost everything depends on m_framework
m_trafficModel = new TrafficModel(m_framework, m_framework.GetDataSource(),
std::make_unique<TrafficDrawerDelegate>(m_framework),
std::make_unique<PointsControllerDelegate>(m_framework));
std::make_unique<PointsControllerDelegate>(m_framework),
*this);
connect(m_mapWidget, &MapWidget::TrafficMarkupClick,
m_trafficModel, &TrafficModel::OnClick);
@@ -339,7 +340,13 @@ void MainWindow::CreateTrafficPanel()
m_dockWidget->adjustSize();
m_dockWidget->setMinimumWidth(400);
m_progressBar = new QProgressBar(m_dockWidget);
m_progressBar->setMinimum(0);
m_progressBar->setMaximum(0);
}
m_dockWidget->setTitleBarWidget(m_progressBar);
m_dockWidget->show();
}
@@ -350,6 +357,9 @@ void MainWindow::DestroyTrafficPanel()
delete m_dockWidget;
m_dockWidget = nullptr;
delete m_progressBar;
m_progressBar = nullptr;
delete m_trafficModel;
m_trafficModel = nullptr;

View File

@@ -5,6 +5,7 @@
#include <string>
#include <QMainWindow>
#include <QProgressBar>
class Framework;
class QHBoxLayout;
@@ -31,6 +32,7 @@ class MainWindow : public QMainWindow
public:
explicit MainWindow(Framework & framework);
QDockWidget * GetDockWidget() { return m_dockWidget; }
private:
void CreateTrafficPanel();
@@ -58,6 +60,7 @@ private:
traffxml::TrafficModel * m_trafficModel = nullptr;
QDockWidget * m_dockWidget = nullptr;
QProgressBar * m_progressBar = nullptr;
#ifdef openlr_obsolete
QAction * m_goldifyMatchedPathAction = nullptr;

View File

@@ -13,6 +13,7 @@
#include "base/assert.hpp"
#include "base/scope_guard.hpp"
#include <QDockWidget>
#include <QItemSelection>
#include <QMessageBox>
@@ -300,12 +301,14 @@ QVariant GetDescription(TraffMessage const & message)
TrafficModel::TrafficModel(Framework & framework, DataSource const & dataSource,
std::unique_ptr<TrafficDrawerDelegateBase> drawerDelegate, // TODO do we need that?
std::unique_ptr<PointsControllerDelegateBase> pointsDelegate, // TODO do we need that?
MainWindow & mainWindow,
QObject * parent)
: QAbstractTableModel(parent)
, m_framework(framework)
, m_dataSource(dataSource)
, m_drawerDelegate(std::move(drawerDelegate))
, m_pointsDelegate(std::move(pointsDelegate))
, m_mainWindow(mainWindow)
{
framework.GetTrafficManager().SetTrafficUpdateCallbackFn([this, &framework](bool final) {
/*
@@ -330,6 +333,10 @@ TrafficModel::TrafficModel(Framework & framework, DataSource const & dataSource,
editSession.ClearGroup(UserMark::Type::COLORED);
editSession.SetIsVisible(UserMark::Type::COLORED, false);
// restore QDockWidget title
if (m_mainWindow.GetDockWidget())
m_mainWindow.GetDockWidget()->setTitleBarWidget(nullptr);
LOG(LINFO, ("Messages:", m_messages.size()));
});
});

View File

@@ -1,5 +1,6 @@
#pragma once
#include "mainwindow.hpp"
#include "points_controller_delegate_base.hpp"
#ifdef openlr_obsolete
#include "segment_correspondence.hpp"
@@ -72,6 +73,7 @@ public:
TrafficModel(Framework & framework, DataSource const & dataSource,
std::unique_ptr<TrafficDrawerDelegateBase> drawerDelegate,
std::unique_ptr<PointsControllerDelegateBase> pointsDelegate,
MainWindow & mainWindow,
QObject * parent = Q_NULLPTR);
bool SaveSampleAs(std::string const & fileName) const;
@@ -123,6 +125,7 @@ private:
Framework & m_framework;
DataSource const & m_dataSource;
MainWindow & m_mainWindow;
#ifdef openlr_obsolete
std::vector<SegmentCorrespondence> m_segments;
// Non-owning pointer to an element of m_segments.