| 180 | // ── AppletPanel ────────────────────────────────────────────────────────────── |
| 181 | |
| 182 | AppletPanel::AppletPanel(QWidget* parent) : QWidget(parent) |
| 183 | { |
| 184 | // Parent container for every applet hosted in this rail. Each |
| 185 | // individual applet declares its own child scope ("applet.tx", |
| 186 | // "applet.rx", …) inside its own constructor so widgets inside |
| 187 | // an applet inherit applet.<name> → applet → root. |
| 188 | theme::setContainer(this, QStringLiteral("applet")); |
| 189 | |
| 190 | setFixedWidth(260); |
| 191 | |
| 192 | auto* root = new QVBoxLayout(this); |
| 193 | root->setContentsMargins(0, 0, 0, 0); |
| 194 | root->setSpacing(0); |
| 195 | |
| 196 | // ── Top button bar: single favorites row + push-down drawer ──────────── |
| 197 | // |
| 198 | // The bar shows kFavoriteCount (5) user-chosen "favorite" buttons in a |
| 199 | // single row, with a 6th slot acting as the drawer toggle (▾/▴). |
| 200 | // Toggling the drawer reveals/hides a grid containing every other |
| 201 | // bar button. Right-click any bar button to open the picker dialog. |
| 202 | // |
| 203 | // Construction: every bar button (LCK, VU, RX, …) is created with the |
| 204 | // drawer's widget+layout as its rowParent/rowLayout. Once all are |
| 205 | // registered, applyBarLayout() lifts the favorites out of the drawer |
| 206 | // into m_favRow. See registerBarButton() / applyBarLayout(). |
| 207 | // |
| 208 | // All colour values resolved through ThemeManager so the bar |
| 209 | // re-themes live alongside the rest of the UI. |
| 210 | const QString kBarContainerStyle = |
| 211 | QStringLiteral("QWidget#barContainer { background: {{color.background.0}}; }"); |
| 212 | const QString kBarBtnStyle = |
| 213 | QStringLiteral( |
| 214 | "QPushButton { background: {{color.background.1}}; " |
| 215 | "border: 1px solid {{color.background.2}}; border-radius: 3px; " |
| 216 | "padding: 2px 3px; font-size: 11px; font-weight: bold; " |
| 217 | "color: {{color.text.primary}}; }" |
| 218 | "QPushButton:hover { background: {{color.background.2}}; }" |
| 219 | // Active/checked state mirrors the kBlueActive style used by |
| 220 | // the RxApplet filter-preset buttons (1.8K/2.1K/…): dim cyan |
| 221 | // fill, light text, slightly brighter outline. |
| 222 | "QPushButton:checked { background: {{color.accent.dim}}; " |
| 223 | "color: {{color.text.primary}}; " |
| 224 | "border: 1px solid {{color.accent.bright}}; }" |
| 225 | "QPushButton:disabled { color: {{color.text.disabled}}; " |
| 226 | "border-color: {{color.background.1}}; }"); |
| 227 | |
| 228 | m_favRow = new QWidget; |
| 229 | m_favRow->setObjectName("barContainer"); |
| 230 | ThemeManager::instance().applyStyleSheet(m_favRow, kBarContainerStyle + kBarBtnStyle); |
| 231 | m_favLayout = new QGridLayout(m_favRow); |
| 232 | m_favLayout->setContentsMargins(2, 3, 2, 3); |
| 233 | m_favLayout->setSpacing(2); |
| 234 | root->addWidget(m_favRow); |
| 235 | |
| 236 | m_drawer = new QWidget; |
| 237 | m_drawer->setObjectName("barContainer"); |
| 238 | ThemeManager::instance().applyStyleSheet(m_drawer, kBarContainerStyle + kBarBtnStyle + |
| 239 | QStringLiteral("QWidget#barContainer { border-bottom: 1px solid {{color.border.subtle}}; }")); |
nothing calls this directly
no test coverage detected