Redesign data structures, part I

This commit is contained in:
2025-12-26 15:19:33 +01:00
parent fcfa61c16c
commit 71d7350913
9 changed files with 62 additions and 84 deletions

View File

@@ -93,13 +93,14 @@ void BCDataManager::onRunnerMessage(const QString &msg)
void BCDataManager::onSyncFromDevice()
{
qDebug() << " ---Syncing";
/*
if( _currentDeviceID != BCDevice::ID::Invalid )
{
if( _valueModels.contains(_currentDeviceID) )
{
BCDataModel* model = _valueModels[_currentDeviceID];
BCDataList& currentList = model->getValueList();
BCValueModel* model = _valueModels[_currentDeviceID];
BCValueList& currentList = model->getValueList();
//BCDataValue& value = currentList[4];
@@ -124,9 +125,10 @@ void BCDataManager::onSyncFromDevice()
}
} // if contains
}
*/
}
std::optional<BCDataModel*> BCDataManager::getModel(BCDevice::ID deviceID )
std::optional<BCValueModel*> BCDataManager::getModel(BCDevice::ID deviceID )
{
if( _valueModels.contains( deviceID) )
return _valueModels[deviceID];
@@ -188,12 +190,13 @@ void BCDataManager::loadXmlBikeData()
qDebug() << " --- Device: " << _xml.name() << ": " << deviceType << " : " << deviceID;
_currentDeviceID = BCDevice::ID( deviceID.value() );
BCDataList parsedValues;
BCValueList parsedValues;
loadXmlBikeDeviceData( parsedValues );
if( parsedValues.count() )
{
BCDataModel* valueModel = new BCDataModel( this );
valueModel->setValueList(parsedValues);
BCValueModel* valueModel = new BCValueModel( this );
// hier lacht der blaue HASE
//valueModel->setValueList(parsedValues);
_valueModels.insert( _currentDeviceID, valueModel );
}
}
@@ -218,7 +221,7 @@ void BCDataManager::loadXmlBikeData()
}
void BCDataManager::loadXmlBikeDeviceData( BCDataList& parsedValues )
void BCDataManager::loadXmlBikeDeviceData( BCValueList& parsedValues )
{
auto printAttrs = [](const QXmlStreamReader& xml)
{