From 23695bc7ef1b839a776f3b179f3c621eb8ebbb55 Mon Sep 17 00:00:00 2001 From: "PANIK\\chris" Date: Wed, 7 Jan 2026 22:20:39 +0100 Subject: [PATCH] Fixed light & dark modes. --- bcdrivertinycan.cpp | 2 +- bcguihelpers.cpp | 3 +- bcmainwindow.cpp | 46 ++---- bcmainwindow.ui | 20 +-- bctransmitter.cpp | 2 +- bcvalue.h | 2 +- bcxmlloader.cpp | 16 +- resources/bc_dark.qss | 101 +------------ resources/bc_light.qss | 301 ++++++++++++++++++++++---------------- resources/bikeinfo.xml | 54 ++++--- resources/gemini_dark.qss | 119 --------------- 11 files changed, 243 insertions(+), 423 deletions(-) delete mode 100644 resources/gemini_dark.qss diff --git a/bcdrivertinycan.cpp b/bcdrivertinycan.cpp index d08b746..692afaf 100644 --- a/bcdrivertinycan.cpp +++ b/bcdrivertinycan.cpp @@ -30,7 +30,7 @@ ***************************************************************************/ -#include +#include #include #include diff --git a/bcguihelpers.cpp b/bcguihelpers.cpp index 098aeba..1f575f0 100644 --- a/bcguihelpers.cpp +++ b/bcguihelpers.cpp @@ -44,6 +44,7 @@ BCThemeSwitchButton::BCThemeSwitchButton(QWidget *parent ) // CSS: Transparent, damit es sich nahtlos in den StatusBar einfügt // Schriftgröße etwas erhöhen, damit die Emojis gut erkennbar sind + /* setStyleSheet(R"( BCThemeSwitchButton { @@ -57,7 +58,7 @@ BCThemeSwitchButton::BCThemeSwitchButton(QWidget *parent ) border-radius: 24px; } )"); - +*/ // Initialer Status (Startet im Dark Mode -> zeigt Mond) updateIcon(); diff --git a/bcmainwindow.cpp b/bcmainwindow.cpp index 0059322..1e755a5 100644 --- a/bcmainwindow.cpp +++ b/bcmainwindow.cpp @@ -50,8 +50,12 @@ BCMainWindow::BCMainWindow(QWidget *parent) qRegisterMetaType("BCValue"); qRegisterMetaType>("BCValueList"); - setupUi(this); +#if defined(Q_OS_LINUX) + // Für Touch screen: Window FRam weglassen + //setWindowFlags(windowFlags() | Qt::FramelessWindowHint); +#endif + setupUi(this); // Wir schreiben den 'initMainWindow()' Aufruf mit Hilfe des // timers in die Event-Queue, damit er erst ausgeführt wird, @@ -81,7 +85,6 @@ BCMainWindow::~BCMainWindow() void BCMainWindow::initMainWindow() { - // Lambda um die buttons mit ihren Actions zu verbinden auto configureAction = [&]( QToolButton* button, QAction* action, BCDevice::ID deviceID ) { @@ -89,9 +92,9 @@ void BCMainWindow::initMainWindow() button->setDefaultAction( action); // new way: die DeviceID muss aber explizit vom Lambda eingefanden werden. connect( action, &QAction::triggered, this, [this,deviceID]() - { - onShowDevicePanel( deviceID ); - }); + { + onShowDevicePanel( deviceID ); + }); if( _devicePanels.contains(deviceID) ) { @@ -110,34 +113,11 @@ void BCMainWindow::initMainWindow() _devicePanels[BCDevice::ID::Battery] = _batteryPanel; _devicePanels[BCDevice::ID::Motor] = _motorPanel; - // Die actions an die Buttons binden + // Die actions an die Buttons binden configureAction(_motorButton, _motorAction, BCDevice::ID::Motor ); configureAction(_consoleButton, _consoleAction, BCDevice::ID::Console ); configureAction(_batteryButton, _batteryAction, BCDevice::ID::Battery ); - /* - bool m_isDarkMode = false; - QString icon = m_isDarkMode ? "☀️" : "🌙"; - fitzeButton->setText(icon); - - QString style = QString( - "QPushButton {" - " background-color: %1;" - " border: 1px solid %2;" - " border-radius: 6px;" - " font-size: 12pt;" - " padding: 0px;" - "}" - "QPushButton:hover {" - " background-color: %3;" - "}" - ).arg(m_isDarkMode ? "#2B2B2B" : "#FFFFFF") - .arg(m_isDarkMode ? "#3F3F3F" : "#E1DFDD") - .arg(m_isDarkMode ? "#3A3A3A" : "#F9F9F9"); - - fitzeButton->setStyleSheet(style); - */ - initStatusBar(); _connectButton->setDefaultAction( _connectAction); @@ -165,12 +145,12 @@ void BCMainWindow::initMainWindow() //_batteryAction->trigger(); // Dummy sync beim starten - QTimer::singleShot(1000, this, [this]() { onSyncDeviceView(); }); - } + +} /* // 2. Bild für den Zustand UNCHECKED (Off) hinzufügen @@ -265,8 +245,8 @@ void BCMainWindow::onShowMessage( const QString& message, int timeOut ) void BCMainWindow::autoConnect() { // __fix! - // if( !connect) - // fallBack + // if( !connect) + // fallBack } void BCMainWindow::onDriverStateChanged( BCDriver::DriverState state, const QString& message ) diff --git a/bcmainwindow.ui b/bcmainwindow.ui index 1441f37..2a2b350 100644 --- a/bcmainwindow.ui +++ b/bcmainwindow.ui @@ -165,14 +165,10 @@ - - - :/sync.png:/sync.png - - 48 - 48 + 64 + 64 @@ -191,14 +187,10 @@ - - - :/connect.png:/connect.png - - 48 - 48 + 64 + 64 @@ -223,8 +215,8 @@ - 48 - 48 + 64 + 64 diff --git a/bctransmitter.cpp b/bctransmitter.cpp index 5ffae1c..c76e30e 100644 --- a/bctransmitter.cpp +++ b/bctransmitter.cpp @@ -31,7 +31,7 @@ #include -#include +#include #include #include diff --git a/bcvalue.h b/bcvalue.h index 76a914d..42d5c17 100644 --- a/bcvalue.h +++ b/bcvalue.h @@ -80,7 +80,7 @@ public: enum class Flag : uint8_t { - NoFlag = 0x00, + NoFlag = 0x00, ReadMe = 0x01, WriteMe = 0x02, ReadOnly = 0x04, diff --git a/bcxmlloader.cpp b/bcxmlloader.cpp index 3b064e5..3797015 100644 --- a/bcxmlloader.cpp +++ b/bcxmlloader.cpp @@ -107,6 +107,7 @@ void BCXmlLoader::loadXmlBikeData( const QString& fileName ) } } + /** * @brief Lädt deie Daten des BionX eBikes * @param deviceID @@ -169,6 +170,11 @@ void BCXmlLoader::loadXmlBikeDeviceData(BCDevice::ID deviceID) } + +/** + * @brief Erzeugt einen BCValue für die DeviceID aus dem gegebenen parameter pack + */ + std::optional BCXmlLoader::makeValue( BCDevice::ID deviceID, const BCValueParams& params ) { @@ -191,13 +197,9 @@ std::optional BCXmlLoader::makeValue( BCDevice::ID deviceID, const B } }; - - /* - Wir brauchen: - - einen gültige ID String um die enum ID herauszufinden. - - einen gültige UnitType String um den ValueType herauszufinden. - - */ + // Wir brauchen: + // - einen gültige ID String um die enum ID herauszufinden. + // - einen gültige UnitType String um den ValueType herauszufinden. // geht nicht auf qt6.8 von debian trixie //std::optional IDVal = s_bcValueEnum.keyToValue64( params.ID.toLatin1().constData() ); diff --git a/resources/bc_dark.qss b/resources/bc_dark.qss index 6602822..fa62ba4 100644 --- a/resources/bc_dark.qss +++ b/resources/bc_dark.qss @@ -1,20 +1,3 @@ -/* appqss */ - -/* Alle QWidgets bekommen diesen Font */ -QWidget -{ - font-family: "Calibri", "Carlito", "Open Sans", sans-serif; - font-size: 10pt; - margin: 0px; - padding: 0px; -} - -QLabel#_headerLabel -{ - font-size: 14pt; - font-weight: bold; -} - /* ===== Fluent Dark Mode Theme ===== */ /* Basierend auf Microsoft Fluent Design System */ @@ -32,6 +15,12 @@ QWidget { font-size: 14px; } +QLabel#_headerLabel +{ + font-size: 18pt; + /*font-weight: bold;*/ +} + QWidget:disabled { color: #6d6d6d; } @@ -128,55 +117,6 @@ QTableView::item:selected:!active { background-color: rgba(0, 120, 212, 0.5); } -/* === QHeaderView === */ -QHeaderView { - background-color: #323232; - border: none; -} - -QHeaderView::section { - background-color: #323232; - color: #e4e4e4; - padding: 8px 12px; - border: none; - border-right: 1px solid #3d3d3d; - border-bottom: 1px solid #3d3d3d; - font-weight: 600; -} - -QHeaderView::section:horizontal { - border-top: none; -} - -QHeaderView::section:vertical { - border-left: none; -} - -QHeaderView::section:hover { - background-color: rgba(255, 255, 255, 0.06); -} - -QHeaderView::section:pressed { - background-color: rgba(255, 255, 255, 0.03); -} - -QHeaderView::section:checked { - background-color: rgba(0, 120, 212, 0.15); - color: #0078d4; -} - -/* Sort indicator */ -QHeaderView::up-arrow { - image: url(:/icons/arrow-up-white.svg); - width: 10px; - height: 10px; -} - -QHeaderView::down-arrow { - image: url(:/icons/arrow-down-white.svg); - width: 10px; - height: 10px; -} /* === QScrollBar Vertical === */ QScrollBar:vertical { @@ -242,35 +182,6 @@ QScrollBar::sub-page:horizontal { background: transparent; } -/* === QMenu (für ToolButton Dropdown) === */ -QMenu { - background-color: #2b2b2b; - border: 1px solid #3d3d3d; - border-radius: 4px; - padding: 4px; - color: #ffffff; -} - -QMenu::item { - padding: 6px 24px 6px 12px; - border-radius: 4px; - margin: 2px; -} - -QMenu::item:selected { - background-color: rgba(255, 255, 255, 0.06); -} - -QMenu::item:pressed { - background-color: rgba(255, 255, 255, 0.03); -} - -QMenu::separator { - height: 1px; - background: #3d3d3d; - margin: 4px 8px; -} - /* === QToolTip === */ QToolTip { background-color: #323232; diff --git a/resources/bc_light.qss b/resources/bc_light.qss index c79ca3b..5e01867 100644 --- a/resources/bc_light.qss +++ b/resources/bc_light.qss @@ -1,12 +1,18 @@ -/* appqss */ +/* ===== Fluent Light Mode Theme ===== */ +/* Basierend auf Microsoft Fluent Design System */ -/* Alle QWidgets bekommen diesen Font */ -QWidget -{ - font-family: "Calibri", "Carlito", "Open Sans", sans-serif; - font-size: 10pt; - margin: 0px; - padding: 0px; +/* === Color Palette === */ +/* Background: #f3f3f3, #ffffff, #fafafa */ +/* Accent: #0078d4 (Fluent Blue) */ +/* Text: #000000, #1f1f1f */ +/* Borders: #e1e1e1, #d1d1d1 */ + +/* === QWidget Base === */ +QWidget { + background-color: #f3f3f3; + color: #1f1f1f; + font-family: "Segoe UI", "Roboto", sans-serif; + font-size: 14px; } QLabel#_headerLabel @@ -15,149 +21,124 @@ QLabel#_headerLabel /*font-weight: bold;*/ } -/* -QToolButton -{ - background-color: white; - color: #201F1E; - border: 1px solid #8A8886; - border-radius: 4px; - - - min-width: 64px; - max-width: 64px; - min-height: 64px; - max-height: 64px; - -} - -QToolButton:hover -{ - background-color: #F3F2F1; - border: 1px solid #323130; -} - -QToolButton:pressed -{ - background-color: #EDEBE9; - border: 1px solid #201F1E; -} - -QToolButton:disabled -{ - background-color: #F3F2F1; - color: #A19F9D; - border: 1px solid #EDEBE9; -} -*/ +QWidget:disabled { + color: #a0a0a0; +} /* === QToolButton === */ -QToolButton -{ +QToolButton { background-color: transparent; - color: #000000; - border: none; + color: #1f1f1f; + border: 1px solid transparent; border-radius: 4px; - padding: 6px; - - min-width: 64px; - max-width: 64px; - min-height: 64px; - max-height: 64px; -} - -QToolButton:hover -{ - background-color: #F9F9F9; - border: 1px solid #DDDDDD; -} - -QToolButton:pressed -{ - background-color: #E0E0E0; -} - -QToolButton:checked -{ - background-color: #AAAAAA; - color: #FFFFFF; -} - -QToolButton:disabled -{ - color: #A19F9D; - background-color: #666666; -} - - - -/* === QTableView & QTableWidget === */ - -QTableView, QTableWidget - { - background-color: #FFFFFF; - color: #000000; - gridline-color: #E1DFDD; - border: 1px solid #E1DFDD; - border-radius: 4px; - selection-background-color: #0078D4; -} - -QTableView::item:hover -{ - background-color: #e8f4f8; -} - - -QScrollBar::handle:horizontal - { - background-color: #C8C6C4; - min-width: 40px; - border-radius: 6px; + padding: 6px 12px; margin: 2px; } -QScrollBar::handle:horizontal:hover -{ - background-color: #A19F9D; +QToolButton:hover { + background-color: rgba(0, 0, 0, 0.03); + border: 1px solid rgba(0, 0, 0, 0.05); } -QScrollBar::handle:horizontal:pressed -{ - background-color: #8A8886; +QToolButton:pressed { + background-color: rgba(0, 0, 0, 0.06); + border: 1px solid rgba(0, 0, 0, 0.08); } -QScrollBar::add-line:horizontal, -QScrollBar::sub-line:horizontal -{ - width: 0px; +QToolButton:checked { + background-color: rgba(0, 120, 212, 0.1); + border: 1px solid #0078d4; + color: #0078d4; } -QScrollBar::add-page:horizontal, -QScrollBar::sub-page:horizontal -{ - background: none; +QToolButton:checked:hover { + background-color: rgba(0, 120, 212, 0.15); } -QScrollBar:vertical { +QToolButton:disabled { + color: #a0a0a0; background-color: transparent; +} + +/* ToolButton mit Icon */ +QToolButton[popupMode="1"] { /* MenuButtonPopup */ + padding-right: 20px; +} + +QToolButton::menu-button { + border: none; + border-left: 1px solid rgba(0, 0, 0, 0.1); + width: 16px; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} + +QToolButton::menu-button:hover { + background-color: rgba(0, 0, 0, 0.05); +} + +QToolButton::menu-arrow { + image: url(:/icons/chevron-down-black.svg); + width: 10px; + height: 10px; +} + +/* === QTableView === */ +QTableView { + background-color: #ffffff; + alternate-background-color: #fafafa; + color: #1f1f1f; + gridline-color: #e1e1e1; + border: 1px solid #d1d1d1; + border-radius: 4px; + selection-background-color: #0078d4; + selection-color: #ffffff; +} + +QTableView::item { + padding: 8px; + border: none; +} + +QTableView::item:hover { + background-color: rgba(0, 0, 0, 0.03); +} + +QTableView::item:selected { + background-color: #0078d4; + color: #ffffff; +} + +QTableView::item:selected:hover { + background-color: #005a9e; +} + +QTableView::item:selected:!active { + background-color: rgba(0, 120, 212, 0.3); + color: #1f1f1f; +} + + +/* === QScrollBar Vertical === */ +QScrollBar:vertical { + background: transparent; width: 12px; margin: 0; } QScrollBar::handle:vertical { - background-color: #C8C6C4; - min-height: 40px; + background: rgba(0, 0, 0, 0.25); + min-height: 30px; border-radius: 6px; margin: 2px; } QScrollBar::handle:vertical:hover { - background-color: #A19F9D; + background: rgba(0, 0, 0, 0.4); } QScrollBar::handle:vertical:pressed { - background-color: #8A8886; + background: rgba(0, 0, 0, 0.5); } QScrollBar::add-line:vertical, @@ -167,7 +148,81 @@ QScrollBar::sub-line:vertical { QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { - background: none; + background: transparent; } +/* === QScrollBar Horizontal === */ +QScrollBar:horizontal { + background: transparent; + height: 12px; + margin: 0; +} +QScrollBar::handle:horizontal { + background: rgba(0, 0, 0, 0.25); + min-width: 30px; + border-radius: 6px; + margin: 2px; +} + +QScrollBar::handle:horizontal:hover { + background: rgba(0, 0, 0, 0.4); +} + +QScrollBar::handle:horizontal:pressed { + background: rgba(0, 0, 0, 0.5); +} + +QScrollBar::add-line:horizontal, +QScrollBar::sub-line:horizontal { + width: 0px; +} + +QScrollBar::add-page:horizontal, +QScrollBar::sub-page:horizontal { + background: transparent; +} + +/* === QToolTip === */ +QToolTip { + background-color: #ffffff; + color: #1f1f1f; + border: 1px solid #d1d1d1; + border-radius: 4px; + padding: 6px 8px; + font-size: 13px; +} + +/* === Corner Widget (zwischen Scrollbars) === */ +QTableView QTableCornerButton::section { + background-color: #fafafa; + border: none; + border-right: 1px solid #e1e1e1; + border-bottom: 1px solid #e1e1e1; +} + +/* QLineEdit */ +QLineEdit { + background-color: #ffffff; + color: #1f1f1f; + border: 1px solid #d1d1d1; + border-radius: 4px; + padding: 6px 8px; + selection-background-color: #0078d4; + selection-color: #ffffff; +} + +QLineEdit:hover { + border: 1px solid #a0a0a0; +} + +QLineEdit:focus { + border: 1px solid #0078d4; + border-bottom: 2px solid #0078d4; +} + +QLineEdit:disabled { + background-color: #fafafa; + color: #a0a0a0; + border: 1px solid #e1e1e1; +} \ No newline at end of file diff --git a/resources/bikeinfo.xml b/resources/bikeinfo.xml index b3b845c..91bf859 100644 --- a/resources/bikeinfo.xml +++ b/resources/bikeinfo.xml @@ -2,47 +2,45 @@ - - - + + + - - + + - + + + + + - - - - + + - - + + - - + + - - - - - + + - - - - - - - - + + + + + + + - + diff --git a/resources/gemini_dark.qss b/resources/gemini_dark.qss deleted file mode 100644 index abf8ac9..0000000 --- a/resources/gemini_dark.qss +++ /dev/null @@ -1,119 +0,0 @@ -/* --- GEMINI GLOBALE EINSTELLUNGEN --- */ - -QWidget { - /* Dunkler Hintergrund (Mica-Ersatz) */ - background-color: #202020; - - /* Fluent Textfarbe (Off-White ist augenschonender als Pure-White) */ - color: #e0e0e0; - - /* Font Stack: Bevorzugt Segoe, Fallback auf Open Sans (Linux) */ - font-family: "Segoe UI", "Open Sans", "Carlito", sans-serif; - -} - -/* Deaktivierte Widgets */ -QWidget:disabled { - color: #606060; -} - -/* --- QTOOLBUTTON (INTERACTIVE) --- */ -QToolButton { - background-color: transparent; - border: 1px solid transparent; - border-radius: 4px; /* Fluent Rounded Corners */ - padding: 6px; /* Touch-freundliches Padding */ - margin: 2px; -} - -/* Hover-Effekt: Subtiler heller Overlay */ -QToolButton:hover { - background-color: rgba(255, 255, 255, 0.06); - border: 1px solid rgba(255, 255, 255, 0.05); -} - -/* Pressed-Effekt: Etwas dunkler/kompakter */ -QToolButton:pressed { - background-color: rgba(255, 255, 255, 0.03); - color: #a0a0a0; -} - -/* Checked (Toggle) Zustand: Akzentuierter Hintergrund */ -QToolButton:checked { - background-color: rgba(96, 205, 255, 0.15); /* Akzentfarbe transparent */ - border: 1px solid rgba(96, 205, 255, 0.3); - color: #60CDFF; /* Text in Akzentfarbe */ -} - -/* --- QTABLEVIEW (DATA) --- */ -QTableView { - /* Etwas hellerer Hintergrund als das Fenster für Tiefe */ - background-color: #292929; - - /* Keine harten Rahmen, Fluent nutzt Whitespace */ - border: 1px solid #353535; - border-radius: 6px; - - /* Grid-Linien sehr subtil */ - gridline-color: #353535; - - /* Selection Style */ - selection-background-color: #60CDFF; /* Fluent Blue */ - selection-color: #000000; /* Schwarzer Text auf hellem Blau für Kontrast */ - - outline: none; /* Entfernt den punktierten Fokus-Rahmen */ -} - -QTableView::item { - padding: 5px; /* Luftigkeit */ - border: none; -} - -QTableView::item:selected { - background-color: #60CDFF; - color: #000000; -} - -QTableView::item:hover { - /* Hover über Zeilen (wenn SelectionMode Row ist) */ - background-color: rgba(255, 255, 255, 0.05); -} - -/* --- HEADER VIEW (SPALTENKÖPFE) --- */ -QHeaderView { - background-color: transparent; - border: none; -} - -QHeaderView::section { - background-color: #202020; /* Verschmilzt mit Hintergrund */ - color: #a0a0a0; /* Sekundäre Textfarbe für Labels */ - border: none; - border-bottom: 1px solid #353535; /* Trennlinie zum Inhalt */ - padding: 4px 8px; - font-weight: bold; - text-align: left; -} - -/* --- SCROLLBARS (MINIMALISTISCH) --- */ -/* Standard Linux Scrollbars zerstören den Look, daher custom: */ -QScrollBar:vertical { - background: transparent; - width: 12px; - margin: 0px; -} - -QScrollBar::handle:vertical { - background: #454545; - min-height: 20px; - border-radius: 6px; - margin: 2px; -} - -QScrollBar::handle:vertical:hover { - background: #606060; -} - -QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { - height: 0px; /* Pfeile oben/unten ausblenden */ -} \ No newline at end of file