Recreated device sync, part I.
This commit is contained in:
@@ -83,11 +83,16 @@ QTableView* BCDevicePanel::getValueView()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const BCValueList& BCDevicePanel::getValueList()
|
||||||
|
{
|
||||||
|
return _valueModel.getValueList();
|
||||||
|
}
|
||||||
|
|
||||||
void BCDevicePanel::onValueListReady( BCDevice::ID deviceID, BCValueList valueList )
|
void BCDevicePanel::onValueListReady( BCDevice::ID deviceID, BCValueList valueList )
|
||||||
{
|
{
|
||||||
qDebug() << " --- onValueListReady: " << getHeaderText() <<" : " << deviceID << ": " << valueList.size();
|
qDebug() << " --- onValueListReady: " << getHeaderText() <<" : " << deviceID << ": " << valueList.size();
|
||||||
if(_devideID == deviceID)
|
if(_devideID == deviceID)
|
||||||
_valueModel.setValueList( valueList );
|
_valueModel.takeValueList( valueList );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -50,10 +50,8 @@ public:
|
|||||||
|
|
||||||
void setDeviceID( BCDevice::ID deviceID );
|
void setDeviceID( BCDevice::ID deviceID );
|
||||||
BCDevice::ID getDeviceID() const;
|
BCDevice::ID getDeviceID() const;
|
||||||
|
|
||||||
BCValueList& exposeValueList();
|
|
||||||
|
|
||||||
QTableView* getValueView();
|
QTableView* getValueView();
|
||||||
|
const BCValueList& getValueList();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|||||||
@@ -162,9 +162,10 @@ void BCMainWindow::initMainWindow()
|
|||||||
|
|
||||||
// C) Aufräumen: Wenn Thread endet, lösche den Runner
|
// C) Aufräumen: Wenn Thread endet, lösche den Runner
|
||||||
connect(&_worker, &QThread::finished, &_transmitter, &QObject::deleteLater);
|
connect(&_worker, &QThread::finished, &_transmitter, &QObject::deleteLater);
|
||||||
|
|
||||||
// 5. Thread starten
|
// 5. Thread starten
|
||||||
_worker.start();
|
_worker.start();
|
||||||
|
|
||||||
|
_consoleAction->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -179,7 +180,7 @@ void BCMainWindow::onValueListReady( BCDevice::ID deviceID )
|
|||||||
BCValueList& newValueList = _dataManager.getCurrentValueList();
|
BCValueList& newValueList = _dataManager.getCurrentValueList();
|
||||||
qDebug() << " --- Before: " << victim.size() << " orig:" << newValueList.size();
|
qDebug() << " --- Before: " << victim.size() << " orig:" << newValueList.size();
|
||||||
victim = std::exchange(newValueList, BCValueList());
|
victim = std::exchange(newValueList, BCValueList());
|
||||||
//_devicePanels[deviceID]->setValueList( newValueList );
|
//_devicePanels[deviceID]->exchangeValueList( newValueList );
|
||||||
qDebug() << " ---After: " << victim.size() << " orig:" << newValueList.size();
|
qDebug() << " ---After: " << victim.size() << " orig:" << newValueList.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,19 +231,16 @@ void BCMainWindow::onRunnerMessage(const QString &msg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void BCMainWindow::onSyncFromDevice()
|
void BCMainWindow::onSyncFromDevice()
|
||||||
{
|
{
|
||||||
qDebug() << " ---Syncing";
|
qDebug() << " ---Syncing";
|
||||||
/*
|
|
||||||
if( _currentDeviceID != BCDevice::ID::Invalid )
|
|
||||||
{
|
|
||||||
if( _valueModels.contains(_currentDeviceID) )
|
|
||||||
{
|
|
||||||
|
|
||||||
BCValueModel* model = _valueModels[_currentDeviceID];
|
Q_ASSERT(_currentPanel && "currentpanel ist null!");
|
||||||
BCValueList& currentList = model->getValueList();
|
|
||||||
|
|
||||||
//BCDataValue& value = currentList[4];
|
const BCValueList& currentList =_currentPanel->getValueList();
|
||||||
|
|
||||||
|
// alle einzeln? echt jetzt?
|
||||||
|
|
||||||
for( const BCDataValue& value : currentList )
|
for( const BCDataValue& value : currentList )
|
||||||
{
|
{
|
||||||
@@ -263,7 +261,5 @@ void BCMainWindow::onSyncFromDevice()
|
|||||||
//QThread::msleep(500);
|
//QThread::msleep(500);
|
||||||
|
|
||||||
}
|
}
|
||||||
} // if contains
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,10 +55,11 @@ const BCValueList& BCValueModel::getValueList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BCValueModel::setValueList(const BCValueList& valueList)
|
void BCValueModel::takeValueList(BCValueList& newValueList)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
_valueList = valueList;
|
// hier nehmen wir die valueList in Besitz.
|
||||||
|
_valueList = std::exchange(newValueList, {} );
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ public:
|
|||||||
explicit BCValueModel(QObject *parent = nullptr);
|
explicit BCValueModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
void addValue(const BCDataValue& val);
|
void addValue(const BCDataValue& val);
|
||||||
void setValueList(const BCValueList& valueList);
|
|
||||||
|
void takeValueList(BCValueList& valueList);
|
||||||
const BCValueList& getValueList();
|
const BCValueList& getValueList();
|
||||||
|
|
||||||
// Pure Virtual Functions von QAbstractTableModel
|
// Pure Virtual Functions von QAbstractTableModel
|
||||||
|
|||||||
Reference in New Issue
Block a user