diff --git a/bc.h b/bc.h index 770d4ea..fbaaed9 100644 --- a/bc.h +++ b/bc.h @@ -799,6 +799,7 @@ namespace BCTags inline constexpr auto Max = "Max"_L1; inline constexpr auto Factor = "Factor"_L1; + } #endif // BC_H diff --git a/bcdeviceview.cpp b/bcdeviceview.cpp index 6292321..5b335ee 100644 --- a/bcdeviceview.cpp +++ b/bcdeviceview.cpp @@ -48,11 +48,6 @@ BCDeviceView::BCDeviceView(QWidget *parent) } -void BCDeviceView::setHeaderLabel( const QString& headerText) -{ - _valueModel.setHeaderLabel( headerText ); -} - void BCDeviceView::setDeviceID( BCDevice::ID deviceID ) { @@ -72,12 +67,7 @@ const BCValueList& BCDeviceView::getValueListX() return _valueModel.getValueList(); } -/* -BCValueModel& BCDeviceView::getValueModel() -{ - return _valueModel; -} -*/ + // __FIX ist das ok so? void BCDeviceView::onValueListReady( BCDevice::ID deviceID, BCValueList valueList ) diff --git a/bcdeviceview.h b/bcdeviceview.h index 8ba640a..f65a4f1 100644 --- a/bcdeviceview.h +++ b/bcdeviceview.h @@ -48,7 +48,6 @@ public: explicit BCDeviceView(QWidget *parent = nullptr); - void setHeaderLabel( const QString& headerText); void setDeviceID( BCDevice::ID deviceID ); BCDevice::ID getDeviceID() const; diff --git a/bcmainwindow.cpp b/bcmainwindow.cpp index c7a0c94..e35a358 100644 --- a/bcmainwindow.cpp +++ b/bcmainwindow.cpp @@ -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() diff --git a/bcmainwindow.h b/bcmainwindow.h index 9c2381c..6a08541 100644 --- a/bcmainwindow.h +++ b/bcmainwindow.h @@ -49,6 +49,8 @@ public: BCMainWindow(QWidget *parent = nullptr); virtual ~BCMainWindow(); + void setHeaderLabel( const QString& headerText); + public slots: //void onValueListReady( BCDevice::ID deviceID ); @@ -59,7 +61,6 @@ public slots: // Slots für Rückmeldungen vom Runner void onValueUpdated( BCDevice::ID deviceID, int index, BC::State state, const QString& newValue="" ); - void onRunnerMessage(const QString &msg); void onSyncFromDevice(); signals: @@ -84,6 +85,9 @@ protected: QThread _worker; BCTransmitter _transmitter; + + static constexpr const char* BCKeyHeaderLabel = "BCHeaderLabel"; + }; #endif // BCMAINWINDOW_H diff --git a/bcmainwindow.ui b/bcmainwindow.ui index 8b1f9e7..b2524cc 100644 --- a/bcmainwindow.ui +++ b/bcmainwindow.ui @@ -23,8 +23,23 @@ + + + 0 + 45 + + + + + 14 + true + + + + -2 + - Bionx Control + Bionx Control @@ -190,6 +205,12 @@ Qt::PenStyle::NoPen + + Console Settings + + + false + true @@ -213,6 +234,12 @@ Qt::PenStyle::NoPen + + Motor Settings + + + false + true @@ -236,6 +263,12 @@ Qt::PenStyle::NoPen + + Battery Settings + + + false + true @@ -259,6 +292,12 @@ Qt::PenStyle::NoPen + + Pimp my Ride ... + + + false + true diff --git a/bcvaluemodel.cpp b/bcvaluemodel.cpp index 1d16511..113e882 100644 --- a/bcvaluemodel.cpp +++ b/bcvaluemodel.cpp @@ -44,14 +44,6 @@ BCValueModel::BCValueModel(QObject *parent) } -/** - * @brief Setzt den Headerlabel ( == die Devicebezeichnung ) - * @param headerLabel - */ -void BCValueModel::setHeaderLabel( const QString& headerLabel ) -{ - _headerLabel = headerLabel; -} /** * @brief Einen Einzelwert hinzufügen @@ -147,17 +139,6 @@ int BCValueModel::columnCount(const QModelIndex& parent) const } -/** - * @brief Gibt die Header-Einträge zurück - */ - -QVariant BCValueModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (role != Qt::DisplayRole || orientation != Qt::Horizontal || section != 0) - return QVariant(); - - return _headerLabel; -} /** diff --git a/bcvaluemodel.h b/bcvaluemodel.h index 2401e0a..adda31d 100644 --- a/bcvaluemodel.h +++ b/bcvaluemodel.h @@ -52,8 +52,6 @@ public: explicit BCValueModel(QObject *parent = nullptr); - void setHeaderLabel( const QString& headerLabel ); - void addValue(const BCValue& val); void takeValueList(BCValueList& valueList); const BCValueList& getValueList() const; @@ -62,7 +60,7 @@ public: int rowCount(const QModelIndex& parent = QModelIndex()) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + //QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; // Nötig für Editierbarkeit @@ -75,7 +73,6 @@ public slots: protected: - QString _headerLabel; // Die eigentlichen Werte wohnen im tatsächlich hier, im Model. BCValueList _valueList; diff --git a/main.cpp b/main.cpp index e3e7728..e7ef26f 100644 --- a/main.cpp +++ b/main.cpp @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); - setApplicationStyleSheet( ":/claude_dark_mode.qss"_L1 ); + //setApplicationStyleSheet( ":/claude_light_mode.qss"_L1 ); /* app.setStyleSheet(R"( QWidget { @@ -81,4 +81,5 @@ int main(int argc, char *argv[]) return app.exec(); + // 🌙☀️ ! }