Ongoing GUI updates.
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
|
||||
#include "qassert.h"
|
||||
@@ -119,6 +119,7 @@ void BCMainWindow::initMainWindow()
|
||||
configureAction(_batteryButton, _batteryAction, BCDevice::ID::Battery );
|
||||
//configureAction(_pimpButton, _pimpAction, BCDevice::ID::Pimp );
|
||||
|
||||
|
||||
/*
|
||||
bool m_isDarkMode = false;
|
||||
QString icon = m_isDarkMode ? "☀️" : "🌙";
|
||||
@@ -165,23 +166,74 @@ void BCMainWindow::initMainWindow()
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
// 2. Bild für den Zustand UNCHECKED (Off) hinzufügen
|
||||
// Das ist das Symbol, wenn NICHT verbunden ist (z.B. ein Stecker)
|
||||
connectIcon.addFile(":/icons/plug_disconnected.svg", QSize(), QIcon::Normal, QIcon::Off);
|
||||
|
||||
// 3. Bild für den Zustand CHECKED (On) hinzufügen
|
||||
// Das ist das Symbol, wenn verbunden IST (z.B. Stecker in Dose)
|
||||
connectIcon.addFile(":/icons/plug_connected.svg", QSize(), QIcon::Normal, QIcon::On);
|
||||
*/
|
||||
|
||||
void BCMainWindow::initStatusBar()
|
||||
{
|
||||
QStatusBar *statBar = statusBar();
|
||||
|
||||
BCDriverStateWidget* connector = new BCDriverStateWidget(this);
|
||||
connect( &_transmitter, &BCTransmitter::driverStateChanged, connector, &BCDriverStateWidget::onDriverStateChanged );
|
||||
statBar->addPermanentWidget(connector);
|
||||
BCDriverStateWidget* conState = new BCDriverStateWidget(this);
|
||||
connect( &_transmitter, &BCTransmitter::driverStateChanged, conState, &BCDriverStateWidget::onDriverStateChanged );
|
||||
connect( conState, &BCDriverStateWidget::clicked, _connectAction, &QAction::trigger );
|
||||
|
||||
statBar->showMessage("Ready");
|
||||
BCThemeSwitchButton *themeBtn = new BCThemeSwitchButton(this);
|
||||
statBar->addPermanentWidget(conState);
|
||||
conState->installEventFilter(this);
|
||||
|
||||
BCThemeSwitchButton* themeBtn = new BCThemeSwitchButton(this);
|
||||
statBar->addPermanentWidget(themeBtn);
|
||||
connect(themeBtn, &BCThemeSwitchButton::themeChanged, this, [this](bool isDark)
|
||||
{
|
||||
QString message = isDark ? "Dark Mode Activated" : "Light Mode Activated";
|
||||
statusBar()->showMessage( message, 3000);
|
||||
setApplicationStyleSheet( isDark ? ":/claude_dark_mode.qss"_L1 : ":/claude_light_mode.qss"_L1 );
|
||||
});
|
||||
|
||||
// Wir starten im light mode
|
||||
//themeBtn->setDarkMode( false );
|
||||
|
||||
statBar->showMessage("Ready");
|
||||
}
|
||||
|
||||
/*
|
||||
bool BCMainWindow::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (obj == myWidget && event->type() == QEvent::MouseButtonRelease) {
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
myAction->trigger();
|
||||
return true; // Event wurde verarbeitet
|
||||
}
|
||||
}
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Setzt das Stylesheet, hier: Dark- oder Lightmode
|
||||
* @param path Der Pfad zuum Stylesheet
|
||||
* @return
|
||||
*/
|
||||
|
||||
bool BCMainWindow::setApplicationStyleSheet( QAnyStringView path )
|
||||
{
|
||||
QFile styleFile( path.toString() );
|
||||
if (styleFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QString style = styleFile.readAll();
|
||||
qApp->setStyleSheet(style);
|
||||
styleFile.close();
|
||||
return false;
|
||||
}
|
||||
qWarning() << "Konnte Stylesheet nicht laden:" << styleFile.errorString();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,6 +247,10 @@ void BCMainWindow::setHeaderLabel( const QString& headerText)
|
||||
_headerLabel->setText( " BionxControl: " + headerText );
|
||||
}
|
||||
|
||||
void BCMainWindow::onShowMessage( const QString& message, int timeOut )
|
||||
{
|
||||
_statusbar->showMessage( message, timeOut );
|
||||
}
|
||||
|
||||
void BCMainWindow::autoConnect()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user