Changed main layout

This commit is contained in:
2025-12-31 13:38:46 +01:00
parent b6764e7a12
commit c7a246e56d
9 changed files with 69 additions and 52 deletions

View File

@@ -68,6 +68,16 @@ BCMainWindow::~BCMainWindow()
}
/**
* @brief Setzt den Headerlabel ( == die Device-Bezeichnung )
* @param headerLabel Der headerLabel
*/
void BCMainWindow::setHeaderLabel( const QString& headerText)
{
_headerLabel->setText( " BionxControl: " + headerText );
}
/**
* @brief Initialisiert alle Komponenten des MainWindows.
*/
@@ -75,7 +85,7 @@ BCMainWindow::~BCMainWindow()
void BCMainWindow::initMainWindow()
{
auto configureAction = [&]( QToolButton* button, QAction* action, BCDevice::ID deviceID, const QString& panelTitle="" )
auto configureAction = [&]( QToolButton* button, QAction* action, BCDevice::ID deviceID )
{
// Action an den Button binden
button->setDefaultAction( action);
@@ -92,8 +102,6 @@ void BCMainWindow::initMainWindow()
if( _devicePanels.contains(deviceID) )
{
BCDeviceView* currentPanel = _devicePanels[deviceID];
// den Panels ihren title geben
currentPanel->setHeaderLabel( panelTitle );
// ... und ihre device ID
currentPanel->setDeviceID( deviceID );
// Wenn ein Device (entspricht einem Datenmodel) fertig eingelesen wurde,
@@ -109,10 +117,10 @@ void BCMainWindow::initMainWindow()
_devicePanels[BCDevice::ID::Motor] = _motorPanel;
// Die actions an die Buttons binden
configureAction(_motorButton, _motorAction, BCDevice::ID::Motor, "Motor Settings"_L1 );
configureAction(_consoleButton, _consoleAction, BCDevice::ID::Console, "Console Settings"_L1 );
configureAction(_batteryButton, _batteryAction, BCDevice::ID::Battery, "Battery Settings"_L1 );
configureAction(_pimpButton, _pimpAction, BCDevice::ID::Pimp, "Pimp my Ride"_L1 );
configureAction(_motorButton, _motorAction, BCDevice::ID::Motor );
configureAction(_consoleButton, _consoleAction, BCDevice::ID::Console );
configureAction(_batteryButton, _batteryAction, BCDevice::ID::Battery );
configureAction(_pimpButton, _pimpAction, BCDevice::ID::Pimp );
/*
@@ -186,8 +194,11 @@ void BCMainWindow::onShowDevicePanel( BCDevice::ID deviceID )
BCDeviceView* nxtPanel = _devicePanels[deviceID];
if( nxtPanel != _currentPanel )
{
_stackedWidget->setCurrentWidget( nxtPanel );
_currentPanel = nxtPanel;
qDebug() << " --- Firz: " << _currentPanel->property( BCKeyHeaderLabel );
setHeaderLabel( _currentPanel->property( BCKeyHeaderLabel ).toString() );
_stackedWidget->setCurrentWidget( nxtPanel );
// knopf auch abschalten?
}
}
@@ -220,12 +231,6 @@ void BCMainWindow::onValueUpdated(BCDevice::ID deviceID, int index, BC::State st
}
}
void BCMainWindow::onRunnerMessage(const QString &msg)
{
qDebug() << "[Worker says]:" << msg;
}
// __fix move this to devicePanel??
void BCMainWindow::onSyncFromDevice()