style(ui): match the interface to the FWS website's design system
The window carried a palette of its own, so the desktop app and the site looked like two different products. The stylesheet now uses the website's tokens (slate surfaces on a #0f172a page, sky-blue accent, serif headings, pill-shaped badges); the site's rgba() borders are pre-blended because a Qt stylesheet only takes solid colours, and plain widgets are left transparent so the page glow shows through them. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
1 parent
5720c398ef
commit
ed58e87520
23 files changed
+208
-161
No files matched your search
+150
-111
@@ -75,142 +75,176 @@ static QString actionErrorTitle(const QString& action) {
|
||||
// Everything the screens draw with. The look of the application is a single
|
||||
// stylesheet applied to the window, so a screen file only describes its layout
|
||||
// and its wording (see pages/ui-kit.h for the shared widgets).
|
||||
//
|
||||
// The palette and the shapes mirror the FWS website's stylesheets
|
||||
// (p/assets/styles/var.css, styles.css and paquets.css): slate surfaces on a
|
||||
// #0f172a page, a sky-blue accent, serif headings, pill-shaped badges and
|
||||
// 8-16px radii. The site draws its borders and tints with rgba() over the
|
||||
// surface below; a Qt stylesheet only takes a solid colour, so those values are
|
||||
// pre-blended here onto the surface they sit on (#232c3f is the site's border
|
||||
// over the page, #303b4e the same border over a card).
|
||||
static QString appStyleSheet() {
|
||||
return QStringLiteral(
|
||||
// ---- Base ----
|
||||
"QMainWindow, QWidget { background: #0d1017; color: #dbe2f0; }"
|
||||
// Widgets stay transparent like in CSS: only real surfaces declare a
|
||||
// background, so the page glow below shows through the layouts. The
|
||||
// dialogs are listed explicitly because they are windows of their own
|
||||
// and would otherwise fall back to the light system palette.
|
||||
"QMainWindow, QDialog { background: #0f172a; }"
|
||||
"QWidget { color: #e2e8f0; }"
|
||||
// The site tints its dark page with a soft accent glow from the top
|
||||
// left; Qt has no radial gradient, so a diagonal one stands in for it.
|
||||
"QWidget#content {"
|
||||
" background: qlineargradient(x1:0, y1:0, x2:0.85, y2:1,"
|
||||
" stop:0 #13243b, stop:0.55 #0f172a, stop:1 #0f172a);"
|
||||
"}"
|
||||
// ---- Sidebar ----
|
||||
"QFrame#sidebar { background: #11151d; border-right: 1px solid #1d2432; }"
|
||||
// A raised surface, like the site's header and footer.
|
||||
"QFrame#sidebar { background: #1e293b; border-right: 1px solid #232c3f; }"
|
||||
"QWidget#logo { padding: 4px 0; }"
|
||||
"QLabel#logoText { font-size: 16px; font-weight: 800; color: #ffffff; }"
|
||||
"QLabel#tagline { font-size: 11px; color: #6b7285; padding: 0 8px 8px 8px; }"
|
||||
"QLabel#logoText { font-family: serif; font-size: 19px; font-weight: 700; color: #e2e8f0; }"
|
||||
"QLabel#tagline { font-size: 11px; color: #64748b; padding: 0 8px 8px 8px; }"
|
||||
// Navigation entries use the site's navigation idiom: a rounded shape
|
||||
// that fills with the accent tint, the label turning accent.
|
||||
"QPushButton[nav=\"true\"] {"
|
||||
" text-align: left;"
|
||||
" background: transparent;"
|
||||
" border: none;"
|
||||
" border-left: 3px solid transparent;"
|
||||
" border: 1px solid transparent;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 9px 10px 9px 13px;"
|
||||
" padding: 9px 12px;"
|
||||
" font-size: 13px;"
|
||||
" font-weight: 600;"
|
||||
" color: #98a0b3;"
|
||||
" color: #94a3b8;"
|
||||
"}"
|
||||
"QPushButton[nav=\"true\"]:hover { background: #1a2130; color: #e8edf9; }"
|
||||
"QPushButton[nav=\"true\"]:checked { background: #1c2434; border-left: 3px solid #7aa2f7; color: #ffffff; }"
|
||||
"QPushButton[nav=\"true\"]:disabled { color: #565f73; }"
|
||||
"QPushButton[nav=\"true\"]:hover { background: #21384e; color: #7dd3fc; }"
|
||||
"QPushButton[nav=\"true\"]:checked { background: #21384e; color: #38bdf8; }"
|
||||
"QPushButton[nav=\"true\"]:disabled { color: #475569; }"
|
||||
// ---- Header ----
|
||||
"QWidget#header { background: #0f1219; border-bottom: 1px solid #1d2432; }"
|
||||
"QLabel#headerTitle { font-size: 19px; font-weight: 800; color: #e8edf9; }"
|
||||
"QLabel#headerSubtitle { font-size: 12px; color: #7a8299; }"
|
||||
"QWidget#header { background: #1e293b; border-bottom: 1px solid #232c3f; }"
|
||||
"QLabel#headerTitle { font-family: serif; font-size: 21px; font-weight: 700; color: #e2e8f0; }"
|
||||
"QLabel#headerSubtitle { font-size: 12px; color: #94a3b8; }"
|
||||
// ---- Cards ----
|
||||
// Cards read as raised surfaces: a slightly lighter background, a hair
|
||||
// line border and a rounded corner separate them from the page without
|
||||
// adding shadows Qt cannot render consistently across platforms.
|
||||
// Cards read as raised surfaces: the site's slightly lighter slate, a
|
||||
// hair line border and a rounded corner separate them from the page
|
||||
// without adding shadows Qt cannot render consistently across
|
||||
// platforms.
|
||||
"QFrame#card {"
|
||||
" background: #121722;"
|
||||
" border: 1px solid #1d2432;"
|
||||
" background: #1e293b;"
|
||||
" border: 1px solid #232c3f;"
|
||||
" border-radius: 12px;"
|
||||
"}"
|
||||
// Stat cards carry a coloured left edge so the four metrics are told
|
||||
// apart at a glance.
|
||||
"QFrame#card[accent=\"blue\"] { border-left: 3px solid #7aa2f7; }"
|
||||
"QFrame#card[accent=\"amber\"] { border-left: 3px solid #e0af68; }"
|
||||
"QFrame#card[accent=\"cyan\"] { border-left: 3px solid #56b6c2; }"
|
||||
"QFrame#card[accent=\"green\"] { border-left: 3px solid #3fb950; }"
|
||||
"QLabel#cardTitle { font-size: 11px; font-weight: 700; color: #7a8299; letter-spacing: 1px; }"
|
||||
"QLabel#statValue { font-size: 32px; font-weight: 800; color: #ffffff; }"
|
||||
"QLabel#statTitle { font-size: 12px; color: #7a8299; font-weight: 600; }"
|
||||
// apart at a glance. The colours are the site's status and accent ones.
|
||||
"QFrame#card[accent=\"blue\"] { border-left: 3px solid #38bdf8; }"
|
||||
"QFrame#card[accent=\"amber\"] { border-left: 3px solid #fbbf24; }"
|
||||
"QFrame#card[accent=\"cyan\"] { border-left: 3px solid #7dd3fc; }"
|
||||
"QFrame#card[accent=\"green\"] { border-left: 3px solid #34d399; }"
|
||||
// Small uppercase labels, as the site's section headings.
|
||||
"QLabel#cardTitle { font-size: 11px; font-weight: 700; color: #64748b; letter-spacing: 1px; }"
|
||||
"QLabel#statValue { font-size: 30px; font-weight: 800; color: #e2e8f0; }"
|
||||
"QLabel#statTitle { font-size: 12px; color: #94a3b8; font-weight: 600; }"
|
||||
// ---- Sidebar extras ----
|
||||
"QLabel#sectionTitle {"
|
||||
" font-size: 10px;"
|
||||
" font-weight: 800;"
|
||||
" color: #4d5566;"
|
||||
" color: #64748b;"
|
||||
" letter-spacing: 1.2px;"
|
||||
" padding: 14px 10px 2px 10px;"
|
||||
"}"
|
||||
"QLabel#versionLabel { font-size: 11px; color: #565f73; padding: 8px 10px; }"
|
||||
"QPushButton[nav=\"true\"][highlighted=\"true\"] { color: #e0af68; }"
|
||||
"QLabel#versionLabel { font-size: 11px; color: #64748b; padding: 8px 10px; }"
|
||||
"QPushButton[nav=\"true\"][highlighted=\"true\"] { color: #fbbf24; }"
|
||||
// ---- Buttons ----
|
||||
// Mirrors the site's .button: rounded, 1px transparent border that
|
||||
// takes the accent when hovered, and a darker fill on hover.
|
||||
"QPushButton {"
|
||||
" background: #232b3a;"
|
||||
" color: #dbe2f0;"
|
||||
" border: none;"
|
||||
" background: #273449;"
|
||||
" color: #94a3b8;"
|
||||
" border: 1px solid #303b4e;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 8px 16px;"
|
||||
" font-size: 13px;"
|
||||
" font-weight: 600;"
|
||||
"}"
|
||||
"QPushButton:hover { background: #2c3648; }"
|
||||
"QPushButton:pressed { background: #1e2634; }"
|
||||
"QPushButton:disabled { background: #181d28; color: #565f73; }"
|
||||
"QPushButton[variant=\"primary\"] { background: #7aa2f7; color: #0d1017; }"
|
||||
"QPushButton[variant=\"primary\"]:hover { background: #8ab0ff; }"
|
||||
"QPushButton[variant=\"primary\"]:pressed { background: #5f86d9; }"
|
||||
"QPushButton[variant=\"primary\"]:disabled { background: #2a3350; color: #7a8299; }"
|
||||
"QPushButton[variant=\"success\"] { background: #3fb950; color: #0d1017; }"
|
||||
"QPushButton[variant=\"success\"]:hover { background: #4ecb5f; }"
|
||||
"QPushButton[variant=\"success\"]:pressed { background: #35a344; }"
|
||||
"QPushButton[variant=\"success\"]:disabled { background: #1d2b21; color: #5f7a66; }"
|
||||
"QPushButton[variant=\"danger\"] { background: #f7768e; color: #0d1017; }"
|
||||
"QPushButton[variant=\"danger\"]:hover { background: #ff8ba4; }"
|
||||
"QPushButton[variant=\"danger\"]:pressed { background: #e05e78; }"
|
||||
"QPushButton[variant=\"danger\"]:disabled { background: #2c1c21; color: #7a5f66; }"
|
||||
"QPushButton[variant=\"warning\"] { background: #e0af68; color: #0d1017; }"
|
||||
"QPushButton[variant=\"warning\"]:hover { background: #ecc27e; }"
|
||||
"QPushButton[variant=\"warning\"]:pressed { background: #d09a50; }"
|
||||
"QPushButton[variant=\"warning\"]:disabled { background: #2b241c; color: #7a6d5c; }"
|
||||
"QPushButton[variant=\"info\"] { background: #56b6c2; color: #0d1017; }"
|
||||
"QPushButton[variant=\"info\"]:hover { background: #6cc7d2; }"
|
||||
"QPushButton[variant=\"info\"]:pressed { background: #45a3ae; }"
|
||||
"QPushButton[variant=\"info\"]:disabled { background: #1c2a2d; color: #5f7a7d; }"
|
||||
"QPushButton:hover { background: #29445e; border-color: #7dd3fc; color: #38bdf8; }"
|
||||
"QPushButton:pressed { background: #22384d; color: #7dd3fc; }"
|
||||
"QPushButton:disabled { background: #232c3f; border-color: transparent; color: #64748b; }"
|
||||
"QPushButton[variant=\"primary\"] { background: #38bdf8; border-color: transparent; color: #0f172a; }"
|
||||
"QPushButton[variant=\"primary\"]:hover { background: #0ea5e9; color: #0f172a; }"
|
||||
"QPushButton[variant=\"primary\"]:pressed { background: #0284c7; color: #0f172a; }"
|
||||
"QPushButton[variant=\"success\"] { background: #34d399; border-color: transparent; color: #0f172a; }"
|
||||
"QPushButton[variant=\"success\"]:hover { background: #10b981; color: #0f172a; }"
|
||||
"QPushButton[variant=\"success\"]:pressed { background: #059669; color: #0f172a; }"
|
||||
"QPushButton[variant=\"danger\"] { background: #f87171; border-color: transparent; color: #0f172a; }"
|
||||
"QPushButton[variant=\"danger\"]:hover { background: #ef4444; color: #0f172a; }"
|
||||
"QPushButton[variant=\"danger\"]:pressed { background: #dc2626; color: #0f172a; }"
|
||||
"QPushButton[variant=\"warning\"] { background: #fbbf24; border-color: transparent; color: #0f172a; }"
|
||||
"QPushButton[variant=\"warning\"]:hover { background: #f59e0b; color: #0f172a; }"
|
||||
"QPushButton[variant=\"warning\"]:pressed { background: #d97706; color: #0f172a; }"
|
||||
"QPushButton[variant=\"info\"] { background: #7dd3fc; border-color: transparent; color: #0f172a; }"
|
||||
"QPushButton[variant=\"info\"]:hover { background: #38bdf8; color: #0f172a; }"
|
||||
"QPushButton[variant=\"info\"]:pressed { background: #0ea5e9; color: #0f172a; }"
|
||||
// A disabled button keeps the muted fill of the site's :disabled rule,
|
||||
// whatever its variant.
|
||||
"QPushButton[variant=\"primary\"]:disabled, QPushButton[variant=\"success\"]:disabled,"
|
||||
"QPushButton[variant=\"danger\"]:disabled, QPushButton[variant=\"warning\"]:disabled,"
|
||||
"QPushButton[variant=\"info\"]:disabled {"
|
||||
" background: #232c3f; border-color: transparent; color: #64748b;"
|
||||
"}"
|
||||
// ---- Inputs ----
|
||||
"QLineEdit {"
|
||||
" background: #141927;"
|
||||
" border: 1px solid #2a3448;"
|
||||
" border-radius: 10px;"
|
||||
" background: #1e293b;"
|
||||
" border: 1px solid #303b4e;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 9px 14px;"
|
||||
" font-size: 13px;"
|
||||
" color: #dbe2f0;"
|
||||
" selection-background-color: #7aa2f7;"
|
||||
" color: #e2e8f0;"
|
||||
" selection-background-color: #38bdf8;"
|
||||
" selection-color: #0f172a;"
|
||||
"}"
|
||||
"QLineEdit:focus { border: 1px solid #7aa2f7; }"
|
||||
"QLineEdit:disabled { color: #565f73; }"
|
||||
"QLineEdit:hover { border-color: #475569; }"
|
||||
"QLineEdit:focus { border: 1px solid #38bdf8; }"
|
||||
"QLineEdit:disabled { color: #64748b; }"
|
||||
"QComboBox {"
|
||||
" background: #141927;"
|
||||
" border: 1px solid #2a3448;"
|
||||
" border-radius: 10px;"
|
||||
" background: #1e293b;"
|
||||
" border: 1px solid #303b4e;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 7px 12px;"
|
||||
" font-size: 13px;"
|
||||
" color: #dbe2f0;"
|
||||
" color: #e2e8f0;"
|
||||
"}"
|
||||
"QComboBox:hover { border-color: #7dd3fc; }"
|
||||
"QComboBox::drop-down { border: none; width: 26px; }"
|
||||
"QComboBox QAbstractItemView {"
|
||||
" background: #141927;"
|
||||
" border: 1px solid #2a3448;"
|
||||
" selection-background-color: #232c44;"
|
||||
" color: #dbe2f0;"
|
||||
" background: #273449;"
|
||||
" border: 1px solid #303b4e;"
|
||||
" selection-background-color: #21384e;"
|
||||
" selection-color: #38bdf8;"
|
||||
" color: #e2e8f0;"
|
||||
"}"
|
||||
// ---- Progress bar ----
|
||||
"QProgressBar { background: #1c2330; border: none; border-radius: 3px; }"
|
||||
"QProgressBar::chunk { background: #7aa2f7; border-radius: 3px; }"
|
||||
"QProgressBar { background: #273449; border: none; border-radius: 3px; }"
|
||||
"QProgressBar::chunk { background: #38bdf8; border-radius: 3px; }"
|
||||
// ---- Package table ----
|
||||
// No outer frame: the table blends with the page background, keeping
|
||||
// No outer frame: the table blends with the card it sits in, keeping
|
||||
// only the column header and alternating rows as visual separators.
|
||||
"QTableWidget {"
|
||||
" background: transparent;"
|
||||
" alternate-background-color: #141a25;"
|
||||
" alternate-background-color: #223044;"
|
||||
" border: none;"
|
||||
" gridline-color: transparent;"
|
||||
" outline: 0;"
|
||||
"}"
|
||||
"QTableWidget::item { border: none; padding: 4px 8px; }"
|
||||
"QTableWidget::item:selected { background: #232c44; color: #ffffff; }"
|
||||
"QTableWidget::item:hover { background: #1a2130; }"
|
||||
"QTableWidget::item:selected { background: #21384e; color: #e2e8f0; }"
|
||||
// Hover stays below the selection tint, so a hovered row is never
|
||||
// mistaken for the selected one.
|
||||
"QTableWidget::item:hover { background: #1b2b40; }"
|
||||
"QHeaderView { background: transparent; }"
|
||||
"QHeaderView::section {"
|
||||
" background: #1a2130;"
|
||||
" color: #7a8299;"
|
||||
" background: transparent;"
|
||||
" color: #64748b;"
|
||||
" border: none;"
|
||||
" border-bottom: 1px solid #232b3a;"
|
||||
" border-bottom: 1px solid #303b4e;"
|
||||
" padding: 8px;"
|
||||
" font-size: 11px;"
|
||||
" font-weight: 700;"
|
||||
@@ -219,43 +253,61 @@ static QString appStyleSheet() {
|
||||
// ---- Recent activity list ----
|
||||
"QListWidget#recentList { background: transparent; border: none; outline: 0; }"
|
||||
"QListWidget#recentList::item { border-radius: 8px; margin: 1px 2px; }"
|
||||
"QListWidget#recentList::item:hover { background: #1a2130; }"
|
||||
"QListWidget#recentList::item:hover { background: #21384e; }"
|
||||
// ---- Logs editor ----
|
||||
// Recessed like the site's inline code: the page colour, not a card.
|
||||
"QTextEdit {"
|
||||
" background: #12161f;"
|
||||
" color: #c8d3f5;"
|
||||
" border: 1px solid #232b3a;"
|
||||
" border-radius: 10px;"
|
||||
" background: #0f172a;"
|
||||
" color: #e2e8f0;"
|
||||
" border: 1px solid #303b4e;"
|
||||
" border-radius: 12px;"
|
||||
" padding: 10px;"
|
||||
" font-family: monospace;"
|
||||
" font-size: 13px;"
|
||||
"}"
|
||||
// ---- Menus ----
|
||||
// The menu strip shares the header's surface, so the two read as the
|
||||
// site's single top band.
|
||||
"QMenuBar { background: #1e293b; color: #94a3b8; padding: 2px 4px; }"
|
||||
"QMenuBar::item { padding: 6px 10px; border-radius: 6px; background: transparent; }"
|
||||
"QMenuBar::item:selected { background: #21384e; color: #38bdf8; }"
|
||||
"QMenu {"
|
||||
" background: #1e293b;"
|
||||
" color: #e2e8f0;"
|
||||
" border: 1px solid #303b4e;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 6px;"
|
||||
"}"
|
||||
"QMenu::item { padding: 7px 24px 7px 14px; border-radius: 6px; }"
|
||||
"QMenu::item:selected { background: #21384e; color: #38bdf8; }"
|
||||
"QMenu::item:disabled { color: #64748b; }"
|
||||
"QMenu::separator { height: 1px; background: #303b4e; margin: 6px 8px; }"
|
||||
// ---- Scrollbars ----
|
||||
"QScrollBar:vertical { background: transparent; width: 10px; margin: 2px; }"
|
||||
"QScrollBar::handle:vertical { background: #2a3448; border-radius: 5px; min-height: 30px; }"
|
||||
"QScrollBar::handle:vertical:hover { background: #3a455c; }"
|
||||
"QScrollBar::handle:vertical { background: #273449; border-radius: 5px; min-height: 30px; }"
|
||||
"QScrollBar::handle:vertical:hover { background: #38bdf8; }"
|
||||
"QScrollBar:horizontal { background: transparent; height: 10px; margin: 2px; }"
|
||||
"QScrollBar::handle:horizontal { background: #2a3448; border-radius: 5px; min-width: 30px; }"
|
||||
"QScrollBar::handle:horizontal:hover { background: #3a455c; }"
|
||||
"QScrollBar::handle:horizontal { background: #273449; border-radius: 5px; min-width: 30px; }"
|
||||
"QScrollBar::handle:horizontal:hover { background: #38bdf8; }"
|
||||
"QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical,"
|
||||
"QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { height: 0; width: 0; }"
|
||||
"QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical,"
|
||||
"QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { background: transparent; }"
|
||||
// ---- Status bar ----
|
||||
"QStatusBar {"
|
||||
" background: #0f1219;"
|
||||
" color: #7a8299;"
|
||||
" border-top: 1px solid #1d2432;"
|
||||
" background: #1e293b;"
|
||||
" color: #94a3b8;"
|
||||
" border-top: 1px solid #232c3f;"
|
||||
" font-size: 12px;"
|
||||
"}"
|
||||
// ---- Splitter ----
|
||||
"QSplitter::handle { background: transparent; }"
|
||||
// ---- Tooltips ----
|
||||
"QToolTip {"
|
||||
" background: #1c2434;"
|
||||
" color: #e8edf9;"
|
||||
" border: 1px solid #2a3448;"
|
||||
" border-radius: 6px;"
|
||||
" background: #273449;"
|
||||
" color: #e2e8f0;"
|
||||
" border: 1px solid #303b4e;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 4px 8px;"
|
||||
"}");
|
||||
}
|
||||
@@ -588,22 +640,9 @@ void MainWindow::notifyUpdatesAvailable(int count) {
|
||||
}
|
||||
|
||||
void MainWindow::setupMenuBar() {
|
||||
// The menu bar and its menus are styled by the window stylesheet
|
||||
// (appStyleSheet), which also covers the tray menu.
|
||||
QMenuBar* menuBar = this->menuBar();
|
||||
menuBar->setStyleSheet(
|
||||
"QMenuBar { background: #0d1017; color: #c8d3f5; padding: 2px 8px; }"
|
||||
"QMenuBar::item { padding: 6px 10px; border-radius: 6px; background: transparent; }"
|
||||
"QMenuBar::item:selected { background: #232b3a; }"
|
||||
"QMenu {"
|
||||
" background: #141927;"
|
||||
" color: #dbe2f0;"
|
||||
" border: 1px solid #2a3448;"
|
||||
" border-radius: 8px;"
|
||||
" padding: 6px;"
|
||||
"}"
|
||||
"QMenu::item { padding: 7px 24px 7px 14px; border-radius: 6px; }"
|
||||
"QMenu::item:selected { background: #7aa2f7; color: #0d1017; }"
|
||||
"QMenu::separator { height: 1px; background: #2a3448; margin: 6px 8px; }"
|
||||
);
|
||||
|
||||
auto goTo = [this](int navId) {
|
||||
if (QAbstractButton* button = m_navGroup->button(navId)) button->click();
|
||||
|
||||
Reference in new issue
Block a user