Cleanups in ui.
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "qassert.h"
|
||||
#include <bcmainwindow.h>
|
||||
#include <bcitemdelegate.h>
|
||||
#include <bcanimateddelegate.h>
|
||||
#include <ui_bcmainwindow.h>
|
||||
|
||||
|
||||
@@ -91,15 +91,15 @@ void BCMainWindow::initMainWindow()
|
||||
|
||||
if( _devicePanels.contains(deviceID) )
|
||||
{
|
||||
BCDevicePanel* currentPanel = _devicePanels[deviceID];
|
||||
BCDeviceView* currentPanel = _devicePanels[deviceID];
|
||||
// den Panels ihren title geben
|
||||
currentPanel->setHeaderText( panelTitle );
|
||||
currentPanel->setHeaderLabel( panelTitle );
|
||||
// ... und ihre device ID
|
||||
currentPanel->setDeviceID( deviceID );
|
||||
// Wenn ein Device (entspricht einem Datenmodel) fertig eingelesen wurde,
|
||||
// wird es weitergereicht.
|
||||
// Problem: alle Panels bekommen alle Datenmodelle angeboten.
|
||||
connect( &_dataManager, &BCDataManager::valueListReady, currentPanel, &BCDevicePanel::onValueListReady );
|
||||
connect( &_dataManager, &BCDataManager::valueListReady, currentPanel, &BCDeviceView::onValueListReady );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -118,7 +118,7 @@ void BCMainWindow::initMainWindow()
|
||||
|
||||
// Verwendung:
|
||||
|
||||
connect(_delegate, &BCItemDelegate::viewUpdateNeeded, _valueView->viewport(), QOverload<>::of(&QWidget::update));
|
||||
connect(_delegate, &BCAnimatedDelegate::viewUpdateNeeded, _valueView->viewport(), QOverload<>::of(&QWidget::update));
|
||||
|
||||
|
||||
//_valueView->setItemDelegate(_delegate);
|
||||
@@ -134,7 +134,7 @@ void BCMainWindow::initMainWindow()
|
||||
|
||||
// besser: model::emit dataChanged
|
||||
// also: emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole, ValueRole});
|
||||
//connect( &_dataManager, &BCMainWindow::valueTouched, _delegate, &BCItemDelegate::onHighlightRow );
|
||||
//connect( &_dataManager, &BCMainWindow::valueTouched, _delegate, &BCAnimatedDelegate::onHighlightRow );
|
||||
connect( _connectButton, &QToolButton::clicked, &_transmitter, &BCTransmitter::onToggleConnectionState );
|
||||
connect( _syncButton, &QToolButton::clicked, this, &BCMainWindow::onSyncFromDevice );
|
||||
|
||||
@@ -166,7 +166,7 @@ void BCMainWindow::onValueListReady( BCDevice::ID deviceID )
|
||||
qDebug() << " --- onValueListReady!" << deviceID;
|
||||
if( _devicePanels.contains( deviceID ) )
|
||||
{
|
||||
BCDevicePanel& panel = *_devicePanels[deviceID];
|
||||
BCDeviceView& panel = *_devicePanels[deviceID];
|
||||
BCValueList& victim = panel.exposeValueList();
|
||||
BCValueList& newValueList = _dataManager.getCurrentValueList();
|
||||
qDebug() << " --- Before: " << victim.size() << " orig:" << newValueList.size();
|
||||
@@ -183,7 +183,7 @@ void BCMainWindow::onShowDevicePanel( BCDevice::ID deviceID )
|
||||
qDebug() << " --- onShowDevicePanel:" << deviceID;
|
||||
if( _devicePanels.contains( deviceID ) )
|
||||
{
|
||||
BCDevicePanel* nxtPanel = _devicePanels[deviceID];
|
||||
BCDeviceView* nxtPanel = _devicePanels[deviceID];
|
||||
if( nxtPanel != _currentPanel )
|
||||
{
|
||||
_stackedWidget->setCurrentWidget( nxtPanel );
|
||||
@@ -215,7 +215,7 @@ void BCMainWindow::onValueUpdated(BCDevice::ID deviceID, int index, BC::State st
|
||||
qDebug() << "Reply: from: " << deviceID << " at: " << index << "finished. Success:" << state << " on:" << newValue;
|
||||
if( _devicePanels.contains( deviceID ) )
|
||||
{
|
||||
BCDevicePanel& panel = *_devicePanels[deviceID];
|
||||
BCDeviceView& panel = *_devicePanels[deviceID];
|
||||
panel.onValueUpdated( index, state, newValue );
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@ void BCMainWindow::onSyncFromDevice()
|
||||
|
||||
//_transmitter.enqueueValueCommand( value );
|
||||
emit sendValueCommand( BC::OpID::ReadValue, &value);
|
||||
emit valueTouched( value.indexRow );
|
||||
//emit valueTouched( value.indexRow );
|
||||
|
||||
bc::processEventsFor(50);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user