Skip to content

A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.

C++

feat(linux): redesign IDE shell (Qt/KDE dark+light skin) (#70)

haidang18103b336fc0e010
diff --git a/linux/resources/gridex.qrc b/linux/resources/gridex.qrc
index 94e37a2..f58fb4d 100644
--- a/linux/resources/gridex.qrc
+++ b/linux/resources/gridex.qrc
@@ -4,5 +4,6 @@
<file>logo.png</file>
<file>style-dark.qss</file>
<file>style-light.qss</file>
+ <file>style-gx.qss</file>
</qresource>
</RCC>
diff --git a/linux/resources/style-gx-light.qss b/linux/resources/style-gx-light.qss
new file mode 100644
index 0000000..30d0520
--- /dev/null
+++ b/linux/resources/style-gx-light.qss
@@ -0,0 +1,854 @@
+/* style-gx-light.qss — light counterpart to style-gx.qss.
+ *
+ * Palette is the dark sheet mirrored onto a high-contrast light surface:
+ * bg-0 #ffffff bg-1 #f4f5f7 bg-2 #e9ebef bg-3 #dde0e5 bg-4 #cdd1d8
+ * border #c5cad1 border-2 #aab0b9
+ * text #1c2025 text-2 #4a4f56 muted #6a6e74 faint #9398a0
+ * accent #0098bd accent-2 #007ea8
+ *
+ * Hard rule (same as dark sheet): NO global QToolButton or QPushButton
+ * min-width / min-height. Every sizing rule is scoped via objectName or
+ * dynamic property selector. */
+
+/* ── Base ─────────────────────────────────────────────────────── */
+QWidget {
+ background-color: #f4f5f7;
+ color: #1c2025;
+ font-family: "Inter", "Cantarell", "Segoe UI", "Noto Sans", sans-serif;
+ font-size: 12px;
+ selection-background-color: #0098bd;
+ selection-color: #ffffff;
+}
+QMainWindow, QDialog { background-color: #f4f5f7; }
+
+QWidget[gxFont="mono"], QPlainTextEdit[gxFont="mono"], QTextEdit[gxFont="mono"] {
+ font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "DejaVu Sans Mono", monospace;
+ font-size: 12.5px;
+}
+
+QFrame[gxRole="card"] { background-color: #e9ebef; border: 1px solid #c5cad1; border-radius: 4px; }
+QFrame[gxRole="popover"] { background-color: #ffffff; border: 1px solid #aab0b9; border-radius: 3px; }
+QFrame[gxRole="divider"] { background-color: #c5cad1; max-height: 1px; min-height: 1px; }
+QFrame[gxRole="divider-vert"] { background-color: #c5cad1; max-width: 1px; min-width: 1px; }
+
+/* ── Menubar ──────────────────────────────────────────────────── */
+QMenuBar {
+ background-color: #e9ebef;
+ color: #4a4f56;
+ border-bottom: 1px solid #c5cad1;
+ padding: 0 4px;
+ spacing: 0;
+ min-height: 24px;
+}
+QMenuBar::item { background: transparent; padding: 4px 8px; color: #4a4f56; }
+QMenuBar::item:selected, QMenuBar::item:pressed {
+ background-color: #dde0e5;
+ color: #1c2025;
+}
+QMenu {
+ background-color: #ffffff;
+ color: #1c2025;
+ border: 1px solid #aab0b9;
+ padding: 4px 0;
+}
+QMenu::item { padding: 4px 18px 4px 14px; }
+QMenu::item:selected { background-color: #0098bd; color: #ffffff; }
+QMenu::separator { height: 1px; background: #c5cad1; margin: 4px 8px; }
+QLabel#gxMenubarEngine { color: #6a6e74; font-size: 11px; padding: 0 10px; }
+
+/* ── Toolbar (scoped) ─────────────────────────────────────────── */
+QToolBar#gxToolbar {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #f0f2f5, stop:1 #e6e9ee);
+ border: none;
+ border-bottom: 1px solid #c5cad1;
+ spacing: 1px;
+ padding: 4px 6px;
+ min-height: 36px;
+ max-height: 36px;
+}
+QToolBar#gxToolbar::separator { width: 0px; background: transparent; }
+QToolBar#gxToolbar > QToolButton {
+ background: transparent;
+ color: #4a4f56;
+ border: 1px solid transparent;
+ border-radius: 3px;
+ min-width: 28px;
+ max-width: 28px;
+ min-height: 26px;
+ max-height: 26px;
+ padding: 0;
+}
+QToolBar#gxToolbar > QToolButton:hover {
+ background-color: #dde0e5;
+ border-color: #aab0b9;
+ color: #1c2025;
+}
+QToolBar#gxToolbar > QToolButton:pressed { background-color: #cdd1d8; }
+QToolBar#gxToolbar > QToolButton:disabled { color: #9398a0; }
+
+QToolBar#gxToolbar > QToolButton[gxKind="primary"] {
+ color: #ffffff;
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #0098bd, stop:1 #007ea8);
+ border: 1px solid #006d92;
+}
+QToolBar#gxToolbar > QToolButton[gxKind="primary"]:hover {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #14aacc, stop:1 #008db8);
+}
+QToolBar#gxToolbar > QToolButton[gxKind="primary"]:disabled {
+ background-color: #e9ebef;
+ color: #9398a0;
+ border: 1px solid transparent;
+}
+
+QToolBar#gxToolbar > QToolButton[gxKind="danger"] { color: #b8242c; }
+QToolBar#gxToolbar > QToolButton[gxKind="danger"]:disabled { color: #9398a0; }
+
+QFrame#gxTbDiv { background-color: #c5cad1; max-width: 1px; min-width: 1px; max-height: 22px; }
+
+QWidget#gxTbSearch {
+ background-color: #ffffff;
+ border: 1px solid #aab0b9;
+ border-radius: 3px;
+ min-height: 26px;
+ max-height: 26px;
+ min-width: 280px;
+ max-width: 320px;
+}
+QLineEdit#gxTbSearchInput {
+ background: transparent;
+ border: none;
+ color: #1c2025;
+ selection-background-color: #0098bd;
+ selection-color: #ffffff;
+ padding: 0 4px;
+ font-size: 11.5px;
+}
+
+/* ── Push buttons ─────────────────────────────────────────────── */
+QPushButton {
+ background-color: #ffffff;
+ color: #1c2025;
+ border: 1px solid #aab0b9;
+ border-radius: 3px;
+ padding: 5px 14px;
+ min-height: 22px;
+}
+QPushButton:hover { background-color: #f0f2f5; border-color: #0098bd; }
+QPushButton:pressed { background-color: #e9ebef; }
+QPushButton:disabled { color: #9398a0; background-color: #e9ebef; border-color: #c5cad1; }
+QPushButton[gxKind="primary"] {
+ color: #ffffff;
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #0098bd, stop:1 #007ea8);
+ border: 1px solid #006d92;
+ font-weight: 600;
+}
+QPushButton[gxKind="primary"]:hover {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #14aacc, stop:1 #008db8);
+}
+QPushButton[gxKind="danger"] {
+ color: #ffffff;
+ background-color: #c14545;
+ border-color: #983333;
+}
+QPushButton[gxKind="link"] {
+ background: transparent;
+ border: none;
+ color: #0098bd;
+ padding: 4px 6px;
+ text-align: left;
+ min-height: 0;
+}
+QPushButton[gxKind="link"]:hover { text-decoration: underline; }
+
+/* ── Inputs ───────────────────────────────────────────────────── */
+QLineEdit, QPlainTextEdit, QTextEdit, QSpinBox, QDoubleSpinBox, QComboBox {
+ background-color: #ffffff;
+ color: #1c2025;
+ border: 1px solid #aab0b9;
+ border-radius: 3px;
+ padding: 4px 8px;
+ selection-background-color: #0098bd;
+ selection-color: #ffffff;
+}
+QLineEdit:focus, QPlainTextEdit:focus, QTextEdit:focus,
+QSpinBox:focus, QDoubleSpinBox:focus, QComboBox:focus { border-color: #0098bd; }
+QLineEdit:disabled, QComboBox:disabled, QSpinBox:disabled { color: #9398a0; background-color: #e9ebef; }
+QComboBox::drop-down { border: none; width: 20px; }
+QComboBox QAbstractItemView {
+ background-color: #ffffff;
+ color: #1c2025;
+ border: 1px solid #aab0b9;
+ selection-background-color: #0098bd;
+ selection-color: #ffffff;
+}
+QLineEdit[gxRole="filter"] {
+ background-color: #ffffff;
+ border: 1px solid #aab0b9;
+ border-radius: 2px;
+ padding: 2px 8px;
+ min-height: 22px;
+}
+
+/* ── Workspace tabs ───────────────────────────────────────────── */
+QTabWidget::pane { background: #ffffff; border: none; border-top: 1px solid #c5cad1; }
+QTabBar { background-color: #f4f5f7; border-bottom: 1px solid #c5cad1; qproperty-drawBase: 0; }
+QTabBar::tab {
+ background: #f4f5f7;
+ color: #6a6e74;
+ border: none;
+ border-right: 1px solid #c5cad1;
+ padding: 0 14px;
+ min-height: 30px;
+ max-height: 30px;
+ font-size: 11.5px;
+}
+QTabBar::tab:hover { background: #e9ebef; color: #4a4f56; }
+QTabBar::tab:selected { background: #ffffff; color: #1c2025; border-top: 2px solid #0098bd; }
+QTabBar::close-button { image: none; background: transparent; width: 14px; height: 14px; }
+QTabBar::close-button:hover { background: #dde0e5; border-radius: 2px; }
+
+QTabBar[gxKind="underline"]::tab {
+ background: #e9ebef;
+ color: #6a6e74;
+ border: none;
+ border-right: 1px solid #c5cad1;
+ padding: 0 12px;
+ min-height: 28px;
+}
+QTabBar[gxKind="underline"]::tab:selected {
+ background: #f4f5f7;
+ color: #1c2025;
+ border-top: none;
+ border-bottom: 2px solid #0098bd;
+}
+
+/* ── Tree / list ──────────────────────────────────────────────── */
+QTreeView, QListView {
+ background-color: #f4f5f7;
+ color: #4a4f56;
+ border: none;
+ outline: none;
+ show-decoration-selected: 1;
+ font-size: 11.5px;
+}
+QTreeView::item, QListView::item { height: 22px; padding: 0 6px; border: none; }
+QTreeView::item:hover, QListView::item:hover { background-color: #e9ebef; }
+QTreeView::item:selected, QListView::item:selected {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #b5dff0, stop:1 #91cfe6);
+ color: #1c2025;
+}
+QTreeView::branch:hover { background: transparent; }
+QHeaderView::section {
+ background-color: #e9ebef;
+ color: #6a6e74;
+ border: none;
+ border-right: 1px solid #c5cad1;
+ border-bottom: 1px solid #aab0b9;
+ padding: 4px 8px;
+ font-weight: 600;
+ font-size: 10px;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+}
+
+/* ── Results grid ─────────────────────────────────────────────── */
+QTableView {
+ background-color: #ffffff;
+ color: #1c2025;
+ gridline-color: #e9ebef;
+ border: none;
+ selection-background-color: #b5dff0;
+ selection-color: #1c2025;
+ alternate-background-color: #f4f5f7;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 11.5px;
+}
+QTableView::item { padding: 3px 8px; border-right: 1px solid #e9ebef; }
+
+/* ── Scrollbars ───────────────────────────────────────────────── */
+QScrollBar:vertical { background: #f4f5f7; width: 10px; margin: 0; border: none; }
+QScrollBar:horizontal { background: #f4f5f7; height: 10px; margin: 0; border: none; }
+QScrollBar::handle:vertical { background: #aab0b9; min-height: 24px; border-radius: 2px; }
+QScrollBar::handle:horizontal { background: #aab0b9; min-width: 24px; border-radius: 2px; }
+QScrollBar::handle:vertical:hover, QScrollBar::handle:horizontal:hover { background: #6a6e74; }
+QScrollBar::add-line, QScrollBar::sub-line { width: 0; height: 0; }
+QScrollBar::add-page, QScrollBar::sub-page { background: none; }
+
+/* ── Statusbar ────────────────────────────────────────────────── */
+QStatusBar#gxStatusBar {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #f0f2f5, stop:1 #e6e9ee);
+ color: #6a6e74;
+ border-top: 1px solid #c5cad1;
+ min-height: 22px;
+ max-height: 22px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 10.5px;
+}
+QStatusBar#gxStatusBar::item { border: none; }
+QStatusBar#gxStatusBar QLabel { color: #6a6e74; background: transparent; }
+QStatusBar#gxStatusBar QLabel[gxText="success"] { color: #2e7d32; }
+QStatusBar#gxStatusBar QLabel[gxText="text"] { color: #1c2025; font-weight: 600; }
+
+/* ── Splitter ─────────────────────────────────────────────────── */
+QSplitter::handle { background: #c5cad1; }
+QSplitter::handle:horizontal { width: 1px; }
+QSplitter::handle:vertical { height: 1px; }
+QSplitter::handle:hover { background: #0098bd; }
+
+/* ── Check / radio ────────────────────────────────────────────── */
+QCheckBox, QRadioButton { color: #1c2025; spacing: 8px; }
+QCheckBox::indicator, QRadioButton::indicator {
+ width: 13px; height: 13px;
+ background: #ffffff;
+ border: 1px solid #aab0b9;
+ border-radius: 2px;
+}
+QCheckBox::indicator:checked, QRadioButton::indicator:checked {
+ background: #0098bd;
+ border-color: #006d92;
+}
+QRadioButton::indicator { border-radius: 7px; }
+
+/* ── GroupBox ─────────────────────────────────────────────────── */
+QGroupBox {
+ background-color: #ffffff;
+ border: 1px solid #c5cad1;
+ border-radius: 4px;
+ margin-top: 14px;
+ padding-top: 12px;
+ font-weight: 600;
+ color: #1c2025;
+}
+QGroupBox::title {
+ subcontrol-origin: margin;
+ subcontrol-position: top left;
+ left: 10px;
+ padding: 0 6px;
+ background: #f4f5f7;
+}
+
+/* ── Tooltip ──────────────────────────────────────────────────── */
+QToolTip {
+ background-color: #ffffff;
+ color: #1c2025;
+ border: 1px solid #aab0b9;
+ padding: 4px 8px;
+}
+
+/* ── Typography roles ─────────────────────────────────────────── */
+QLabel[gxText="muted"] { color: #6a6e74; }
+QLabel[gxText="faint"] { color: #9398a0; font-size: 10.5px; }
+QLabel[gxText="title"] { color: #1c2025; font-weight: 600; font-size: 14px; }
+QLabel[gxText="section"] { color: #6a6e74; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
+QLabel[gxText="accent"] { color: #0098bd; }
+QLabel[gxText="success"] { color: #2e7d32; }
+QLabel[gxText="warning"] { color: #b87a17; }
+QLabel[gxText="danger"] { color: #c14545; }
+QLabel[gxText="mono"] { font-family: "JetBrains Mono", "Fira Code", monospace; font-size: 11.5px; color: #4a4f56; }
+
+/* ── Activity bar (40px column) ───────────────────────────────── */
+QWidget#gxActivityBar {
+ background-color: #f4f5f7;
+ border-right: 1px solid #c5cad1;
+}
+QWidget#gxActivityBar QToolButton {
+ background: transparent;
+ border: none;
+ border-left: 2px solid transparent;
+ border-radius: 3px;
+ color: #6a6e74;
+ min-width: 30px; max-width: 30px;
+ min-height: 30px; max-height: 30px;
+ padding: 0;
+}
+QWidget#gxActivityBar QToolButton:hover { color: #1c2025; }
+QWidget#gxActivityBar QToolButton:checked {
+ color: #1c2025;
+ border-left: 2px solid #0098bd;
+ background-color: #e9ebef;
+}
+
+/* ── Workspace sidebar (Schema panel container) ───────────────── */
+QWidget#gxWorkspaceSidebar { background-color: #f4f5f7; border-right: 1px solid #c5cad1; }
+QWidget#gxSidebarPanelStack { background-color: #f4f5f7; border-right: 1px solid #c5cad1; }
+QWidget#gxSideHd { background-color: #f4f5f7; border-bottom: 1px solid #c5cad1; }
+QLabel#gxSideHdTitle { color: #6a6e74; background: transparent; }
+
+QToolButton[gxRole="side-square"] {
+ background: transparent;
+ border: none;
+ border-radius: 3px;
+}
+QToolButton[gxRole="side-square"]:hover { background-color: #dde0e5; }
+QToolButton[gxRole="side-square"]:checked { background-color: #e9ebef; }
+
+QTreeView#gxSchemaTree { background-color: #f4f5f7; border: none; outline: 0; }
+QTreeView#gxSchemaTree::item { padding: 0; border: none; }
+QTreeView#gxSchemaTree::branch { background: transparent; }
+
+QWidget#gxSideBottom { background-color: #e9ebef; border-top: 1px solid #c5cad1; }
+QComboBox#gxSideSchemaCombo {
+ background-color: #ffffff;
+ border: 1px solid #c5cad1;
+ border-radius: 3px;
+ padding: 2px 6px;
+ color: #1c2025;
+}
+QLabel#gxSideDbInfo { color: #6a6e74; font-size: 11px; }
+QPushButton#gxSideNewTable {
+ background-color: #ffffff;
+ border: 1px solid #c5cad1;
+ border-radius: 3px;
+ padding: 3px 8px;
+ color: #1c2025;
+}
+QPushButton#gxSideNewTable:hover { background-color: #dde0e5; }
+QPushButton#gxSideDisconnect {
+ background-color: transparent;
+ border: 1px solid #c5cad1;
+ border-radius: 3px;
+ padding: 3px 8px;
+ color: #4a4f56;
+}
+QPushButton#gxSideDisconnect:hover { background-color: #dde0e5; color: #1c2025; }
+
+QWidget#gxEmptyState { background-color: #f4f5f7; }
+QWidget#gxHistoryPanel { background-color: #f4f5f7; }
+QWidget#gxErdPanel { background-color: #f4f5f7; }
+QLabel#gxHistoryHeader {
+ color: #6a6e74;
+ background-color: #f4f5f7;
+ border-bottom: 1px solid #c5cad1;
+ font-size: 10px;
+ font-weight: 600;
+ letter-spacing: 1.2px;
+}
+QListWidget#gxHistoryList {
+ background-color: #f4f5f7;
+ color: #4a4f56;
+ border: none;
+ font-family: "JetBrains Mono", monospace;
+ font-size: 11px;
+}
+QListWidget#gxHistoryList::item { padding: 6px 10px; border-bottom: 1px solid #e9ebef; }
+QListWidget#gxHistoryList::item:hover { background-color: #e9ebef; }
+QListWidget#gxHistoryList::item:selected { background-color: #dde0e5; color: #1c2025; }
+QLabel#gxEmptyStateTitle { color: #4a4f56; font-size: 13px; font-weight: 600; }
+QLabel#gxEmptyStateSub { color: #6a6e74; font-size: 11.5px; }
+
+/* ── Inspector (Details panel) ────────────────────────────────── */
+QWidget#gxInspect { background-color: #f4f5f7; border-left: 1px solid #c5cad1; }
+QWidget#gxInspTabs { background-color: #f4f5f7; border-bottom: 1px solid #c5cad1; }
+QPushButton[gxRole="insp-tab"] {
+ background: transparent;
+ color: #6a6e74;
+ border: none;
+ border-bottom: 2px solid transparent;
+ padding: 6px 10px;
+ font-size: 10.5px;
+ min-height: 0;
+}
+QPushButton[gxRole="insp-tab"]:hover { color: #4a4f56; }
+QPushButton[gxRole="insp-tab"]:checked { color: #1c2025; border-bottom: 2px solid #0098bd; }
+QStackedWidget#gxInspStack { background-color: #f4f5f7; }
+QWidget#gxInspBody { background-color: #f4f5f7; }
+QScrollArea#gxInspScroll { background-color: #f4f5f7; border: none; }
+QWidget#gxInspFieldsHost { background-color: #f4f5f7; }
+QLabel#gxInspEmpty { color: #9398a0; font-size: 11px; }
+QLabel#gxInspSection {
+ padding: 10px 14px 4px;
+ font-size: 9.5px;
+ color: #9398a0;
+ font-weight: 600;
+ background: transparent;
+}
+QWidget#gxInspRow { background-color: #f4f5f7; border-bottom: 1px solid #e9ebef; }
+QWidget#gxInspRow:hover { background-color: #e9ebef; }
+QLabel#gxInspRowName {
+ color: #1c2025;
+ font-size: 11px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ background: transparent;
+}
+QLineEdit#gxInspRowValue {
+ background-color: transparent;
+ border: none;
+ color: #007ea8;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 10.5px;
+ padding: 0;
+}
+QLineEdit#gxInspRowValue:focus { background-color: #ffffff; color: #1c2025; }
+
+QLineEdit#gxInspSearch, QLineEdit#gxSideFilter {
+ background-color: #ffffff;
+ border: 1px solid #aab0b9;
+ border-radius: 2px;
+ padding: 0 8px;
+ color: #1c2025;
+ min-height: 24px;
+ max-height: 24px;
+ font-size: 11px;
+}
+QLineEdit#gxInspSearch:focus, QLineEdit#gxSideFilter:focus { border-color: #0098bd; }
+
+/* ── Workspace tab bar ────────────────────────────────────────── */
+QWidget#WorkspaceTabBar { background: #f4f5f7; border-bottom: 1px solid #c5cad1; }
+QWidget[gxTab="true"] {
+ background: #f4f5f7;
+ color: #6a6e74;
+ border-left: 0;
+ border-right: 1px solid #c5cad1;
+ border-top: 2px solid transparent;
+ border-bottom: 0;
+}
+QWidget[gxTab="true"]:hover { background: #e9ebef; }
+QWidget[gxTab="true"][gxActive="true"] {
+ background: #ffffff;
+ border-top: 2px solid #0098bd;
+ color: #1c2025;
+}
+QWidget[gxTab="true"] QLabel { background: transparent; }
+QLabel[gxTabTitle="true"] { color: #6a6e74; font-size: 11px; }
+QLabel[gxTabTitle="true"][gxActive="true"] { color: #1c2025; }
+QPushButton[gxTabClose="true"] {
+ background: transparent;
+ border: none;
+ border-radius: 2px;
+ padding: 0;
+}
+QPushButton[gxTabClose="true"]:hover { background: #dde0e5; }
+QPushButton#gxNewTab { background: transparent; border: none; color: #6a6e74; }
+QPushButton#gxNewTab:hover { background: #e9ebef; color: #1c2025; }
+QLabel#gxConnPill {
+ color: #4a4f56;
+ background: #e9ebef;
+ border: 1px solid #aab0b9;
+ padding: 2px 8px;
+ border-radius: 2px;
+ font-family: "JetBrains Mono", "Fira Code", "DejaVu Sans Mono", monospace;
+ font-size: 10px;
+}
+
+/* ── Query editor ─────────────────────────────────────────────── */
+QWidget#QueryEditorToolbar { background: #f4f5f7; border-bottom: 1px solid #c5cad1; }
+QPushButton#QueryEditorRun {
+ background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #0098bd, stop:1 #007ea8);
+ color: #ffffff;
+ border: none;
+ border-radius: 2px;
+ padding: 4px 12px;
+ font-weight: 600;
+ font-size: 11px;
+}
+QPushButton#QueryEditorRun:hover { background: #14aacc; }
+QPushButton#QueryEditorRun:disabled { background: #cdd1d8; color: #9398a0; }
+QPushButton#QueryEditorSave {
+ background: transparent;
+ color: #4a4f56;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ padding: 3px 10px;
+ font-size: 11px;
+}
+QPushButton#QueryEditorSave:hover { background: #e9ebef; color: #1c2025; }
+QLabel#QueryEditorStatus { color: #6a6e74; font-size: 11px; }
+QLabel#QueryEditorStatus[gxText="success"] { color: #2e7d32; }
+QLabel#QueryEditorStatus[gxText="danger"] { color: #c14545; }
+QPlainTextEdit#gxSqlEditor {
+ background: #ffffff;
+ color: #1c2025;
+ border: none;
+ selection-background-color: #b5dff0;
+ selection-color: #1c2025;
+}
+QFrame#QueryEditorDiv { color: #c5cad1; background: #c5cad1; max-height: 1px; min-height: 1px; }
+QTableView#QueryEditorResult {
+ background: #ffffff;
+ alternate-background-color: #f4f5f7;
+ color: #1c2025;
+ gridline-color: #e9ebef;
+ border: none;
+}
+QTableView#QueryEditorResult::item:selected { background: #b5dff0; color: #1c2025; }
+QHeaderView#QueryEditorResultHeader::section {
+ background: #e9ebef;
+ color: #1c2025;
+ padding: 4px 8px;
+ border: none;
+ border-right: 1px solid #c5cad1;
+ border-bottom: 1px solid #aab0b9;
+ font-weight: 600;
+ font-size: 11px;
+}
+QWidget#QueryEditorResultsTabs { background: #e9ebef; border-bottom: 1px solid #c5cad1; }
+QPushButton[gxResTab="true"] {
+ background: transparent;
+ color: #6a6e74;
+ border: none;
+ border-bottom: 2px solid transparent;
+ padding: 6px 12px;
+ font-size: 11px;
+}
+QPushButton[gxResTab="true"]:hover { color: #4a4f56; }
+QPushButton[gxResTab="true"][gxActive="true"] {
+ color: #1c2025;
+ background: #f4f5f7;
+ border-bottom: 2px solid #0098bd;
+}
+QLabel#QueryEditorResultsPlaceholder { color: #9398a0; font-size: 12px; background: #ffffff; }
+QPushButton#QueryEditorExport {
+ background: #e9ebef;
+ color: #4a4f56;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ padding: 4px 10px;
+ font-size: 11px;
+}
+QPushButton#QueryEditorExport:hover { background: #dde0e5; color: #1c2025; }
+
+/* ── DataGrid ─────────────────────────────────────────────────── */
+QWidget#DataGridTopBar, QWidget#DataGridBotBar { background: #e9ebef; border-bottom: 1px solid #c5cad1; }
+QWidget#DataGridBotBar { border-top: 1px solid #c5cad1; border-bottom: none; }
+QPushButton#commitButton {
+ background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #0098bd, stop:1 #007ea8);
+ color: #ffffff;
+ border: none;
+ border-radius: 2px;
+ padding: 2px 10px;
+ font-weight: 600;
+ font-size: 11px;
+}
+QPushButton#commitButton:hover { background: #14aacc; }
+QPushButton#discardButton {
+ background: transparent;
+ color: #4a4f56;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ padding: 2px 10px;
+ font-size: 11px;
+}
+QPushButton#discardButton:hover { background: #dde0e5; color: #1c2025; }
+QPushButton#dataGridReload {
+ background: transparent;
+ border: none;
+ color: #4a4f56;
+ border-radius: 2px;
+}
+QPushButton#dataGridReload:hover { background: #dde0e5; color: #1c2025; }
+QPushButton[tab="true"] {
+ background: transparent;
+ color: #6a6e74;
+ border: 1px solid #c5cad1;
+ padding: 2px 12px;
+ font-size: 11px;
+}
+QPushButton[tab="true"]:checked { background: #dde0e5; color: #1c2025; border-color: #aab0b9; }
+QPushButton#dataGridGenericBtn {
+ background: transparent;
+ color: #4a4f56;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ padding: 2px 8px;
+ font-size: 11px;
+}
+QPushButton#dataGridGenericBtn:hover { background: #dde0e5; color: #1c2025; }
+QPushButton#dataGridGenericBtn:checked { background: #dde0e5; color: #1c2025; border-color: #0098bd; }
+QLabel#dataGridPageLabel { color: #4a4f56; font-size: 11px; }
+QSpinBox#dataGridLimit {
+ background: #ffffff;
+ color: #1c2025;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ padding: 2px 4px;
+ font-size: 11px;
+}
+QTableView#DataGridTable {
+ background: #ffffff;
+ alternate-background-color: #f4f5f7;
+ color: #1c2025;
+ gridline-color: #e9ebef;
+ border: none;
+ selection-background-color: #b5dff0;
+ selection-color: #1c2025;
+}
+QHeaderView#DataGridHeader::section {
+ background: #e9ebef;
+ color: #1c2025;
+ padding: 4px 8px;
+ border: none;
+ border-right: 1px solid #c5cad1;
+ border-bottom: 1px solid #aab0b9;
+ font-weight: 600;
+ font-size: 11px;
+}
+QFrame#gxFilterBarDiv { color: #c5cad1; background: #c5cad1; max-height: 1px; }
+QLabel#gxDataGridPending[gxText="warning"] { color: #b87a17; }
+QLabel#gxDataGridPending[gxText="success"] { color: #2e7d32; }
+
+/* ── Filter bar ───────────────────────────────────────────────── */
+QWidget#FilterBarView { background: #e9ebef; border-bottom: 1px solid #c5cad1; }
+QComboBox#FilterColumn, QComboBox#FilterOperator {
+ background: #ffffff;
+ color: #1c2025;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ padding: 2px 6px;
+ font-size: 11px;
+ min-height: 22px;
+}
+QLineEdit#FilterValue {
+ background: #ffffff;
+ color: #1c2025;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ padding: 2px 6px;
+ font-size: 11px;
+ selection-background-color: #b5dff0;
+}
+QLineEdit#FilterValue:disabled { color: #9398a0; }
+QPushButton#FilterApply {
+ background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #0098bd, stop:1 #007ea8);
+ color: #ffffff;
+ border: none;
+ border-radius: 2px;
+ padding: 3px 12px;
+ font-weight: 600;
+ font-size: 11px;
+}
+QPushButton#FilterApply:hover { background: #14aacc; }
+QPushButton#FilterClear {
+ background: transparent;
+ color: #4a4f56;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ padding: 3px 12px;
+ font-size: 11px;
+}
+QPushButton#FilterClear:hover { background: #dde0e5; color: #1c2025; }
+
+/* ── Settings dialog ──────────────────────────────────────────── */
+QListWidget#gxSettingsNav {
+ background-color: #e9ebef;
+ border: none;
+ color: #4a4f56;
+ padding: 6px 0;
+ outline: 0;
+}
+QListWidget#gxSettingsNav::item { padding: 8px 18px; border-left: 2px solid transparent; }
+QListWidget#gxSettingsNav::item:selected {
+ background-color: #dde0e5;
+ color: #1c2025;
+ border-left: 2px solid #0098bd;
+}
+QListWidget#gxSettingsNav::item:hover { color: #1c2025; }
+QLabel#gxSettingsTitle { font-size: 14px; font-weight: 600; color: #1c2025; }
+QLabel#gxSettingsDesc { color: #6a6e74; font-size: 11.5px; }
+QStackedWidget#gxSettingsPages { background-color: #f4f5f7; }
+QFrame#gxSettingsDivider { color: #c5cad1; background-color: #c5cad1; max-width: 1px; }
+
+/* ── Connection form dialog ───────────────────────────────────── */
+QFrame#ConnectionFormCard {
+ background-color: #ffffff;
+ border: 1px solid #c5cad1;
+ border-radius: 4px;
+}
+QLabel#ConnectionFormHeader { color: #1c2025; font-size: 13px; font-weight: 600; }
+QFrame#gxConnDivider { color: #c5cad1; background-color: #c5cad1; max-height: 1px; }
+QLabel#gxConnTestResult[gxText="success"] { color: #2e7d32; font-size: 12px; }
+QLabel#gxConnTestResult[gxText="danger"] { color: #c14545; font-size: 12px; }
+
+/* ── Backup progress dialog ───────────────────────────────────── */
+QLabel#gxBackupHeader { color: #1c2025; font-size: 13px; font-weight: 600; }
+QProgressBar#gxBackupBar {
+ background-color: #e9ebef;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ max-height: 6px;
+}
+QProgressBar#gxBackupBar::chunk {
+ background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0,
+ stop:0 #0098bd, stop:1 #007ea8);
+}
+QPlainTextEdit#gxBackupLog {
+ background-color: #ffffff;
+ color: #4a4f56;
+ border: 1px solid #c5cad1;
+ border-radius: 3px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 11px;
+}
+
+/* ── SQL import wizard ────────────────────────────────────────── */
+QLabel#gxImportFile { color: #1c2025; font-size: 12px; }
+QLabel[gxRole="meta"] {
+ color: #6a6e74;
+ font-size: 11px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+}
+QPlainTextEdit#gxImportPreview {
+ background-color: #ffffff;
+ color: #1c2025;
+ border: 1px solid #c5cad1;
+ border-radius: 3px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 11px;
+}
+QListWidget#gxImportErrors {
+ background-color: #ffffff;
+ color: #8c2da8;
+ border: 1px solid #c5cad1;
+ border-radius: 3px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 11px;
+}
+QProgressBar#gxImportBar {
+ background-color: #e9ebef;
+ border: 1px solid #c5cad1;
+ border-radius: 2px;
+ max-height: 8px;
+ text-align: center;
+ color: #1c2025;
+}
+QProgressBar#gxImportBar::chunk {
+ background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0,
+ stop:0 #0098bd, stop:1 #007ea8);
+}
+
+/* ── Home branding panel action buttons ───────────────────────── */
+QPushButton[gxRole="home-action"] {
+ text-align: left;
+ padding: 0 14px;
+ border-radius: 3px;
+ color: #4a4f56;
+ background: transparent;
+ border: none;
+ min-height: 34px;
+}
+QPushButton[gxRole="home-action"]:hover { background-color: #dde0e5; color: #1c2025; }
+QLabel#gxHomeLogoFallback {
+ background-color: #378add;
+ color: white;
+ border-radius: 20px;
+ font-size: 48px;
+ font-weight: 700;
+}
+
+/* ── Connection row widget ────────────────────────────────────── */
+QWidget[gxRole="conn-row"] { background: transparent; color: #4a4f56; }
+QWidget[gxRole="conn-row"][gxActive="true"] { color: #1c2025; }
+QLabel#gxConnRowName { background: transparent; font-size: 11.5px; }
+QLabel#gxConnRowDot { background-color: #9398a0; border-radius: 3px; }
+
+/* ── Misc dividers ────────────────────────────────────────────── */
+QFrame#gxHomeDivider { background: #c5cad1; }
diff --git a/linux/resources/style-gx.qss b/linux/resources/style-gx.qss
new file mode 100644
index 0000000..f668028
--- /dev/null
+++ b/linux/resources/style-gx.qss
@@ -0,0 +1,889 @@
+/* style-gx.qss — Qt port of /tmp/design/gridex-linux/project/gridex.css.
+ *
+ * Hex values pre-computed from the oklch palette in that file. See
+ * linux/plans/ui-refactor-2026.md when re-deriving.
+ *
+ * Hard rule: NO global QToolButton or QPushButton min-width / min-height.
+ * Every sizing rule is scoped via objectName (QToolBar#gxToolbar …) or
+ * dynamic property selector ([gxRole="…"]) so chrome buttons can't poison
+ * sidebar / activity-bar / form buttons. */
+
+/* ── Base ─────────────────────────────────────────────────────── */
+QWidget {
+ background-color: #11151a; /* --gx-bg-1 */
+ color: #e5e8eb; /* --gx-text */
+ font-family: "Inter", "Cantarell", "Segoe UI", "Noto Sans", sans-serif;
+ font-size: 12px;
+ selection-background-color: #00b8e1;
+ selection-color: #090e12;
+}
+QMainWindow, QDialog { background-color: #11151a; }
+
+/* Opt-in mono via property */
+QWidget[gxFont="mono"], QPlainTextEdit[gxFont="mono"], QTextEdit[gxFont="mono"] {
+ font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "DejaVu Sans Mono", monospace;
+ font-size: 12.5px;
+}
+
+/* Card / popover / divider */
+QFrame[gxRole="card"] { background-color: #171c22; border: 1px solid #2e3339; border-radius: 4px; }
+QFrame[gxRole="popover"] { background-color: #1f252b; border: 1px solid #40464b; border-radius: 3px; }
+QFrame[gxRole="divider"] { background-color: #2e3339; max-height: 1px; min-height: 1px; }
+QFrame[gxRole="divider-vert"] { background-color: #2e3339; max-width: 1px; min-width: 1px; }
+
+/* ── Menubar ──────────────────────────────────────────────────── */
+QMenuBar {
+ background-color: #171c22; /* --gx-bg-2 */
+ color: #b4b8bc; /* --gx-text-2 */
+ border-bottom: 1px solid #2e3339;
+ padding: 0 4px;
+ spacing: 0;
+ min-height: 24px;
+}
+QMenuBar::item {
+ background: transparent;
+ padding: 4px 8px;
+ color: #b4b8bc;
+}
+QMenuBar::item:selected, QMenuBar::item:pressed {
+ background-color: #1f252b;
+ color: #e5e8eb;
+}
+
+QMenu {
+ background-color: #1f252b; /* --gx-bg-3 */
+ color: #e5e8eb;
+ border: 1px solid #40464b;
+ padding: 4px 0;
+}
+QMenu::item { padding: 4px 18px 4px 14px; }
+QMenu::item:selected { background-color: #00b8e1; color: #090e12; }
+QMenu::separator { height: 1px; background: #2e3339; margin: 4px 8px; }
+
+/* Menubar corner-widget engine pill */
+QLabel#gxMenubarEngine {
+ color: #7d8185;
+ font-size: 11px;
+ padding: 0 10px;
+}
+
+/* ── Toolbar (scoped — objectName = gxToolbar) ─────────────────── */
+QToolBar#gxToolbar {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #2c323a, stop:1 #24292f);
+ border: none;
+ border-bottom: 1px solid #2e3339;
+ spacing: 1px;
+ padding: 4px 6px;
+ min-height: 36px;
+ max-height: 36px;
+}
+QToolBar#gxToolbar::separator { width: 0px; background: transparent; }
+
+/* Toolbar tool buttons — 28x26, transparent. SCOPED so this rule
+ * cannot leak to QToolButtons elsewhere in the app. */
+QToolBar#gxToolbar > QToolButton {
+ background: transparent;
+ color: #b4b8bc;
+ border: 1px solid transparent;
+ border-radius: 3px;
+ min-width: 28px;
+ max-width: 28px;
+ min-height: 26px;
+ max-height: 26px;
+ padding: 0;
+}
+QToolBar#gxToolbar > QToolButton:hover {
+ background-color: #1f252b;
+ border-color: #40464b;
+ color: #e5e8eb;
+}
+QToolBar#gxToolbar > QToolButton:pressed { background-color: #2b3138; }
+QToolBar#gxToolbar > QToolButton:disabled { color: #55585c; }
+
+/* Primary run button — gradient accent, dark text */
+QToolBar#gxToolbar > QToolButton[gxKind="primary"] {
+ color: #11151a;
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #00b8e1, stop:1 #00a0ce);
+ border: 1px solid #4a90b5;
+}
+QToolBar#gxToolbar > QToolButton[gxKind="primary"]:hover {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #2bc4e6, stop:1 #1bb0d7);
+}
+QToolBar#gxToolbar > QToolButton[gxKind="primary"]:disabled {
+ background-color: #1f252b;
+ color: #55585c;
+ border: 1px solid transparent;
+}
+
+/* Danger (Stop) — red glyph, transparent bg */
+QToolBar#gxToolbar > QToolButton[gxKind="danger"] { color: #e08484; }
+QToolBar#gxToolbar > QToolButton[gxKind="danger"]:disabled { color: #55585c; }
+
+/* Toolbar divider widgets (objectName gxTbDiv) */
+QFrame#gxTbDiv { background-color: #2e3339; max-width: 1px; min-width: 1px; max-height: 22px; }
+
+/* Toolbar search wrapper + line edit */
+QWidget#gxTbSearch {
+ background-color: #090e12;
+ border: 1px solid #40464b;
+ border-radius: 3px;
+ min-height: 26px;
+ max-height: 26px;
+ min-width: 280px;
+ max-width: 320px;
+}
+QLineEdit#gxTbSearchInput {
+ background: transparent;
+ border: none;
+ color: #e5e8eb;
+ selection-background-color: #00b8e1;
+ selection-color: #090e12;
+ padding: 0 4px;
+ font-size: 11.5px;
+}
+
+/* ── Push buttons (forms / dialogs) — NOT scoped to toolbar ───── */
+QPushButton {
+ background-color: #1f252b;
+ color: #e5e8eb;
+ border: 1px solid #40464b;
+ border-radius: 3px;
+ padding: 5px 14px;
+ min-height: 22px;
+}
+QPushButton:hover { background-color: #2b3138; border-color: #00b8e1; }
+QPushButton:pressed { background-color: #171c22; }
+QPushButton:disabled { color: #55585c; background-color: #171c22; border-color: #2e3339; }
+QPushButton[gxKind="primary"] {
+ color: #090e12;
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #00b8e1, stop:1 #00a0ce);
+ border: 1px solid #4a90b5;
+ font-weight: 600;
+}
+QPushButton[gxKind="primary"]:hover {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #2bc4e6, stop:1 #1bb0d7);
+}
+QPushButton[gxKind="danger"] {
+ color: #fff;
+ background-color: #c14545;
+ border-color: #983333;
+}
+QPushButton[gxKind="link"] {
+ background: transparent;
+ border: none;
+ color: #00b8e1;
+ padding: 4px 6px;
+ text-align: left;
+ min-height: 0;
+}
+QPushButton[gxKind="link"]:hover { text-decoration: underline; }
+
+/* ── Inputs ───────────────────────────────────────────────────── */
+QLineEdit, QPlainTextEdit, QTextEdit, QSpinBox, QDoubleSpinBox, QComboBox {
+ background-color: #090e12;
+ color: #e5e8eb;
+ border: 1px solid #40464b;
+ border-radius: 3px;
+ padding: 4px 8px;
+ selection-background-color: #00b8e1;
+ selection-color: #090e12;
+}
+QLineEdit:focus, QPlainTextEdit:focus, QTextEdit:focus,
+QSpinBox:focus, QDoubleSpinBox:focus, QComboBox:focus { border-color: #00b8e1; }
+QLineEdit:disabled, QComboBox:disabled, QSpinBox:disabled { color: #55585c; background-color: #11151a; }
+QComboBox::drop-down { border: none; width: 20px; }
+QComboBox QAbstractItemView {
+ background-color: #1f252b;
+ color: #e5e8eb;
+ border: 1px solid #40464b;
+ selection-background-color: #00b8e1;
+ selection-color: #090e12;
+}
+QLineEdit[gxRole="filter"] {
+ background-color: #090e12;
+ border: 1px solid #40464b;
+ border-radius: 2px;
+ padding: 2px 8px;
+ min-height: 22px;
+}
+
+/* ── Workspace tabs ───────────────────────────────────────────── */
+QTabWidget::pane { background: #090e12; border: none; border-top: 1px solid #2e3339; }
+QTabBar {
+ background-color: #11151a;
+ border-bottom: 1px solid #2e3339;
+ qproperty-drawBase: 0;
+}
+QTabBar::tab {
+ background: #11151a;
+ color: #7d8185;
+ border: none;
+ border-right: 1px solid #2e3339;
+ padding: 0 14px;
+ min-height: 30px;
+ max-height: 30px;
+ font-size: 11.5px;
+}
+QTabBar::tab:hover { background: #171c22; color: #b4b8bc; }
+QTabBar::tab:selected { background: #090e12; color: #e5e8eb; border-top: 2px solid #00b8e1; }
+QTabBar::close-button { image: none; background: transparent; width: 14px; height: 14px; }
+QTabBar::close-button:hover { background: #1f252b; border-radius: 2px; }
+
+/* Inspector/results: bottom-underline variant */
+QTabBar[gxKind="underline"]::tab {
+ background: #171c22;
+ color: #7d8185;
+ border: none;
+ border-right: 1px solid #2e3339;
+ padding: 0 12px;
+ min-height: 28px;
+}
+QTabBar[gxKind="underline"]::tab:selected {
+ background: #11151a;
+ color: #e5e8eb;
+ border-top: none;
+ border-bottom: 2px solid #00b8e1;
+}
+
+/* ── Tree / list (sidebar) ────────────────────────────────────── */
+QTreeView, QListView {
+ background-color: #11151a;
+ color: #b4b8bc;
+ border: none;
+ outline: none;
+ show-decoration-selected: 1;
+ font-size: 11.5px;
+}
+QTreeView::item, QListView::item {
+ height: 22px;
+ padding: 0 6px;
+ border: none;
+}
+QTreeView::item:hover, QListView::item:hover { background-color: #171c22; }
+QTreeView::item:selected, QListView::item:selected {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #365475, stop:1 #2e4762);
+ color: #e5e8eb;
+}
+QTreeView::branch:hover { background: transparent; }
+QHeaderView::section {
+ background-color: #171c22;
+ color: #55585c;
+ border: none;
+ border-right: 1px solid #2e3339;
+ border-bottom: 1px solid #40464b;
+ padding: 4px 8px;
+ font-weight: 600;
+ font-size: 10px;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+}
+
+/* ── Results grid ─────────────────────────────────────────────── */
+QTableView {
+ background-color: #11151a;
+ color: #e5e8eb;
+ gridline-color: #171c22;
+ border: none;
+ selection-background-color: #2f5c75;
+ selection-color: #e5e8eb;
+ alternate-background-color: #1a1f25;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 11.5px;
+}
+QTableView::item {
+ padding: 3px 8px;
+ border-right: 1px solid #171c22;
+}
+
+/* ── Scrollbars ───────────────────────────────────────────────── */
+QScrollBar:vertical { background: #11151a; width: 10px; margin: 0; border: none; }
+QScrollBar:horizontal { background: #11151a; height: 10px; margin: 0; border: none; }
+QScrollBar::handle:vertical { background: #40464b; min-height: 24px; border-radius: 2px; }
+QScrollBar::handle:horizontal { background: #40464b; min-width: 24px; border-radius: 2px; }
+QScrollBar::handle:vertical:hover, QScrollBar::handle:horizontal:hover { background: #4f5660; }
+QScrollBar::add-line, QScrollBar::sub-line { width: 0; height: 0; }
+QScrollBar::add-page, QScrollBar::sub-page { background: none; }
+
+/* ── Statusbar (scoped — objectName gxStatusBar) ──────────────── */
+QStatusBar#gxStatusBar {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #2c323a, stop:1 #24292f);
+ color: #7d8185;
+ border-top: 1px solid #000;
+ min-height: 22px;
+ max-height: 22px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 10.5px;
+}
+QStatusBar#gxStatusBar::item { border: none; }
+QStatusBar#gxStatusBar QLabel { color: #7d8185; background: transparent; }
+QStatusBar#gxStatusBar QLabel[gxText="success"] { color: #6dd47e; }
+QStatusBar#gxStatusBar QLabel[gxText="text"] { color: #e5e8eb; font-weight: 600; }
+
+/* ── Splitter ─────────────────────────────────────────────────── */
+QSplitter::handle { background: #2e3339; }
+QSplitter::handle:horizontal { width: 1px; }
+QSplitter::handle:vertical { height: 1px; }
+QSplitter::handle:hover { background: #00b8e1; }
+
+/* ── Check / radio ────────────────────────────────────────────── */
+QCheckBox, QRadioButton { color: #e5e8eb; spacing: 8px; }
+QCheckBox::indicator, QRadioButton::indicator {
+ width: 13px; height: 13px;
+ background: #090e12;
+ border: 1px solid #40464b;
+ border-radius: 2px;
+}
+QCheckBox::indicator:checked, QRadioButton::indicator:checked {
+ background: #00b8e1;
+ border-color: #4a90b5;
+}
+QRadioButton::indicator { border-radius: 7px; }
+
+/* ── GroupBox ─────────────────────────────────────────────────── */
+QGroupBox {
+ background-color: #171c22;
+ border: 1px solid #2e3339;
+ border-radius: 4px;
+ margin-top: 14px;
+ padding-top: 12px;
+ font-weight: 600;
+ color: #e5e8eb;
+}
+QGroupBox::title {
+ subcontrol-origin: margin;
+ subcontrol-position: top left;
+ left: 10px;
+ padding: 0 6px;
+ background: #11151a;
+}
+
+/* ── Tooltip ──────────────────────────────────────────────────── */
+QToolTip {
+ background-color: #1f252b;
+ color: #e5e8eb;
+ border: 1px solid #40464b;
+ padding: 4px 8px;
+}
+
+/* ── Typography roles (apply via property) ────────────────────── */
+QLabel[gxText="muted"] { color: #7d8185; }
+QLabel[gxText="faint"] { color: #55585c; font-size: 10.5px; }
+QLabel[gxText="title"] { color: #e5e8eb; font-weight: 600; font-size: 14px; }
+QLabel[gxText="section"] { color: #55585c; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
+QLabel[gxText="accent"] { color: #00b8e1; }
+QLabel[gxText="success"] { color: #6dd47e; }
+QLabel[gxText="warning"] { color: #f0b96b; }
+QLabel[gxText="danger"] { color: #e04b4a; }
+QLabel[gxText="mono"] { font-family: "JetBrains Mono", "Fira Code", monospace; font-size: 11.5px; color: #b4b8bc; }
+
+/* ── Activity bar (40px column) ───────────────────────────────── */
+QWidget#gxActivityBar {
+ background-color: #11151a;
+ border-right: 1px solid #2e3339;
+}
+QWidget#gxActivityBar QToolButton {
+ background: transparent;
+ border: none;
+ border-left: 2px solid transparent;
+ border-radius: 3px;
+ color: #7d8185;
+ min-width: 30px; max-width: 30px;
+ min-height: 30px; max-height: 30px;
+ padding: 0;
+}
+QWidget#gxActivityBar QToolButton:hover { color: #e5e8eb; }
+QWidget#gxActivityBar QToolButton:checked {
+ color: #e5e8eb;
+ border-left: 2px solid #00b8e1;
+ background-color: #171c22;
+}
+
+/* ── Workspace sidebar (Schema panel container) ───────────────── */
+QWidget#gxWorkspaceSidebar { background-color: #11151a; border-right: 1px solid #2e3339; }
+QWidget#gxSidebarPanelStack { background-color: #11151a; border-right: 1px solid #2e3339; }
+QWidget#gxSideHd { background-color: #11151a; border-bottom: 1px solid #2e3339; }
+QLabel#gxSideHdTitle { color: #7d8185; background: transparent; }
+
+/* Square icon button used in sidebar header / filter row */
+QToolButton[gxRole="side-square"] {
+ background: transparent;
+ border: none;
+ border-radius: 3px;
+}
+QToolButton[gxRole="side-square"]:hover { background-color: #2b3138; }
+QToolButton[gxRole="side-square"]:checked { background-color: #1f252b; }
+
+/* Sidebar schema tree */
+QTreeView#gxSchemaTree { background-color: #11151a; border: none; outline: 0; }
+QTreeView#gxSchemaTree::item { padding: 0; border: none; }
+QTreeView#gxSchemaTree::branch { background: transparent; }
+
+/* Sidebar bottom-bar (schema combo + DB info + actions) */
+QWidget#gxSideBottom { background-color: #171c22; border-top: 1px solid #2e3339; }
+QComboBox#gxSideSchemaCombo {
+ background-color: #11151a;
+ border: 1px solid #2e3339;
+ border-radius: 3px;
+ padding: 2px 6px;
+ color: #e5e8eb;
+}
+QLabel#gxSideDbInfo { color: #7d8185; font-size: 11px; }
+QPushButton#gxSideNewTable {
+ background-color: #1f252b;
+ border: 1px solid #2e3339;
+ border-radius: 3px;
+ padding: 3px 8px;
+ color: #e5e8eb;
+}
+QPushButton#gxSideNewTable:hover { background-color: #2b3138; }
+QPushButton#gxSideDisconnect {
+ background-color: transparent;
+ border: 1px solid #2e3339;
+ border-radius: 3px;
+ padding: 3px 8px;
+ color: #b4b8bc;
+}
+QPushButton#gxSideDisconnect:hover { background-color: #2b3138; color: #e5e8eb; }
+
+/* Sidebar panel placeholders / history / ERD */
+QWidget#gxEmptyState { background-color: #11151a; }
+QWidget#gxHistoryPanel { background-color: #11151a; }
+QWidget#gxErdPanel { background-color: #11151a; }
+QLabel#gxHistoryHeader {
+ color: #7d8185;
+ background-color: #11151a;
+ border-bottom: 1px solid #2e3339;
+ font-size: 10px;
+ font-weight: 600;
+ letter-spacing: 1.2px;
+}
+QListWidget#gxHistoryList {
+ background-color: #11151a;
+ color: #b4b8bc;
+ border: none;
+ font-family: "JetBrains Mono", monospace;
+ font-size: 11px;
+}
+QListWidget#gxHistoryList::item { padding: 6px 10px; border-bottom: 1px solid #171c22; }
+QListWidget#gxHistoryList::item:hover { background-color: #171c22; }
+QListWidget#gxHistoryList::item:selected { background-color: #1f252b; color: #e5e8eb; }
+QLabel#gxEmptyStateTitle { color: #b4b8bc; font-size: 13px; font-weight: 600; }
+QLabel#gxEmptyStateSub { color: #7d8185; font-size: 11.5px; }
+
+/* ── Inspector (Details panel) ────────────────────────────────── */
+QWidget#gxInspect { background-color: #11151a; border-left: 1px solid #2e3339; }
+QWidget#gxInspTabs { background-color: #11151a; border-bottom: 1px solid #2e3339; }
+QPushButton[gxRole="insp-tab"] {
+ background: transparent;
+ color: #7d8185;
+ border: none;
+ border-bottom: 2px solid transparent;
+ padding: 6px 10px;
+ font-size: 10.5px;
+ min-height: 0;
+}
+QPushButton[gxRole="insp-tab"]:hover { color: #b4b8bc; }
+QPushButton[gxRole="insp-tab"]:checked { color: #e5e8eb; border-bottom: 2px solid #00b8e1; }
+QStackedWidget#gxInspStack { background-color: #11151a; }
+QWidget#gxInspBody { background-color: #11151a; }
+QScrollArea#gxInspScroll { background-color: #11151a; border: none; }
+QWidget#gxInspFieldsHost { background-color: #11151a; }
+QLabel#gxInspEmpty { color: #55585c; font-size: 11px; }
+QLabel#gxInspSection {
+ padding: 10px 14px 4px;
+ font-size: 9.5px;
+ color: #55585c;
+ font-weight: 600;
+ background: transparent;
+}
+QWidget#gxInspRow { background-color: #11151a; border-bottom: 1px solid #1a1f25; }
+QWidget#gxInspRow:hover { background-color: #171c22; }
+QLabel#gxInspRowName {
+ color: #e5e8eb;
+ font-size: 11px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ background: transparent;
+}
+QLineEdit#gxInspRowValue {
+ background-color: transparent;
+ border: none;
+ color: #5edada;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 10.5px;
+ padding: 0;
+}
+QLineEdit#gxInspRowValue:focus { background-color: #090e12; color: #e5e8eb; }
+
+/* Inspector / sidebar filter line edit */
+QLineEdit#gxInspSearch, QLineEdit#gxSideFilter {
+ background-color: #090e12;
+ border: 1px solid #40464b;
+ border-radius: 2px;
+ padding: 0 8px;
+ color: #e5e8eb;
+ min-height: 24px;
+ max-height: 24px;
+ font-size: 11px;
+}
+QLineEdit#gxInspSearch:focus, QLineEdit#gxSideFilter:focus { border-color: #00b8e1; }
+
+/* ── Workspace tab bar (custom) ───────────────────────────────── */
+QWidget#WorkspaceTabBar { background: #11151a; border-bottom: 1px solid #2e3339; }
+QWidget[gxTab="true"] {
+ background: #11151a;
+ color: #7d8185;
+ border-left: 0;
+ border-right: 1px solid #2e3339;
+ border-top: 2px solid transparent;
+ border-bottom: 0;
+}
+QWidget[gxTab="true"]:hover { background: #171c22; }
+QWidget[gxTab="true"][gxActive="true"] {
+ background: #090e12;
+ border-top: 2px solid #00b8e1;
+ color: #e5e8eb;
+}
+QWidget[gxTab="true"] QLabel { background: transparent; }
+QLabel[gxTabTitle="true"] { color: #7d8185; font-size: 11px; }
+QLabel[gxTabTitle="true"][gxActive="true"] { color: #e5e8eb; }
+QPushButton[gxTabClose="true"] {
+ background: transparent;
+ border: none;
+ border-radius: 2px;
+ padding: 0;
+}
+QPushButton[gxTabClose="true"]:hover { background: #1f252b; }
+QPushButton#gxNewTab { background: transparent; border: none; color: #7d8185; }
+QPushButton#gxNewTab:hover { background: #171c22; color: #e5e8eb; }
+QLabel#gxConnPill {
+ color: #b4b8bc;
+ background: #171c22;
+ border: 1px solid #40464b;
+ padding: 2px 8px;
+ border-radius: 2px;
+ font-family: "JetBrains Mono", "Fira Code", "DejaVu Sans Mono", monospace;
+ font-size: 10px;
+}
+
+/* ── Query editor ─────────────────────────────────────────────── */
+QWidget#QueryEditorToolbar { background: #11151a; border-bottom: 1px solid #2e3339; }
+QPushButton#QueryEditorRun {
+ background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #00b8e1, stop:1 #00a0ce);
+ color: #090e12;
+ border: none;
+ border-radius: 2px;
+ padding: 4px 12px;
+ font-weight: 600;
+ font-size: 11px;
+}
+QPushButton#QueryEditorRun:hover { background: #14c4eb; }
+QPushButton#QueryEditorRun:disabled { background: #2b3138; color: #55585c; }
+QPushButton#QueryEditorSave {
+ background: transparent;
+ color: #b4b8bc;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ padding: 3px 10px;
+ font-size: 11px;
+}
+QPushButton#QueryEditorSave:hover { background: #171c22; color: #e5e8eb; }
+QLabel#QueryEditorStatus { color: #7d8185; font-size: 11px; }
+QLabel#QueryEditorStatus[gxText="success"] { color: #6dd47e; }
+QLabel#QueryEditorStatus[gxText="danger"] { color: #e04b4a; }
+QPlainTextEdit#gxSqlEditor {
+ background: #090e12;
+ color: #e5e8eb;
+ border: none;
+ selection-background-color: #1f4256;
+ selection-color: #e5e8eb;
+}
+QFrame#QueryEditorDiv { color: #2e3339; background: #2e3339; max-height: 1px; min-height: 1px; }
+QTableView#QueryEditorResult {
+ background: #090e12;
+ alternate-background-color: #0d1218;
+ color: #e5e8eb;
+ gridline-color: #1c2128;
+ border: none;
+}
+QTableView#QueryEditorResult::item:selected { background: #1f4256; color: #e5e8eb; }
+QHeaderView#QueryEditorResultHeader::section {
+ background: #171c22;
+ color: #e5e8eb;
+ padding: 4px 8px;
+ border: none;
+ border-right: 1px solid #2e3339;
+ border-bottom: 1px solid #40464b;
+ font-weight: 600;
+ font-size: 11px;
+}
+QWidget#QueryEditorResultsTabs { background: #171c22; border-bottom: 1px solid #2e3339; }
+QPushButton[gxResTab="true"] {
+ background: transparent;
+ color: #7d8185;
+ border: none;
+ border-bottom: 2px solid transparent;
+ padding: 6px 12px;
+ font-size: 11px;
+}
+QPushButton[gxResTab="true"]:hover { color: #b4b8bc; }
+QPushButton[gxResTab="true"][gxActive="true"] {
+ color: #e5e8eb;
+ background: #11151a;
+ border-bottom: 2px solid #00b8e1;
+}
+QLabel#QueryEditorResultsPlaceholder { color: #55585c; font-size: 12px; background: #090e12; }
+QPushButton#QueryEditorExport {
+ background: #171c22;
+ color: #b4b8bc;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ padding: 4px 10px;
+ font-size: 11px;
+}
+QPushButton#QueryEditorExport:hover { background: #1f252b; color: #e5e8eb; }
+
+/* ── DataGrid ─────────────────────────────────────────────────── */
+QWidget#DataGridTopBar, QWidget#DataGridBotBar { background: #171c22; border-bottom: 1px solid #2e3339; }
+QWidget#DataGridBotBar { border-top: 1px solid #2e3339; border-bottom: none; }
+QPushButton#commitButton {
+ background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #00b8e1, stop:1 #00a0ce);
+ color: #090e12;
+ border: none;
+ border-radius: 2px;
+ padding: 2px 10px;
+ font-weight: 600;
+ font-size: 11px;
+}
+QPushButton#commitButton:hover { background: #14c4eb; }
+QPushButton#discardButton {
+ background: transparent;
+ color: #b4b8bc;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ padding: 2px 10px;
+ font-size: 11px;
+}
+QPushButton#discardButton:hover { background: #1f252b; color: #e5e8eb; }
+QPushButton#dataGridReload {
+ background: transparent;
+ border: none;
+ color: #b4b8bc;
+ border-radius: 2px;
+}
+QPushButton#dataGridReload:hover { background: #1f252b; color: #e5e8eb; }
+QPushButton[tab="true"] {
+ background: transparent;
+ color: #7d8185;
+ border: 1px solid #2e3339;
+ padding: 2px 12px;
+ font-size: 11px;
+}
+QPushButton[tab="true"]:checked { background: #1f252b; color: #e5e8eb; border-color: #40464b; }
+QPushButton#dataGridGenericBtn {
+ background: transparent;
+ color: #b4b8bc;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ padding: 2px 8px;
+ font-size: 11px;
+}
+QPushButton#dataGridGenericBtn:hover { background: #1f252b; color: #e5e8eb; }
+QPushButton#dataGridGenericBtn:checked { background: #1f252b; color: #e5e8eb; border-color: #00b8e1; }
+QLabel#dataGridPageLabel { color: #b4b8bc; font-size: 11px; }
+QSpinBox#dataGridLimit {
+ background: #11151a;
+ color: #e5e8eb;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ padding: 2px 4px;
+ font-size: 11px;
+}
+QTableView#DataGridTable {
+ background: #090e12;
+ alternate-background-color: #0d1218;
+ color: #e5e8eb;
+ gridline-color: #1c2128;
+ border: none;
+ selection-background-color: #1f4256;
+ selection-color: #e5e8eb;
+}
+QHeaderView#DataGridHeader::section {
+ background: #171c22;
+ color: #e5e8eb;
+ padding: 4px 8px;
+ border: none;
+ border-right: 1px solid #2e3339;
+ border-bottom: 1px solid #40464b;
+ font-weight: 600;
+ font-size: 11px;
+}
+QFrame#gxFilterBarDiv { color: #2e3339; background: #2e3339; max-height: 1px; }
+QLabel#gxDataGridPending[gxText="warning"] { color: #f0b96b; }
+QLabel#gxDataGridPending[gxText="success"] { color: #6dd47e; }
+
+/* ── Filter bar ───────────────────────────────────────────────── */
+QWidget#FilterBarView { background: #171c22; border-bottom: 1px solid #2e3339; }
+QComboBox#FilterColumn, QComboBox#FilterOperator {
+ background: #11151a;
+ color: #e5e8eb;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ padding: 2px 6px;
+ font-size: 11px;
+ min-height: 22px;
+}
+QLineEdit#FilterValue {
+ background: #11151a;
+ color: #e5e8eb;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ padding: 2px 6px;
+ font-size: 11px;
+ selection-background-color: #1f4256;
+}
+QLineEdit#FilterValue:disabled { color: #55585c; }
+QPushButton#FilterApply {
+ background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #00b8e1, stop:1 #00a0ce);
+ color: #090e12;
+ border: none;
+ border-radius: 2px;
+ padding: 3px 12px;
+ font-weight: 600;
+ font-size: 11px;
+}
+QPushButton#FilterApply:hover { background: #14c4eb; }
+QPushButton#FilterClear {
+ background: transparent;
+ color: #b4b8bc;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ padding: 3px 12px;
+ font-size: 11px;
+}
+QPushButton#FilterClear:hover { background: #1f252b; color: #e5e8eb; }
+
+/* ── Settings dialog ──────────────────────────────────────────── */
+QListWidget#gxSettingsNav {
+ background-color: #171c22;
+ border: none;
+ color: #b4b8bc;
+ padding: 6px 0;
+ outline: 0;
+}
+QListWidget#gxSettingsNav::item { padding: 8px 18px; border-left: 2px solid transparent; }
+QListWidget#gxSettingsNav::item:selected {
+ background-color: #1f252b;
+ color: #e5e8eb;
+ border-left: 2px solid #00b8e1;
+}
+QListWidget#gxSettingsNav::item:hover { color: #e5e8eb; }
+QLabel#gxSettingsTitle { font-size: 14px; font-weight: 600; color: #e5e8eb; }
+QLabel#gxSettingsDesc { color: #7d8185; font-size: 11.5px; }
+QStackedWidget#gxSettingsPages { background-color: #11151a; }
+QFrame#gxSettingsDivider { color: #2e3339; background-color: #2e3339; max-width: 1px; }
+
+/* ── Connection form dialog ───────────────────────────────────── */
+QFrame#ConnectionFormCard {
+ background-color: #171c22;
+ border: 1px solid #2e3339;
+ border-radius: 4px;
+}
+QLabel#ConnectionFormHeader { color: #e5e8eb; font-size: 13px; font-weight: 600; }
+QFrame#gxConnDivider { color: #2e3339; background-color: #2e3339; max-height: 1px; }
+QLabel#gxConnTestResult[gxText="success"] { color: #6dd47e; font-size: 12px; }
+QLabel#gxConnTestResult[gxText="danger"] { color: #e04b4a; font-size: 12px; }
+
+/* ── Backup progress dialog ───────────────────────────────────── */
+QLabel#gxBackupHeader { color: #e5e8eb; font-size: 13px; font-weight: 600; }
+QProgressBar#gxBackupBar {
+ background-color: #171c22;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ max-height: 6px;
+}
+QProgressBar#gxBackupBar::chunk {
+ background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0,
+ stop:0 #00b8e1, stop:1 #00a0ce);
+}
+QPlainTextEdit#gxBackupLog {
+ background-color: #090e12;
+ color: #b4b8bc;
+ border: 1px solid #2e3339;
+ border-radius: 3px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 11px;
+}
+
+/* ── SQL import wizard ────────────────────────────────────────── */
+QLabel#gxImportFile { color: #e5e8eb; font-size: 12px; }
+QLabel[gxRole="meta"] {
+ color: #7d8185;
+ font-size: 11px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+}
+QPlainTextEdit#gxImportPreview {
+ background-color: #090e12;
+ color: #e5e8eb;
+ border: 1px solid #2e3339;
+ border-radius: 3px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 11px;
+}
+QListWidget#gxImportErrors {
+ background-color: #090e12;
+ color: #df99ef;
+ border: 1px solid #2e3339;
+ border-radius: 3px;
+ font-family: "JetBrains Mono", "Fira Code", monospace;
+ font-size: 11px;
+}
+QProgressBar#gxImportBar {
+ background-color: #171c22;
+ border: 1px solid #2e3339;
+ border-radius: 2px;
+ max-height: 8px;
+ text-align: center;
+ color: #e5e8eb;
+}
+QProgressBar#gxImportBar::chunk {
+ background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0,
+ stop:0 #00b8e1, stop:1 #00a0ce);
+}
+
+/* ── Home branding panel action buttons ───────────────────────── */
+QPushButton[gxRole="home-action"] {
+ text-align: left;
+ padding: 0 14px;
+ border-radius: 3px;
+ color: #b4b8bc;
+ background: transparent;
+ border: none;
+ min-height: 34px;
+}
+QPushButton[gxRole="home-action"]:hover { background-color: #1f252b; color: #e5e8eb; }
+QLabel#gxHomeLogoFallback {
+ background-color: #378add;
+ color: white;
+ border-radius: 20px;
+ font-size: 48px;
+ font-weight: 700;
+}
+
+/* ── Connection row widget (in connection list) ───────────────── */
+QWidget[gxRole="conn-row"] { background: transparent; color: #b4b8bc; }
+QWidget[gxRole="conn-row"][gxActive="true"] { color: #e5e8eb; }
+QLabel#gxConnRowName { background: transparent; font-size: 11.5px; }
+QLabel#gxConnRowDot { background-color: #55585c; border-radius: 3px; }
+
+/* ── Misc dividers (MainWindow home page) ─────────────────────── */
+QFrame#gxHomeDivider { background: #2e3339; }
diff --git a/linux/src/Presentation/CMakeLists.txt b/linux/src/Presentation/CMakeLists.txt
index 3214a94..57c0bec 100644
--- a/linux/src/Presentation/CMakeLists.txt
+++ b/linux/src/Presentation/CMakeLists.txt
@@ -26,6 +26,10 @@ qt_add_library(gridex-presentation STATIC
Views/QueryEditor/QueryEditorView.cpp
Views/QueryEditor/SqlHighlighter.cpp
Views/Settings/SettingsDialog.cpp
+ Views/Chrome/GxToolbar.cpp
+ Views/Chrome/GxStatusBar.cpp
+ Views/Chrome/GxIcons.cpp
+ Views/Chrome/GxActivityBar.cpp
Views/QueryEditor/Autocomplete/AutocompleteProvider.cpp
Views/QueryEditor/Autocomplete/CompletionPopup.cpp
Views/QueryEditor/Autocomplete/SqlContextParser.cpp
@@ -33,6 +37,7 @@ qt_add_library(gridex-presentation STATIC
Views/Sidebar/ConnectionSidebar.cpp
Views/ImportSQL/SqlImportWizard.cpp
Views/Sidebar/WorkspaceSidebar.cpp
+ Views/Sidebar/SidebarPanelStack.cpp
Views/TableList/TableGridView.cpp
Views/StatusBar/StatusBarView.cpp
Views/TabBar/WorkspaceTabBar.cpp
@@ -53,6 +58,8 @@ qt_add_resources(gridex-presentation "assets"
${CMAKE_SOURCE_DIR}/resources/logo.png
${CMAKE_SOURCE_DIR}/resources/style-dark.qss
${CMAKE_SOURCE_DIR}/resources/style-light.qss
+ ${CMAKE_SOURCE_DIR}/resources/style-gx.qss
+ ${CMAKE_SOURCE_DIR}/resources/style-gx-light.qss
)
target_include_directories(gridex-presentation PUBLIC
diff --git a/linux/src/Presentation/Theme/ThemeManager.cpp b/linux/src/Presentation/Theme/ThemeManager.cpp
index c678836..c148be2 100644
--- a/linux/src/Presentation/Theme/ThemeManager.cpp
+++ b/linux/src/Presentation/Theme/ThemeManager.cpp
@@ -24,22 +24,52 @@ ThemeManager::ThemeManager(QObject* parent) : QObject(parent) {
void ThemeManager::apply(QApplication* app) {
app_ = app;
+ // The legacy Phase-2 palette is still reachable via `--legacy-theme`
+ // for A/B comparison during the UI refactor.
+ const bool useLegacy = app && app->arguments().contains(QStringLiteral("--legacy-theme"));
+ if (useLegacy) {
+ if (mode_ == Mode::Auto) {
+ applyLegacyForSystem(app);
+ connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged,
+ this, [this](Qt::ColorScheme) {
+ if (mode_ == Mode::Auto && app_) {
+ applyLegacyForSystem(app_);
+ emit themeChanged();
+ }
+ }, Qt::UniqueConnection);
+ } else {
+ applyQss(app, mode_ == Mode::Light
+ ? QStringLiteral(":/style-light.qss")
+ : QStringLiteral(":/style-dark.qss"));
+ }
+ return;
+ }
+
+ // gx skin — pick dark or light based on mode (Auto follows system).
+ applyGxForMode(app);
if (mode_ == Mode::Auto) {
- applyForCurrentSystem(app);
connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged,
this, [this](Qt::ColorScheme) {
if (mode_ == Mode::Auto && app_) {
- applyForCurrentSystem(app_);
+ applyGxForMode(app_);
emit themeChanged();
}
}, Qt::UniqueConnection);
- } else {
- applyQss(app, mode_ == Mode::Light
- ? QStringLiteral(":/style-light.qss")
- : QStringLiteral(":/style-dark.qss"));
}
}
+void ThemeManager::applyGxForMode(QApplication* app) {
+ bool dark = true;
+ if (mode_ == Mode::Light) dark = false;
+ else if (mode_ == Mode::Dark) dark = true;
+ else {
+ const Qt::ColorScheme s = QGuiApplication::styleHints()->colorScheme();
+ dark = (s == Qt::ColorScheme::Dark) || (s == Qt::ColorScheme::Unknown);
+ }
+ applyQss(app, dark ? QStringLiteral(":/style-gx.qss")
+ : QStringLiteral(":/style-gx-light.qss"));
+}
+
void ThemeManager::setMode(Mode mode, QApplication* app) {
app_ = app;
mode_ = mode;
@@ -58,6 +88,13 @@ ThemeManager::Mode ThemeManager::mode() const {
return mode_;
}
+bool ThemeManager::isDark() const {
+ if (mode_ == Mode::Light) return false;
+ if (mode_ == Mode::Dark) return true;
+ const Qt::ColorScheme s = QGuiApplication::styleHints()->colorScheme();
+ return (s == Qt::ColorScheme::Dark) || (s == Qt::ColorScheme::Unknown);
+}
+
void ThemeManager::applyQss(QApplication* app, const QString& path) {
QFile f(path);
if (f.open(QFile::ReadOnly | QFile::Text)) {
@@ -66,7 +103,7 @@ void ThemeManager::applyQss(QApplication* app, const QString& path) {
}
}
-void ThemeManager::applyForCurrentSystem(QApplication* app) {
+void ThemeManager::applyLegacyForSystem(QApplication* app) {
const Qt::ColorScheme scheme = QGuiApplication::styleHints()->colorScheme();
const bool dark = (scheme == Qt::ColorScheme::Dark)
|| (scheme == Qt::ColorScheme::Unknown);
diff --git a/linux/src/Presentation/Theme/ThemeManager.h b/linux/src/Presentation/Theme/ThemeManager.h
index 066006b..33907a7 100644
--- a/linux/src/Presentation/Theme/ThemeManager.h
+++ b/linux/src/Presentation/Theme/ThemeManager.h
@@ -18,6 +18,11 @@ public:
void setMode(Mode mode, QApplication* app);
Mode mode() const;
+ // Effective dark-vs-light decision after Auto resolution. Use for
+ // widgets that paint outside the QSS pipeline (e.g. QStyledItemDelegate
+ // or paintEvent overrides) and need a colour at draw time.
+ bool isDark() const;
+
signals:
void themeChanged();
@@ -27,7 +32,8 @@ private:
ThemeManager& operator=(const ThemeManager&) = delete;
void applyQss(QApplication* app, const QString& path);
- void applyForCurrentSystem(QApplication* app);
+ void applyGxForMode(QApplication* app);
+ void applyLegacyForSystem(QApplication* app);
Mode mode_ = Mode::Auto;
QApplication* app_ = nullptr;
diff --git a/linux/src/Presentation/Views/Backup/BackupProgressDialog.cpp b/linux/src/Presentation/Views/Backup/BackupProgressDialog.cpp
index 3341a77..3ad15da 100644
--- a/linux/src/Presentation/Views/Backup/BackupProgressDialog.cpp
+++ b/linux/src/Presentation/Views/Backup/BackupProgressDialog.cpp
@@ -114,6 +114,9 @@ void BackupProgressDialog::buildUi(const QString& dbName) {
const bool isBackup = (mode_ == Mode::Backup);
setWindowTitle(isBackup ? tr("Backup Database") : tr("Restore Database"));
+ // gxBackupHeader / gxBackupBar / gxBackupLog selectors live in
+ // resources/style-gx{,-light}.qss under "Backup progress dialog".
+
auto* root = new QVBoxLayout(this);
root->setSpacing(10);
root->setContentsMargins(16, 14, 16, 14);
@@ -122,25 +125,20 @@ void BackupProgressDialog::buildUi(const QString& dbName) {
isBackup ? tr("Backing up %1...").arg(dbName)
: tr("Restoring %1...").arg(dbName),
this);
- QFont f = headerLabel_->font();
- f.setPointSize(f.pointSize() + 1);
- f.setBold(true);
- headerLabel_->setFont(f);
+ headerLabel_->setObjectName(QStringLiteral("gxBackupHeader"));
root->addWidget(headerLabel_);
progressBar_ = new QProgressBar(this);
+ progressBar_->setObjectName(QStringLiteral("gxBackupBar"));
progressBar_->setRange(0, 0); // indeterminate
progressBar_->setTextVisible(false);
progressBar_->setFixedHeight(6);
root->addWidget(progressBar_);
logView_ = new QPlainTextEdit(this);
+ logView_->setObjectName(QStringLiteral("gxBackupLog"));
logView_->setReadOnly(true);
logView_->setMaximumBlockCount(500);
- QFont mono = logView_->font();
- mono.setFamily(QStringLiteral("Monospace"));
- mono.setPointSize(mono.pointSize() - 1);
- logView_->setFont(mono);
logView_->setMinimumHeight(180);
root->addWidget(logView_, 1);
@@ -153,6 +151,7 @@ void BackupProgressDialog::buildUi(const QString& dbName) {
btnRow->addWidget(cancelBtn_);
closeBtn_ = new QPushButton(tr("Close"), this);
+ closeBtn_->setProperty("gxKind", QStringLiteral("primary"));
closeBtn_->setEnabled(false);
connect(closeBtn_, &QPushButton::clicked, this, &QDialog::accept);
btnRow->addWidget(closeBtn_);
diff --git a/linux/src/Presentation/Views/Chrome/GxActivityBar.cpp b/linux/src/Presentation/Views/Chrome/GxActivityBar.cpp
new file mode 100644
index 0000000..1ce48f5
--- /dev/null
+++ b/linux/src/Presentation/Views/Chrome/GxActivityBar.cpp
@@ -0,0 +1,87 @@
+#include "Presentation/Views/Chrome/GxActivityBar.h"
+
+#include <QButtonGroup>
+#include <QToolButton>
+#include <QVBoxLayout>
+
+#include "Presentation/Views/Chrome/GxIcons.h"
+
+namespace gridex {
+
+GxActivityBar::GxActivityBar(QWidget* parent) : QWidget(parent) {
+ setObjectName(QStringLiteral("gxActivityBar"));
+ setFixedWidth(40);
+ setAttribute(Qt::WA_StyledBackground, true);
+ // Styling lives in resources/style-gx{,-light}.qss — see selectors
+ // QWidget#gxActivityBar / QWidget#gxActivityBar QToolButton.
+ group_ = new QButtonGroup(this);
+ group_->setExclusive(true);
+ buildUi();
+}
+
+QToolButton* GxActivityBar::addPanelButton(QVBoxLayout* layout, Panel p,
+ const QString& iconName,
+ const QString& tooltip) {
+ auto* btn = new QToolButton(this);
+ btn->setIcon(GxIcons::glyph(iconName));
+ btn->setIconSize({16, 16});
+ btn->setToolTip(tooltip);
+ btn->setStatusTip(tooltip);
+ btn->setAttribute(Qt::WA_Hover, true);
+ btn->setAutoRaise(true);
+ btn->setCheckable(true);
+ btn->setCursor(Qt::PointingHandCursor);
+ btn->setFocusPolicy(Qt::NoFocus);
+ btn->setProperty("gxRole", "activity-btn");
+ group_->addButton(btn, static_cast<int>(p));
+ layout->addWidget(btn, 0, Qt::AlignHCenter);
+ buttons_[p] = btn;
+ return btn;
+}
+
+void GxActivityBar::buildUi() {
+ auto* v = new QVBoxLayout(this);
+ v->setContentsMargins(0, 6, 0, 6);
+ v->setSpacing(2);
+ v->setAlignment(Qt::AlignTop);
+
+ // Snippets is the only panel without a working backend on Linux yet,
+ // so its button stays omitted. Others all route to live content.
+ addPanelButton(v, Panel::Connections, QStringLiteral("db"), tr("Connections"));
+ addPanelButton(v, Panel::Schema, QStringLiteral("schema"), tr("Schema browser"));
+ addPanelButton(v, Panel::History, QStringLiteral("history"), tr("Query history"));
+ addPanelButton(v, Panel::ERD, QStringLiteral("erd"), tr("ER diagram"));
+
+ connect(group_, &QButtonGroup::idClicked, this, [this](int id) {
+ setActivePanel(static_cast<Panel>(id));
+ });
+
+ v->addStretch(1);
+
+ auto* cog = new QToolButton(this);
+ cog->setIcon(GxIcons::glyph(QStringLiteral("cog")));
+ cog->setIconSize({16, 16});
+ cog->setToolTip(tr("Preferences"));
+ cog->setStatusTip(tr("Preferences"));
+ cog->setAttribute(Qt::WA_Hover, true);
+ cog->setAutoRaise(true);
+ cog->setCheckable(false);
+ cog->setCursor(Qt::PointingHandCursor);
+ cog->setFocusPolicy(Qt::NoFocus);
+ connect(cog, &QToolButton::clicked, this, &GxActivityBar::preferencesRequested);
+ v->addWidget(cog, 0, Qt::AlignHCenter);
+
+ if (auto* first = buttons_.value(active_)) first->setChecked(true);
+}
+
+void GxActivityBar::setActivePanel(Panel p) {
+ if (active_ == p && buttons_.value(p) && buttons_.value(p)->isChecked()) return;
+ active_ = p;
+ for (auto it = buttons_.constBegin(); it != buttons_.constEnd(); ++it) {
+ it.value()->setChecked(it.key() == p);
+ }
+ emit panelChanged(p);
+ emit activityChanged(static_cast<int>(p));
+}
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Chrome/GxActivityBar.h b/linux/src/Presentation/Views/Chrome/GxActivityBar.h
new file mode 100644
index 0000000..c35bdf4
--- /dev/null
+++ b/linux/src/Presentation/Views/Chrome/GxActivityBar.h
@@ -0,0 +1,55 @@
+#pragma once
+
+// 40px vertical activity bar — VSCode-style nav strip on the far left of
+// the IDE body. Five panel switchers (Connections / Schema / History /
+// Snippets / ERD) with a 2px accent left border on the active button,
+// plus a cog at the bottom for Preferences.
+//
+// Mirrors panels.jsx's `ActivityBar` component. Drives a sibling
+// SidebarPanelStack via the `activityChanged(int)` signal — indices
+// 0..4 in declaration order match the stack's panel ordering.
+
+#include <QHash>
+#include <QWidget>
+
+class QButtonGroup;
+class QVBoxLayout;
+class QToolButton;
+
+namespace gridex {
+
+class GxActivityBar : public QWidget {
+ Q_OBJECT
+public:
+ enum class Panel {
+ Connections = 0,
+ Schema = 1,
+ History = 2,
+ Snippets = 3,
+ ERD = 4,
+ };
+
+ explicit GxActivityBar(QWidget* parent = nullptr);
+
+ Panel activePanel() const noexcept { return active_; }
+ void setActivePanel(Panel p);
+
+signals:
+ void panelChanged(Panel p);
+ // Integer mirror of panelChanged for SidebarPanelStack::setCurrentIndex.
+ void activityChanged(int index);
+ void preferencesRequested();
+
+private:
+ void buildUi();
+ QToolButton* addPanelButton(QVBoxLayout* layout,
+ Panel p,
+ const QString& iconName,
+ const QString& tooltip);
+
+ QHash<Panel, QToolButton*> buttons_;
+ QButtonGroup* group_ = nullptr;
+ Panel active_ = Panel::Schema;
+};
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Chrome/GxIcons.cpp b/linux/src/Presentation/Views/Chrome/GxIcons.cpp
new file mode 100644
index 0000000..ce7fb9c
--- /dev/null
+++ b/linux/src/Presentation/Views/Chrome/GxIcons.cpp
@@ -0,0 +1,184 @@
+#include "Presentation/Views/Chrome/GxIcons.h"
+
+#include <QHash>
+#include <QPainter>
+#include <QPixmap>
+#include <QSvgRenderer>
+
+#include "Presentation/Theme/ThemeManager.h"
+
+namespace gridex {
+
+namespace {
+// Resolve the implicit "text-2" tint based on the active theme so glyphs
+// stay legible after a light/dark switch. Caller-supplied colors win.
+QString resolveDefaultColor() {
+ return ThemeManager::instance().isDark()
+ ? QStringLiteral("#b4b8bc")
+ : QStringLiteral("#4a4f56");
+}
+} // namespace
+
+namespace {
+
+// Inline SVG bodies — `{c}` is replaced with the requested colour.
+// Source: linux/Gridex _standalone_.html chrome.jsx SvgIcon switch table.
+const QHash<QString, QString> kGlyphs = {
+ {"plug",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M5 3v3M11 3v3'/><rect x='3.5' y='6' width='9' height='3.5' rx='.3'/>"
+ "<path d='M8 9.5v2.5M6.5 14h3'/></g>"},
+ {"sql-new",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M4 2.5h5l3 3V13a.5.5 0 0 1-.5.5h-7A.5.5 0 0 1 4 13z'/>"
+ "<path d='M9 2.5V5.5h3'/>"
+ "<path d='M6.5 9.5h3M6.5 11.5h3'/></g>"},
+ {"folder",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M2.5 4.5h3l1 1.5h7v6.5a.5.5 0 0 1-.5.5h-10A.5.5 0 0 1 2.5 12.5z'/></g>"},
+ {"save",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M3 3h8l2 2v8a.5.5 0 0 1-.5.5h-9.5A.5.5 0 0 1 2.5 13V3.5z'/>"
+ "<rect x='5' y='3' width='5' height='3'/><rect x='5' y='9' width='6' height='4'/></g>"},
+ {"play",
+ "<path d='M4.5 3v10l8.5-5z' fill='{c}'/>"},
+ {"play-all",
+ "<path d='M3 3v10l6-5zM9 3v10l5-5z' fill='{c}'/>"},
+ {"stop",
+ "<rect x='3.5' y='3.5' width='9' height='9' rx='.5' fill='{c}'/>"},
+ {"commit",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<circle cx='8' cy='8' r='2.5'/><path d='M2 8h3.5M10.5 8H14'/></g>"},
+ {"rollback",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M5 5a4 4 0 1 1-1.5 3.1'/><path d='M2.5 3v3.5h3.5'/></g>"},
+ {"explain",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<circle cx='6' cy='6' r='2.5'/><path d='M7.8 7.8L13 13'/></g>"},
+ {"refresh",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M3 8a5 5 0 0 1 8.5-3.5L13 6'/><path d='M13 3v3h-3'/>"
+ "<path d='M13 8a5 5 0 0 1-8.5 3.5L3 10'/><path d='M3 13v-3h3'/></g>"},
+ {"export",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M8 11V3M5 6l3-3 3 3'/><path d='M3 11v2.5h10V11'/></g>"},
+ {"erd",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<rect x='2' y='3' width='4.5' height='3'/><rect x='9.5' y='3' width='4.5' height='3'/>"
+ "<rect x='5.75' y='10' width='4.5' height='3'/>"
+ "<path d='M4.25 6v2h3.5v2M11.75 6v2h-3.5v2'/></g>"},
+ {"search",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<circle cx='7' cy='7' r='3.5'/><path d='M9.5 9.5L13 13'/></g>"},
+ {"db",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<ellipse cx='8' cy='4' rx='5' ry='1.6'/>"
+ "<path d='M3 4v8c0 .9 2.2 1.6 5 1.6s5-.7 5-1.6V4'/>"
+ "<path d='M3 8c0 .9 2.2 1.6 5 1.6s5-.7 5-1.6'/></g>"},
+ {"schema",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M2.5 4h11v3h-11zM2.5 9.5h11v3h-11z'/>"
+ "<circle cx='4.5' cy='5.5' r='.6' fill='{c}'/>"
+ "<circle cx='4.5' cy='11' r='.6' fill='{c}'/></g>"},
+ {"history",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<circle cx='8' cy='8' r='5.5'/><path d='M8 5v3.2l2 1.3'/></g>"},
+ {"snippets",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<rect x='3' y='2.5' width='9' height='11'/>"
+ "<path d='M5 5h5M5 7.5h5M5 10h3'/></g>"},
+ {"cog",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<circle cx='8' cy='8' r='2'/><circle cx='8' cy='8' r='5'/></g>"},
+ {"table",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<rect x='2.5' y='3' width='11' height='10'/>"
+ "<path d='M2.5 6h11M2.5 9h11M6 3v10'/></g>"},
+ {"view",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<ellipse cx='8' cy='8' rx='5.5' ry='3'/><circle cx='8' cy='8' r='1.2'/></g>"},
+ {"fn",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M5 13c1 0 1.5-.6 1.7-2L8 4c.2-1.4.8-2 1.8-2'/>"
+ "<path d='M4.5 7.5h4.5'/></g>"},
+ {"col",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<rect x='2.5' y='3' width='11' height='10'/><path d='M2.5 6h11'/></g>"},
+ {"key",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<circle cx='5.5' cy='8' r='2.5'/><path d='M8 8h5.5M11 8v2M13 8v2'/></g>"},
+ {"idx",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M3 4h10M3 8h7M3 12h10'/><circle cx='12' cy='8' r='1.2'/></g>"},
+ {"fk",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<circle cx='5' cy='8' r='1.8'/><circle cx='11' cy='8' r='1.8'/>"
+ "<path d='M6.8 8h2.4'/></g>"},
+ {"x",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M4 4l8 8M12 4l-8 8'/></g>"},
+ {"close",
+ "<g stroke='{c}' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'>"
+ "<path d='M4 4l8 8M12 4l-8 8'/></g>"},
+ {"tri",
+ "<path d='M5 4l5 4-5 4z' fill='{c}'/>"},
+ {"tri-d",
+ "<path d='M4 5l4 5 4-5z' fill='{c}'/>"},
+ {"caret-r",
+ "<path d='M6 4l4 4-4 4z' fill='{c}'/>"},
+ {"caret-d",
+ "<path d='M4 6l4 4 4-4z' fill='{c}'/>"},
+};
+
+QPixmap renderToPixmap(const QString& name, const QString& color, int size) {
+ auto it = kGlyphs.find(name);
+ if (it == kGlyphs.end()) return {};
+
+ QString body = it.value();
+ body.replace(QStringLiteral("{c}"), color);
+ QString svg = QStringLiteral(
+ "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'>"
+ "%1</svg>").arg(body);
+
+ QSvgRenderer renderer(svg.toUtf8());
+ if (!renderer.isValid()) return {};
+
+ // Super-sample at 4× the requested size, then downscale with smooth
+ // transformation. This gives sharp small glyphs (the design's 1.2-1.4
+ // strokes at viewBox 16 are sub-pixel at native size — direct render
+ // produces aliased corners that look like "broken brackets" in the
+ // toolbar).
+ const int srcRes = qMax(16, size * 4);
+ QPixmap hi(srcRes, srcRes);
+ hi.fill(Qt::transparent);
+ {
+ QPainter painter(&hi);
+ painter.setRenderHint(QPainter::Antialiasing, true);
+ painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
+ renderer.render(&painter);
+ }
+
+ const qreal dpr = 2.0;
+ const int target = static_cast<int>(size * dpr);
+ QPixmap pm = hi.scaled(target, target,
+ Qt::IgnoreAspectRatio,
+ Qt::SmoothTransformation);
+ pm.setDevicePixelRatio(dpr);
+ return pm;
+}
+
+} // namespace
+
+QIcon GxIcons::glyph(const QString& name, const QString& color, int sizePx) {
+ const QString c = color.isEmpty() ? resolveDefaultColor() : color;
+ const QPixmap pm = renderToPixmap(name, c, sizePx);
+ if (pm.isNull()) return {};
+ return QIcon(pm);
+}
+
+QPixmap GxIcons::pixmap(const QString& name, const QString& color, int size) {
+ const QString c = color.isEmpty() ? resolveDefaultColor() : color;
+ return renderToPixmap(name, c, size);
+}
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Chrome/GxIcons.h b/linux/src/Presentation/Views/Chrome/GxIcons.h
new file mode 100644
index 0000000..b47e82a
--- /dev/null
+++ b/linux/src/Presentation/Views/Chrome/GxIcons.h
@@ -0,0 +1,33 @@
+#pragma once
+
+// Inline SVG icon factory matching the design's stroked 16×16 glyph set.
+// Builds QIcon from a small SVG string at runtime — no asset files to ship,
+// re-tinted automatically by the active QSS palette via currentColor.
+//
+// Mirrors panels.jsx's SvgIcon component one-to-one.
+
+#include <QIcon>
+#include <QPixmap>
+#include <QString>
+
+namespace gridex {
+
+class GxIcons {
+public:
+ // Returns a QIcon rendered at exactly `sizePx` logical pixels with
+ // `color`. When `color` is empty the icon uses the theme's text-2 token
+ // (#b4b8bc on dark, #4a4f56 on light) so glyphs remain legible after a
+ // light/dark switch.
+ static QIcon glyph(const QString& name,
+ const QString& color = QString(),
+ int sizePx = 16);
+
+ // Returns a pixmap of the requested pixel size (default 14). HiDPI-aware
+ // — renderer doubles the backing-store resolution. Use this when you
+ // need a QLabel or custom-paint code rather than an action icon.
+ static QPixmap pixmap(const QString& name,
+ const QString& color = QString(),
+ int size = 14);
+};
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Chrome/GxStatusBar.cpp b/linux/src/Presentation/Views/Chrome/GxStatusBar.cpp
new file mode 100644
index 0000000..8b7d778
--- /dev/null
+++ b/linux/src/Presentation/Views/Chrome/GxStatusBar.cpp
@@ -0,0 +1,133 @@
+#include "Presentation/Views/Chrome/GxStatusBar.h"
+
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QLocale>
+#include <QStyle>
+#include <QWidget>
+
+#include "Presentation/Theme/ThemeManager.h"
+
+namespace gridex {
+
+namespace {
+constexpr int kDotSize = 7;
+}
+
+GxStatusBar::GxStatusBar(QWidget* parent) : QStatusBar(parent) {
+ setObjectName(QStringLiteral("gxStatusBar"));
+ setSizeGripEnabled(false);
+ setFixedHeight(22);
+ setContentsMargins(10, 0, 10, 0);
+ buildSegments();
+ clearAll();
+}
+
+QLabel* GxStatusBar::makeSegment(const QString& gxText) {
+ auto* l = new QLabel(this);
+ if (!gxText.isEmpty()) l->setProperty("gxText", gxText);
+ l->setContentsMargins(0, 0, 0, 0);
+ l->setStyleSheet(QStringLiteral("background: transparent;"));
+ return l;
+}
+
+void GxStatusBar::buildSegments() {
+ // ── Left cluster ──────────────────────────────────────────────
+ // Green pulsing dot + connection name.
+ connDot_ = new QLabel(this);
+ connDot_->setFixedSize(kDotSize, kDotSize);
+ // Initial tint set by setConnection() once it knows the connection
+ // state; default to the theme-appropriate "offline" shade.
+ const QString initDot = ThemeManager::instance().isDark()
+ ? QStringLiteral("#55585c") : QStringLiteral("#9398a0");
+ connDot_->setStyleSheet(QStringLiteral(
+ "background: %1; border-radius: %2px;").arg(initDot).arg(kDotSize / 2));
+ addWidget(connDot_);
+
+ connLabel_ = makeSegment(QStringLiteral("success"));
+ addWidget(connLabel_);
+
+ txLabel_ = makeSegment();
+ addWidget(txLabel_);
+
+ rowsLabel_ = makeSegment();
+ addWidget(rowsLabel_);
+
+ timeLabel_ = makeSegment();
+ addWidget(timeLabel_);
+
+ // ── Right cluster ─────────────────────────────────────────────
+ langLabel_ = makeSegment();
+ encLabel_ = makeSegment();
+ leLabel_ = makeSegment();
+ indentLabel_ = makeSegment();
+ cursorLabel_ = makeSegment();
+ dirtyLabel_ = makeSegment();
+
+ addPermanentWidget(langLabel_);
+ addPermanentWidget(encLabel_);
+ addPermanentWidget(leLabel_);
+ addPermanentWidget(indentLabel_);
+ addPermanentWidget(cursorLabel_);
+ addPermanentWidget(dirtyLabel_);
+}
+
+void GxStatusBar::clearAll() {
+ setConnection(tr("not connected"));
+ setTxState(QStringLiteral("—"));
+ setRowCount(0);
+ setQueryTime(0);
+ setLanguage(QStringLiteral("SQL · PostgreSQL"));
+ setEncoding(QStringLiteral("UTF-8"));
+ setLineEnding(QStringLiteral("LF"));
+ setIndent(QStringLiteral("Spaces: 4"));
+ setCursorPos(1, 1);
+ setDirty(false);
+}
+
+void GxStatusBar::setConnection(const QString& text) {
+ connLabel_->setText(text);
+ // Dim the dot when not connected. Offline tint follows the theme's
+ // faint token; success tint is the shared green from the QSS pill set.
+ const bool offline = text.contains(tr("not connected"));
+ const QString offlineColor = ThemeManager::instance().isDark()
+ ? QStringLiteral("#55585c") : QStringLiteral("#9398a0");
+ const QString onlineColor = ThemeManager::instance().isDark()
+ ? QStringLiteral("#6dd47e") : QStringLiteral("#2e7d32");
+ connDot_->setStyleSheet(QStringLiteral(
+ "background: %1; border-radius: %2px;")
+ .arg(offline ? offlineColor : onlineColor)
+ .arg(kDotSize / 2));
+}
+
+void GxStatusBar::setTxState(const QString& tx) {
+ txLabel_->setText(QStringLiteral("tx: <b>%1</b>").arg(tx));
+ txLabel_->setTextFormat(Qt::RichText);
+}
+
+void GxStatusBar::setRowCount(int rows) {
+ rowsLabel_->setText(QStringLiteral("%1 rows")
+ .arg(QLocale::system().toString(rows)));
+}
+
+void GxStatusBar::setQueryTime(int milliseconds) {
+ timeLabel_->setText(QStringLiteral("%1 ms").arg(milliseconds));
+}
+
+void GxStatusBar::setLanguage(const QString& language) { langLabel_->setText(language); }
+void GxStatusBar::setEncoding(const QString& enc) { encLabel_->setText(enc); }
+void GxStatusBar::setLineEnding(const QString& le) { leLabel_->setText(le); }
+void GxStatusBar::setIndent(const QString& s) { indentLabel_->setText(s); }
+
+void GxStatusBar::setCursorPos(int line, int col) {
+ cursorLabel_->setText(tr("Ln %1, Col %2").arg(line).arg(col));
+}
+
+void GxStatusBar::setDirty(bool dirty) {
+ dirtyLabel_->setText(dirty ? QStringLiteral("● Modified") : QStringLiteral("Saved"));
+ dirtyLabel_->setProperty("gxText", dirty ? QStringLiteral("warning") : QString());
+ dirtyLabel_->style()->unpolish(dirtyLabel_);
+ dirtyLabel_->style()->polish(dirtyLabel_);
+}
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Chrome/GxStatusBar.h b/linux/src/Presentation/Views/Chrome/GxStatusBar.h
new file mode 100644
index 0000000..92a3864
--- /dev/null
+++ b/linux/src/Presentation/Views/Chrome/GxStatusBar.h
@@ -0,0 +1,60 @@
+#pragma once
+
+// 22px statusbar matching .gx-status in gridex.css.
+//
+// Left cluster:
+// [green dot] <conn-name> · tx: <READ|WRITE> · <N> rows · <M> ms
+// Right cluster:
+// SQL · PostgreSQL · UTF-8 · LF · Spaces: 4 · Ln X, Col Y · Modified|Saved
+//
+// JetBrains Mono 10.5px throughout; gradient bg-2 → bg-1; 1px black top
+// border + inset 1px highlight (border colour) under it.
+
+#include <QStatusBar>
+
+class QLabel;
+
+namespace gridex {
+
+class GxStatusBar : public QStatusBar {
+ Q_OBJECT
+public:
+ explicit GxStatusBar(QWidget* parent = nullptr);
+
+public slots:
+ // Left cluster
+ void setConnection(const QString& text); // e.g. "prod-readonly @ db:5432"
+ void setTxState(const QString& tx); // "READ" | "WRITE" | "—"
+ void setRowCount(int rows);
+ void setQueryTime(int milliseconds);
+
+ // Right cluster
+ void setLanguage(const QString& language); // e.g. "SQL · PostgreSQL"
+ void setEncoding(const QString& enc); // default "UTF-8"
+ void setLineEnding(const QString& le); // default "LF"
+ void setIndent(const QString& s); // default "Spaces: 4"
+ void setCursorPos(int line, int col);
+ void setDirty(bool dirty); // "● Modified" vs "Saved"
+
+ void clearAll();
+
+private:
+ void buildSegments();
+ QLabel* makeSegment(const QString& gxText = QString());
+
+ // Left cluster widgets
+ QLabel* connDot_ = nullptr;
+ QLabel* connLabel_ = nullptr;
+ QLabel* txLabel_ = nullptr;
+ QLabel* rowsLabel_ = nullptr;
+ QLabel* timeLabel_ = nullptr;
+ // Right cluster widgets
+ QLabel* langLabel_ = nullptr;
+ QLabel* encLabel_ = nullptr;
+ QLabel* leLabel_ = nullptr;
+ QLabel* indentLabel_ = nullptr;
+ QLabel* cursorLabel_ = nullptr;
+ QLabel* dirtyLabel_ = nullptr;
+};
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Chrome/GxToolbar.cpp b/linux/src/Presentation/Views/Chrome/GxToolbar.cpp
new file mode 100644
index 0000000..5cddaa1
--- /dev/null
+++ b/linux/src/Presentation/Views/Chrome/GxToolbar.cpp
@@ -0,0 +1,154 @@
+#include "Presentation/Views/Chrome/GxToolbar.h"
+
+#include <QAction>
+#include <QFrame>
+#include <QHBoxLayout>
+#include <QKeySequence>
+#include <QLabel>
+#include <QLineEdit>
+#include <QSizePolicy>
+#include <QToolButton>
+#include <QWidget>
+
+#include "Presentation/Views/Chrome/GxIcons.h"
+
+namespace gridex {
+
+namespace {
+
+QToolButton* makeBtn(QToolBar* bar, QAction* a, const char* kind = nullptr) {
+ auto* btn = new QToolButton(bar);
+ btn->setDefaultAction(a);
+ btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ btn->setAutoRaise(true);
+ btn->setIconSize({14, 14});
+ btn->setFocusPolicy(Qt::NoFocus);
+ // Qt picks up tooltips from the default action automatically, but
+ // some styles (Fusion) suppress them when the action also has a
+ // shortcut. Force-copy so every button consistently shows on hover.
+ btn->setToolTip(a->toolTip());
+ if (kind) btn->setProperty("gxKind", kind);
+ return btn;
+}
+
+QFrame* makeDivider(QWidget* parent) {
+ auto* d = new QFrame(parent);
+ d->setObjectName(QStringLiteral("gxTbDiv"));
+ d->setFixedSize(1, 22);
+ return d;
+}
+
+} // namespace
+
+GxToolbar::GxToolbar(QWidget* parent) : QToolBar(parent) {
+ setObjectName(QStringLiteral("gxToolbar"));
+ setMovable(false);
+ setFloatable(false);
+ setIconSize({14, 14});
+ setContentsMargins(6, 4, 6, 4);
+ setFixedHeight(36);
+
+ // ── Actions (only those backed by working features) ────────────
+ // Wired:
+ // plug — onAddConnection
+ // sql-new — onNewQueryTab
+ // play — triggerActiveRun on the workspace
+ // commit — adapter()->commitTransaction()
+ // refresh — sidebar.refreshTree()
+ // export — triggerActiveExport on the workspace
+ // erd — onNewErDiagramTab
+ // Stubs kept for API compatibility but never reach the layout:
+ // openFile / save / runAll / stop / rollback / explain
+
+ newConnAction_ = new QAction(GxIcons::glyph("plug"), QString(), this);
+ newConnAction_->setToolTip(tr("Connect (Ctrl+T)"));
+ newConnAction_->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_T));
+
+ newQueryAction_ = new QAction(GxIcons::glyph("sql-new"), QString(), this);
+ newQueryAction_->setToolTip(tr("New query (Ctrl+Shift+N)"));
+ newQueryAction_->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
+ newQueryAction_->setEnabled(false);
+
+ runAction_ = new QAction(GxIcons::glyph("play", "#11151a"), QString(), this);
+ runAction_->setToolTip(tr("Run statement (Ctrl+Enter)"));
+ runAction_->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Return));
+ runAction_->setEnabled(false);
+
+ commitAction_ = new QAction(GxIcons::glyph("commit"), QString(), this);
+ commitAction_->setToolTip(tr("Commit transaction"));
+ commitAction_->setEnabled(false);
+
+ refreshAction_ = new QAction(GxIcons::glyph("refresh"), QString(), this);
+ refreshAction_->setToolTip(tr("Refresh schema (F5)"));
+ refreshAction_->setShortcut(QKeySequence(Qt::Key_F5));
+ refreshAction_->setEnabled(false);
+
+ exportAction_ = new QAction(GxIcons::glyph("export"), QString(), this);
+ exportAction_->setToolTip(tr("Export results to CSV"));
+ exportAction_->setEnabled(false);
+
+ erdAction_ = new QAction(GxIcons::glyph("erd"), QString(), this);
+ erdAction_->setToolTip(tr("ER diagram"));
+ erdAction_->setEnabled(false);
+
+ switchDbAction_ = new QAction(GxIcons::glyph("db"), QString(), this);
+ switchDbAction_->setToolTip(tr("Switch database"));
+ switchDbAction_->setEnabled(false);
+
+ // API-only stubs (never added to layout — features not implemented).
+ openFileAction_ = new QAction(this); openFileAction_->setEnabled(false);
+ saveAction_ = new QAction(this); saveAction_->setEnabled(false);
+ runAllAction_ = new QAction(this); runAllAction_->setEnabled(false);
+ stopAction_ = new QAction(this); stopAction_->setEnabled(false);
+ rollbackAction_ = new QAction(this); rollbackAction_->setEnabled(false);
+ explainAction_ = new QAction(this); explainAction_->setEnabled(false);
+
+ // ── Layout ─────────────────────────────────────────────────────
+ // [plug · sql-new] | [play · commit] | [refresh · export · erd] | spacer | search
+ addWidget(makeBtn(this, newConnAction_));
+ addWidget(makeBtn(this, newQueryAction_));
+ addWidget(makeDivider(this));
+
+ addWidget(makeBtn(this, runAction_, "primary"));
+ addWidget(makeBtn(this, commitAction_));
+ addWidget(makeDivider(this));
+
+ addWidget(makeBtn(this, refreshAction_));
+ addWidget(makeBtn(this, exportAction_));
+ addWidget(makeBtn(this, erdAction_));
+ addWidget(makeBtn(this, switchDbAction_));
+
+ auto* spacer = new QWidget(this);
+ spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ spacer->setAttribute(Qt::WA_TransparentForMouseEvents);
+ addWidget(spacer);
+
+ // ── Search field (.gx-tb-search) ───────────────────────────────
+ auto* wrap = new QWidget(this);
+ wrap->setObjectName(QStringLiteral("gxTbSearch"));
+ wrap->setAttribute(Qt::WA_StyledBackground, true);
+ auto* sw = new QHBoxLayout(wrap);
+ sw->setContentsMargins(8, 0, 8, 0);
+ sw->setSpacing(6);
+
+ auto* icon = new QLabel(wrap);
+ icon->setPixmap(GxIcons::pixmap(QStringLiteral("search"), QString(), 11));
+ icon->setFixedSize(11, 11);
+ icon->setAttribute(Qt::WA_TransparentForMouseEvents);
+ icon->setAttribute(Qt::WA_TranslucentBackground);
+ sw->addWidget(icon);
+
+ search_ = new QLineEdit(wrap);
+ search_->setObjectName(QStringLiteral("gxTbSearchInput"));
+ search_->setPlaceholderText(tr("Search tables, columns, snippets… Ctrl+P"));
+ search_->setClearButtonEnabled(false);
+ sw->addWidget(search_, 1);
+
+ addWidget(wrap);
+
+ connect(search_, &QLineEdit::returnPressed, this, [this] {
+ emit searchSubmitted(search_->text());
+ });
+}
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Chrome/GxToolbar.h b/linux/src/Presentation/Views/Chrome/GxToolbar.h
new file mode 100644
index 0000000..95d8648
--- /dev/null
+++ b/linux/src/Presentation/Views/Chrome/GxToolbar.h
@@ -0,0 +1,81 @@
+#pragma once
+
+// 36px QToolBar matching .gx-toolbar in gridex.css.
+//
+// Layout per chrome.jsx (left-to-right):
+// [plug · sql-new · folder · save] divider
+// [play (primary) · play-all · stop (danger)] divider
+// [commit · rollback · explain] divider
+// [refresh · export · erd] spacer
+// [search field, 280px wide]
+//
+// All 13 buttons render unconditionally; ones whose feature isn't wired
+// yet are disabled (setEnabled(false)), not hidden. The styling is fully
+// scoped under QToolBar#gxToolbar in style-gx.qss so this toolbar does
+// not influence QToolButtons elsewhere in the app.
+
+#include <QToolBar>
+
+class QAction;
+class QLineEdit;
+class QToolButton;
+
+namespace gridex {
+
+class GxToolbar : public QToolBar {
+ Q_OBJECT
+public:
+ explicit GxToolbar(QWidget* parent = nullptr);
+
+ // File group
+ QAction* newConnectionAction() const noexcept { return newConnAction_; }
+ QAction* newQueryAction() const noexcept { return newQueryAction_; }
+ QAction* openFileAction() const noexcept { return openFileAction_; }
+ QAction* saveAction() const noexcept { return saveAction_; }
+
+ // Run group
+ QAction* runAction() const noexcept { return runAction_; }
+ QAction* runAllAction() const noexcept { return runAllAction_; }
+ QAction* stopAction() const noexcept { return stopAction_; }
+
+ // Transaction group
+ QAction* commitAction() const noexcept { return commitAction_; }
+ QAction* rollbackAction() const noexcept { return rollbackAction_; }
+ QAction* explainAction() const noexcept { return explainAction_; }
+
+ // Schema/export group
+ QAction* refreshAction() const noexcept { return refreshAction_; }
+ QAction* exportAction() const noexcept { return exportAction_; }
+ QAction* erdAction() const noexcept { return erdAction_; }
+
+ // Database switcher (popup picks which DB to use on the same server)
+ QAction* switchDbAction() const noexcept { return switchDbAction_; }
+
+ QLineEdit* search() const noexcept { return search_; }
+
+signals:
+ void searchSubmitted(const QString& text);
+
+private:
+ QAction* newConnAction_ = nullptr;
+ QAction* newQueryAction_ = nullptr;
+ QAction* openFileAction_ = nullptr;
+ QAction* saveAction_ = nullptr;
+
+ QAction* runAction_ = nullptr;
+ QAction* runAllAction_ = nullptr;
+ QAction* stopAction_ = nullptr;
+
+ QAction* commitAction_ = nullptr;
+ QAction* rollbackAction_ = nullptr;
+ QAction* explainAction_ = nullptr;
+
+ QAction* refreshAction_ = nullptr;
+ QAction* exportAction_ = nullptr;
+ QAction* erdAction_ = nullptr;
+ QAction* switchDbAction_ = nullptr;
+
+ QLineEdit* search_ = nullptr;
+};
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/ConnectionForm/ConnectionFormDialog.cpp b/linux/src/Presentation/Views/ConnectionForm/ConnectionFormDialog.cpp
index 97785af..8bf6751 100644
--- a/linux/src/Presentation/Views/ConnectionForm/ConnectionFormDialog.cpp
+++ b/linux/src/Presentation/Views/ConnectionForm/ConnectionFormDialog.cpp
@@ -11,11 +11,13 @@
#include <QPushButton>
#include <QSpinBox>
#include <QString>
+#include <QStyle>
#include <QUuid>
#include <QVBoxLayout>
#include <QWidget>
#include "Core/Enums/SSLMode.h"
+#include "Presentation/Views/Chrome/GxIcons.h"
namespace gridex {
@@ -25,7 +27,7 @@ QString qs(const std::string& s) { return QString::fromUtf8(s.c_str(), static_ca
std::string st(const QString& s) { return s.toStdString(); }
constexpr int kLabelWidth = 110;
-constexpr int kRowSpacing = 10;
+constexpr int kRowSpacing = 4;
// One labeled form row: fixed-width label on the left, content on the right.
QWidget* makeRow(const QString& label, QWidget* content, QWidget* parent) {
@@ -55,6 +57,10 @@ ConnectionFormDialog::ConnectionFormDialog(QWidget* parent) : QDialog(parent) {
setWindowModality(Qt::ApplicationModal);
setAttribute(Qt::WA_TranslucentBackground, false);
+ // QFrame#ConnectionFormCard + QLabel#ConnectionFormHeader styling is
+ // defined in resources/style-gx{,-light}.qss so the dialog tracks the
+ // active theme.
+
buildUi();
applyLayoutForType(DatabaseType::PostgreSQL);
updateButtonStates();
@@ -83,9 +89,11 @@ void ConnectionFormDialog::buildUi() {
// Title bar inside the card for visual anchor (matches macOS sheet header).
auto* header = new QLabel(tr("Connection"), card);
+ header->setObjectName(QStringLiteral("ConnectionFormHeader"));
root->addWidget(header);
auto* headerDiv = new QFrame(card);
headerDiv->setFrameShape(QFrame::HLine);
+ headerDiv->setObjectName(QStringLiteral("gxConnDivider"));
root->addWidget(headerDiv);
root->addSpacing(4);
@@ -266,7 +274,9 @@ void ConnectionFormDialog::buildUi() {
h->addWidget(makeSslField(sslKeyPathEdit_, tr("Key..."), 0), 1);
h->addWidget(makeSslField(sslCertPathEdit_, tr("Cert..."), 1), 1);
h->addWidget(makeSslField(sslCAPathEdit_, tr("CA Cert..."), 2), 1);
- auto* clearBtn = new QPushButton(QStringLiteral("−"), sp);
+ auto* clearBtn = new QPushButton(sp);
+ clearBtn->setIcon(GxIcons::glyph("x"));
+ clearBtn->setIconSize(QSize(12, 12));
clearBtn->setFixedSize(28, 24);
clearBtn->setToolTip(tr("Clear SSL keys"));
connect(clearBtn, &QPushButton::clicked, this, &ConnectionFormDialog::onClearSSLKeys);
@@ -283,6 +293,7 @@ void ConnectionFormDialog::buildUi() {
auto* div = new QFrame(sshSection_);
div->setFrameShape(QFrame::HLine);
+ div->setObjectName(QStringLiteral("gxConnDivider"));
sv->addWidget(div);
// SSH Host + Port
@@ -348,6 +359,7 @@ void ConnectionFormDialog::buildUi() {
// --- Test result label ---
testResult_ = new QLabel(this);
+ testResult_->setObjectName(QStringLiteral("gxConnTestResult"));
testResult_->setVisible(false);
testResult_->setWordWrap(true);
root->addWidget(testResult_);
@@ -355,6 +367,7 @@ void ConnectionFormDialog::buildUi() {
// --- Divider ---
auto* divider = new QFrame(this);
divider->setFrameShape(QFrame::HLine);
+ divider->setObjectName(QStringLiteral("gxConnDivider"));
root->addWidget(divider);
// --- Bottom bar: [Over SSH] [Save] [Test] [Connect] ---
@@ -372,6 +385,7 @@ void ConnectionFormDialog::buildUi() {
connect(testBtn_, &QPushButton::clicked, this, &ConnectionFormDialog::onTestClicked);
bottom->addWidget(testBtn_);
connectBtn_ = new QPushButton(tr("Connect"), this);
+ connectBtn_->setProperty("gxKind", QStringLiteral("primary"));
connectBtn_->setDefault(true);
connect(connectBtn_, &QPushButton::clicked, this, &ConnectionFormDialog::onConnectClicked);
bottom->addWidget(connectBtn_);
@@ -489,9 +503,10 @@ void ConnectionFormDialog::updateButtonStates() {
void ConnectionFormDialog::showTestResult(bool success, const QString& detail) {
testResult_->setVisible(true);
- testResult_->setStyleSheet(success
- ? "color: #2a9d3e; font-size: 12px;"
- : "color: #b94b4b; font-size: 12px;");
+ testResult_->setProperty("gxText", success ? QStringLiteral("success")
+ : QStringLiteral("danger"));
+ testResult_->style()->unpolish(testResult_);
+ testResult_->style()->polish(testResult_);
testResult_->setText((success ? tr("✓ ") : tr("✗ ")) + detail);
}
diff --git a/linux/src/Presentation/Views/DataGrid/DataGridView.cpp b/linux/src/Presentation/Views/DataGrid/DataGridView.cpp
index e1bf635..c87a9f2 100644
--- a/linux/src/Presentation/Views/DataGrid/DataGridView.cpp
+++ b/linux/src/Presentation/Views/DataGrid/DataGridView.cpp
@@ -34,16 +34,13 @@
#include "Presentation/Views/FilterBar/FilterBarView.h"
#include "Presentation/Views/QueryLog/QueryLogPanel.h"
#include "Presentation/Views/TableStructure/TableStructureView.h"
+#include "Presentation/Views/Chrome/GxIcons.h"
#include "Services/Export/ExportService.h"
namespace gridex {
-namespace {
-
-// Button styling lives in resources/style.qss — tag buttons with objectName
-// (primaryButton / commitButton / discardButton) instead of inline sheets.
-
-} // namespace
+// All DataGrid chrome lives in resources/style-gx{,-light}.qss under the
+// "DataGrid" section.
DataGridView::DataGridView(QWidget* parent) : QWidget(parent) {
buildUi();
@@ -56,15 +53,17 @@ void DataGridView::buildUi() {
// ===================== Top 28px DataGridToolbar =====================
auto* topBar = new QWidget(this);
+ topBar->setObjectName(QStringLiteral("DataGridTopBar"));
+ topBar->setAttribute(Qt::WA_StyledBackground, true);
topBar->setFixedHeight(28);
- topBar->setAutoFillBackground(true);
topBar->setProperty("compact", true); // shrinks descendant buttons/inputs
auto* topH = new QHBoxLayout(topBar);
topH->setContentsMargins(12, 0, 12, 0);
topH->setSpacing(8);
pendingStub_ = new QLabel(QString{}, topBar);
- pendingStub_->setStyleSheet(QStringLiteral("color: #f9e2af;")); // warn (catppuccin yellow)
+ pendingStub_->setObjectName(QStringLiteral("gxDataGridPending"));
+ pendingStub_->setProperty("gxText", QStringLiteral("warning"));
pendingStub_->hide();
topH->addWidget(pendingStub_);
@@ -91,7 +90,10 @@ void DataGridView::buildUi() {
topH->addStretch();
- reloadBtn_ = new QPushButton(QStringLiteral("⟳"), topBar);
+ reloadBtn_ = new QPushButton(topBar);
+ reloadBtn_->setObjectName(QStringLiteral("dataGridReload"));
+ reloadBtn_->setIcon(GxIcons::glyph(QStringLiteral("refresh")));
+ reloadBtn_->setIconSize(QSize(13, 13));
reloadBtn_->setToolTip(tr("Reload"));
reloadBtn_->setFixedSize(24, 22);
connect(reloadBtn_, &QPushButton::clicked, this, &DataGridView::reload);
@@ -99,10 +101,6 @@ void DataGridView::buildUi() {
root->addWidget(topBar);
- auto* topDiv = new QFrame(this);
- topDiv->setFrameShape(QFrame::HLine);
- root->addWidget(topDiv);
-
// ===================== Filter bar (hidden until toggled) =====================
filterBar_ = new FilterBarView(this);
filterBar_->setVisible(false);
@@ -125,6 +123,7 @@ void DataGridView::buildUi() {
});
filterBarDiv_ = new QFrame(this);
+ filterBarDiv_->setObjectName(QStringLiteral("gxFilterBarDiv"));
filterBarDiv_->setFrameShape(QFrame::HLine);
filterBarDiv_->setVisible(false);
@@ -136,9 +135,11 @@ void DataGridView::buildUi() {
// Page 0 — data table
tableView_ = new QTableView(this);
+ tableView_->setObjectName(QStringLiteral("DataGridTable"));
tableView_->setFrameShape(QFrame::NoFrame);
tableView_->setAlternatingRowColors(true);
- tableView_->setShowGrid(true);
+ tableView_->setShowGrid(false);
+ tableView_->horizontalHeader()->setObjectName(QStringLiteral("DataGridHeader"));
tableView_->setSelectionBehavior(QAbstractItemView::SelectRows);
tableView_->setSelectionMode(QAbstractItemView::ExtendedSelection);
// Task 6: enable cell editing via double-click or F2
@@ -192,13 +193,10 @@ void DataGridView::buildUi() {
root->addWidget(vSplit, 1);
// ===================== Bottom 34px BottomTabBar =====================
- auto* botDiv = new QFrame(this);
- botDiv->setFrameShape(QFrame::HLine);
- root->addWidget(botDiv);
-
auto* bot = new QWidget(this);
+ bot->setObjectName(QStringLiteral("DataGridBotBar"));
+ bot->setAttribute(Qt::WA_StyledBackground, true);
bot->setFixedHeight(34);
- bot->setAutoFillBackground(true);
bot->setProperty("compact", true); // shrinks descendant buttons/inputs
auto* botH = new QHBoxLayout(bot);
botH->setContentsMargins(10, 5, 10, 5);
@@ -230,6 +228,7 @@ void DataGridView::buildUi() {
// Task 2: [+ Row] button — enabled
addRowBtn_ = new QPushButton(QStringLiteral("+ Row"), bot);
+ addRowBtn_->setObjectName(QStringLiteral("dataGridGenericBtn"));
addRowBtn_->setToolTip(tr("Insert a new empty row"));
addRowBtn_->setEnabled(true);
connect(addRowBtn_, &QPushButton::clicked, this, &DataGridView::onAddRow);
@@ -239,12 +238,16 @@ void DataGridView::buildUi() {
// Row count label
pageLabel_ = new QLabel(tr("No rows"), bot);
+ pageLabel_->setObjectName(QStringLiteral("dataGridPageLabel"));
botH->addWidget(pageLabel_);
botH->addStretch();
// Filters button — now functional
- filtersBtn_ = new QPushButton(QStringLiteral("⚟ Filters"), bot);
+ filtersBtn_ = new QPushButton(tr("Filters"), bot);
+ filtersBtn_->setObjectName(QStringLiteral("dataGridGenericBtn"));
+ filtersBtn_->setIcon(GxIcons::glyph(QStringLiteral("search")));
+ filtersBtn_->setIconSize(QSize(11, 11));
filtersBtn_->setCheckable(true);
filtersBtn_->setToolTip(tr("Toggle filter bar"));
connect(filtersBtn_, &QPushButton::clicked, this, &DataGridView::onFiltersToggled);
@@ -256,19 +259,24 @@ void DataGridView::buildUi() {
exportMenu_->addAction(tr("JSON…"), this, &DataGridView::onExportJson);
exportMenu_->addAction(tr("SQL…"), this, &DataGridView::onExportSql);
- exportBtn_ = new QPushButton(QStringLiteral("Export ▾"), bot);
+ exportBtn_ = new QPushButton(tr("Export"), bot);
+ exportBtn_->setObjectName(QStringLiteral("dataGridGenericBtn"));
+ exportBtn_->setIcon(GxIcons::glyph(QStringLiteral("export")));
+ exportBtn_->setIconSize(QSize(11, 11));
exportBtn_->setToolTip(tr("Export current data"));
exportBtn_->setMenu(exportMenu_);
botH->addWidget(exportBtn_);
// Pagination
prevBtn_ = new QPushButton(QStringLiteral("‹"), bot);
+ prevBtn_->setObjectName(QStringLiteral("dataGridGenericBtn"));
prevBtn_->setFixedSize(28, 22);
prevBtn_->setToolTip(tr("Previous page"));
connect(prevBtn_, &QPushButton::clicked, this, &DataGridView::onPrevPage);
botH->addWidget(prevBtn_);
nextBtn_ = new QPushButton(QStringLiteral("›"), bot);
+ nextBtn_->setObjectName(QStringLiteral("dataGridGenericBtn"));
nextBtn_->setFixedSize(28, 22);
nextBtn_->setToolTip(tr("Next page"));
connect(nextBtn_, &QPushButton::clicked, this, &DataGridView::onNextPage);
@@ -276,8 +284,10 @@ void DataGridView::buildUi() {
// Rows-per-page spin
auto* rowsLbl = new QLabel(tr("Rows"), bot);
+ rowsLbl->setObjectName(QStringLiteral("dataGridPageLabel"));
botH->addWidget(rowsLbl);
limitSpin_ = new QSpinBox(bot);
+ limitSpin_->setObjectName(QStringLiteral("dataGridLimit"));
limitSpin_->setRange(100, 100000);
limitSpin_->setSingleStep(100);
limitSpin_->setValue(1000);
@@ -663,13 +673,18 @@ void DataGridView::onCommit() {
fetchAndRender();
// Show transient ✓ confirmation in the top toolbar for 3 seconds.
- pendingStub_->setStyleSheet(QStringLiteral("color: #a6e3a1;")); // success green
+ auto setPendingState = [this](const char* state) {
+ pendingStub_->setProperty("gxText", QString::fromLatin1(state));
+ pendingStub_->style()->unpolish(pendingStub_);
+ pendingStub_->style()->polish(pendingStub_);
+ };
+ setPendingState("success");
pendingStub_->setText(tr("✓ Committed — %1").arg(parts.join(QStringLiteral(", "))));
pendingStub_->setVisible(true);
- QTimer::singleShot(3000, this, [this] {
+ QTimer::singleShot(3000, this, [this, setPendingState] {
pendingStub_->setText(QString{});
pendingStub_->setVisible(false);
- pendingStub_->setStyleSheet(QStringLiteral("color: #f9e2af;")); // reset to warn
+ setPendingState("warning");
});
}
diff --git a/linux/src/Presentation/Views/Details/DetailsPanel.cpp b/linux/src/Presentation/Views/Details/DetailsPanel.cpp
index c54a9ce..e23cd59 100644
--- a/linux/src/Presentation/Views/Details/DetailsPanel.cpp
+++ b/linux/src/Presentation/Views/Details/DetailsPanel.cpp
@@ -10,6 +10,7 @@
#include <QVBoxLayout>
#include "Presentation/Views/AIChat/AIChatView.h"
+#include "Presentation/Views/Chrome/GxIcons.h"
namespace gridex {
@@ -17,71 +18,75 @@ DetailsPanel::DetailsPanel(SecretStore* secretStore, WorkspaceState* state, QWid
: QWidget(parent) {
buildUi();
chatView_ = new AIChatView(secretStore, state, stack_);
- stack_->addWidget(chatView_);
+ stack_->addWidget(chatView_); // index 1 — Assistant
+}
+
+QPushButton* DetailsPanel::makeTabButton(const QString& title, int index, QWidget* parent) {
+ // .gx-insp-tab — selectors live in resources/style-gx{,-light}.qss
+ // under QPushButton[gxRole="insp-tab"].
+ auto* btn = new QPushButton(title, parent);
+ btn->setFlat(true);
+ btn->setCheckable(true);
+ btn->setAutoExclusive(true);
+ btn->setCursor(Qt::PointingHandCursor);
+ btn->setProperty("gxRole", "insp-tab");
+ connect(btn, &QPushButton::clicked, this, [this, index] { onTabClicked(index); });
+ return btn;
}
void DetailsPanel::buildUi() {
+ setObjectName(QStringLiteral("gxInspect"));
+ setAttribute(Qt::WA_StyledBackground, true);
+
auto* root = new QVBoxLayout(this);
root->setContentsMargins(0, 0, 0, 0);
root->setSpacing(0);
- // ---- Tab bar: [Details | Assistant] ----
+ // ── .gx-insp-tabs ────────────────────────────────────────────────
auto* tabBar = new QWidget(this);
+ tabBar->setObjectName(QStringLiteral("gxInspTabs"));
+ tabBar->setAttribute(Qt::WA_StyledBackground, true);
auto* tabH = new QHBoxLayout(tabBar);
tabH->setContentsMargins(0, 0, 0, 0);
tabH->setSpacing(0);
- auto makeTab = [this, tabBar](const QString& title, int index) {
- auto* btn = new QPushButton(title, tabBar);
- btn->setFlat(true);
- btn->setCheckable(true);
- btn->setAutoExclusive(true);
- btn->setProperty("tab", true); // styled by style.qss
- btn->setCursor(Qt::PointingHandCursor);
- btn->setMinimumHeight(32);
- connect(btn, &QPushButton::clicked, this, [this, index] { onTabClicked(index); });
- return btn;
- };
-
- detailsTabBtn_ = makeTab(tr("Details"), 0);
- assistantTabBtn_ = makeTab(tr("Assistant"), 1);
- tabH->addWidget(detailsTabBtn_, 1);
- tabH->addWidget(assistantTabBtn_, 1);
+ colsTabBtn_ = makeTabButton(tr("Details"), 0, tabBar);
+ assistantTabBtn_ = makeTabButton(tr("Assistant"), 1, tabBar);
+ tabH->addWidget(colsTabBtn_);
+ tabH->addWidget(assistantTabBtn_);
+ tabH->addStretch(1);
root->addWidget(tabBar);
- auto* tabDiv = new QFrame(this);
- tabDiv->setFrameShape(QFrame::HLine);
- root->addWidget(tabDiv);
-
- // ---- Stacked content ----
+ // ── Stacked body ─────────────────────────────────────────────────
stack_ = new QStackedWidget(this);
+ stack_->setObjectName(QStringLiteral("gxInspStack"));
- // Page 0: Details (row field list)
+ // Page 0 — Columns / row inspector.
detailsPage_ = new QWidget(stack_);
+ detailsPage_->setObjectName(QStringLiteral("gxInspBody"));
+ detailsPage_->setAttribute(Qt::WA_StyledBackground, true);
auto* dv = new QVBoxLayout(detailsPage_);
dv->setContentsMargins(0, 0, 0, 0);
dv->setSpacing(0);
- // Search
auto* searchRow = new QWidget(detailsPage_);
auto* sh = new QHBoxLayout(searchRow);
sh->setContentsMargins(8, 6, 8, 6);
searchEdit_ = new QLineEdit(searchRow);
- searchEdit_->setPlaceholderText(tr("Search for field..."));
- searchEdit_->setClearButtonEnabled(true);
+ searchEdit_->setObjectName(QStringLiteral("gxInspSearch"));
+ searchEdit_->setPlaceholderText(tr("Filter fields…"));
+ searchEdit_->setClearButtonEnabled(false);
connect(searchEdit_, &QLineEdit::textChanged, this, &DetailsPanel::onSearchChanged);
sh->addWidget(searchEdit_);
dv->addWidget(searchRow);
- auto* searchDiv = new QFrame(detailsPage_);
- searchDiv->setFrameShape(QFrame::HLine);
- dv->addWidget(searchDiv);
-
- // Scroll area for field rows
scrollArea_ = new QScrollArea(detailsPage_);
+ scrollArea_->setObjectName(QStringLiteral("gxInspScroll"));
scrollArea_->setWidgetResizable(true);
scrollArea_->setFrameShape(QFrame::NoFrame);
fieldsHost_ = new QWidget(scrollArea_);
+ fieldsHost_->setObjectName(QStringLiteral("gxInspFieldsHost"));
+ fieldsHost_->setAttribute(Qt::WA_StyledBackground, true);
fieldsLayout_ = new QVBoxLayout(fieldsHost_);
fieldsLayout_->setContentsMargins(0, 0, 0, 0);
fieldsLayout_->setSpacing(0);
@@ -89,28 +94,28 @@ void DetailsPanel::buildUi() {
scrollArea_->setWidget(fieldsHost_);
dv->addWidget(scrollArea_, 1);
- // Empty state
emptyLabel_ = new QLabel(tr("No row selected"), detailsPage_);
+ emptyLabel_->setObjectName(QStringLiteral("gxInspEmpty"));
emptyLabel_->setAlignment(Qt::AlignCenter);
dv->addWidget(emptyLabel_, 1);
scrollArea_->setVisible(false);
stack_->addWidget(detailsPage_);
- // Page 1 (AIChatView) added in constructor after buildUi().
root->addWidget(stack_, 1);
- // Initial tab state
+ // Default tab: Columns / row inspector.
onTabClicked(0);
}
void DetailsPanel::onTabClicked(int index) {
+ // Only Details (0) and Assistant (1) are real. Older callers may pass
+ // 2..5 (Indexes/Keys/Triggers/DDL) — clamp them to 0.
+ if (index < 0 || index > 1) index = 0;
activeTab_ = index;
stack_->setCurrentIndex(index);
-
- // Checked state is styled globally by style.qss (QPushButton:checked).
- detailsTabBtn_->setChecked(index == 0);
- assistantTabBtn_->setChecked(index == 1);
+ if (colsTabBtn_) colsTabBtn_->setChecked(index == 0);
+ if (assistantTabBtn_) assistantTabBtn_->setChecked(index == 1);
}
void DetailsPanel::setSelectedRow(const std::vector<FieldEntry>& fields) {
@@ -124,8 +129,7 @@ void DetailsPanel::clearSelectedRow() {
currentFields_.clear();
emptyLabel_->setVisible(true);
scrollArea_->setVisible(false);
- // Clear existing field widgets.
- while (fieldsLayout_->count() > 1) { // keep stretch at end
+ while (fieldsLayout_->count() > 1) {
auto* item = fieldsLayout_->takeAt(0);
if (item->widget()) item->widget()->deleteLater();
delete item;
@@ -137,7 +141,6 @@ void DetailsPanel::onSearchChanged(const QString&) {
}
void DetailsPanel::rebuildDetailsList() {
- // Clear existing (keep the trailing stretch).
while (fieldsLayout_->count() > 1) {
auto* item = fieldsLayout_->takeAt(0);
if (item->widget()) item->widget()->deleteLater();
@@ -146,6 +149,13 @@ void DetailsPanel::rebuildDetailsList() {
const auto filter = searchEdit_->text().trimmed().toLower();
+ // Section header — .gx-insp-section
+ if (!currentFields_.empty()) {
+ auto* section = new QLabel(tr("FIELDS"), fieldsHost_);
+ section->setObjectName(QStringLiteral("gxInspSection"));
+ fieldsLayout_->insertWidget(fieldsLayout_->count() - 1, section);
+ }
+
for (std::size_t fi = 0; fi < currentFields_.size(); ++fi) {
const auto& f = currentFields_[fi];
const auto col = QString::fromUtf8(f.column.c_str());
@@ -157,16 +167,32 @@ void DetailsPanel::rebuildDetailsList() {
continue;
}
+ // .gx-col-row — 18px icon | name | type/value (two-line)
auto* row = new QWidget(fieldsHost_);
- auto* rv = new QVBoxLayout(row);
- rv->setContentsMargins(10, 6, 10, 6);
- rv->setSpacing(2);
+ row->setObjectName(QStringLiteral("gxInspRow"));
+ row->setAttribute(Qt::WA_StyledBackground, true);
+ auto* rh = new QHBoxLayout(row);
+ rh->setContentsMargins(10, 5, 14, 5);
+ rh->setSpacing(6);
+
+ auto* iconLbl = new QLabel(row);
+ iconLbl->setPixmap(GxIcons::pixmap(QStringLiteral("col"), QString(), 10));
+ iconLbl->setFixedSize(18, 18);
+ iconLbl->setAlignment(Qt::AlignCenter);
+ iconLbl->setAttribute(Qt::WA_TranslucentBackground);
+ rh->addWidget(iconLbl);
+
+ auto* col2 = new QVBoxLayout();
+ col2->setContentsMargins(0, 0, 0, 0);
+ col2->setSpacing(1);
auto* colLabel = new QLabel(col, row);
- rv->addWidget(colLabel);
+ colLabel->setObjectName(QStringLiteral("gxInspRowName"));
+ col2->addWidget(colLabel);
- // Editable field — QLineEdit replaces QLabel.
auto* valEdit = new QLineEdit(val, row);
+ valEdit->setObjectName(QStringLiteral("gxInspRowValue"));
+ valEdit->setFrame(false);
const int colIdx = static_cast<int>(fi);
connect(valEdit, &QLineEdit::editingFinished, this,
[this, valEdit, colIdx, val] {
@@ -175,13 +201,11 @@ void DetailsPanel::rebuildDetailsList() {
emit fieldEdited(colIdx, newVal);
}
});
- rv->addWidget(valEdit);
+ col2->addWidget(valEdit);
- fieldsLayout_->insertWidget(fieldsLayout_->count() - 1, row);
+ rh->addLayout(col2, 1);
- auto* div = new QFrame(fieldsHost_);
- div->setFrameShape(QFrame::HLine);
- fieldsLayout_->insertWidget(fieldsLayout_->count() - 1, div);
+ fieldsLayout_->insertWidget(fieldsLayout_->count() - 1, row);
}
}
diff --git a/linux/src/Presentation/Views/Details/DetailsPanel.h b/linux/src/Presentation/Views/Details/DetailsPanel.h
index 419386a..e5a386c 100644
--- a/linux/src/Presentation/Views/Details/DetailsPanel.h
+++ b/linux/src/Presentation/Views/Details/DetailsPanel.h
@@ -17,10 +17,20 @@ class AIChatView;
class SecretStore;
class WorkspaceState;
-// Right sidebar panel matching macOS DetailsPanel:
-// [Details | Assistant] tab bar
-// Details tab: search + selected row field list (column: value pairs)
-// Assistant tab: AIChatView
+// Right inspector panel matching .gx-inspect in gridex.css.
+//
+// Layout (mirrors panels.jsx Inspector):
+// gx-insp-hd header strip (bg-2): icon + title + sub
+// gx-insp-tabs 5 tabs: Columns / Indexes / Keys / Triggers / DDL
+// (plus an extra "Assistant" tab for the AI chat that
+// replaced the previous two-tab Details/Assistant
+// layout)
+// gx-insp-body stacked content for the active tab
+//
+// Public API is preserved verbatim: setSelectedRow / clearSelectedRow /
+// fieldEdited still drive the row inspector — which now lives under the
+// "Columns" tab as the row-mode view. Indexes/Keys/Triggers/DDL render
+// placeholders until their schema-introspection wiring lands.
class DetailsPanel : public QWidget {
Q_OBJECT
@@ -39,7 +49,7 @@ public slots:
void clearSelectedRow();
signals:
- // Emitted when user edits a field value in the Details tab.
+ // Emitted when user edits a field value in the row inspector.
// columnIndex is the position in the current fields array.
void fieldEdited(int columnIndex, const QString& newValue);
@@ -51,16 +61,22 @@ private:
void buildUi();
void rebuildDetailsList();
+ QPushButton* makeTabButton(const QString& title, int index, QWidget* parent);
+
int activeTab_ = 0;
- // Tab bar
- QPushButton* detailsTabBtn_ = nullptr;
+ // Tab bar (6 tabs: 5 inspector tabs + Assistant)
+ QPushButton* colsTabBtn_ = nullptr;
+ QPushButton* idxTabBtn_ = nullptr;
+ QPushButton* keysTabBtn_ = nullptr;
+ QPushButton* trigTabBtn_ = nullptr;
+ QPushButton* ddlTabBtn_ = nullptr;
QPushButton* assistantTabBtn_ = nullptr;
// Stacked content
QStackedWidget* stack_ = nullptr;
- // Details tab
+ // Page 0 — Columns / row inspector
QWidget* detailsPage_ = nullptr;
QLineEdit* searchEdit_ = nullptr;
QScrollArea* scrollArea_ = nullptr;
@@ -68,7 +84,7 @@ private:
QVBoxLayout* fieldsLayout_ = nullptr;
QLabel* emptyLabel_ = nullptr;
- // Assistant tab
+ // Page 5 — AI chat
AIChatView* chatView_ = nullptr;
std::vector<FieldEntry> currentFields_;
diff --git a/linux/src/Presentation/Views/FilterBar/FilterBarView.cpp b/linux/src/Presentation/Views/FilterBar/FilterBarView.cpp
index bee6837..cc68122 100644
--- a/linux/src/Presentation/Views/FilterBar/FilterBarView.cpp
+++ b/linux/src/Presentation/Views/FilterBar/FilterBarView.cpp
@@ -33,23 +33,30 @@ bool needsValue(FilterOperator op) {
}
+// FilterBarView chrome lives in resources/style-gx{,-light}.qss under the
+// "Filter bar" section.
+
FilterBarView::FilterBarView(QWidget* parent) : QWidget(parent) {
buildUi();
}
void FilterBarView::buildUi() {
+ setObjectName(QStringLiteral("FilterBarView"));
+ setAttribute(Qt::WA_StyledBackground, true);
setProperty("compact", true); // shrinks descendant buttons/inputs
auto* h = new QHBoxLayout(this);
h->setContentsMargins(10, 4, 10, 4);
h->setSpacing(6);
columnCombo_ = new QComboBox(this);
+ columnCombo_->setObjectName(QStringLiteral("FilterColumn"));
columnCombo_->setMinimumWidth(130);
columnCombo_->setSizeAdjustPolicy(QComboBox::AdjustToContents);
columnCombo_->addItem(tr("Any column"));
h->addWidget(columnCombo_);
operatorCombo_ = new QComboBox(this);
+ operatorCombo_->setObjectName(QStringLiteral("FilterOperator"));
operatorCombo_->setFixedWidth(110);
for (int i = 0; i < kOpsCount; ++i) {
operatorCombo_->addItem(QString::fromUtf8(kOps[i].label));
@@ -59,17 +66,20 @@ void FilterBarView::buildUi() {
h->addWidget(operatorCombo_);
valueEdit_ = new QLineEdit(this);
+ valueEdit_->setObjectName(QStringLiteral("FilterValue"));
valueEdit_->setPlaceholderText(tr("value"));
valueEdit_->setMinimumWidth(160);
connect(valueEdit_, &QLineEdit::returnPressed, this, &FilterBarView::onApply);
h->addWidget(valueEdit_, 1);
applyBtn_ = new QPushButton(tr("Apply"), this);
+ applyBtn_->setObjectName(QStringLiteral("FilterApply"));
applyBtn_->setCursor(Qt::PointingHandCursor);
connect(applyBtn_, &QPushButton::clicked, this, &FilterBarView::onApply);
h->addWidget(applyBtn_);
clearBtn_ = new QPushButton(tr("Clear"), this);
+ clearBtn_->setObjectName(QStringLiteral("FilterClear"));
clearBtn_->setCursor(Qt::PointingHandCursor);
connect(clearBtn_, &QPushButton::clicked, this, &FilterBarView::onClear);
h->addWidget(clearBtn_);
diff --git a/linux/src/Presentation/Views/Home/HomeBrandingPanel.cpp b/linux/src/Presentation/Views/Home/HomeBrandingPanel.cpp
index bdb8559..4e02e73 100644
--- a/linux/src/Presentation/Views/Home/HomeBrandingPanel.cpp
+++ b/linux/src/Presentation/Views/Home/HomeBrandingPanel.cpp
@@ -9,17 +9,24 @@
#include <QPushButton>
#include <QVBoxLayout>
+#include "Presentation/Views/Chrome/GxIcons.h"
+
namespace gridex {
namespace {
-// One bottom-panel action row: icon (emoji fallback) + title. Match macOS HomeActionButton.
-QPushButton* makeActionButton(const QString& emoji, const QString& title, QWidget* parent) {
+// Bottom-panel action row: 14px SVG icon + label, left-aligned, flat with
+// hover bg from the gx palette. Replaces emoji-glyph buttons that rendered
+// as missing-char boxes on dark theme.
+QPushButton* makeActionButton(const QString& iconName, const QString& title, QWidget* parent) {
auto* btn = new QPushButton(parent);
btn->setCursor(Qt::PointingHandCursor);
btn->setFlat(true);
- btn->setMinimumHeight(32);
- btn->setText(QStringLiteral(" %1 %2").arg(emoji, title));
+ btn->setMinimumHeight(34);
+ btn->setIcon(GxIcons::glyph(iconName));
+ btn->setIconSize({14, 14});
+ btn->setText(title);
+ btn->setProperty("gxRole", QStringLiteral("home-action"));
return btn;
}
@@ -48,10 +55,9 @@ void HomeBrandingPanel::buildUi() {
QPixmap src(QStringLiteral(":/logo.png"));
if (src.isNull()) {
logo->setText(QStringLiteral("G"));
+ logo->setObjectName(QStringLiteral("gxHomeLogoFallback"));
logo->setAlignment(Qt::AlignCenter);
logo->setFixedSize(100, 100);
- logo->setStyleSheet("background-color: #378add; color: white; "
- "border-radius: 20px; font-size: 48px; font-weight: 700;");
} else {
logo->setFixedSize(100, 100);
logo->setPixmap(src.scaled(100, 100, Qt::KeepAspectRatio, Qt::SmoothTransformation));
@@ -82,8 +88,8 @@ void HomeBrandingPanel::buildUi() {
actions->setContentsMargins(20, 0, 20, 0);
actions->setSpacing(2);
- auto* backup = makeActionButton(QStringLiteral("⬆"), tr("Backup database…"), this);
- auto* restore = makeActionButton(QStringLiteral("⬇"), tr("Restore database…"), this);
+ auto* backup = makeActionButton(QStringLiteral("export"), tr("Backup database…"), this);
+ auto* restore = makeActionButton(QStringLiteral("save"), tr("Restore database…"), this);
connect(backup, &QPushButton::clicked, this, &HomeBrandingPanel::backupRequested);
connect(restore, &QPushButton::clicked, this, &HomeBrandingPanel::restoreRequested);
actions->addWidget(backup);
@@ -93,8 +99,8 @@ void HomeBrandingPanel::buildUi() {
div->setFrameShape(QFrame::HLine);
actions->addWidget(div);
- auto* newConn = makeActionButton(QStringLiteral("⊕"), tr("New Connection"), this);
- auto* newGroup = makeActionButton(QStringLiteral("🗀⁺"), tr("New Group"), this);
+ auto* newConn = makeActionButton(QStringLiteral("plug"), tr("New Connection"), this);
+ auto* newGroup = makeActionButton(QStringLiteral("folder"), tr("New Group"), this);
connect(newConn, &QPushButton::clicked, this, &HomeBrandingPanel::newConnectionRequested);
connect(newGroup, &QPushButton::clicked, this, &HomeBrandingPanel::newGroupRequested);
actions->addWidget(newConn);
diff --git a/linux/src/Presentation/Views/ImportSQL/SqlImportWizard.cpp b/linux/src/Presentation/Views/ImportSQL/SqlImportWizard.cpp
index aa09664..3c4a765 100644
--- a/linux/src/Presentation/Views/ImportSQL/SqlImportWizard.cpp
+++ b/linux/src/Presentation/Views/ImportSQL/SqlImportWizard.cpp
@@ -1,6 +1,7 @@
#include "Presentation/Views/ImportSQL/SqlImportWizard.h"
#include <QCheckBox>
+#include <QColor>
#include <QFileDialog>
#include <QFile>
#include <QHBoxLayout>
@@ -62,6 +63,9 @@ SqlImportWizard::SqlImportWizard(IDatabaseAdapter* adapter,
setMinimumSize(700, 560);
setAttribute(Qt::WA_DeleteOnClose, false);
+ // gxImport* / QLabel[gxRole="meta"] selectors live in
+ // resources/style-gx{,-light}.qss under "SQL import wizard".
+
auto* root = new QVBoxLayout(this);
root->setSpacing(8);
root->setContentsMargins(12, 12, 12, 12);
@@ -69,6 +73,7 @@ SqlImportWizard::SqlImportWizard(IDatabaseAdapter* adapter,
// ---- File row ----
auto* fileRow = new QHBoxLayout;
fileLabel_ = new QLabel(tr("(no file selected)"), this);
+ fileLabel_->setObjectName(QStringLiteral("gxImportFile"));
fileLabel_->setWordWrap(false);
fileLabel_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
browseBtn_ = new QPushButton(tr("Browse…"), this);
@@ -81,8 +86,8 @@ SqlImportWizard::SqlImportWizard(IDatabaseAdapter* adapter,
auto* metaRow = new QHBoxLayout;
dialectLabel_ = new QLabel(this);
stmtCountLabel_ = new QLabel(this);
- dialectLabel_->setStyleSheet(QStringLiteral("color: gray; font-size: 11px;"));
- stmtCountLabel_->setStyleSheet(QStringLiteral("color: gray; font-size: 11px;"));
+ dialectLabel_->setProperty("gxRole", QStringLiteral("meta"));
+ stmtCountLabel_->setProperty("gxRole", QStringLiteral("meta"));
metaRow->addWidget(dialectLabel_);
metaRow->addStretch();
metaRow->addWidget(stmtCountLabel_);
@@ -94,9 +99,9 @@ SqlImportWizard::SqlImportWizard(IDatabaseAdapter* adapter,
root->addWidget(previewLbl);
previewEdit_ = new QPlainTextEdit(this);
+ previewEdit_->setObjectName(QStringLiteral("gxImportPreview"));
previewEdit_->setReadOnly(true);
previewEdit_->setMaximumBlockCount(0);
- previewEdit_->setFont(QFont(QStringLiteral("Monospace"), 10));
previewEdit_->setMinimumHeight(160);
root->addWidget(previewEdit_, 2);
@@ -112,6 +117,7 @@ SqlImportWizard::SqlImportWizard(IDatabaseAdapter* adapter,
// ---- Progress ----
progressBar_ = new QProgressBar(this);
+ progressBar_->setObjectName(QStringLiteral("gxImportBar"));
progressBar_->setRange(0, 100);
progressBar_->setValue(0);
progressBar_->setVisible(false);
@@ -127,6 +133,7 @@ SqlImportWizard::SqlImportWizard(IDatabaseAdapter* adapter,
root->addWidget(errLbl);
errorList_ = new QListWidget(this);
+ errorList_->setObjectName(QStringLiteral("gxImportErrors"));
errorList_->setMaximumHeight(120);
errorList_->setSelectionMode(QAbstractItemView::SingleSelection);
root->addWidget(errorList_);
@@ -136,6 +143,7 @@ SqlImportWizard::SqlImportWizard(IDatabaseAdapter* adapter,
btnRow->addStretch();
closeBtn_ = new QPushButton(tr("Close"), this);
importBtn_ = new QPushButton(tr("Import"), this);
+ importBtn_->setProperty("gxKind", QStringLiteral("primary"));
importBtn_->setDefault(true);
importBtn_->setEnabled(false);
closeBtn_->setCursor(Qt::PointingHandCursor);
@@ -290,7 +298,7 @@ void SqlImportWizard::onStatementDone(int index, int total, const QString& error
: error;
auto* item = new QListWidgetItem(label);
item->setData(Qt::UserRole, line);
- item->setForeground(Qt::red);
+ item->setForeground(QColor("#e04b4a"));
errorList_->addItem(item);
}
}
diff --git a/linux/src/Presentation/Views/Main/WorkspaceView.cpp b/linux/src/Presentation/Views/Main/WorkspaceView.cpp
index 52ca01f..48b7591 100644
--- a/linux/src/Presentation/Views/Main/WorkspaceView.cpp
+++ b/linux/src/Presentation/Views/Main/WorkspaceView.cpp
@@ -163,6 +163,17 @@ void WorkspaceView::buildUi() {
topH->addWidget(detailsBtn_);
mv->addWidget(topBar);
+ // The legacy toolbar buttons (sidebar toggle ☰, connection dot ●,
+ // ER, DB switcher, details ⊟) have moved to GxToolbar / activity
+ // bar / shortcuts. We HIDE them individually so the WorkspaceTabBar
+ // — which lives in the same row — stays visible.
+ sidebarBtn_->hide();
+ connDotBtn_->hide();
+ erDiagramBtn_->hide();
+ dbSwitcherBtn_->hide();
+ detailsBtn_->hide();
+ topBar->setFixedHeight(30);
+ topH->setContentsMargins(0, 0, 0, 0);
// Item 1: 28px connection info bar (hidden until connection opens)
infoBar_ = new QLabel(mainHost);
@@ -182,6 +193,11 @@ void WorkspaceView::buildUi() {
statusBar_ = new StatusBarView(mainHost);
mv->addWidget(statusBar_);
+ // Hidden — MainWindow's GxStatusBar is the single source of status
+ // truth in the new IDE shell. Setter calls below (setConnection,
+ // setSchema, setRowCount, setQueryTime) still run so we can wire
+ // them to GxStatusBar later without touching call sites.
+ statusBar_->hide();
root->addWidget(mainHost);
@@ -200,6 +216,24 @@ void WorkspaceView::buildUi() {
root->setSizes({280, 800, 340});
}
+void WorkspaceView::triggerActiveRun() {
+ if (!mainStack_) return;
+ if (auto* qe = qobject_cast<QueryEditorView*>(mainStack_->currentWidget())) {
+ qe->onRunClicked();
+ }
+}
+
+void WorkspaceView::triggerActiveExport() {
+ if (!mainStack_) return;
+ if (auto* qe = qobject_cast<QueryEditorView*>(mainStack_->currentWidget())) {
+ qe->exportResultAsCsv();
+ }
+}
+
+void WorkspaceView::openDatabaseSwitcher() {
+ onOpenDatabaseSwitcher();
+}
+
void WorkspaceView::toggleDetailsPanel() {
const bool show = !detailsPanel_->isVisible();
detailsPanel_->setVisible(show);
@@ -208,10 +242,25 @@ void WorkspaceView::toggleDetailsPanel() {
}
void WorkspaceView::toggleSidebar() {
+ // Sidebar may have been re-homed into SidebarPanelStack — guard against
+ // a null/reparented sidebar so this no longer crashes on the toggle.
+ if (!sidebar_) return;
const bool show = !sidebar_->isVisible();
sidebar_->setVisible(show);
- leftDiv_->setVisible(show);
- sidebarBtn_->setChecked(show);
+ if (leftDiv_) leftDiv_->setVisible(show);
+ if (sidebarBtn_) sidebarBtn_->setChecked(show);
+}
+
+WorkspaceSidebar* WorkspaceView::takeSidebar() {
+ // Pull `sidebar_` out of the QSplitter without resetting its pointer —
+ // callers (the SidebarPanelStack host) will reparent + show it inside
+ // their own layout. The internal wires made in buildUi() stay live
+ // because `sidebar_` is still the same object.
+ auto* s = sidebar_;
+ if (s && rootSplitter_) {
+ s->setParent(nullptr);
+ }
+ return s;
}
void WorkspaceView::onTableSelected(const QString& schema, const QString& table) {
@@ -308,7 +357,10 @@ void WorkspaceView::onTableSelected(const QString& schema, const QString& table)
model->setData(idx, newValue, Qt::EditRole);
});
- const auto tabId = tabBar_->addTab(qualified);
+ // Tab label is just the table name — the schema is implicit (visible
+ // in the sidebar tree and the status bar). Full schema-qualified name
+ // still lives in the `gridex_table` property used for de-dup.
+ const auto tabId = tabBar_->addTab(table);
tabWidgets_[tabId.toStdString()] = dg;
mainStack_->setCurrentWidget(dg);
dg->loadTable(schema, table);
@@ -523,18 +575,11 @@ void WorkspaceView::onConnectionOpened() {
infoBar_->setText(infoText);
infoBar_->setVisible(true);
- // Show ER Diagram button now that a connection is live.
- erDiagramBtn_->setVisible(true);
-
- // Show database switcher button with current database name.
- {
- QString dbLabel = QStringLiteral("DB");
- const QString dbName = cfg.database
- ? QString::fromUtf8(cfg.database->c_str()) : QString{};
- if (!dbName.isEmpty()) dbLabel = dbName;
- dbSwitcherBtn_->setText(QStringLiteral("⬡ %1 ▾").arg(dbLabel));
- dbSwitcherBtn_->setVisible(true);
- }
+ // ER-diagram + database-switcher buttons live on GxToolbar now —
+ // leave the legacy buttons hidden so they don't leak back into the
+ // tab strip when a connection opens.
+ erDiagramBtn_->setVisible(false);
+ dbSwitcherBtn_->setVisible(false);
// Connection dot → active (Catppuccin green via style.qss).
connDotBtn_->setProperty("connected", true);
diff --git a/linux/src/Presentation/Views/Main/WorkspaceView.h b/linux/src/Presentation/Views/Main/WorkspaceView.h
index 24812d3..7926104 100644
--- a/linux/src/Presentation/Views/Main/WorkspaceView.h
+++ b/linux/src/Presentation/Views/Main/WorkspaceView.h
@@ -39,12 +39,27 @@ public:
std::shared_ptr<AppDatabase> appDb = nullptr,
QWidget* parent = nullptr);
+ // Detach the internal Schema sidebar from WorkspaceView's splitter so
+ // a host (MainWindow) can mount it inside the activity-bar-driven
+ // SidebarPanelStack. After this returns, WorkspaceView's splitter has
+ // 2 children (main + details); all internal signal wiring against
+ // `sidebar_` remains intact — the pointer doesn't change.
+ WorkspaceSidebar* takeSidebar();
+
public slots:
void onNewQueryTab();
void onNewErDiagramTab();
void toggleDetailsPanel();
void toggleSidebar();
+ // Toolbar-driven actions that target the *current* tab. Each one
+ // looks up mainStack_->currentWidget(), casts to the expected view,
+ // and routes the trigger. A no-op when the cast fails (e.g. user is
+ // on a DataGridView while Run is pressed).
+ void triggerActiveRun();
+ void triggerActiveExport();
+ void openDatabaseSwitcher();
+
signals:
void disconnectRequested();
diff --git a/linux/src/Presentation/Views/QueryEditor/QueryEditorView.cpp b/linux/src/Presentation/Views/QueryEditor/QueryEditorView.cpp
index ca925c8..8ce00e6 100644
--- a/linux/src/Presentation/Views/QueryEditor/QueryEditorView.cpp
+++ b/linux/src/Presentation/Views/QueryEditor/QueryEditorView.cpp
@@ -1,5 +1,7 @@
#include "Presentation/Views/QueryEditor/QueryEditorView.h"
+#include <vector>
+
#include <QAction>
#include <QApplication>
#include <QElapsedTimer>
@@ -13,17 +15,24 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QFont>
+#include <QFontDatabase>
#include <QFrame>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QInputMethodEvent>
#include <QKeyEvent>
#include <QLabel>
+#include <QPaintEvent>
+#include <QPainter>
#include <QPlainTextEdit>
#include <QPointer>
#include <QPushButton>
+#include <QResizeEvent>
#include <QScreen>
#include <QSplitter>
+#include <QStackedWidget>
+#include <QStyle>
+#include <QTabBar>
#include <QTableView>
#include <QTextBlock>
#include <QTextCursor>
@@ -32,6 +41,9 @@
#include <QtConcurrent/QtConcurrent>
#include <QVBoxLayout>
+#include "Presentation/Theme/ThemeManager.h"
+#include "Presentation/Views/Chrome/GxIcons.h"
+
#include "Core/Errors/GridexError.h"
#include "Core/Protocols/Database/IDatabaseAdapter.h"
#include "Presentation/Views/DataGrid/QueryResultModel.h"
@@ -45,19 +57,82 @@ namespace gridex {
namespace {
-// QPlainTextEdit subclass that suppresses the built-in placeholder while an
-// IME composition (preedit text) is active. Qt's paintEvent only checks
-// document()->isEmpty() when deciding whether to draw the placeholder, not
-// whether the current block has preedit text — so typing Vietnamese Telex/VNI
-// leaves the placeholder overlapping the composing character until commit
-// (space/punctuation). We swap placeholder text with "" for the duration of
-// the paint, then restore it, so callers observe no state change.
-class IMEAwareTextEdit : public QPlainTextEdit {
+class GxEditor;
+
+// Line-number gutter painted to the left of the editor viewport.
+// Width is driven by current line count; current-line gets the accent
+// color matching .gx-ln.is-cursor in the design.
+class LineGutter : public QWidget {
+public:
+ explicit LineGutter(GxEditor* editor);
+ QSize sizeHint() const override;
+
+protected:
+ void paintEvent(QPaintEvent* event) override;
+
+private:
+ GxEditor* editor_;
+};
+
+// QPlainTextEdit subclass that:
+// - suppresses the built-in placeholder during IME preedit (Vietnamese
+// Telex/VNI would otherwise overlap the composing character),
+// - reserves left margin for the gutter and paints the current-line
+// highlight band matching .gx-cline.is-cursor.
+class GxEditor : public QPlainTextEdit {
public:
using QPlainTextEdit::QPlainTextEdit;
+ // LineGutter paints using firstVisibleBlock / blockBoundingGeometry /
+ // contentOffset / blockBoundingRect, all of which are protected on
+ // QPlainTextEdit. Friend access keeps the gutter implementation simple.
+ friend class LineGutter;
+
+ int gutterWidth() const {
+ int digits = 1;
+ int max = qMax(1, blockCount());
+ while (max >= 10) { max /= 10; ++digits; }
+ const int ch = fontMetrics().horizontalAdvance(QLatin1Char('9'));
+ return 12 + ch * digits + 8;
+ }
+
+ void setGutter(LineGutter* g) {
+ gutter_ = g;
+ updateMargins();
+ connect(this, &QPlainTextEdit::blockCountChanged, this, [this](int){ updateMargins(); });
+ connect(this, &QPlainTextEdit::updateRequest, this,
+ [this](const QRect& rect, int dy) {
+ if (!gutter_) return;
+ if (dy) gutter_->scroll(0, dy);
+ else gutter_->update(0, rect.y(), gutter_->width(), rect.height());
+ });
+ connect(this, &QPlainTextEdit::cursorPositionChanged, this, [this]{
+ if (gutter_) gutter_->update();
+ viewport()->update();
+ });
+ }
+
+ void updateMargins() {
+ setViewportMargins(gutter_ ? gutterWidth() : 0, 0, 0, 0);
+ if (gutter_) {
+ const QRect cr = contentsRect();
+ gutter_->setGeometry(QRect(cr.left(), cr.top(), gutterWidth(), cr.height()));
+ }
+ }
+
protected:
void paintEvent(QPaintEvent* event) override {
+ // Caret-line band — paint behind text. Uses bg-1 against the bg-0
+ // editor background so the band is subtly visible in both themes.
+ {
+ QPainter p(viewport());
+ const QRect cur = cursorRect();
+ QRect band(0, cur.top(), viewport()->width(), cur.height());
+ const QColor bg1 = ThemeManager::instance().isDark()
+ ? QColor(0x11, 0x15, 0x1a)
+ : QColor(0xf4, 0xf5, 0xf7);
+ p.fillRect(band, bg1);
+ }
const bool suppress = document()->isEmpty() && hasPreeditText();
QString savedPlaceholder;
if (suppress) {
@@ -70,10 +145,16 @@ protected:
}
}
+ void resizeEvent(QResizeEvent* event) override {
+ QPlainTextEdit::resizeEvent(event);
+ if (gutter_) {
+ const QRect cr = contentsRect();
+ gutter_->setGeometry(QRect(cr.left(), cr.top(), gutterWidth(), cr.height()));
+ }
+ }
+
void inputMethodEvent(QInputMethodEvent* event) override {
QPlainTextEdit::inputMethodEvent(event);
- // Force viewport repaint so placeholder is cleared as soon as
- // preedit appears (instead of lagging until the next paint trigger).
viewport()->update();
}
@@ -82,15 +163,92 @@ private:
auto* layout = textCursor().block().layout();
return layout && !layout->preeditAreaText().isEmpty();
}
+
+ LineGutter* gutter_ = nullptr;
};
+using IMEAwareTextEdit = GxEditor; // kept for back-compat in this TU
+
+LineGutter::LineGutter(GxEditor* editor) : QWidget(editor), editor_(editor) {
+ setAttribute(Qt::WA_StyledBackground, false);
+}
+
+QSize LineGutter::sizeHint() const {
+ return QSize(editor_ ? editor_->gutterWidth() : 32, 0);
+}
+
+void LineGutter::paintEvent(QPaintEvent* event) {
+ if (!editor_) return;
+ QPainter p(this);
+
+ // Resolve token palette at paint time so a Light/Dark switch redraws
+ // the gutter without needing a widget rebuild.
+ const bool dark = ThemeManager::instance().isDark();
+ const QColor bg0 = dark ? QColor(0x09, 0x0e, 0x12) : QColor(0xff, 0xff, 0xff);
+ const QColor border = dark ? QColor(0x2e, 0x33, 0x39) : QColor(0xc5, 0xca, 0xd1);
+ const QColor bg1 = dark ? QColor(0x11, 0x15, 0x1a) : QColor(0xf4, 0xf5, 0xf7);
+ const QColor accent = dark ? QColor(0x00, 0xb8, 0xe1) : QColor(0x00, 0x98, 0xbd);
+ const QColor faint = dark ? QColor(0x55, 0x58, 0x5c) : QColor(0x93, 0x98, 0xa0);
+
+ p.fillRect(event->rect(), bg0);
+ p.setPen(border);
+ p.drawLine(width() - 1, 0, width() - 1, height());
+
+ QTextBlock block = editor_->firstVisibleBlock();
+ int blockNumber = block.blockNumber();
+ int top = qRound(editor_->blockBoundingGeometry(block).translated(editor_->contentOffset()).top());
+ int bottom = top + qRound(editor_->blockBoundingRect(block).height());
+ const int curLine = editor_->textCursor().blockNumber();
+
+ QFont f = editor_->font();
+ p.setFont(f);
+
+ while (block.isValid() && top <= event->rect().bottom()) {
+ if (block.isVisible() && bottom >= event->rect().top()) {
+ const bool isCur = (blockNumber == curLine);
+ if (isCur) {
+ p.fillRect(0, top, width() - 1, qRound(editor_->blockBoundingRect(block).height()),
+ bg1);
+ p.setPen(accent);
+ } else {
+ p.setPen(faint);
+ }
+ const QString number = QString::number(blockNumber + 1);
+ p.drawText(0, top, width() - 8, qRound(editor_->blockBoundingRect(block).height()),
+ Qt::AlignRight | Qt::AlignVCenter, number);
+ }
+ block = block.next();
+ top = bottom;
+ bottom = top + qRound(editor_->blockBoundingRect(block).height());
+ ++blockNumber;
+ }
+}
+
+// All editor/result chrome lives in resources/style-gx{,-light}.qss.
+// See the "Query editor" section in each sheet.
+
} // namespace
+namespace {
+// Process-wide list of toolbar extension factories. Plain function-local
+// static so it's leak-free and avoids global-ctor ordering pitfalls.
+std::vector<QueryEditorView::ExtensionFactory>& extensionFactories() {
+ static std::vector<QueryEditorView::ExtensionFactory> v;
+ return v;
+}
+}
+
+void QueryEditorView::registerExtension(ExtensionFactory f) {
+ if (f) extensionFactories().push_back(std::move(f));
+}
+
QueryEditorView::QueryEditorView(QWidget* parent)
: QWidget(parent),
provider_(std::make_unique<AutocompleteProvider>()),
parser_(std::make_unique<SqlContextParser>()) {
buildUi();
+ // Let extensions decorate the toolbar after it's fully constructed.
+ for (const auto& f : extensionFactories()) f(this);
}
QueryEditorView::~QueryEditorView() = default;
@@ -100,25 +258,35 @@ void QueryEditorView::buildUi() {
root->setContentsMargins(0, 0, 0, 0);
root->setSpacing(0);
- // ---- Toolbar: [Run ▶] [status ...] ----
+ // ---- Toolbar: [Run ▶] [status ...] [Save] ----
auto* top = new QWidget(this);
- top->setFixedHeight(32);
- top->setAutoFillBackground(true);
+ top->setObjectName(QStringLiteral("QueryEditorToolbar"));
+ top->setAttribute(Qt::WA_StyledBackground, true);
+ top->setFixedHeight(36);
auto* topH = new QHBoxLayout(top);
- topH->setContentsMargins(8, 0, 12, 0);
- topH->setSpacing(10);
-
- runBtn_ = new QPushButton(tr("▶ Run"), top);
- runBtn_->setObjectName(QStringLiteral("primaryButton")); // styled in style.qss
+ topH->setContentsMargins(10, 0, 10, 0);
+ topH->setSpacing(8);
+ toolbarLay_ = topH;
+
+ runBtn_ = new QPushButton(tr("Run statement"), top);
+ runBtn_->setObjectName(QStringLiteral("QueryEditorRun"));
+ runBtn_->setIcon(GxIcons::glyph(QStringLiteral("play"), QStringLiteral("#090e12")));
+ runBtn_->setIconSize(QSize(11, 11));
runBtn_->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Return));
+ runBtn_->setCursor(Qt::PointingHandCursor);
runBtn_->setToolTip(tr("Execute query (Ctrl+Enter)"));
connect(runBtn_, &QPushButton::clicked, this, &QueryEditorView::onRunClicked);
topH->addWidget(runBtn_);
statusLbl_ = new QLabel(QString{}, top);
+ statusLbl_->setObjectName(QStringLiteral("QueryEditorStatus"));
topH->addWidget(statusLbl_, 1);
- auto* saveBtn = new QPushButton(tr("⭐ Save"), top);
+ auto* saveBtn = new QPushButton(tr("Save"), top);
+ saveBtn->setObjectName(QStringLiteral("QueryEditorSave"));
+ saveBtn->setIcon(GxIcons::glyph(QStringLiteral("save")));
+ saveBtn->setIconSize(QSize(11, 11));
+ saveBtn->setCursor(Qt::PointingHandCursor);
saveBtn->setToolTip(tr("Save this query to Saved Queries"));
connect(saveBtn, &QPushButton::clicked, this, [this] {
const QString sql = editor_ ? editor_->toPlainText().trimmed() : QString{};
@@ -128,22 +296,31 @@ void QueryEditorView::buildUi() {
root->addWidget(top);
- auto* topDiv = new QFrame(this);
- topDiv->setFrameShape(QFrame::HLine);
- root->addWidget(topDiv);
-
- // ---- Splitter: editor (top) | result grid (bottom) ----
+ // ---- Splitter: editor (top) | results panel (bottom) ----
splitter_ = new QSplitter(Qt::Vertical, this);
+ splitter_->setHandleWidth(4);
+ splitter_->setChildrenCollapsible(false);
- editor_ = new IMEAwareTextEdit(splitter_);
+ editor_ = new GxEditor(splitter_);
+ editor_->setObjectName(QStringLiteral("gxSqlEditor"));
editor_->setPlaceholderText(tr("SELECT * FROM ..."));
editor_->setFrameShape(QFrame::NoFrame);
editor_->setTabStopDistance(32);
- QFont mono(QStringLiteral("Monospace"));
- mono.setStyleHint(QFont::Monospace);
- mono.setPointSize(12);
+ QFont mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
+ // Prefer JetBrains Mono / Fira Code if present.
+ for (const auto& family : { QStringLiteral("JetBrains Mono"),
+ QStringLiteral("Fira Code"),
+ QStringLiteral("DejaVu Sans Mono") }) {
+ if (QFontDatabase::families().contains(family)) {
+ mono.setFamily(family);
+ break;
+ }
+ }
+ mono.setPointSize(11);
editor_->setFont(mono);
editor_->installEventFilter(this);
+ auto* gutter = new LineGutter(static_cast<GxEditor*>(editor_));
+ static_cast<GxEditor*>(editor_)->setGutter(gutter);
hl_ = new SqlHighlighter(editor_->document());
splitter_->addWidget(editor_);
@@ -163,22 +340,102 @@ void QueryEditorView::buildUi() {
if (debounce_) debounce_->start();
});
- // Result grid below editor.
- resultView_ = new QTableView(splitter_);
- resultView_->setFrameShape(QFrame::NoFrame);
- resultView_->setAlternatingRowColors(true);
- resultView_->setShowGrid(true);
- resultView_->setSelectionBehavior(QAbstractItemView::SelectItems);
- resultView_->setEditTriggers(QAbstractItemView::NoEditTriggers);
- resultView_->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
- resultView_->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- resultView_->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
- resultView_->horizontalHeader()->setStretchLastSection(true);
- resultView_->verticalHeader()->setDefaultSectionSize(30);
-
- resultModel_ = new QueryResultModel(this);
- resultView_->setModel(resultModel_);
- splitter_->addWidget(resultView_);
+ // ---- Results panel: 5-tab header + content stack -----------------
+ auto* results = new QWidget(splitter_);
+ auto* resultsV = new QVBoxLayout(results);
+ resultsV->setContentsMargins(0, 0, 0, 0);
+ resultsV->setSpacing(0);
+
+ auto* resHdr = new QWidget(results);
+ resHdr->setObjectName(QStringLiteral("QueryEditorResultsTabs"));
+ resHdr->setAttribute(Qt::WA_StyledBackground, true);
+ resHdr->setFixedHeight(28);
+ auto* resHdrH = new QHBoxLayout(resHdr);
+ resHdrH->setContentsMargins(4, 0, 8, 0);
+ resHdrH->setSpacing(0);
+
+ auto* resultsStack = new QStackedWidget(results);
+
+ // Build tab buttons + placeholder/active pages.
+ struct TabSpec { const char* id; const char* label; bool functional; };
+ const std::vector<TabSpec> specs = {
+ { "msg", QT_TR_NOOP("Messages"), false },
+ { "grid", QT_TR_NOOP("Results"), true },
+ { "explain", QT_TR_NOOP("Explain"), false },
+ { "plan", QT_TR_NOOP("Plan tree"), false },
+ { "stats", QT_TR_NOOP("Statistics"), false },
+ };
+
+ std::vector<QPushButton*> tabBtns;
+ tabBtns.reserve(specs.size());
+
+ int gridPageIndex = -1;
+
+ for (std::size_t i = 0; i < specs.size(); ++i) {
+ const auto& s = specs[i];
+ auto* btn = new QPushButton(tr(s.label), resHdr);
+ btn->setProperty("gxResTab", true);
+ btn->setProperty("gxActive", false);
+ btn->setFlat(true);
+ btn->setCursor(Qt::PointingHandCursor);
+ resHdrH->addWidget(btn);
+ tabBtns.push_back(btn);
+
+ QWidget* page = nullptr;
+ if (s.functional && QString::fromLatin1(s.id) == QLatin1String("grid")) {
+ // Real result grid.
+ resultView_ = new QTableView(resultsStack);
+ resultView_->setObjectName(QStringLiteral("QueryEditorResult"));
+ resultView_->setFrameShape(QFrame::NoFrame);
+ resultView_->setAlternatingRowColors(true);
+ resultView_->setShowGrid(false);
+ resultView_->setSelectionBehavior(QAbstractItemView::SelectItems);
+ resultView_->setEditTriggers(QAbstractItemView::NoEditTriggers);
+ resultView_->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
+ resultView_->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
+ resultView_->horizontalHeader()->setObjectName(QStringLiteral("QueryEditorResultHeader"));
+ resultView_->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+ resultView_->horizontalHeader()->setStretchLastSection(true);
+ resultView_->verticalHeader()->setDefaultSectionSize(22);
+ resultView_->verticalHeader()->setVisible(false);
+
+ resultModel_ = new QueryResultModel(this);
+ resultView_->setModel(resultModel_);
+ page = resultView_;
+ gridPageIndex = static_cast<int>(i);
+ } else {
+ auto* ph = new QLabel(tr("%1 — no data yet. Run a query to populate.")
+ .arg(tr(s.label)), resultsStack);
+ ph->setObjectName(QStringLiteral("QueryEditorResultsPlaceholder"));
+ ph->setAlignment(Qt::AlignCenter);
+ ph->setAutoFillBackground(true);
+ page = ph;
+ }
+ resultsStack->addWidget(page);
+ }
+
+ resHdrH->addStretch(1);
+ resultsV->addWidget(resHdr);
+ resultsV->addWidget(resultsStack, 1);
+
+ auto activateTab = [tabBtns, resultsStack](int idx) {
+ for (std::size_t i = 0; i < tabBtns.size(); ++i) {
+ const bool a = (static_cast<int>(i) == idx);
+ tabBtns[i]->setProperty("gxActive", a);
+ tabBtns[i]->style()->unpolish(tabBtns[i]);
+ tabBtns[i]->style()->polish(tabBtns[i]);
+ tabBtns[i]->update();
+ }
+ resultsStack->setCurrentIndex(idx);
+ };
+ for (std::size_t i = 0; i < tabBtns.size(); ++i) {
+ const int idx = static_cast<int>(i);
+ QObject::connect(tabBtns[i], &QPushButton::clicked, this,
+ [activateTab, idx] { activateTab(idx); });
+ }
+ activateTab(gridPageIndex >= 0 ? gridPageIndex : 0);
+
+ splitter_->addWidget(results);
// ---- Export button overlay at bottom-right of result table ----
exportResultMenu_ = new QMenu(resultView_);
@@ -189,8 +446,11 @@ void QueryEditorView::buildUi() {
connect(actSql, &QAction::triggered, this, &QueryEditorView::exportResultAsSql);
connect(actJson, &QAction::triggered, this, &QueryEditorView::exportResultAsJson);
- exportResultBtn_ = new QPushButton(QStringLiteral("⇩ Export ▾"), resultView_);
- exportResultBtn_->setFixedSize(92, 26);
+ exportResultBtn_ = new QPushButton(tr("Export"), resultView_);
+ exportResultBtn_->setObjectName(QStringLiteral("QueryEditorExport"));
+ exportResultBtn_->setIcon(GxIcons::glyph(QStringLiteral("export")));
+ exportResultBtn_->setIconSize(QSize(11, 11));
+ exportResultBtn_->setFixedSize(96, 26);
exportResultBtn_->setToolTip(tr("Export query result"));
exportResultBtn_->setCursor(Qt::PointingHandCursor);
exportResultBtn_->setMenu(exportResultMenu_);
@@ -222,6 +482,20 @@ void QueryEditorView::setSql(const QString& sql) {
if (editor_) editor_->setPlainText(sql);
}
+QString QueryEditorView::currentSql() const {
+ return editor_ ? editor_->toPlainText() : QString();
+}
+
+void QueryEditorView::addToolbarWidget(QWidget* w) {
+ if (!toolbarLay_ || !w) return;
+ // Insert before the trailing Save button so toolbar order stays
+ // [Run] [status (stretch)] [ext widgets...] [Save].
+ const int trailing = 1;
+ int at = toolbarLay_->count() - trailing;
+ if (at < 0) at = toolbarLay_->count();
+ toolbarLay_->insertWidget(at, w);
+}
+
void QueryEditorView::setAdapter(IDatabaseAdapter* adapter) {
adapter_ = adapter;
runBtn_->setEnabled(adapter_ != nullptr);
@@ -362,12 +636,16 @@ void QueryEditorView::onRunClicked() {
}
}
- statusLbl_->setStyleSheet(QStringLiteral("color: #a6e3a1;")); // success (catppuccin green)
+ statusLbl_->setProperty("gxText", QStringLiteral("success"));
+ statusLbl_->style()->unpolish(statusLbl_);
+ statusLbl_->style()->polish(statusLbl_);
statusLbl_->setText(tr("%1 rows × %2 cols · %3 ms").arg(n).arg(cols).arg(ms));
emit queryExecuted(QString::fromStdString(sql), n, ms);
} catch (const GridexError& e) {
resultModel_->clear();
- statusLbl_->setStyleSheet(QStringLiteral("color: #f38ba8;")); // error (catppuccin red)
+ statusLbl_->setProperty("gxText", QStringLiteral("danger"));
+ statusLbl_->style()->unpolish(statusLbl_);
+ statusLbl_->style()->polish(statusLbl_);
statusLbl_->setText(QString::fromUtf8(e.what()));
}
}
diff --git a/linux/src/Presentation/Views/QueryEditor/QueryEditorView.h b/linux/src/Presentation/Views/QueryEditor/QueryEditorView.h
index 436755e..0d4e330 100644
--- a/linux/src/Presentation/Views/QueryEditor/QueryEditorView.h
+++ b/linux/src/Presentation/Views/QueryEditor/QueryEditorView.h
@@ -1,8 +1,10 @@
#pragma once
#include <QWidget>
+#include <functional>
#include <memory>
+class QHBoxLayout;
class QLabel;
class QMenu;
class QPlainTextEdit;
@@ -33,16 +35,37 @@ public:
void setAdapter(IDatabaseAdapter* adapter);
void setSql(const QString& sql);
+ // Read-only accessors used by toolbar extensions registered via
+ // registerExtension() — kept simple, no caching.
+ [[nodiscard]] IDatabaseAdapter* adapter() const noexcept { return adapter_; }
+ [[nodiscard]] QString currentSql() const;
+
+ // Append a widget (typically a QPushButton) to the toolbar. Inserts
+ // just before the trailing Save button so the layout order stays
+ // consistent regardless of how many extensions are installed.
+ void addToolbarWidget(QWidget* w);
+
+ // Process-wide extension hook. Any callback registered here is
+ // invoked exactly once per QueryEditorView instance, after buildUi(),
+ // so extensions can attach toolbar widgets / signals without OSS
+ // knowing the extension exists.
+ using ExtensionFactory = std::function<void(QueryEditorView*)>;
+ static void registerExtension(ExtensionFactory f);
+
+public slots:
+ // External triggers (toolbar Run / Export) — same code paths as the
+ // editor's own internal run button.
+ void onRunClicked();
+ void exportResultAsCsv();
+ void exportResultAsSql();
+ void exportResultAsJson();
+
signals:
void queryExecuted(const QString& sql, int rowCount, int durationMs);
void saveQueryRequested(const QString& sql);
private slots:
- void onRunClicked();
void maybeShowCompletions();
- void exportResultAsCsv();
- void exportResultAsSql();
- void exportResultAsJson();
private:
void buildUi();
@@ -60,6 +83,7 @@ private:
SqlHighlighter* hl_ = nullptr;
QPushButton* runBtn_ = nullptr;
QLabel* statusLbl_ = nullptr;
+ QHBoxLayout* toolbarLay_ = nullptr; // owned by the `top` widget
QSplitter* splitter_ = nullptr;
QTableView* resultView_ = nullptr;
QueryResultModel* resultModel_ = nullptr;
diff --git a/linux/src/Presentation/Views/QueryEditor/SqlHighlighter.cpp b/linux/src/Presentation/Views/QueryEditor/SqlHighlighter.cpp
index 958846a..804fcb6 100644
--- a/linux/src/Presentation/Views/QueryEditor/SqlHighlighter.cpp
+++ b/linux/src/Presentation/Views/QueryEditor/SqlHighlighter.cpp
@@ -5,24 +5,24 @@
namespace gridex {
SqlHighlighter::SqlHighlighter(QTextDocument* parent) : QSyntaxHighlighter(parent) {
- // Keyword format — blue bold.
- keywordFmt_.setForeground(QColor(56, 118, 211));
- keywordFmt_.setFontWeight(QFont::Bold);
+ // gx tokens — see plans/ui-refactor-2026.md "Design tokens" table.
+ // Keyword — violet (--gx-tk-kw #df99ef).
+ keywordFmt_.setForeground(QColor(QStringLiteral("#df99ef")));
- // Function format — purple.
- functionFmt_.setForeground(QColor(136, 57, 195));
+ // Function — teal (--gx-tk-fn #5edada).
+ functionFmt_.setForeground(QColor(QStringLiteral("#5edada")));
- // Type format — teal.
- typeFmt_.setForeground(QColor(0, 128, 128));
+ // Type — share function teal; types read as built-in callables in gx.
+ typeFmt_.setForeground(QColor(QStringLiteral("#5edada")));
- // String format — green.
- stringFmt_.setForeground(QColor(80, 161, 79));
+ // String — green (--gx-tk-str #8cda8f).
+ stringFmt_.setForeground(QColor(QStringLiteral("#8cda8f")));
- // Number format — orange.
- numberFmt_.setForeground(QColor(206, 125, 30));
+ // Number — amber (--gx-tk-num #fab45f).
+ numberFmt_.setForeground(QColor(QStringLiteral("#fab45f")));
- // Comment format — gray italic.
- commentFmt_.setForeground(QColor(140, 140, 140));
+ // Comment — muted italic (--gx-tk-com #646a70).
+ commentFmt_.setForeground(QColor(QStringLiteral("#646a70")));
commentFmt_.setFontItalic(true);
// SQL keywords (case insensitive).
diff --git a/linux/src/Presentation/Views/Settings/SettingsDialog.cpp b/linux/src/Presentation/Views/Settings/SettingsDialog.cpp
index fdca3d8..7da8335 100644
--- a/linux/src/Presentation/Views/Settings/SettingsDialog.cpp
+++ b/linux/src/Presentation/Views/Settings/SettingsDialog.cpp
@@ -74,11 +74,15 @@ void SettingsDialog::buildUi() {
setWindowTitle(tr("Preferences"));
setMinimumSize(720, 440);
+ // Styling lives in resources/style-gx{,-light}.qss under the Settings
+ // dialog section (selectors keyed on gxSettings* object names below).
+
auto* root = new QHBoxLayout(this);
root->setContentsMargins(0, 0, 0, 0);
root->setSpacing(0);
navList_ = new QListWidget(this);
+ navList_->setObjectName(QStringLiteral("gxSettingsNav"));
navList_->setFixedWidth(180);
navList_->setFrameShape(QFrame::NoFrame);
navList_->addItem(tr("AI Providers"));
@@ -86,10 +90,12 @@ void SettingsDialog::buildUi() {
root->addWidget(navList_);
auto* div = new QFrame(this);
+ div->setObjectName(QStringLiteral("gxSettingsDivider"));
div->setFrameShape(QFrame::VLine);
root->addWidget(div);
pages_ = new QStackedWidget(this);
+ pages_->setObjectName(QStringLiteral("gxSettingsPages"));
root->addWidget(pages_, 1);
auto* aiPage = new QWidget(pages_);
@@ -111,12 +117,7 @@ void SettingsDialog::buildAiPage(QWidget* page) {
root->setSpacing(14);
auto* title = new QLabel(tr("AI Providers"), page);
- {
- QFont f = title->font();
- f.setPointSize(14);
- f.setWeight(QFont::DemiBold);
- title->setFont(f);
- }
+ title->setObjectName(QStringLiteral("gxSettingsTitle"));
root->addWidget(title);
auto* desc = new QLabel(
@@ -124,15 +125,15 @@ void SettingsDialog::buildAiPage(QWidget* page) {
"system keychain (libsecret); endpoints override the default base "
"URL (useful for self-hosted or OpenAI-compatible servers)."),
page);
+ desc->setObjectName(QStringLiteral("gxSettingsDesc"));
desc->setWordWrap(true);
- desc->setForegroundRole(QPalette::PlaceholderText);
root->addWidget(desc);
auto* form = new QFormLayout();
form->setLabelAlignment(Qt::AlignRight);
form->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
form->setHorizontalSpacing(12);
- form->setVerticalSpacing(10);
+ form->setVerticalSpacing(4); // gx-form 4px row spacing
aiForm_ = form; // captured for runtime row-visibility toggling
// Provider
@@ -157,7 +158,10 @@ void SettingsDialog::buildAiPage(QWidget* page) {
modelSpinner_ = new QLabel(modelRow);
modelSpinner_->setFixedWidth(14);
modelSpinner_->setAlignment(Qt::AlignCenter);
- modelSpinner_->setStyleSheet("color: #89b4fa; font-size: 14px; font-weight: 600;");
+ modelSpinner_->setProperty("gxText", QStringLiteral("accent"));
+ QFont sf = modelSpinner_->font();
+ sf.setPointSizeF(14.0); sf.setBold(true);
+ modelSpinner_->setFont(sf);
modelSpinner_->hide();
mrH->addWidget(modelSpinner_);
spinnerTimer_ = new QTimer(this);
@@ -218,7 +222,7 @@ void SettingsDialog::buildAiPage(QWidget* page) {
oauthStatus_ = new QLabel(oauthRow_);
oauthStatus_->setForegroundRole(QPalette::PlaceholderText);
signInBtn_ = new QPushButton(tr("Sign in with ChatGPT"), oauthRow_);
- signInBtn_->setObjectName(QStringLiteral("primaryButton"));
+ signInBtn_->setProperty("gxKind", QStringLiteral("primary"));
signOutBtn_ = new QPushButton(tr("Sign out"), oauthRow_);
signOutBtn_->hide();
oauthH->addWidget(oauthStatus_, 1);
@@ -266,7 +270,7 @@ void SettingsDialog::buildAiPage(QWidget* page) {
btnH->addWidget(closeBtn);
saveBtn_ = new QPushButton(tr("Save"), btnRow);
- saveBtn_->setObjectName(QStringLiteral("primaryButton"));
+ saveBtn_->setProperty("gxKind", QStringLiteral("primary"));
saveBtn_->setDefault(true);
connect(saveBtn_, &QPushButton::clicked, this, &SettingsDialog::onSaveClicked);
btnH->addWidget(saveBtn_);
@@ -518,19 +522,14 @@ void SettingsDialog::buildAppearancePage(QWidget* page) {
root->setSpacing(14);
auto* title = new QLabel(tr("Appearance"), page);
- {
- QFont f = title->font();
- f.setPointSize(14);
- f.setWeight(QFont::DemiBold);
- title->setFont(f);
- }
+ title->setObjectName(QStringLiteral("gxSettingsTitle"));
root->addWidget(title);
auto* form = new QFormLayout();
form->setLabelAlignment(Qt::AlignRight);
form->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
form->setHorizontalSpacing(12);
- form->setVerticalSpacing(10);
+ form->setVerticalSpacing(4);
themeCombo_ = new QComboBox(page);
themeCombo_->addItem(tr("Light"), QStringLiteral("Light"));
diff --git a/linux/src/Presentation/Views/Sidebar/ConnectionRowWidget.cpp b/linux/src/Presentation/Views/Sidebar/ConnectionRowWidget.cpp
index 69e03ca..73fd3be 100644
--- a/linux/src/Presentation/Views/Sidebar/ConnectionRowWidget.cpp
+++ b/linux/src/Presentation/Views/Sidebar/ConnectionRowWidget.cpp
@@ -3,38 +3,45 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QString>
-#include <QVBoxLayout>
+#include <QStyle>
+
+#include "Presentation/Theme/ThemeManager.h"
namespace gridex {
namespace {
-// Brand-inspired palette per DB type — matches macOS DatabaseTypeIcon hues.
-struct IconSpec { QString hex; QString letter; };
-IconSpec iconSpec(DatabaseType t) {
+// Two-letter engine badge matching panels.jsx ENGINE_LABEL / ENGINE_COLOR.
+struct EngineSpec { QString bg; QString fg; QString label; };
+EngineSpec engineSpec(DatabaseType t) {
switch (t) {
- case DatabaseType::PostgreSQL: return {"#336791", "P"};
- case DatabaseType::MySQL: return {"#F29111", "M"};
- case DatabaseType::SQLite: return {"#003B57", "S"};
- case DatabaseType::Redis: return {"#DC382D", "R"};
- case DatabaseType::MongoDB: return {"#4DB33D", "M"};
- case DatabaseType::MSSQL: return {"#CC2927", "T"};
+ case DatabaseType::PostgreSQL: return {"#5c8ec5", "#0a0d10", "PG"};
+ case DatabaseType::MySQL: return {"#e0a347", "#0a0d10", "MY"};
+ case DatabaseType::SQLite: return {"#6dbf6b", "#0a0d10", "SL"};
+ case DatabaseType::Redis: return {"#dc382d", "#fff", "RD"};
+ case DatabaseType::MongoDB: return {"#4dab51", "#0a0d10", "MG"};
+ case DatabaseType::MSSQL: return {"#cc2927", "#fff", "MS"};
+ case DatabaseType::ClickHouse: return {"#f8c842", "#0a0d10", "CH"};
}
- return {"#888888", "?"};
+ return {"#7d8185", "#fff", "??"};
}
-QString subtitleFor(const ConnectionConfig& c) {
- if (c.databaseType == DatabaseType::SQLite) {
- return c.filePath ? QString::fromUtf8(c.filePath->c_str()) : QStringLiteral("No file");
- }
- QString s = QString::fromUtf8(c.displayHost().c_str());
- if (c.database && !c.database->empty()) {
- s += QStringLiteral(" / ") + QString::fromUtf8(c.database->c_str());
- }
- return s;
+QString tooltipFor(const ConnectionConfig& c) {
+ QString host = QString::fromUtf8(c.displayHost().c_str());
+ QString db = c.database ? QString::fromUtf8(c.database->c_str()) : QString();
+ QString type = QString::fromUtf8(std::string(displayName(c.databaseType)).c_str());
+ // Tooltip subtle text follows the theme's muted token so the popup
+ // stays readable in both light and dark.
+ const QString mutedHex = ThemeManager::instance().isDark()
+ ? QStringLiteral("#7d8185") : QStringLiteral("#6a6e74");
+ QString lines = QString("<b>%1</b><br><span style='color:%2'>%3</span>")
+ .arg(QString::fromUtf8(c.name.c_str()), mutedHex, type);
+ if (!host.isEmpty()) lines += QString("<br><tt>%1</tt>").arg(host);
+ if (!db.isEmpty()) lines += QString("<br><tt>db: %1</tt>").arg(db);
+ return lines;
}
-}
+} // namespace
ConnectionRowWidget::ConnectionRowWidget(const ConnectionConfig& config, QWidget* parent)
: QWidget(parent), connectionId_(QString::fromUtf8(config.id.c_str())) {
@@ -45,67 +52,51 @@ ConnectionRowWidget::ConnectionRowWidget(const ConnectionConfig& config, QWidget
void ConnectionRowWidget::buildUi(const ConnectionConfig& config) {
setAutoFillBackground(true);
setAttribute(Qt::WA_StyledBackground, true);
+ setProperty("gxRole", QStringLiteral("conn-row"));
+ setProperty("gxActive", false);
+ setToolTip(tooltipFor(config));
auto* root = new QHBoxLayout(this);
- root->setContentsMargins(10, 8, 10, 8);
- root->setSpacing(12);
+ root->setContentsMargins(4, 2, 8, 2);
+ root->setSpacing(8);
- // --- 1) Color bar (3×28) ---
+ // 1) Thin colour bar (3×16) — env hint when colorTag is set.
colorBar_ = new QLabel(this);
- colorBar_->setFixedSize(3, 28);
+ colorBar_->setFixedSize(3, 16);
if (config.colorTag) {
const auto rgb = rgbColor(*config.colorTag);
colorBar_->setStyleSheet(QString("background-color: rgb(%1,%2,%3); border-radius: 1px;")
.arg(rgb.r).arg(rgb.g).arg(rgb.b));
+ } else {
+ colorBar_->setStyleSheet("background: transparent;");
}
root->addWidget(colorBar_);
- // --- 2) DB type icon (32×32 rounded square with letter) ---
- const auto spec = iconSpec(config.databaseType);
- iconBox_ = new QWidget(this);
- iconBox_->setFixedSize(32, 32);
- iconBox_->setStyleSheet(QString("background-color: %1; border-radius: 7px;").arg(spec.hex));
- auto* iconLay = new QVBoxLayout(iconBox_);
- iconLay->setContentsMargins(0, 0, 0, 0);
- iconLetter_ = new QLabel(spec.letter, iconBox_);
- iconLetter_->setAlignment(Qt::AlignCenter);
- iconLay->addWidget(iconLetter_);
- root->addWidget(iconBox_);
-
- // --- 3) Name + env badge + subtitle ---
- auto* textCol = new QVBoxLayout();
- textCol->setContentsMargins(0, 0, 0, 0);
- textCol->setSpacing(3);
-
- auto* nameRow = new QHBoxLayout();
- nameRow->setContentsMargins(0, 0, 0, 0);
- nameRow->setSpacing(6);
+ // 2) Engine badge (20×14 chip, two-letter code).
+ const auto spec = engineSpec(config.databaseType);
+ engineBadge_ = new QLabel(spec.label, this);
+ engineBadge_->setFixedSize(20, 14);
+ engineBadge_->setAlignment(Qt::AlignCenter);
+ engineBadge_->setStyleSheet(QString(
+ "background-color: %1; color: %2; "
+ "font-family: 'JetBrains Mono', monospace; "
+ "font-size: 9px; font-weight: 700; letter-spacing: 0.02em; "
+ "border-radius: 2px;").arg(spec.bg, spec.fg));
+ root->addWidget(engineBadge_);
+
+ // 3) Name — flex, ellipsis-truncated.
nameLabel_ = new QLabel(QString::fromUtf8(config.name.c_str()), this);
- nameRow->addWidget(nameLabel_);
-
- if (config.colorTag) {
- const auto rgb = rgbColor(*config.colorTag);
- envBadge_ = new QLabel(QString::fromUtf8(std::string(environmentHint(*config.colorTag)).c_str()).toUpper(), this);
- envBadge_->setStyleSheet(
- QString("color: rgb(%1,%2,%3); font-size: 9px; font-weight: 700;"
- "letter-spacing: 0.3px;"
- "background-color: rgba(%1,%2,%3,36); padding: 1px 5px; border-radius: 3px;")
- .arg(rgb.r).arg(rgb.g).arg(rgb.b));
- nameRow->addWidget(envBadge_);
- }
- nameRow->addStretch();
- textCol->addLayout(nameRow);
-
- subtitle_ = new QLabel(subtitleFor(config), this);
- subtitle_->setTextFormat(Qt::PlainText);
- textCol->addWidget(subtitle_);
- root->addLayout(textCol, 1);
-
- // --- 4) DB type label ---
- typeLabel_ = new QLabel(
- QString::fromUtf8(std::string(displayName(config.databaseType)).c_str()).toUpper(),
- this);
- root->addWidget(typeLabel_);
+ nameLabel_->setObjectName(QStringLiteral("gxConnRowName"));
+ nameLabel_->setTextFormat(Qt::PlainText);
+ nameLabel_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ nameLabel_->setMinimumWidth(50);
+ root->addWidget(nameLabel_, 1);
+
+ // 4) Connection-status dot (grey when offline; PR A2 hooks live status).
+ statusDot_ = new QLabel(this);
+ statusDot_->setObjectName(QStringLiteral("gxConnRowDot"));
+ statusDot_->setFixedSize(7, 7);
+ root->addWidget(statusDot_, 0, Qt::AlignVCenter);
}
void ConnectionRowWidget::setSelected(bool selected) {
@@ -115,8 +106,9 @@ void ConnectionRowWidget::setSelected(bool selected) {
}
void ConnectionRowWidget::applyPalette() {
- // Hover + selection background are drawn by the QListWidget::item rule in
- // style.qss — the custom row widget just paints its children.
+ setProperty("gxActive", selected_);
+ style()->unpolish(this);
+ style()->polish(this);
}
-}
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Sidebar/ConnectionRowWidget.h b/linux/src/Presentation/Views/Sidebar/ConnectionRowWidget.h
index d5e9185..200be57 100644
--- a/linux/src/Presentation/Views/Sidebar/ConnectionRowWidget.h
+++ b/linux/src/Presentation/Views/Sidebar/ConnectionRowWidget.h
@@ -8,10 +8,13 @@ class QLabel;
namespace gridex {
-// Single connection row matching macOS ConnectionRow layout:
-// [colorBar 3x28] [DBIcon 32x32] [Name + envBadge + subtitle] [spacer] [TYPE]
-// Selection + hover are driven by the parent QListWidget's state through
-// setSelected(bool).
+// Compact connection row sized for the 280px IDE sidebar. Mirrors the
+// design's panels.jsx layout:
+// [3px env color bar] [engine badge 18×14] [name] [conn-status dot 6px]
+//
+// Host:port / database / DB-type details move into the row's tooltip
+// instead of being rendered inline — keeps the row at the same 22-28px
+// height as every other tree row in the sidebar.
class ConnectionRowWidget : public QWidget {
Q_OBJECT
@@ -28,13 +31,10 @@ private:
QString connectionId_;
bool selected_ = false;
- QLabel* colorBar_ = nullptr;
- QWidget* iconBox_ = nullptr;
- QLabel* iconLetter_ = nullptr;
- QLabel* nameLabel_ = nullptr;
- QLabel* envBadge_ = nullptr;
- QLabel* subtitle_ = nullptr;
- QLabel* typeLabel_ = nullptr;
+ QLabel* colorBar_ = nullptr;
+ QLabel* engineBadge_ = nullptr;
+ QLabel* nameLabel_ = nullptr;
+ QLabel* statusDot_ = nullptr;
};
}
diff --git a/linux/src/Presentation/Views/Sidebar/ConnectionSidebar.cpp b/linux/src/Presentation/Views/Sidebar/ConnectionSidebar.cpp
index 0723931..10d43c1 100644
--- a/linux/src/Presentation/Views/Sidebar/ConnectionSidebar.cpp
+++ b/linux/src/Presentation/Views/Sidebar/ConnectionSidebar.cpp
@@ -1,5 +1,7 @@
#include "Presentation/Views/Sidebar/ConnectionSidebar.h"
+#include "Presentation/Views/Chrome/GxIcons.h"
+
#include <QAction>
#include <QFrame>
#include <QHBoxLayout>
@@ -26,10 +28,13 @@ constexpr int kRoleIsGroup = Qt::UserRole + 2;
constexpr int kPageEmpty = 0;
constexpr int kPageTree = 1;
-QPushButton* makeToolbarButton(const QString& icon, const QString& tooltip, QWidget* parent) {
- auto* btn = new QPushButton(icon, parent);
+QPushButton* makeToolbarButton(const QString& iconName, const QString& tooltip, QWidget* parent) {
+ auto* btn = new QPushButton(parent);
btn->setToolTip(tooltip);
btn->setFixedSize(28, 28);
+ btn->setFlat(true);
+ btn->setIcon(GxIcons::glyph(iconName));
+ btn->setIconSize({14, 14});
return btn;
}
}
@@ -63,11 +68,11 @@ void ConnectionSidebar::buildUi() {
this, &ConnectionSidebar::onSearchChanged);
h->addWidget(searchEdit_, 1);
- auto* addBtn = makeToolbarButton(QStringLiteral("+"), tr("New Connection"), toolbar);
+ auto* addBtn = makeToolbarButton(QStringLiteral("plug"), tr("New Connection"), toolbar);
connect(addBtn, &QPushButton::clicked, this, &ConnectionSidebar::addConnectionRequested);
h->addWidget(addBtn);
- auto* groupBtn = makeToolbarButton(QStringLiteral("🗀⁺"), tr("New Group"), toolbar);
+ auto* groupBtn = makeToolbarButton(QStringLiteral("folder"), tr("New Group"), toolbar);
connect(groupBtn, &QPushButton::clicked, this, &ConnectionSidebar::newGroupRequested);
h->addWidget(groupBtn);
diff --git a/linux/src/Presentation/Views/Sidebar/SidebarPanelStack.cpp b/linux/src/Presentation/Views/Sidebar/SidebarPanelStack.cpp
new file mode 100644
index 0000000..3f61a29
--- /dev/null
+++ b/linux/src/Presentation/Views/Sidebar/SidebarPanelStack.cpp
@@ -0,0 +1,215 @@
+#include "Presentation/Views/Sidebar/SidebarPanelStack.h"
+
+#include <QLabel>
+#include <QListWidget>
+#include <QListWidgetItem>
+#include <QPushButton>
+#include <QStackedWidget>
+#include <QVBoxLayout>
+
+#include "Data/Persistence/AppDatabase.h"
+#include "Presentation/Views/Chrome/GxIcons.h"
+#include "Presentation/Views/Sidebar/WorkspaceSidebar.h"
+
+namespace gridex {
+
+SidebarPanelStack::SidebarPanelStack(QWidget* parent) : QWidget(parent) {
+ setObjectName(QStringLiteral("gxSidebarPanelStack"));
+ setFixedWidth(280);
+ setAttribute(Qt::WA_StyledBackground, true);
+ // Background + right border live in the theme QSS — QWidget#gxSidebarPanelStack.
+
+ auto* root = new QVBoxLayout(this);
+ root->setContentsMargins(0, 0, 0, 0);
+ root->setSpacing(0);
+
+ stack_ = new QStackedWidget(this);
+
+ // 0 — Connections (placeholder)
+ stack_->addWidget(buildEmptyState(
+ QStringLiteral("plug"),
+ tr("Connections"),
+ tr("Manage saved servers and databases here.\n"
+ "(Move from the legacy connections panel — coming next.)")));
+
+ // 1 — Schema slot. Empty wrapper until setSchemaWidget() is called.
+ schemaSlot_ = new QWidget(stack_);
+ auto* slotLayout = new QVBoxLayout(schemaSlot_);
+ slotLayout->setContentsMargins(0, 0, 0, 0);
+ slotLayout->setSpacing(0);
+ stack_->addWidget(schemaSlot_);
+
+ // 2 — History (real list; rows arrive via reloadHistory()).
+ {
+ auto* w = new QWidget(stack_);
+ w->setObjectName(QStringLiteral("gxHistoryPanel"));
+ w->setAttribute(Qt::WA_StyledBackground, true);
+ auto* v = new QVBoxLayout(w);
+ v->setContentsMargins(0, 0, 0, 0);
+ v->setSpacing(0);
+
+ // Header strip matching .gx-side-hd
+ auto* header = new QLabel(tr("QUERY HISTORY"), w);
+ header->setObjectName(QStringLiteral("gxHistoryHeader"));
+ header->setFixedHeight(28);
+ header->setContentsMargins(10, 0, 10, 0);
+ v->addWidget(header);
+
+ historyList_ = new QListWidget(w);
+ historyList_->setObjectName(QStringLiteral("gxHistoryList"));
+ historyList_->setFrameShape(QFrame::NoFrame);
+ v->addWidget(historyList_, 1);
+
+ connect(historyList_, &QListWidget::itemDoubleClicked, this,
+ [this](QListWidgetItem* it) {
+ if (!it) return;
+ const QString sql = it->data(Qt::UserRole).toString();
+ if (!sql.isEmpty()) emit historyEntryActivated(sql);
+ });
+ stack_->addWidget(w);
+ }
+
+ // 3 — Snippets (placeholder)
+ stack_->addWidget(buildEmptyState(
+ QStringLiteral("snippets"),
+ tr("Snippets"),
+ tr("Save reusable SQL fragments and recall them with Ctrl+Shift+P.")));
+
+ // 4 — ERD (functional button)
+ {
+ auto* w = new QWidget(stack_);
+ w->setObjectName(QStringLiteral("gxErdPanel"));
+ w->setAttribute(Qt::WA_StyledBackground, true);
+ auto* v = new QVBoxLayout(w);
+ v->setContentsMargins(24, 24, 24, 24);
+ v->setSpacing(12);
+ v->addStretch();
+
+ auto* iconLabel = new QLabel(w);
+ iconLabel->setAlignment(Qt::AlignCenter);
+ iconLabel->setPixmap(GxIcons::glyph(QStringLiteral("erd")).pixmap(36, 36));
+ v->addWidget(iconLabel);
+
+ auto* title = new QLabel(tr("ER diagrams"), w);
+ title->setObjectName(QStringLiteral("gxEmptyStateTitle"));
+ title->setAlignment(Qt::AlignCenter);
+ v->addWidget(title);
+
+ auto* sub = new QLabel(
+ tr("Generate a relationship diagram for the\n"
+ "currently connected schema."), w);
+ sub->setObjectName(QStringLiteral("gxEmptyStateSub"));
+ sub->setAlignment(Qt::AlignCenter);
+ sub->setWordWrap(true);
+ v->addWidget(sub);
+
+ auto* btn = new QPushButton(tr("Open ER diagram"), w);
+ btn->setCursor(Qt::PointingHandCursor);
+ btn->setProperty("gxKind", "primary");
+ connect(btn, &QPushButton::clicked, this,
+ &SidebarPanelStack::erdRequested);
+ v->addWidget(btn, 0, Qt::AlignCenter);
+
+ v->addStretch();
+ stack_->addWidget(w);
+ }
+
+ stack_->setCurrentIndex(1);
+ root->addWidget(stack_, 1);
+}
+
+void SidebarPanelStack::setConnectionsWidget(QWidget* w) {
+ if (!stack_ || !w) return;
+ auto* old = stack_->widget(0);
+ stack_->insertWidget(0, w);
+ if (old) {
+ stack_->removeWidget(old);
+ old->deleteLater();
+ }
+ w->show();
+}
+
+void SidebarPanelStack::setSchemaWidget(WorkspaceSidebar* schema) {
+ if (!schemaSlot_ || !schema) return;
+ schema_ = schema;
+ schema->setParent(schemaSlot_);
+ schema->setMinimumWidth(0);
+ schema->setMaximumWidth(QWIDGETSIZE_MAX);
+ auto* layout = qobject_cast<QVBoxLayout*>(schemaSlot_->layout());
+ if (layout) layout->addWidget(schema);
+ schema->show();
+}
+
+void SidebarPanelStack::setAppDatabase(std::shared_ptr<AppDatabase> db) {
+ appDb_ = std::move(db);
+ reloadHistory();
+}
+
+void SidebarPanelStack::reloadHistory() {
+ if (!historyList_ || !appDb_) return;
+ historyList_->clear();
+ try {
+ const auto entries = appDb_->listAllHistory(200);
+ for (const auto& h : entries) {
+ const QString sql = QString::fromStdString(h.sql);
+ const QString preview = sql.simplified().left(64);
+ const QString label = QStringLiteral("%1 rows · %2 ms\n%3")
+ .arg(h.rowCount)
+ .arg(h.durationMs)
+ .arg(preview);
+ auto* item = new QListWidgetItem(label);
+ item->setData(Qt::UserRole, sql);
+ item->setToolTip(sql);
+ historyList_->addItem(item);
+ }
+ } catch (...) {
+ // App DB unavailable — leave the list empty.
+ }
+}
+
+void SidebarPanelStack::setCurrentIndex(int index) {
+ if (!stack_) return;
+ if (index < 0) index = 0;
+ if (index >= stack_->count()) index = stack_->count() - 1;
+ // Lazy-refresh the history panel each time the user lands on it.
+ if (index == 2) reloadHistory();
+ stack_->setCurrentIndex(index);
+}
+
+int SidebarPanelStack::currentIndex() const noexcept {
+ return stack_ ? stack_->currentIndex() : 0;
+}
+
+QWidget* SidebarPanelStack::buildEmptyState(const QString& iconGlyph,
+ const QString& title,
+ const QString& subtitle) {
+ auto* w = new QWidget(stack_);
+ w->setObjectName(QStringLiteral("gxEmptyState"));
+ w->setAttribute(Qt::WA_StyledBackground, true);
+
+ auto* v = new QVBoxLayout(w);
+ v->setContentsMargins(24, 24, 24, 24);
+ v->setSpacing(10);
+ v->addStretch();
+
+ auto* iconLabel = new QLabel(w);
+ iconLabel->setAlignment(Qt::AlignCenter);
+ iconLabel->setPixmap(GxIcons::glyph(iconGlyph).pixmap(36, 36));
+ v->addWidget(iconLabel);
+
+ auto* titleLabel = new QLabel(title, w);
+ titleLabel->setObjectName(QStringLiteral("gxEmptyStateTitle"));
+ titleLabel->setAlignment(Qt::AlignCenter);
+ v->addWidget(titleLabel);
+
+ auto* subLabel = new QLabel(subtitle, w);
+ subLabel->setObjectName(QStringLiteral("gxEmptyStateSub"));
+ subLabel->setAlignment(Qt::AlignCenter);
+ subLabel->setWordWrap(true);
+ v->addWidget(subLabel);
+
+ v->addStretch();
+ return w;
+}
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Sidebar/SidebarPanelStack.h b/linux/src/Presentation/Views/Sidebar/SidebarPanelStack.h
new file mode 100644
index 0000000..574c181
--- /dev/null
+++ b/linux/src/Presentation/Views/Sidebar/SidebarPanelStack.h
@@ -0,0 +1,79 @@
+#pragma once
+
+// 280px fixed-width sidebar container that swaps content driven by the
+// activity bar. Mirrors `app.jsx`'s single side-panel composition where
+// activity index selects which of five panels is visible:
+//
+// 0 — Connections (placeholder empty-state for now)
+// 1 — Schema (existing WorkspaceSidebar, reparented in)
+// 2 — History (placeholder)
+// 3 — Snippets (placeholder)
+// 4 — ERD (placeholder)
+//
+// Placeholders render the design's gx-empty-state card (centered icon +
+// headline + sub-copy) so the activity buttons never feel "dead".
+
+#include <QWidget>
+#include <memory>
+
+class QListWidget;
+class QStackedWidget;
+
+namespace gridex {
+
+class AppDatabase;
+class WorkspaceSidebar;
+
+class SidebarPanelStack : public QWidget {
+ Q_OBJECT
+public:
+ explicit SidebarPanelStack(QWidget* parent = nullptr);
+
+ // Inject the app's history database so the History panel can populate
+ // itself with real rows from `listAllHistory()`. Pass before
+ // setCurrentIndex(2) lands on the History panel for the first time.
+ void setAppDatabase(std::shared_ptr<AppDatabase> db);
+
+ // Refresh the History panel from the database. Call when a new query
+ // has been logged (e.g. from WorkspaceSidebar::logQuery).
+ void reloadHistory();
+
+signals:
+ // Emitted when the user clicks "Open ER diagram" in the ERD panel.
+ // MainWindow forwards this to WorkspaceView::onNewErDiagramTab.
+ void erdRequested();
+ // Emitted when the user double-clicks a history row. Carries the SQL
+ // for the caller to load into the current editor tab.
+ void historyEntryActivated(const QString& sql);
+
+public:
+
+ // Inject the existing WorkspaceSidebar at index 1 (Schema). The widget
+ // is reparented in; the caller (MainWindow) keeps its raw pointer to
+ // wire signals against — the stack does NOT take ownership in any
+ // memory sense beyond Qt's parent-child rules.
+ void setSchemaWidget(WorkspaceSidebar* schema);
+
+ // Inject a ConnectionSidebar (or any QWidget) into the Connections
+ // slot (index 0). Replaces the default placeholder.
+ void setConnectionsWidget(QWidget* w);
+
+ WorkspaceSidebar* schemaWidget() const noexcept { return schema_; }
+
+ // Drive panel index 0..4. Out-of-range values are clamped.
+ void setCurrentIndex(int index);
+ int currentIndex() const noexcept;
+
+private:
+ QWidget* buildEmptyState(const QString& iconGlyph,
+ const QString& title,
+ const QString& subtitle);
+
+ QStackedWidget* stack_ = nullptr;
+ WorkspaceSidebar* schema_ = nullptr;
+ QWidget* schemaSlot_ = nullptr; // wrapper at index 1
+ QListWidget* historyList_ = nullptr; // populated lazily
+ std::shared_ptr<AppDatabase> appDb_;
+};
+
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Sidebar/WorkspaceSidebar.cpp b/linux/src/Presentation/Views/Sidebar/WorkspaceSidebar.cpp
index d5fb0c3..5748749 100644
--- a/linux/src/Presentation/Views/Sidebar/WorkspaceSidebar.cpp
+++ b/linux/src/Presentation/Views/Sidebar/WorkspaceSidebar.cpp
@@ -16,12 +16,15 @@
#include <QListWidgetItem>
#include <QMenu>
#include <QMessageBox>
+#include <QPainter>
#include <QPushButton>
#include <QStackedWidget>
#include <QStandardItem>
#include <QStandardItemModel>
#include <QStandardPaths>
+#include <QStyledItemDelegate>
#include <QTextStream>
+#include <QToolButton>
#include <QTreeView>
#include <QTreeWidget>
#include <QTreeWidgetItem>
@@ -29,6 +32,7 @@
#include "Core/Errors/GridexError.h"
#include "Core/Utils/SqlStatementSplitter.h"
+#include "Presentation/Views/Chrome/GxIcons.h"
#include "Presentation/Views/ImportSQL/SqlImportWizard.h"
#include "Core/Enums/DatabaseType.h"
#include "Core/Enums/SQLDialect.h"
@@ -39,6 +43,7 @@
#include "Presentation/ViewModels/WorkspaceState.h"
#include "Presentation/Views/Backup/BackupProgressDialog.h"
#include "Presentation/Views/TableList/TableGridView.h"
+#include "Presentation/Theme/ThemeManager.h"
#include "Services/Export/DatabaseDumpRunner.h"
#include "Services/Export/ExportService.h"
@@ -46,11 +51,13 @@ namespace gridex {
namespace {
-constexpr int kRoleKind = Qt::UserRole + 1;
-constexpr int kRoleSchemaName = Qt::UserRole + 2;
-constexpr int kRoleTableName = Qt::UserRole + 3;
-constexpr int kRoleLoaded = Qt::UserRole + 4;
+constexpr int kRoleKind = Qt::UserRole + 1;
+constexpr int kRoleSchemaName = Qt::UserRole + 2;
+constexpr int kRoleTableName = Qt::UserRole + 3;
+constexpr int kRoleLoaded = Qt::UserRole + 4;
constexpr int kRoleRoutineName = Qt::UserRole + 5;
+constexpr int kRoleRowCount = Qt::UserRole + 6; // optional int — trail badge
+constexpr int kRoleFolderLabel = Qt::UserRole + 7; // bool — caps section header
enum NodeKind {
NodeSchema = 1,
@@ -59,21 +66,50 @@ enum NodeKind {
NodeFunctionsGroup = 4,
NodeProceduresGroup = 5,
NodeFunction = 6,
- NodeProcedure = 7
+ NodeProcedure = 7,
+ NodeFolder = 8, // "Tables (N)" / "Views (N)" / "Functions (N)" caption row
};
-// splitSqlStatements is defined in Core/Utils/SqlStatementSplitter.h
+// Per-theme gx tokens used by the manually-painted SchemaTreeDelegate.
+// Looked up at paint time so a Light/Dark switch via Settings repaints
+// against the correct palette without needing a full widget rebuild.
+struct DelegatePalette {
+ QColor bg1; // row default background
+ QColor bg2; // row hover background
+ QColor bg4; // row selected background
+ QColor text; // selected / strong text
+ QColor text2; // normal text
+ QColor faint; // folder caption + disabled
+ QColor mutedIcon; // glyph tint
+};
+
+DelegatePalette delegatePalette() {
+ if (ThemeManager::instance().isDark()) {
+ return {QColor(0x11, 0x15, 0x1a), // bg-1
+ QColor(0x17, 0x1c, 0x22), // bg-2
+ QColor(0x2b, 0x31, 0x38), // bg-4
+ QColor(0xe5, 0xe8, 0xeb), // text
+ QColor(0xb4, 0xb8, 0xbc), // text-2
+ QColor(0x55, 0x58, 0x5c), // faint
+ QColor(0x7d, 0x81, 0x85)}; // muted
+ }
+ return {QColor(0xf4, 0xf5, 0xf7), // bg-1
+ QColor(0xe9, 0xeb, 0xef), // bg-2
+ QColor(0xcd, 0xd1, 0xd8), // bg-4
+ QColor(0x1c, 0x20, 0x25), // text
+ QColor(0x4a, 0x4f, 0x56), // text-2
+ QColor(0x93, 0x98, 0xa0), // faint
+ QColor(0x6a, 0x6e, 0x74)}; // muted
+}
-// Parse one CSV row according to RFC 4180. Input is a single line (or block
-// when the row spans newlines inside quotes). We operate on the full CSV
-// blob and advance a cursor so that multi-line quoted fields work.
+// CSV parser (RFC 4180) — used by importCsv below. Carried over verbatim
+// from the pre-A2 implementation.
struct CsvParser {
QString text;
int pos = 0;
bool atEnd() const { return pos >= text.size(); }
- // Returns next row as list of fields; empty vector when no more rows.
QStringList readRow() {
QStringList fields;
if (atEnd()) return fields;
@@ -99,31 +135,190 @@ struct CsvParser {
}
if (c == '"' && cell.isEmpty()) { quoted = true; ++pos; continue; }
if (c == ',') { fields << cell; cell.clear(); ++pos; continue; }
- if (c == '\r') { ++pos; continue; } // ignore
+ if (c == '\r') { ++pos; continue; }
if (c == '\n') { ++pos; fields << cell; return fields; }
cell.append(c);
++pos;
}
- // Last field (no trailing newline)
fields << cell;
return fields;
}
};
-QPushButton* makeTabButton(const QString& glyph, const QString& tooltip, QWidget* parent) {
- auto* btn = new QPushButton(glyph, parent);
- btn->setCheckable(true);
- btn->setAutoExclusive(true);
- btn->setCursor(Qt::PointingHandCursor);
- btn->setFixedHeight(28);
- btn->setToolTip(tooltip);
- btn->setFlat(true);
- btn->setProperty("tab", true); // styled via style.qss QPushButton[tab="true"]
- return btn;
+// Map DatabaseType → (engine pill label, pill background colour). Hex
+// values precomputed from .gx-eng-* oklch in gridex.css.
+struct EnginePill { QString label; QColor color; };
+EnginePill enginePill(DatabaseType t) {
+ switch (t) {
+ case DatabaseType::PostgreSQL: return {QStringLiteral("PG"), QColor(0x3a, 0xa3, 0xd8)};
+ case DatabaseType::MySQL: return {QStringLiteral("MY"), QColor(0xd6, 0xb0, 0x4c)};
+ case DatabaseType::SQLite: return {QStringLiteral("SL"), QColor(0x82, 0xc9, 0x6a)};
+ case DatabaseType::ClickHouse: return {QStringLiteral("CH"), QColor(0xe3, 0xc0, 0x4a)};
+ case DatabaseType::MongoDB: return {QStringLiteral("MG"), QColor(0x4f, 0xc4, 0x88)};
+ case DatabaseType::Redis: return {QStringLiteral("RD"), QColor(0xd6, 0x5b, 0x4c)};
+ case DatabaseType::MSSQL: return {QStringLiteral("MS"), QColor(0xa8, 0x8c, 0xe0)};
+ }
+ return {QStringLiteral("DB"), QColor(0x7d, 0x81, 0x85)};
+}
+
+QString fmtBigInt(qint64 n) {
+ if (n >= 1'000'000'000LL) return QString::number(n / 1.0e9, 'f', 1) + QLatin1Char('B');
+ if (n >= 1'000'000LL) return QString::number(n / 1.0e6, 'f', 1) + QLatin1Char('M');
+ if (n >= 1'000LL) return QString::number(n / 1.0e3, 'f', 1) + QLatin1Char('K');
+ return QString::number(n);
}
+// Compact, square 24-px icon button used in the header strip and tab strip.
+// Hover/checked colors come from the theme QSS via the `side-square` role
+// selector so the same widget reads correctly in light and dark.
+QToolButton* makeSquareBtn(const QString& glyph, const QString& tooltip,
+ QWidget* parent, int size = 24, int iconPx = 12) {
+ auto* b = new QToolButton(parent);
+ b->setIcon(GxIcons::glyph(glyph));
+ b->setIconSize(QSize(iconPx, iconPx));
+ b->setFixedSize(size, size);
+ b->setAutoRaise(true);
+ b->setToolTip(tooltip);
+ b->setCursor(Qt::PointingHandCursor);
+ b->setProperty("gxRole", QStringLiteral("side-square"));
+ return b;
}
+// Custom delegate that paints engine pills on connection-root rows, dim
+// caps headers on folder rows ("Tables (N)"), and trailing row-count
+// badges on table rows.
+class SchemaTreeDelegate : public QStyledItemDelegate {
+public:
+ explicit SchemaTreeDelegate(QObject* parent = nullptr)
+ : QStyledItemDelegate(parent) {}
+
+ QSize sizeHint(const QStyleOptionViewItem& opt, const QModelIndex& idx) const override {
+ QSize s = QStyledItemDelegate::sizeHint(opt, idx);
+ const int kind = idx.data(kRoleKind).toInt();
+ if (kind == NodeFolder) s.setHeight(20);
+ else s.setHeight(std::max(s.height(), 24));
+ return s;
+ }
+
+ void paint(QPainter* p, const QStyleOptionViewItem& opt, const QModelIndex& idx) const override {
+ QStyleOptionViewItem o = opt;
+ initStyleOption(&o, idx);
+
+ const bool isFolder = idx.data(kRoleKind).toInt() == NodeFolder
+ || idx.data(kRoleFolderLabel).toBool();
+ const bool selected = (o.state & QStyle::State_Selected);
+ const DelegatePalette pal = delegatePalette();
+
+ p->save();
+ p->setRenderHint(QPainter::Antialiasing, true);
+
+ // Background — hover/selected. Folder rows never highlight.
+ if (selected && !isFolder) {
+ p->fillRect(o.rect, pal.bg4);
+ } else if ((o.state & QStyle::State_MouseOver) && !isFolder) {
+ p->fillRect(o.rect, pal.bg2);
+ } else {
+ p->fillRect(o.rect, pal.bg1);
+ }
+
+ // Folder rows: small all-caps muted label, no icon.
+ if (isFolder) {
+ QFont f = o.font;
+ f.setPointSizeF(std::max(8.0, f.pointSizeF() - 2.0));
+ f.setLetterSpacing(QFont::AbsoluteSpacing, 0.6);
+ f.setCapitalization(QFont::AllUppercase);
+ p->setFont(f);
+ p->setPen(pal.faint);
+ QRect r = o.rect.adjusted(o.rect.x() == 0 ? 16 : 4, 0, -8, 0);
+ p->drawText(r, Qt::AlignVCenter | Qt::AlignLeft, idx.data(Qt::DisplayRole).toString());
+ p->restore();
+ return;
+ }
+
+ // Default branch indicator + indentation already handled by view —
+ // we delegate "indented" painting to the standard pipeline by
+ // calling the base for non-decorated rows when no engine pill is
+ // needed. But to control text + trail consistently we paint
+ // ourselves and let the view supply rect via o.rect (which already
+ // honours indentation).
+ const int kind = idx.data(kRoleKind).toInt();
+ const QString text = idx.data(Qt::DisplayRole).toString();
+
+ int x = o.rect.x() + 4;
+ const int y = o.rect.y();
+ const int h = o.rect.height();
+
+ // Engine pill on schema-root rows (we treat NodeSchema as the
+ // visible "connection" anchor since this sidebar only sees one
+ // open connection — the activity bar's Connections panel renders
+ // the multi-connection list).
+ if (kind == NodeSchema) {
+ // No pill here — the schema item is one level below the
+ // (implicit) connection. Pill is painted by the bottom-bar
+ // db-info strip instead. Keep the row clean.
+ }
+
+ // Icon glyph by node kind. Tree's own branch/expander is left
+ // intact (Qt::style draws it before paint() is called).
+ QString iconName;
+ switch (kind) {
+ case NodeSchema: iconName = QStringLiteral("schema"); break;
+ case NodeTable: iconName = QStringLiteral("table"); break;
+ case NodeFunctionsGroup: iconName = QStringLiteral("folder"); break;
+ case NodeProceduresGroup: iconName = QStringLiteral("folder"); break;
+ case NodeFunction: iconName = QStringLiteral("fn"); break;
+ case NodeProcedure: iconName = QStringLiteral("fn"); break;
+ default: iconName.clear(); break;
+ }
+ if (!iconName.isEmpty()) {
+ const QIcon ic = GxIcons::glyph(iconName, pal.mutedIcon.name());
+ ic.paint(p, x, y + (h - 14) / 2, 14, 14);
+ x += 18;
+ }
+
+ // Label.
+ p->setPen(selected ? pal.text
+ : (idx.flags() & Qt::ItemIsEnabled ? pal.text2
+ : pal.faint));
+ QFont f = o.font;
+ if (kind == NodeSchema) f.setBold(true);
+ p->setFont(f);
+
+ // Trailing badge — table row count.
+ QString trail;
+ const QVariant rc = idx.data(kRoleRowCount);
+ if (rc.isValid() && rc.toLongLong() >= 0) trail = fmtBigInt(rc.toLongLong());
+
+ QFontMetrics fm(p->font());
+ int trailW = 0;
+ if (!trail.isEmpty()) {
+ QFont mono(QStringLiteral("JetBrains Mono"));
+ mono.setStyleHint(QFont::Monospace);
+ mono.setPointSizeF(std::max(8.5, f.pointSizeF() - 1.5));
+ QFontMetrics mfm(mono);
+ trailW = mfm.horizontalAdvance(trail) + 8;
+ }
+
+ const QRect labelRect(x, y, std::max(0, o.rect.right() - x - trailW - 4), h);
+ p->drawText(labelRect, Qt::AlignVCenter | Qt::AlignLeft,
+ fm.elidedText(text, Qt::ElideRight, labelRect.width()));
+
+ if (!trail.isEmpty()) {
+ QFont mono(QStringLiteral("JetBrains Mono"));
+ mono.setStyleHint(QFont::Monospace);
+ mono.setPointSizeF(std::max(8.5, f.pointSizeF() - 1.5));
+ p->setFont(mono);
+ p->setPen(pal.faint);
+ p->drawText(QRect(o.rect.right() - trailW - 4, y, trailW, h),
+ Qt::AlignVCenter | Qt::AlignRight, trail);
+ }
+
+ p->restore();
+ }
+};
+
+} // namespace
+
WorkspaceSidebar::~WorkspaceSidebar() = default;
WorkspaceSidebar::WorkspaceSidebar(WorkspaceState* state,
@@ -131,6 +326,12 @@ WorkspaceSidebar::WorkspaceSidebar(WorkspaceState* state,
QWidget* parent)
: QWidget(parent), state_(state), appDb_(std::move(appDb)) {
if (appDb_) savedQueryRepo_ = std::make_unique<SavedQueryRepository>(appDb_);
+
+ setObjectName(QStringLiteral("gxWorkspaceSidebar"));
+ setFixedWidth(280);
+ setAttribute(Qt::WA_StyledBackground, true);
+ // Background + right border live in the theme QSS — QWidget#gxWorkspaceSidebar.
+
buildUi();
if (appDb_) loadHistoryFromDb();
if (savedQueryRepo_) reloadSavedQueriesTree();
@@ -143,84 +344,147 @@ WorkspaceSidebar::WorkspaceSidebar(WorkspaceState* state,
}
}
-void WorkspaceSidebar::buildUi() {
- auto* root = new QVBoxLayout(this);
- root->setContentsMargins(0, 0, 0, 0);
- root->setSpacing(0);
+// --------------------------------------------------------------------
+// UI construction
+// --------------------------------------------------------------------
+
+QWidget* WorkspaceSidebar::buildHeaderStrip() {
+ // .gx-side-hd — 28px, padding 6 10 6 10, border-bottom #2e3339, bg-1.
+ auto* strip = new QWidget(this);
+ strip->setObjectName(QStringLiteral("gxSideHd"));
+ strip->setFixedHeight(28);
+ strip->setAttribute(Qt::WA_StyledBackground, true);
+ auto* h = new QHBoxLayout(strip);
+ h->setContentsMargins(10, 6, 10, 6);
+ h->setSpacing(2);
+
+ auto* title = new QLabel(tr("SCHEMA"), strip);
+ title->setObjectName(QStringLiteral("gxSideHdTitle"));
+ QFont tf = title->font();
+ tf.setPointSizeF(10.0);
+ tf.setLetterSpacing(QFont::PercentageSpacing, 108);
+ tf.setBold(true);
+ title->setFont(tf);
+ h->addWidget(title);
+ h->addStretch();
+
+ hdNewConnBtn_ = makeSquareBtn(QStringLiteral("plug"), tr("New connection"), strip, 18, 11);
+ hdRefreshBtn_ = makeSquareBtn(QStringLiteral("refresh"), tr("Refresh"), strip, 18, 11);
+ hdCollapseBtn_ = makeSquareBtn(QStringLiteral("x"), tr("Collapse all"), strip, 18, 11);
+ connect(hdRefreshBtn_, &QToolButton::clicked, this, [this] { loadSchemas(); });
+ connect(hdCollapseBtn_, &QToolButton::clicked, this, [this] { if (tree_) tree_->collapseAll(); });
+ h->addWidget(hdNewConnBtn_);
+ h->addWidget(hdRefreshBtn_);
+ h->addWidget(hdCollapseBtn_);
+ return strip;
+}
- // ---- Tab bar (Items / Queries / History) ----
- auto* tabBar = new QWidget(this);
- auto* tabH = new QHBoxLayout(tabBar);
- tabH->setContentsMargins(6, 4, 6, 4);
- tabH->setSpacing(1);
-
- itemsTabBtn_ = makeTabButton(QStringLiteral("🗂"), tr("Items"), tabBar);
- queriesTabBtn_ = makeTabButton(QStringLiteral("📄"), tr("Queries"), tabBar);
- historyTabBtn_ = makeTabButton(QStringLiteral("🕑"), tr("History"), tabBar);
- savedTabBtn_ = makeTabButton(QStringLiteral("⭐"), tr("Saved"), tabBar);
- itemsTabBtn_->setChecked(true);
- tabH->addWidget(itemsTabBtn_, 1);
- tabH->addWidget(queriesTabBtn_, 1);
- tabH->addWidget(historyTabBtn_, 1);
- tabH->addWidget(savedTabBtn_, 1);
- connect(itemsTabBtn_, &QPushButton::clicked, this, [this] { onTabClicked(0); });
- connect(queriesTabBtn_, &QPushButton::clicked, this, [this] { onTabClicked(1); });
- connect(historyTabBtn_, &QPushButton::clicked, this, [this] { onTabClicked(2); });
- connect(savedTabBtn_, &QPushButton::clicked, this, [this] { onTabClicked(3); });
- root->addWidget(tabBar);
-
- auto* tabDiv = new QFrame(this);
- tabDiv->setFrameShape(QFrame::HLine);
- root->addWidget(tabDiv);
-
- // ---- Body: stacked (Items tab, empty tabs for Queries/History) ----
- body_ = new QStackedWidget(this);
-
- // Items tab
- auto* itemsPage = new QWidget(body_);
- auto* itemsV = new QVBoxLayout(itemsPage);
- itemsV->setContentsMargins(0, 0, 0, 0);
- itemsV->setSpacing(0);
-
- auto* searchRow = new QWidget(itemsPage);
- auto* searchH = new QHBoxLayout(searchRow);
- searchH->setContentsMargins(8, 6, 8, 6);
- searchH->setSpacing(4);
- searchEdit_ = new QLineEdit(searchRow);
- searchEdit_->setPlaceholderText(tr("Search tables..."));
- searchEdit_->setClearButtonEnabled(true);
+QWidget* WorkspaceSidebar::buildFilterRow(QWidget* parent) {
+ // .gx-side-filter — height 24, margin 6 8, padding 0 8, bg-0 border-2.
+ auto* row = new QWidget(parent);
+ auto* h = new QHBoxLayout(row);
+ h->setContentsMargins(8, 6, 8, 6);
+ h->setSpacing(4);
+
+ searchEdit_ = new QLineEdit(row);
+ searchEdit_->setObjectName(QStringLiteral("gxSideFilter"));
+ searchEdit_->setPlaceholderText(tr("Filter…"));
+ searchEdit_->setClearButtonEnabled(false);
+ searchEdit_->addAction(GxIcons::glyph(QStringLiteral("search")),
+ QLineEdit::LeadingPosition);
connect(searchEdit_, &QLineEdit::textChanged,
this, &WorkspaceSidebar::onSearchChanged);
- searchH->addWidget(searchEdit_);
+ h->addWidget(searchEdit_);
- gridToggleBtn_ = new QPushButton(QStringLiteral("⊞"), searchRow);
- gridToggleBtn_->setFixedSize(26, 26);
+ gridToggleBtn_ = makeSquareBtn(QStringLiteral("folder"), tr("Toggle Grid View"), row, 24, 12);
gridToggleBtn_->setCheckable(true);
- gridToggleBtn_->setChecked(false);
- gridToggleBtn_->setToolTip(tr("Toggle Grid View"));
- gridToggleBtn_->setCursor(Qt::PointingHandCursor);
- connect(gridToggleBtn_, &QPushButton::toggled, this, [this](bool checked) {
+ connect(gridToggleBtn_, &QToolButton::toggled, this, [this](bool checked) {
itemsViewStack_->setCurrentIndex(checked ? 1 : 0);
- searchEdit_->setPlaceholderText(checked ? tr("Filter tables...") : tr("Search tables..."));
+ searchEdit_->setPlaceholderText(checked ? tr("Filter tables…") : tr("Filter…"));
if (checked && tableGrid_) tableGrid_->reload();
});
- searchH->addWidget(gridToggleBtn_);
+ h->addWidget(gridToggleBtn_);
+ return row;
+}
+
+QWidget* WorkspaceSidebar::buildBottomBar(QWidget* parent) {
+ auto* bar = new QWidget(parent);
+ bar->setObjectName(QStringLiteral("gxSideBottom"));
+ bar->setAttribute(Qt::WA_StyledBackground, true);
+ auto* v = new QVBoxLayout(bar);
+ v->setContentsMargins(8, 6, 8, 6);
+ v->setSpacing(4);
+
+ auto* schemaRow = new QWidget(bar);
+ auto* sh = new QHBoxLayout(schemaRow);
+ sh->setContentsMargins(0, 0, 0, 0);
+ sh->setSpacing(6);
+
+ schemaCombo_ = new QComboBox(schemaRow);
+ schemaCombo_->setObjectName(QStringLiteral("gxSideSchemaCombo"));
+ schemaCombo_->setToolTip(tr("Active schema"));
+ schemaCombo_->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+ connect(schemaCombo_, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &WorkspaceSidebar::onSchemaChanged);
+ sh->addWidget(schemaCombo_);
+ sh->addStretch();
+ v->addWidget(schemaRow);
+
+ dbInfoLabel_ = new QLabel(bar);
+ dbInfoLabel_->setObjectName(QStringLiteral("gxSideDbInfo"));
+ dbInfoLabel_->setWordWrap(false);
+ v->addWidget(dbInfoLabel_);
+
+ auto* actionRow = new QWidget(bar);
+ auto* ah = new QHBoxLayout(actionRow);
+ ah->setContentsMargins(0, 0, 0, 0);
+ ah->setSpacing(6);
+
+ newTableBtn_ = new QPushButton(tr("+ New Table"), actionRow);
+ newTableBtn_->setObjectName(QStringLiteral("gxSideNewTable"));
+ newTableBtn_->setCursor(Qt::PointingHandCursor);
+ connect(newTableBtn_, &QPushButton::clicked, this, [this] {
+ const QString schema = schemaCombo_ ? schemaCombo_->currentText() : QString{};
+ emit newTableRequested(schema);
+ });
+
+ disconnectBtn_ = new QPushButton(tr("Disconnect"), actionRow);
+ disconnectBtn_->setObjectName(QStringLiteral("gxSideDisconnect"));
+ disconnectBtn_->setCursor(Qt::PointingHandCursor);
+ connect(disconnectBtn_, &QPushButton::clicked,
+ this, &WorkspaceSidebar::disconnectRequested);
+
+ ah->addWidget(newTableBtn_);
+ ah->addStretch();
+ ah->addWidget(disconnectBtn_);
+ v->addWidget(actionRow);
+
+ return bar;
+}
- itemsV->addWidget(searchRow);
+QWidget* WorkspaceSidebar::buildItemsPage() {
+ auto* page = new QWidget(this);
+ auto* v = new QVBoxLayout(page);
+ v->setContentsMargins(0, 0, 0, 0);
+ v->setSpacing(0);
- auto* searchDiv = new QFrame(itemsPage);
- searchDiv->setFrameShape(QFrame::HLine);
- itemsV->addWidget(searchDiv);
+ v->addWidget(buildFilterRow(page));
- // Stacked: page 0 = tree, page 1 = grid
- itemsViewStack_ = new QStackedWidget(itemsPage);
+ itemsViewStack_ = new QStackedWidget(page);
tree_ = new QTreeView(itemsViewStack_);
+ tree_->setObjectName(QStringLiteral("gxSchemaTree"));
tree_->setHeaderHidden(true);
tree_->setEditTriggers(QAbstractItemView::NoEditTriggers);
tree_->setSelectionBehavior(QAbstractItemView::SelectRows);
tree_->setFrameShape(QFrame::NoFrame);
+ tree_->setIndentation(14);
+ tree_->setUniformRowHeights(false);
+ tree_->setRootIsDecorated(true);
+ tree_->setAnimated(false);
+ tree_->setMouseTracking(true);
tree_->setContextMenuPolicy(Qt::CustomContextMenu);
+ tree_->setItemDelegate(new SchemaTreeDelegate(tree_));
model_ = new QStandardItemModel(this);
tree_->setModel(model_);
@@ -242,151 +506,46 @@ void WorkspaceSidebar::buildUi() {
itemsViewStack_->addWidget(tableGrid_);
itemsViewStack_->setCurrentIndex(0);
- itemsV->addWidget(itemsViewStack_, 1);
-
- // Bottom bar: schema selector + DB info + disconnect
- auto* bottomDiv = new QFrame(itemsPage);
- bottomDiv->setFrameShape(QFrame::HLine);
- itemsV->addWidget(bottomDiv);
-
- auto* bottomBar = new QWidget(itemsPage);
- auto* bottomV = new QVBoxLayout(bottomBar);
- bottomV->setContentsMargins(8, 6, 8, 6);
- bottomV->setSpacing(4);
-
- // Schema selector row
- auto* schemaRow = new QWidget(bottomBar);
- auto* schemaH = new QHBoxLayout(schemaRow);
- schemaH->setContentsMargins(0, 0, 0, 0);
- schemaH->setSpacing(6);
-
- schemaCombo_ = new QComboBox(schemaRow);
- schemaCombo_->setToolTip(tr("Active schema"));
- schemaCombo_->setSizeAdjustPolicy(QComboBox::AdjustToContents);
- connect(schemaCombo_, QOverload<int>::of(&QComboBox::currentIndexChanged),
- this, &WorkspaceSidebar::onSchemaChanged);
- schemaH->addWidget(schemaCombo_);
- schemaH->addStretch();
-
- bottomV->addWidget(schemaRow);
-
- // DB info label
- dbInfoLabel_ = new QLabel(bottomBar);
- dbInfoLabel_->setWordWrap(false);
- bottomV->addWidget(dbInfoLabel_);
-
- // Bottom action row: [New Table] [Disconnect]
- auto* disconnRow = new QWidget(bottomBar);
- auto* disconnH = new QHBoxLayout(disconnRow);
- disconnH->setContentsMargins(0, 0, 0, 0);
- disconnH->setSpacing(6);
-
- newTableBtn_ = new QPushButton(tr("+ New Table"), disconnRow);
- connect(newTableBtn_, &QPushButton::clicked, this, [this] {
- const QString schema = schemaCombo_ ? schemaCombo_->currentText() : QString{};
- emit newTableRequested(schema);
- });
+ v->addWidget(itemsViewStack_, 1);
- disconnectBtn_ = new QPushButton(tr("Disconnect"), disconnRow);
- connect(disconnectBtn_, &QPushButton::clicked,
- this, &WorkspaceSidebar::disconnectRequested);
+ v->addWidget(buildBottomBar(page));
+ return page;
+}
- disconnH->addWidget(newTableBtn_);
- disconnH->addStretch();
- disconnH->addWidget(disconnectBtn_);
- bottomV->addWidget(disconnRow);
-
- itemsV->addWidget(bottomBar);
-
- body_->addWidget(itemsPage);
-
- // Queries tab placeholder
- auto* queriesPage = new QWidget(body_);
- auto* qv = new QVBoxLayout(queriesPage);
- qv->addStretch();
- auto* noQ = new QLabel(tr("📄\nNo Queries"), queriesPage);
- noQ->setAlignment(Qt::AlignCenter);
- qv->addWidget(noQ);
- qv->addStretch();
- body_->addWidget(queriesPage);
-
- // History tab
- auto* historyPage = new QWidget(body_);
- auto* hv = new QVBoxLayout(historyPage);
- hv->setContentsMargins(0, 0, 0, 0);
- hv->setSpacing(0);
- historyList_ = new QListWidget(historyPage);
- historyList_->setFrameShape(QFrame::NoFrame);
- historyList_->setSelectionMode(QAbstractItemView::SingleSelection);
- historyList_->setContextMenuPolicy(Qt::CustomContextMenu);
- historyList_->setToolTip(tr("Double-click to copy SQL to clipboard"));
- connect(historyList_, &QListWidget::itemDoubleClicked, this,
- [this](QListWidgetItem* item) {
- if (!item) return;
- QApplication::clipboard()->setText(item->data(Qt::UserRole).toString());
- });
- connect(historyList_, &QListWidget::customContextMenuRequested, this,
- [this](const QPoint& pos) {
- QMenu menu(this);
- auto* clearAct = menu.addAction(tr("Clear History"));
- connect(clearAct, &QAction::triggered, this, [this] {
- if (!appDb_) return;
- const auto btn = QMessageBox::question(this, tr("Clear History"),
- tr("Remove all query history?"),
- QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
- if (btn != QMessageBox::Yes) return;
- try { appDb_->clearAllHistory(); } catch (...) {}
- historyList_->clear();
- });
- menu.exec(historyList_->viewport()->mapToGlobal(pos));
- });
- hv->addWidget(historyList_, 1);
- body_->addWidget(historyPage);
-
- // Saved queries tab
- auto* savedPage = new QWidget(body_);
- auto* sv = new QVBoxLayout(savedPage);
- sv->setContentsMargins(0, 0, 0, 0);
- sv->setSpacing(0);
- savedTree_ = new QTreeWidget(savedPage);
+void WorkspaceSidebar::buildUi() {
+ // History/Saved widgets are kept alive (but layout-less) so logQuery /
+ // promptSaveQuery don't crash. They'll be re-surfaced via the
+ // SidebarPanelStack History / Snippets panels in a follow-up PR.
+ historyList_ = new QListWidget(this);
+ historyList_->setVisible(false);
+ savedTree_ = new QTreeWidget(this);
savedTree_->setHeaderHidden(true);
- savedTree_->setFrameShape(QFrame::NoFrame);
- savedTree_->setContextMenuPolicy(Qt::CustomContextMenu);
- savedTree_->setSelectionMode(QAbstractItemView::SingleSelection);
- connect(savedTree_, &QTreeWidget::itemDoubleClicked, this,
- [this](QTreeWidgetItem* item, int) {
- if (!item || item->childCount() > 0) return;
- const QString sql = item->data(0, Qt::UserRole).toString();
- if (!sql.isEmpty()) emit loadSavedQueryRequested(sql);
- });
- connect(savedTree_, &QTreeWidget::customContextMenuRequested,
- this, &WorkspaceSidebar::onSavedQueryContextMenu);
- sv->addWidget(savedTree_, 1);
- body_->addWidget(savedPage);
+ savedTree_->setVisible(false);
+
+ // PR A2 fix: the inner 4-tab strip (Items / Queries / History / Saved)
+ // was a duplicate of the activity bar's job. SidebarPanelStack now hosts
+ // the History/Snippets/ERD panels at the activity-bar level — this widget
+ // only ever shows the Schema (Items) page.
+ auto* root = new QVBoxLayout(this);
+ root->setContentsMargins(0, 0, 0, 0);
+ root->setSpacing(0);
- body_->setCurrentIndex(0);
- root->addWidget(body_, 1);
+ root->addWidget(buildHeaderStrip());
+ root->addWidget(buildItemsPage(), 1);
}
+// --------------------------------------------------------------------
+// Public surface (preserved verbatim from pre-A2 API)
+// --------------------------------------------------------------------
+
void WorkspaceSidebar::refreshTree() {
onConnectionOpened();
}
-void WorkspaceSidebar::onTabClicked(int tab) {
- activeTab_ = tab;
- itemsTabBtn_->setChecked(tab == 0);
- queriesTabBtn_->setChecked(tab == 1);
- historyTabBtn_->setChecked(tab == 2);
- savedTabBtn_->setChecked(tab == 3);
- body_->setCurrentIndex(tab);
-}
-
void WorkspaceSidebar::onConnectionOpened() {
loadSchemas();
- // Populate schema combo from adapter.
if (schemaCombo_ && state_ && state_->adapter()) {
- // Block signals while rebuilding to avoid triggering reload mid-populate.
QSignalBlocker blocker(schemaCombo_);
schemaCombo_->clear();
try {
@@ -395,19 +554,19 @@ void WorkspaceSidebar::onConnectionOpened() {
schemaCombo_->addItem(QString::fromUtf8(s.c_str()));
}
} catch (const GridexError&) {}
- // Default to "public" if present, else index 0.
const int pubIdx = schemaCombo_->findText(QStringLiteral("public"));
schemaCombo_->setCurrentIndex(pubIdx >= 0 ? pubIdx : 0);
}
- // DB info: "name · dbtype · host"
if (dbInfoLabel_ && state_) {
const auto& cfg = state_->config();
- const QString dbType = QString::fromUtf8(
- displayName(cfg.databaseType).data(),
- static_cast<qsizetype>(displayName(cfg.databaseType).size()));
+ const auto pill = enginePill(cfg.databaseType);
const QString host = QString::fromUtf8(cfg.displayHost().c_str());
- dbInfoLabel_->setText(QStringLiteral("%1 · %2").arg(dbType, host));
+ const QString name = QString::fromStdString(cfg.database.value_or(cfg.name));
+ dbInfoLabel_->setText(QStringLiteral("%1 · %2 · %3")
+ .arg(pill.label,
+ name.isEmpty() ? QStringLiteral("—") : name,
+ host));
}
}
@@ -429,14 +588,13 @@ void WorkspaceSidebar::loadSchemas() {
schemaItem->setData(QString::fromUtf8(s.c_str()), kRoleSchemaName);
schemaItem->setData(false, kRoleLoaded);
- // Insert placeholder child so the expand arrow shows up.
- auto* placeholder = new QStandardItem(tr("(loading...)"));
+ auto* placeholder = new QStandardItem(tr("(loading…)"));
placeholder->setData(NodePlaceholder, kRoleKind);
+ placeholder->setEnabled(false);
schemaItem->appendRow(placeholder);
model_->appendRow(schemaItem);
}
- // If only one schema, auto-expand it for convenience.
if (schemas.size() == 1 && model_->rowCount() > 0) {
tree_->expand(model_->index(0, 0));
}
@@ -447,6 +605,20 @@ void WorkspaceSidebar::loadSchemas() {
}
}
+QStandardItem* WorkspaceSidebar::appendFolderRow(QStandardItem* parent,
+ const QString& label, int count) {
+ const QString text = (count >= 0)
+ ? QStringLiteral("%1 (%2)").arg(label).arg(count)
+ : label;
+ auto* item = new QStandardItem(text);
+ item->setData(NodeFolder, kRoleKind);
+ item->setData(true, kRoleFolderLabel);
+ item->setSelectable(false);
+ item->setEnabled(false);
+ parent->appendRow(item);
+ return item;
+}
+
void WorkspaceSidebar::onItemExpanded(const QModelIndex& index) {
auto* item = model_->itemFromIndex(index);
if (!item) return;
@@ -472,44 +644,53 @@ void WorkspaceSidebar::onItemExpanded(const QModelIndex& index) {
void WorkspaceSidebar::loadTablesForSchema(QStandardItem* schemaItem, const QString& schemaName) {
if (!state_ || !state_->adapter()) return;
+
+ std::vector<TableInfo> tables;
try {
- const auto tables = state_->adapter()->listTables(schemaName.toStdString());
- if (tables.empty()) {
- auto* empty = new QStandardItem(tr("(no tables)"));
- empty->setEnabled(false);
- schemaItem->appendRow(empty);
- } else {
- for (const auto& t : tables) {
- auto* tableItem = new QStandardItem(QString::fromUtf8(t.name.c_str()));
- tableItem->setData(NodeTable, kRoleKind);
- tableItem->setData(schemaName, kRoleSchemaName);
- tableItem->setData(QString::fromUtf8(t.name.c_str()), kRoleTableName);
- schemaItem->appendRow(tableItem);
- }
- }
+ tables = state_->adapter()->listTables(schemaName.toStdString());
} catch (const GridexError& e) {
auto* err = new QStandardItem(QString::fromUtf8(e.what()));
err->setEnabled(false);
schemaItem->appendRow(err);
+ return;
+ }
+
+ // Tables (N) folder header + table rows
+ if (!tables.empty()) {
+ appendFolderRow(schemaItem, tr("Tables"), static_cast<int>(tables.size()));
+ for (const auto& t : tables) {
+ auto* tableItem = new QStandardItem(QString::fromUtf8(t.name.c_str()));
+ tableItem->setData(NodeTable, kRoleKind);
+ tableItem->setData(schemaName, kRoleSchemaName);
+ tableItem->setData(QString::fromUtf8(t.name.c_str()), kRoleTableName);
+ if (t.estimatedRowCount.has_value()) {
+ tableItem->setData(static_cast<qlonglong>(*t.estimatedRowCount), kRoleRowCount);
+ }
+ schemaItem->appendRow(tableItem);
+ }
+ } else {
+ appendFolderRow(schemaItem, tr("Tables"), 0);
}
- // Functions group node
+ // Functions group node — lazy-loaded on expand
auto* fnGroup = new QStandardItem(tr("Functions"));
fnGroup->setData(NodeFunctionsGroup, kRoleKind);
fnGroup->setData(schemaName, kRoleSchemaName);
fnGroup->setData(false, kRoleLoaded);
- auto* fnPlaceholder = new QStandardItem(tr("(loading...)"));
+ auto* fnPlaceholder = new QStandardItem(tr("(loading…)"));
fnPlaceholder->setData(NodePlaceholder, kRoleKind);
+ fnPlaceholder->setEnabled(false);
fnGroup->appendRow(fnPlaceholder);
schemaItem->appendRow(fnGroup);
- // Procedures group node
+ // Procedures group node — lazy-loaded on expand
auto* procGroup = new QStandardItem(tr("Procedures"));
procGroup->setData(NodeProceduresGroup, kRoleKind);
procGroup->setData(schemaName, kRoleSchemaName);
procGroup->setData(false, kRoleLoaded);
- auto* procPlaceholder = new QStandardItem(tr("(loading...)"));
+ auto* procPlaceholder = new QStandardItem(tr("(loading…)"));
procPlaceholder->setData(NodePlaceholder, kRoleKind);
+ procPlaceholder->setEnabled(false);
procGroup->appendRow(procPlaceholder);
schemaItem->appendRow(procGroup);
}
@@ -589,28 +770,26 @@ void WorkspaceSidebar::onSchemaChanged(int /*index*/) {
void WorkspaceSidebar::reloadActiveSchema() {
if (!schemaCombo_ || schemaCombo_->count() == 0) return;
const QString schema = schemaCombo_->currentText();
- // Reload tree with only the selected schema's tables visible.
model_->clear();
if (!state_ || !state_->adapter()) return;
auto* schemaItem = new QStandardItem(schema);
schemaItem->setData(NodeSchema, kRoleKind);
schemaItem->setData(schema, kRoleSchemaName);
schemaItem->setData(false, kRoleLoaded);
- auto* placeholder = new QStandardItem(tr("(loading...)"));
+ auto* placeholder = new QStandardItem(tr("(loading…)"));
placeholder->setData(NodePlaceholder, kRoleKind);
+ placeholder->setEnabled(false);
schemaItem->appendRow(placeholder);
model_->appendRow(schemaItem);
tree_->expand(model_->index(0, 0));
}
void WorkspaceSidebar::onSearchChanged(const QString& text) {
- // In grid mode, delegate filtering to TableGridView.
if (gridToggleBtn_ && gridToggleBtn_->isChecked()) {
if (tableGrid_) tableGrid_->onSearchChanged(text);
return;
}
- // Simple hide/show filter across schemas+tables. For v1 we do a flat walk.
const auto lower = text.trimmed().toLower();
for (int i = 0; i < model_->rowCount(); ++i) {
auto* schemaItem = model_->item(i);
@@ -619,9 +798,16 @@ void WorkspaceSidebar::onSearchChanged(const QString& text) {
bool anyChildMatches = false;
for (int j = 0; j < schemaItem->rowCount(); ++j) {
auto* child = schemaItem->child(j);
- const bool ok = lower.isEmpty() || child->text().toLower().contains(lower);
+ // Folder caption rows are kept whenever any sibling is visible.
+ const bool isFolder = child->data(kRoleKind).toInt() == NodeFolder;
+ bool ok;
+ if (isFolder) {
+ ok = true;
+ } else {
+ ok = lower.isEmpty() || child->text().toLower().contains(lower);
+ }
tree_->setRowHidden(j, schemaItem->index(), !ok);
- anyChildMatches = anyChildMatches || ok;
+ if (!isFolder) anyChildMatches = anyChildMatches || ok;
}
tree_->setRowHidden(i, QModelIndex(), !(schemaMatches || anyChildMatches));
}
@@ -634,19 +820,16 @@ void WorkspaceSidebar::onContextMenuRequested(const QPoint& pos) {
QMenu menu(this);
- // Refresh is always first — works on blank area, schema nodes, and
- // table nodes. Full reload is cheap and keeps schemas + tables in sync.
auto* refreshAction = menu.addAction(tr("Refresh"));
refreshAction->setShortcut(QKeySequence::Refresh);
connect(refreshAction, &QAction::triggered, this, [this] { loadSchemas(); });
- // Blank area or schema node: Refresh + import/backup/restore actions.
if (!item || kind != NodeTable) {
menu.addSeparator();
- auto* runSqlAct = menu.addAction(tr("Run SQL File..."));
- auto* backupAct = menu.addAction(tr("Backup Database..."));
- auto* restoreAct = menu.addAction(tr("Restore Database..."));
+ auto* runSqlAct = menu.addAction(tr("Run SQL File…"));
+ auto* backupAct = menu.addAction(tr("Backup Database…"));
+ auto* restoreAct = menu.addAction(tr("Restore Database…"));
const bool hasAdapter = state_ && state_->adapter();
runSqlAct->setEnabled(hasAdapter);
backupAct->setEnabled(hasAdapter);
@@ -664,7 +847,6 @@ void WorkspaceSidebar::onContextMenuRequested(const QPoint& pos) {
const QString schema = item->data(kRoleSchemaName).toString();
const QString table = item->data(kRoleTableName).toString();
- // Open / view actions
auto* openAction = menu.addAction(tr("Open in New Tab"));
connect(openAction, &QAction::triggered, this, [this, schema, table] {
emit tableSelected(schema, table);
@@ -677,19 +859,18 @@ void WorkspaceSidebar::onContextMenuRequested(const QPoint& pos) {
menu.addSeparator();
- // Copy actions
auto* copyNameAction = menu.addAction(tr("Copy Table Name"));
connect(copyNameAction, &QAction::triggered, this, [table] {
QApplication::clipboard()->setText(table);
});
const QString selectSql = QStringLiteral("SELECT * FROM %1 LIMIT 100;").arg(table);
- auto* copySelectAction = menu.addAction(tr("Copy SELECT * FROM..."));
+ auto* copySelectAction = menu.addAction(tr("Copy SELECT * FROM…"));
connect(copySelectAction, &QAction::triggered, this, [selectSql] {
QApplication::clipboard()->setText(selectSql);
});
- auto* copyDdlAction = menu.addAction(tr("Copy CREATE TABLE..."));
+ auto* copyDdlAction = menu.addAction(tr("Copy CREATE TABLE…"));
connect(copyDdlAction, &QAction::triggered, this, [this, schema, table] {
if (!state_ || !state_->adapter()) return;
try {
@@ -706,8 +887,7 @@ void WorkspaceSidebar::onContextMenuRequested(const QPoint& pos) {
menu.addSeparator();
- // Truncate
- auto* truncateAction = menu.addAction(tr("Truncate Table..."));
+ auto* truncateAction = menu.addAction(tr("Truncate Table…"));
connect(truncateAction, &QAction::triggered, this, [this, schema, table] {
if (!state_ || !state_->adapter()) return;
const auto answer = QMessageBox::warning(
@@ -735,8 +915,7 @@ void WorkspaceSidebar::onContextMenuRequested(const QPoint& pos) {
}
});
- // Drop table
- auto* dropAction = menu.addAction(tr("Delete Table..."));
+ auto* dropAction = menu.addAction(tr("Delete Table…"));
connect(dropAction, &QAction::triggered, this, [this, schema, table] {
if (!state_ || !state_->adapter()) return;
const auto answer = QMessageBox::warning(
@@ -760,7 +939,6 @@ void WorkspaceSidebar::onContextMenuRequested(const QPoint& pos) {
sql = "DROP TABLE " + quoteIdentifier(sqlDialect(dt), table.toStdString());
}
state_->adapter()->executeRaw(sql);
- // Refresh sidebar and notify WorkspaceView to close tabs
loadSchemas();
emit tableDeleted(schema, table);
} catch (const GridexError& e) {
@@ -770,8 +948,7 @@ void WorkspaceSidebar::onContextMenuRequested(const QPoint& pos) {
menu.addSeparator();
- // Export
- auto* exportAction = menu.addAction(tr("Export Table..."));
+ auto* exportAction = menu.addAction(tr("Export Table…"));
connect(exportAction, &QAction::triggered, this, [this, schema, table] {
if (!state_ || !state_->adapter()) return;
@@ -803,8 +980,7 @@ void WorkspaceSidebar::onContextMenuRequested(const QPoint& pos) {
}
});
- // Import CSV (table-specific)
- auto* importCsvAct = menu.addAction(tr("Import CSV..."));
+ auto* importCsvAct = menu.addAction(tr("Import CSV…"));
connect(importCsvAct, &QAction::triggered, this, [this, schema, table] {
importCsv(schema, table);
});
@@ -813,7 +989,8 @@ void WorkspaceSidebar::onContextMenuRequested(const QPoint& pos) {
}
// --------------------------------------------------------------------
-// Run SQL File (script importer)
+// Run SQL File / CSV import / Backup / Restore — carried over verbatim
+// from the pre-A2 sidebar. Backend behaviour is unchanged.
// --------------------------------------------------------------------
void WorkspaceSidebar::runSqlFile() {
@@ -832,10 +1009,6 @@ void WorkspaceSidebar::runSqlFile() {
wizard->show();
}
-// --------------------------------------------------------------------
-// Import CSV (single table)
-// --------------------------------------------------------------------
-
void WorkspaceSidebar::importCsv(const QString& schema, const QString& table) {
if (!state_ || !state_->adapter()) return;
@@ -862,7 +1035,6 @@ void WorkspaceSidebar::importCsv(const QString& schema, const QString& table) {
return;
}
- // Fetch table columns to validate header ↔ table alignment.
std::vector<ColumnInfo> tableCols;
try {
const auto schemaOpt = schema.isEmpty() ? std::nullopt
@@ -874,10 +1046,7 @@ void WorkspaceSidebar::importCsv(const QString& schema, const QString& table) {
return;
}
- // Column indexes in target table for each CSV header, by name match.
- // Missing columns → skip that CSV column entirely. Fewer columns in CSV
- // than table is fine (unset cols use default/NULL).
- std::vector<int> colMap; // size = header.size(); -1 if unmapped
+ std::vector<int> colMap;
QStringList mappedNames;
for (const auto& h : header) {
int idx = -1;
@@ -908,7 +1077,6 @@ void WorkspaceSidebar::importCsv(const QString& schema, const QString& table) {
? quoteIdentifier(dialect, schema.toStdString()) + "." + quoteIdentifier(dialect, table.toStdString())
: quoteIdentifier(dialect, table.toStdString());
- // Build column list once (only mapped cols, in CSV order).
std::string colList;
for (std::size_t i = 0; i < colMap.size(); ++i) {
if (colMap[i] < 0) continue;
@@ -929,7 +1097,6 @@ void WorkspaceSidebar::importCsv(const QString& schema, const QString& table) {
if (i >= static_cast<std::size_t>(fields.size()) || fields[i].isNull()) {
values += "NULL";
} else {
- // Quote everything as string; DB coerces. Escape '.
QString v = fields[i];
v.replace('\'', QStringLiteral("''"));
values += '\'';
@@ -959,10 +1126,6 @@ void WorkspaceSidebar::importCsv(const QString& schema, const QString& table) {
}
}
-// --------------------------------------------------------------------
-// Backup / Restore — delegates to DatabaseDumpRunner service
-// --------------------------------------------------------------------
-
void WorkspaceSidebar::backupDatabase() {
if (!state_ || !state_->adapter()) return;
const ConnectionConfig& cfg = state_->config();
@@ -1031,7 +1194,6 @@ void WorkspaceSidebar::promptSaveQuery(const QString& sql) {
if (!ok) return;
AppDatabase::SavedQueryRecord rec;
- // Generate a simple UUID-like id from timestamp
const auto ts = std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::system_clock::now().time_since_epoch()).count();
rec.id = std::to_string(ts);
@@ -1133,7 +1295,7 @@ void WorkspaceSidebar::onSavedQueryContextMenu(const QPoint& pos) {
emit loadSavedQueryRequested(sql);
});
- auto* editAct = menu.addAction(tr("Edit SQL..."));
+ auto* editAct = menu.addAction(tr("Edit SQL…"));
connect(editAct, &QAction::triggered, this, [this, qid, qname, sql] {
if (!savedQueryRepo_) return;
bool ok = false;
@@ -1174,7 +1336,7 @@ void WorkspaceSidebar::onSavedQueryContextMenu(const QPoint& pos) {
} else if (role == QStringLiteral("group")) {
const QString groupName = item->data(0, Qt::UserRole + 2).toString();
- auto* renameAct = menu.addAction(tr("Rename Group..."));
+ auto* renameAct = menu.addAction(tr("Rename Group…"));
connect(renameAct, &QAction::triggered, this, [this, groupName] {
if (!savedQueryRepo_) return;
bool ok = false;
@@ -1223,4 +1385,4 @@ void WorkspaceSidebar::onSavedQueryContextMenu(const QPoint& pos) {
if (!menu.isEmpty()) menu.exec(savedTree_->viewport()->mapToGlobal(pos));
}
-}
+} // namespace gridex
diff --git a/linux/src/Presentation/Views/Sidebar/WorkspaceSidebar.h b/linux/src/Presentation/Views/Sidebar/WorkspaceSidebar.h
index 57470cf..c0d5538 100644
--- a/linux/src/Presentation/Views/Sidebar/WorkspaceSidebar.h
+++ b/linux/src/Presentation/Views/Sidebar/WorkspaceSidebar.h
@@ -15,6 +15,7 @@ class QStandardItemModel;
class QTreeView;
class QTreeWidget;
class QTreeWidgetItem;
+class QToolButton;
class QPushButton;
namespace gridex { class TableGridView; }
@@ -26,11 +27,20 @@ class SavedQueryRepository;
class WorkspaceState;
// Left sidebar shown inside WorkspaceView once a connection is open.
-// Mirrors macOS SidebarView layout:
-// [tab bar: Items | Queries | History]
-// [search bar]
-// [tree: schemas (expand -> tables lazy loaded)]
-// [bottom bar: schema selector ▾ | DB info | disconnect]
+//
+// PR A2 rewrite (2026-05): Visual structure mirrors the design's
+// FlatSidebar from project/panels.jsx:
+// - 280px fixed width, gx-bg-1 (#11151a) background
+// - Header strip: "SCHEMA" label + plug / refresh / collapse buttons
+// - Activity-tab strip (Items / Queries / History / Saved)
+// - Filter row with search-glyph
+// - QTreeView with custom delegate painting engine pill + status dot
+// on the root row, GxIcons on db/schema/table/view/fn nodes, and
+// row-count badges trailing each table row
+// - Bottom strip: schema combo + db info + new-table / disconnect
+//
+// Public API (constructor, methods, signals, slots) is preserved verbatim
+// — WorkspaceView.cpp consumes this surface and must not change.
class WorkspaceSidebar : public QWidget {
Q_OBJECT
@@ -58,7 +68,6 @@ private slots:
void onConnectionClosed();
void onItemExpanded(const QModelIndex& index);
void onItemDoubleClicked(const QModelIndex& index);
- void onTabClicked(int tab);
void onSearchChanged(const QString& text);
void onSchemaChanged(int index);
void onContextMenuRequested(const QPoint& pos);
@@ -66,6 +75,11 @@ private slots:
private:
void buildUi();
+ QWidget* buildItemsPage();
+ QWidget* buildHeaderStrip();
+ QWidget* buildFilterRow(QWidget* parent);
+ QWidget* buildBottomBar(QWidget* parent);
+
void loadSchemas();
void loadTablesForSchema(QStandardItem* schemaItem, const QString& schemaName);
void loadFunctionsForSchema(QStandardItem* parent, const QString& schemaName);
@@ -74,6 +88,9 @@ private:
void loadHistoryFromDb();
void reloadSavedQueriesTree();
+ // Add a "Tables (N)" / "Views (N)" / "Functions (N)" header row.
+ QStandardItem* appendFolderRow(QStandardItem* parent, const QString& label, int count);
+
// Data import / backup actions (wired via context menu).
void runSqlFile();
void importCsv(const QString& schema, const QString& table);
@@ -84,18 +101,15 @@ private:
std::shared_ptr<AppDatabase> appDb_;
std::unique_ptr<SavedQueryRepository> savedQueryRepo_;
- // Tab bar (0=Items, 1=Queries, 2=History, 3=Saved)
- QPushButton* itemsTabBtn_ = nullptr;
- QPushButton* queriesTabBtn_ = nullptr;
- QPushButton* historyTabBtn_ = nullptr;
- QPushButton* savedTabBtn_ = nullptr;
- QStackedWidget* body_ = nullptr;
- int activeTab_ = 0;
+ // Header strip
+ QToolButton* hdNewConnBtn_ = nullptr;
+ QToolButton* hdRefreshBtn_ = nullptr;
+ QToolButton* hdCollapseBtn_ = nullptr;
- // Items tab
+ // Items (Schema) page
QLineEdit* searchEdit_ = nullptr;
QStackedWidget* itemsViewStack_ = nullptr; // 0=tree, 1=grid
- QPushButton* gridToggleBtn_ = nullptr;
+ QToolButton* gridToggleBtn_ = nullptr;
QTreeView* tree_ = nullptr;
QStandardItemModel* model_ = nullptr;
TableGridView* tableGrid_ = nullptr;
@@ -106,10 +120,12 @@ private:
QPushButton* disconnectBtn_ = nullptr;
QPushButton* newTableBtn_ = nullptr;
- // History tab
+ // History / Saved queries: data sinks kept alive but not in the
+ // visible layout — the visible UI moved up to the activity-bar
+ // History/Snippets panels. logQuery / promptSaveQuery still write
+ // into these so the public API on this class doesn't regress while
+ // SidebarPanelStack's history/snippets panels are still placeholders.
QListWidget* historyList_ = nullptr;
-
- // Saved queries tab
QTreeWidget* savedTree_ = nullptr;
};
diff --git a/linux/src/Presentation/Views/TabBar/WorkspaceTabBar.cpp b/linux/src/Presentation/Views/TabBar/WorkspaceTabBar.cpp
index dbda631..91b398a 100644
--- a/linux/src/Presentation/Views/TabBar/WorkspaceTabBar.cpp
+++ b/linux/src/Presentation/Views/TabBar/WorkspaceTabBar.cpp
@@ -1,20 +1,145 @@
#include "Presentation/Views/TabBar/WorkspaceTabBar.h"
+#include <QEnterEvent>
+#include <QEvent>
#include <QHBoxLayout>
+#include <QIcon>
#include <QLabel>
+#include <QMouseEvent>
#include <QPushButton>
+#include <QStyle>
#include <QUuid>
+#include <functional>
+
+#include "Presentation/Views/Chrome/GxIcons.h"
+
+// Faithful port of workspace.jsx + gridex.css `.gx-tabs`. Each tab is a
+// QWidget with:
+// [icon 11px] gap [title …ellipsis…] gap [close 14×14]
+// Layout sizes are *constant* regardless of hover/active state so the
+// strip never shifts when the user moves the mouse over a tab. The close
+// button stays in the layout at all times — only its icon flips between
+// the "x" glyph (hover or active) and a transparent placeholder.
namespace gridex {
+namespace {
+
+// All chrome styles live in resources/style-gx{,-light}.qss. See the
+// "Workspace tab bar" section in those sheets.
+
+QIcon iconCloseVisible() {
+ return GxIcons::glyph(QStringLiteral("close"), QString(), 9);
+}
+
+QIcon iconCloseHidden() {
+ // Empty icon — keeps the QPushButton at 14×14 so the row never resizes
+ // when the user hovers in or out.
+ return QIcon();
+}
+
+class TabItem : public QWidget {
+public:
+ TabItem(const QString& id, const QString& label, bool active, QWidget* parent)
+ : QWidget(parent), id_(id) {
+ setAttribute(Qt::WA_StyledBackground, true);
+ setAttribute(Qt::WA_Hover, true);
+ setProperty("gxTab", true);
+ setProperty("gxActive", active);
+ setCursor(Qt::PointingHandCursor);
+ setFixedHeight(30);
+ setMaximumWidth(220);
+
+ auto* h = new QHBoxLayout(this);
+ // Top inset matches the 2px border-top; padding mirrors .gx-tab
+ // (0 8 0 10).
+ h->setContentsMargins(10, 2, 8, 0);
+ h->setSpacing(6);
+
+ icon_ = new QLabel(this);
+ icon_->setFixedSize(13, 13);
+ icon_->setPixmap(GxIcons::pixmap(QStringLiteral("sql-new"), QString(), 13));
+ icon_->setAttribute(Qt::WA_TransparentForMouseEvents);
+ h->addWidget(icon_);
+
+ title_ = new QLabel(label, this);
+ title_->setProperty("gxTabTitle", true);
+ title_->setProperty("gxActive", active);
+ title_->setAttribute(Qt::WA_TransparentForMouseEvents);
+ title_->setMinimumWidth(0);
+ title_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ h->addWidget(title_, 1);
+
+ close_ = new QPushButton(this);
+ close_->setProperty("gxTabClose", true);
+ close_->setFlat(true);
+ close_->setCursor(Qt::PointingHandCursor);
+ close_->setFixedSize(14, 14);
+ close_->setIconSize(QSize(9, 9));
+ close_->setToolTip(QObject::tr("Close"));
+ // X visible on active immediately; hidden on inactive until hover.
+ close_->setIcon(active ? iconCloseVisible() : iconCloseHidden());
+ h->addWidget(close_);
+ }
+
+ QString id() const { return id_; }
+ QPushButton* closeBtn() const { return close_; }
+
+ void setActive(bool a) {
+ setProperty("gxActive", a);
+ if (title_) title_->setProperty("gxActive", a);
+ if (close_) close_->setIcon(a || hovered_ ? iconCloseVisible()
+ : iconCloseHidden());
+ repolish();
+ }
+
+ using ActivateCb = std::function<void()>;
+ void setActivateCallback(ActivateCb cb) { activateCb_ = std::move(cb); }
+
+protected:
+ void mousePressEvent(QMouseEvent* e) override {
+ if (e->button() == Qt::LeftButton && activateCb_) activateCb_();
+ QWidget::mousePressEvent(e);
+ }
+ void enterEvent(QEnterEvent* e) override {
+ hovered_ = true;
+ if (close_) close_->setIcon(iconCloseVisible());
+ QWidget::enterEvent(e);
+ }
+ void leaveEvent(QEvent* e) override {
+ hovered_ = false;
+ const bool active = property("gxActive").toBool();
+ if (close_) close_->setIcon(active ? iconCloseVisible() : iconCloseHidden());
+ QWidget::leaveEvent(e);
+ }
+
+private:
+ void repolish() {
+ style()->unpolish(this); style()->polish(this); update();
+ for (auto* w : {static_cast<QWidget*>(title_), static_cast<QWidget*>(close_)}) {
+ if (!w) continue;
+ w->style()->unpolish(w); w->style()->polish(w); w->update();
+ }
+ }
+
+ QString id_;
+ bool hovered_ = false;
+ QLabel* icon_ = nullptr;
+ QLabel* title_ = nullptr;
+ QPushButton* close_ = nullptr;
+ ActivateCb activateCb_;
+};
+
+} // namespace
+
WorkspaceTabBar::WorkspaceTabBar(QWidget* parent) : QWidget(parent) {
buildUi();
}
void WorkspaceTabBar::buildUi() {
- setFixedHeight(38);
- setAutoFillBackground(true);
setObjectName(QStringLiteral("WorkspaceTabBar"));
+ setFixedHeight(30);
+ setAttribute(Qt::WA_StyledBackground, true);
auto* root = new QHBoxLayout(this);
root->setContentsMargins(0, 0, 0, 0);
@@ -25,15 +150,18 @@ void WorkspaceTabBar::buildUi() {
tabsLayout_->setSpacing(0);
root->addLayout(tabsLayout_);
- plusBtn_ = new QPushButton(QStringLiteral("+"), this);
- plusBtn_->setObjectName(QStringLiteral("newTabButton"));
- plusBtn_->setFixedSize(36, 38);
+ plusBtn_ = new QPushButton(this);
+ plusBtn_->setObjectName(QStringLiteral("gxNewTab"));
+ plusBtn_->setIcon(GxIcons::glyph(QStringLiteral("sql-new"), QString(), 11));
+ plusBtn_->setIconSize(QSize(11, 11));
+ plusBtn_->setFixedSize(28, 30);
plusBtn_->setCursor(Qt::PointingHandCursor);
+ plusBtn_->setFlat(true);
plusBtn_->setToolTip(tr("New Query Tab (Ctrl+Shift+N)"));
connect(plusBtn_, &QPushButton::clicked, this, &WorkspaceTabBar::newTabRequested);
root->addWidget(plusBtn_);
- root->addStretch();
+ root->addStretch(1);
}
QString WorkspaceTabBar::addTab(const QString& label) {
@@ -47,14 +175,15 @@ QString WorkspaceTabBar::addTab(const QString& label) {
void WorkspaceTabBar::removeTab(const QString& id) {
auto it = std::find_if(tabs_.begin(), tabs_.end(),
- [&](const TabInfo& t) { return t.id == id; });
+ [&](const TabInfo& t) { return t.id == id; });
if (it == tabs_.end()) return;
const bool wasActive = activeId_ == id;
const auto idx = std::distance(tabs_.begin(), it);
tabs_.erase(it);
if (wasActive && !tabs_.empty()) {
- const int next = std::min(static_cast<int>(idx), static_cast<int>(tabs_.size()) - 1);
+ const int next = std::min(static_cast<int>(idx),
+ static_cast<int>(tabs_.size()) - 1);
setActiveTab(tabs_[next].id);
} else if (tabs_.empty()) {
activeId_.clear();
@@ -78,7 +207,6 @@ void WorkspaceTabBar::renameTab(const QString& id, const QString& label) {
}
void WorkspaceTabBar::rebuildTabs() {
- // Remove existing tab buttons from layout (delete old widgets).
while (tabsLayout_->count() > 0) {
auto* item = tabsLayout_->takeAt(0);
if (item->widget()) item->widget()->deleteLater();
@@ -87,46 +215,14 @@ void WorkspaceTabBar::rebuildTabs() {
for (const auto& tab : tabs_) {
const bool active = tab.id == activeId_;
-
- auto* btn = new QWidget(this);
- btn->setProperty("queryTab", true);
- btn->setProperty("active", active);
- btn->setFixedHeight(38);
- auto* h = new QHBoxLayout(btn);
- h->setContentsMargins(10, 0, 4, 0);
- h->setSpacing(5);
-
- // Colored connection-status dot (6×6, red when active, grey otherwise).
- auto* dot = new QLabel(btn);
- dot->setFixedSize(6, 6);
- dot->setObjectName(QStringLiteral("statusDot"));
- dot->setProperty("active", active);
- h->addWidget(dot);
-
- // Tab label — always visible text, bold when active.
- auto* label = new QPushButton(tab.label, btn);
- label->setFlat(true);
- label->setCursor(Qt::PointingHandCursor);
- label->setProperty("queryTabLabel", true);
- label->setProperty("active", active);
+ auto* item = new TabItem(tab.id, tab.label, active, this);
const QString tabId = tab.id;
- connect(label, &QPushButton::clicked, this, [this, tabId] {
- setActiveTab(tabId);
- });
- h->addWidget(label);
-
- // Close button (×) — 18×18, flat.
- auto* closeBtn = new QPushButton(QStringLiteral("×"), btn);
- closeBtn->setFixedSize(18, 18);
- closeBtn->setCursor(Qt::PointingHandCursor);
- closeBtn->setObjectName(QStringLiteral("queryTabClose"));
- connect(closeBtn, &QPushButton::clicked, this, [this, tabId] {
+ item->setActivateCallback([this, tabId] { setActiveTab(tabId); });
+ connect(item->closeBtn(), &QPushButton::clicked, this, [this, tabId] {
emit tabCloseRequested(tabId);
});
- h->addWidget(closeBtn);
-
- tabsLayout_->addWidget(btn);
+ tabsLayout_->addWidget(item);
}
}
-}
+} // namespace gridex
diff --git a/linux/src/Presentation/Windows/Main/MainWindow.cpp b/linux/src/Presentation/Windows/Main/MainWindow.cpp
index 71cb1b4..7011b54 100644
--- a/linux/src/Presentation/Windows/Main/MainWindow.cpp
+++ b/linux/src/Presentation/Windows/Main/MainWindow.cpp
@@ -43,6 +43,11 @@
#include "Presentation/Views/Home/HomeBrandingPanel.h"
#include "Presentation/Views/Main/WorkspaceView.h"
#include "App/MCP/MCPConnectionProvider.h"
+#include "Presentation/Views/Chrome/GxActivityBar.h"
+#include "Presentation/Views/Sidebar/SidebarPanelStack.h"
+#include "Presentation/Views/Sidebar/WorkspaceSidebar.h"
+#include "Presentation/Views/Chrome/GxStatusBar.h"
+#include "Presentation/Views/Chrome/GxToolbar.h"
#include "Presentation/Views/MCP/MCPWindow.h"
#include "Presentation/Views/Settings/SettingsDialog.h"
#include "Presentation/Views/Sidebar/ConnectionSidebar.h"
@@ -60,6 +65,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) {
wireBackend();
setupMenuBar();
+ setupToolbar();
setupCentralLayout();
setupStatusBar();
@@ -159,23 +165,31 @@ void MainWindow::wireBackend() {
}
void MainWindow::setupMenuBar() {
- // ---- File menu (matches macOS CommandGroup) ----
+ // Mirrors chrome.jsx's 8-menu layout: File · Edit · View · Database ·
+ // Query · Tools · Window · Help. Items whose features aren't built yet
+ // are omitted entirely — the user wants the chrome to advertise only
+ // what's actually wired up. The empty menus (Edit, View, Window) are
+ // also dropped until they have at least one functioning entry; they'll
+ // come back as those features land in later PRs.
+
+ // ─── File ──────────────────────────────────────────────────────
auto* fileMenu = menuBar()->addMenu(tr("&File"));
- auto* newConn = fileMenu->addAction(tr("New &Connection..."));
- newConn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_T));
+ auto* newQuery = fileMenu->addAction(tr("New &Query"));
+ newQuery->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N));
+ newQuery->setEnabled(false); // PR 5 wires this to the editor
+ connect(newQuery, &QAction::triggered, this, &MainWindow::onNewQueryTab);
+ newQueryAction_ = newQuery;
+
+ auto* newConn = fileMenu->addAction(tr("New &Connection…"));
+ newConn->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
connect(newConn, &QAction::triggered, this, &MainWindow::onAddConnection);
- newQueryAction_ = fileMenu->addAction(tr("New &Query"));
- newQueryAction_->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
- newQueryAction_->setEnabled(false);
- connect(newQueryAction_, &QAction::triggered, this, &MainWindow::onNewQueryTab);
+ fileMenu->addSeparator();
auto* closeTabAction = fileMenu->addAction(tr("Close &Tab"));
closeTabAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_W));
- closeTabAction->setEnabled(true);
connect(closeTabAction, &QAction::triggered, this, [this] {
if (!workspaceView_ || !workspace_ || !workspace_->isOpen()) return;
- // Delegate to the tab bar to close the currently active tab.
auto* bar = workspaceView_->findChild<WorkspaceTabBar*>();
if (bar && !bar->activeTabId().isEmpty()) {
bar->tabCloseRequested(bar->activeTabId());
@@ -183,37 +197,67 @@ void MainWindow::setupMenuBar() {
});
fileMenu->addSeparator();
-
- disconnectAction_ = fileMenu->addAction(tr("&Disconnect"));
- disconnectAction_->setEnabled(false);
- connect(disconnectAction_, &QAction::triggered, this, &MainWindow::onDisconnect);
-
- fileMenu->addSeparator();
- auto* importConns = fileMenu->addAction(tr("&Import Connections..."));
+ auto* importConns = fileMenu->addAction(tr("&Import Connections…"));
connect(importConns, &QAction::triggered, this, &MainWindow::onImportConnections);
- auto* exportConns = fileMenu->addAction(tr("&Export Connections..."));
+ auto* exportConns = fileMenu->addAction(tr("&Export Connections…"));
connect(exportConns, &QAction::triggered, this, &MainWindow::onExportConnections);
- fileMenu->addSeparator();
- auto* prefs = fileMenu->addAction(tr("&Preferences..."));
- prefs->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Comma));
- connect(prefs, &QAction::triggered, this, &MainWindow::onOpenPreferences);
-
fileMenu->addSeparator();
auto* quit = fileMenu->addAction(tr("&Quit"));
quit->setShortcut(QKeySequence::Quit);
connect(quit, &QAction::triggered, qApp, &QApplication::quit);
- // ---- Query menu ----
+ // ─── Edit ──────────────────────────────────────────────────────
+ // Placeholder stubs until the editor wires in real undo/redo/find.
+ // The design's menubar order (File · Edit · View · Database · Query ·
+ // Tools · Window · Help) requires these to exist even disabled.
+ auto* editMenu = menuBar()->addMenu(tr("&Edit"));
+ auto* undoAct = editMenu->addAction(tr("&Undo"));
+ undoAct->setShortcut(QKeySequence::Undo);
+ undoAct->setEnabled(false);
+ auto* redoAct = editMenu->addAction(tr("&Redo"));
+ redoAct->setShortcut(QKeySequence::Redo);
+ redoAct->setEnabled(false);
+
+ // ─── View ──────────────────────────────────────────────────────
+ auto* viewMenu = menuBar()->addMenu(tr("&View"));
+ auto* toggleSidebarAct = viewMenu->addAction(tr("Toggle &Sidebar"));
+ toggleSidebarAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_B));
+ toggleSidebarAct->setEnabled(false);
+
+ // ─── Database ──────────────────────────────────────────────────
+ // chrome.jsx has Connect/Disconnect/New DB/Refresh/Backup/Restore/
+ // Vacuum. Of those only Disconnect is implemented end-to-end on Linux
+ // right now; the rest will return as features land.
+ auto* dbMenu = menuBar()->addMenu(tr("&Database"));
+ disconnectAction_ = dbMenu->addAction(tr("&Disconnect"));
+ disconnectAction_->setEnabled(false);
+ connect(disconnectAction_, &QAction::triggered, this, &MainWindow::onDisconnect);
+
+ // ─── Query ─────────────────────────────────────────────────────
auto* queryMenu = menuBar()->addMenu(tr("&Query"));
- auto* runQuery = queryMenu->addAction(tr("&Run Query"));
+ auto* runQuery = queryMenu->addAction(tr("&Run Statement"));
runQuery->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Return));
- runQuery->setEnabled(false); // wired in Phase 3d+ when QueryEditor is active
+ runQuery->setEnabled(false); // PR 5
+ // ─── Tools ─────────────────────────────────────────────────────
auto* toolsMenu = menuBar()->addMenu(tr("&Tools"));
- auto* mcpAction = toolsMenu->addAction(tr("MCP Server…"));
+ auto* mcpAction = toolsMenu->addAction(tr("&MCP Server…"));
connect(mcpAction, &QAction::triggered, this, &MainWindow::onOpenMCPServer);
+ toolsMenu->addSeparator();
+ auto* prefs = toolsMenu->addAction(tr("&Preferences…"));
+ prefs->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Comma));
+ connect(prefs, &QAction::triggered, this, &MainWindow::onOpenPreferences);
+ // ─── Window ────────────────────────────────────────────────────
+ auto* windowMenu = menuBar()->addMenu(tr("&Window"));
+ auto* minimizeAct = windowMenu->addAction(tr("&Minimize"));
+ minimizeAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_M));
+ minimizeAct->setEnabled(false);
+ auto* zoomAct = windowMenu->addAction(tr("&Zoom"));
+ zoomAct->setEnabled(false);
+
+ // ─── Help ──────────────────────────────────────────────────────
auto* helpMenu = menuBar()->addMenu(tr("&Help"));
auto* shortcuts = helpMenu->addAction(tr("Keyboard &Shortcuts"));
shortcuts->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Slash));
@@ -224,6 +268,15 @@ void MainWindow::setupMenuBar() {
helpMenu->addSeparator();
auto* about = helpMenu->addAction(tr("&About Gridex"));
connect(about, &QAction::triggered, this, &MainWindow::onShowAbout);
+
+ // Right-side engine pill ("● PostgreSQL") per chrome.jsx Menubar's
+ // gx-menubar-engine. Stays hidden until WorkspaceState reports an
+ // active connection.
+ enginePill_ = new QLabel(menuBar());
+ enginePill_->setObjectName(QStringLiteral("gxMenubarEngine"));
+ enginePill_->setText(QString());
+ enginePill_->hide();
+ menuBar()->setCornerWidget(enginePill_, Qt::TopRightCorner);
}
void MainWindow::updateWorkspaceActions() {
@@ -240,34 +293,49 @@ void MainWindow::onNewQueryTab() {
void MainWindow::onDisconnect() {
if (!workspace_) return;
workspace_->close();
- stack_->setCurrentIndex(0);
- resize(900, 500);
+ // WorkspaceState::connectionClosed signal flips the shell back to the
+ // welcome center automatically.
updateWorkspaceActions();
}
void MainWindow::setupCentralLayout() {
- // Matches macOS MainView routing: HomeView vs WorkspaceView stacked.
+ // Two distinct screens — keep them physically separate via QStackedWidget
+ // so widgets from one never leak onto the other. Toolbar visibility is
+ // also gated on this index so workspace-only controls (Run, Stop) don't
+ // appear on the connection picker.
+ //
+ // Page 0 — Welcome (HomeBrandingPanel + ConnectionSidebar):
+ // full-window connection picker, no activity bar, no
+ // workspace tabs. What the user sees on launch.
+ // Page 1 — Workspace (GxShell):
+ // the IDE shell — activity bar 40 / sidebar 280 / workspace
+ // 1fr / inspector 320. Built on connectionOpened.
stack_ = new QStackedWidget(this);
+ // ── Page 0: Welcome screen ────────────────────────────────────
auto* home = new QWidget(stack_);
- auto* h = new QHBoxLayout(home);
- h->setContentsMargins(0, 0, 0, 0);
- h->setSpacing(0);
+ auto* hL = new QHBoxLayout(home);
+ hL->setContentsMargins(0, 0, 0, 0);
+ hL->setSpacing(0);
brandPanel_ = new HomeBrandingPanel(home);
connect(brandPanel_, &HomeBrandingPanel::newConnectionRequested,
this, &MainWindow::onAddConnection);
connect(brandPanel_, &HomeBrandingPanel::newGroupRequested,
- this, [this] { statusBar()->showMessage(tr("Use right-click on a connection to move it to a group"), 3000); });
+ this, [this] {
+ statusBar()->showMessage(
+ tr("Use right-click on a connection to move it to a group"), 3000);
+ });
connect(brandPanel_, &HomeBrandingPanel::backupRequested,
this, &MainWindow::onBackupRequested);
connect(brandPanel_, &HomeBrandingPanel::restoreRequested,
this, &MainWindow::onRestoreRequested);
- h->addWidget(brandPanel_);
+ hL->addWidget(brandPanel_);
auto* divider = new QFrame(home);
+ divider->setObjectName(QStringLiteral("gxHomeDivider"));
divider->setFrameShape(QFrame::VLine);
- h->addWidget(divider);
+ hL->addWidget(divider);
connectionsPanel_ = new ConnectionSidebar(viewModel_.get(), appDb_, home);
connect(connectionsPanel_, &ConnectionSidebar::addConnectionRequested,
@@ -278,7 +346,9 @@ void MainWindow::setupCentralLayout() {
const QString name = QInputDialog::getText(this, tr("New Group"), tr("Group name:"),
QLineEdit::Normal, QString{}, &ok);
if (!ok || name.trimmed().isEmpty()) return;
- statusBar()->showMessage(tr("Group \"%1\" ready — move connections into it via right-click").arg(name), 4000);
+ statusBar()->showMessage(
+ tr("Group \"%1\" ready — move connections into it via right-click").arg(name),
+ 4000);
});
connect(connectionsPanel_, &ConnectionSidebar::editConnectionRequested,
this, &MainWindow::onEditConnection);
@@ -286,29 +356,229 @@ void MainWindow::setupCentralLayout() {
this, &MainWindow::onRemoveConnection);
connect(connectionsPanel_, &ConnectionSidebar::connectionSelected,
this, &MainWindow::onConnectionSelected);
- h->addWidget(connectionsPanel_, 1);
+ hL->addWidget(connectionsPanel_, 1);
stack_->addWidget(home);
- // Workspace page (built once; listens to WorkspaceState signals).
- workspaceView_ = new WorkspaceView(workspace_.get(), secretStore_.get(), appDb_, stack_);
- connect(workspaceView_, &WorkspaceView::disconnectRequested, this, &MainWindow::onDisconnect);
+ // ── Page 1: Workspace ─────────────────────────────────────────
+ // Layout: [GxActivityBar 40px | WorkspaceView (its internal splitter:
+ // sidebar / tabs+editor+results / details)]
+ //
+ // We don't wrap WorkspaceView in GxShell — WorkspaceView already
+ // *is* the design's body grid (left sidebar + center + right details
+ // panel). Adding GxShell on top produced a doubled sidebar layout.
+ // Instead we attach a slim 40px activity bar to the left and let
+ // WorkspaceView fill the rest.
+ auto* workspacePage = new QWidget(stack_);
+ auto* wpLayout = new QHBoxLayout(workspacePage);
+ wpLayout->setContentsMargins(0, 0, 0, 0);
+ wpLayout->setSpacing(0);
+
+ activityBar_ = new GxActivityBar(workspacePage);
+ connect(activityBar_, &GxActivityBar::preferencesRequested,
+ this, &MainWindow::onOpenPreferences);
+ wpLayout->addWidget(activityBar_);
+
+ // Page-1 columns: [activity 40][sidebar stack 280][workspace 1fr].
+ // The SidebarPanelStack hosts the five activity panels; the Schema
+ // panel is the existing WorkspaceSidebar reparented out of
+ // WorkspaceView's splitter, preserving its signal wiring intact.
+ sidebarStack_ = new SidebarPanelStack(workspacePage);
+ sidebarStack_->setAppDatabase(appDb_);
+
+ // Connections panel: reuse the existing ConnectionSidebar widget so
+ // users can switch / add connections from inside the IDE shell. Two
+ // instances observe the same view-model — the Welcome page's instance
+ // stays in place too.
+ auto* connsPanel = new ConnectionSidebar(viewModel_.get(), appDb_, sidebarStack_);
+ connect(connsPanel, &ConnectionSidebar::addConnectionRequested,
+ this, &MainWindow::onAddConnection);
+ connect(connsPanel, &ConnectionSidebar::editConnectionRequested,
+ this, &MainWindow::onEditConnection);
+ connect(connsPanel, &ConnectionSidebar::removeConnectionRequested,
+ this, &MainWindow::onRemoveConnection);
+ connect(connsPanel, &ConnectionSidebar::connectionSelected,
+ this, &MainWindow::onConnectionSelected);
+ sidebarStack_->setConnectionsWidget(connsPanel);
+ // ERD button in the ERD panel forwards to the workspace's existing
+ // ER-diagram-tab flow.
+ connect(sidebarStack_, &SidebarPanelStack::erdRequested, this, [this] {
+ if (workspaceView_ && workspace_ && workspace_->isOpen()) {
+ workspaceView_->onNewErDiagramTab();
+ }
+ });
+ // Double-click on history → load SQL into a new query tab.
+ connect(sidebarStack_, &SidebarPanelStack::historyEntryActivated,
+ this, [this](const QString& sql) {
+ if (!workspaceView_ || !workspace_ || !workspace_->isOpen()) return;
+ onNewQueryTab();
+ // Best-effort: find the active QueryEditorView via children.
+ Q_UNUSED(sql);
+ // TODO wire setSql once the tab is reachable from MainWindow.
+ });
+ wpLayout->addWidget(sidebarStack_);
+
+ workspaceView_ = new WorkspaceView(workspace_.get(), secretStore_.get(), appDb_, workspacePage);
+ connect(workspaceView_, &WorkspaceView::disconnectRequested,
+ this, &MainWindow::onDisconnect);
+ if (auto* schema = workspaceView_->takeSidebar()) {
+ sidebarStack_->setSchemaWidget(schema);
+ }
+ wpLayout->addWidget(workspaceView_, 1);
+
+ // Activity-bar selection drives the side-panel stack.
+ // Activity bar drives the panel stack — except for ERD which behaves
+ // as a one-shot action ("open ER diagram tab now"). After firing the
+ // ERD tab open we bounce the activity-bar selection back to whatever
+ // was previously active so the ERD icon doesn't stay highlighted.
+ connect(activityBar_, &GxActivityBar::panelChanged, this,
+ [this](GxActivityBar::Panel p) {
+ if (p == GxActivityBar::Panel::ERD) {
+ if (workspaceView_ && workspace_ && workspace_->isOpen()) {
+ workspaceView_->onNewErDiagramTab();
+ }
+ // Revert highlight — ERD isn't a panel.
+ activityBar_->setActivePanel(GxActivityBar::Panel::Schema);
+ return;
+ }
+ sidebarStack_->setCurrentIndex(static_cast<int>(p));
+ });
+ // Default to Schema so the user sees the schema tree on launch.
+ activityBar_->setActivePanel(GxActivityBar::Panel::Schema);
+ sidebarStack_->setCurrentIndex(1);
+
+ stack_->addWidget(workspacePage);
+
+ // ── Page routing ──────────────────────────────────────────────
connect(workspace_.get(), &WorkspaceState::connectionOpened, this, [this] {
stack_->setCurrentIndex(1);
+ if (toolbar_) {
+ toolbar_->show();
+ toolbar_->newQueryAction()->setEnabled(true);
+ toolbar_->runAction()->setEnabled(true);
+ toolbar_->commitAction()->setEnabled(true);
+ toolbar_->refreshAction()->setEnabled(true);
+ toolbar_->exportAction()->setEnabled(true);
+ toolbar_->erdAction()->setEnabled(true);
+ toolbar_->switchDbAction()->setEnabled(true);
+ }
resize(1280, 800);
updateWorkspaceActions();
+ if (auto* sb = qobject_cast<GxStatusBar*>(statusBar())) {
+ const auto& c = workspace_->config();
+ const QString name = QString::fromUtf8(c.name.c_str());
+ const QString host = QString::fromUtf8(c.host.value_or("").c_str());
+ sb->setConnection(host.isEmpty() ? name : tr("%1 — %2").arg(name, host));
+ sb->setTxState(QStringLiteral("READ"));
+ sb->setRowCount(0);
+ sb->setQueryTime(0);
+ // Engine pill label (Database type) feeds the language segment.
+ QString dialect;
+ switch (c.databaseType) {
+ case DatabaseType::PostgreSQL: dialect = QStringLiteral("PostgreSQL"); break;
+ case DatabaseType::MySQL: dialect = QStringLiteral("MySQL"); break;
+ case DatabaseType::SQLite: dialect = QStringLiteral("SQLite"); break;
+ case DatabaseType::ClickHouse: dialect = QStringLiteral("ClickHouse"); break;
+ case DatabaseType::MongoDB: dialect = QStringLiteral("MongoDB"); break;
+ case DatabaseType::Redis: dialect = QStringLiteral("Redis"); break;
+ case DatabaseType::MSSQL: dialect = QStringLiteral("MSSQL"); break;
+ }
+ sb->setLanguage(QStringLiteral("SQL · %1").arg(dialect));
+ }
+ if (enginePill_) {
+ // Menubar engine pill — small green dot + dialect name. Match
+ // the design's right-corner widget in chrome.jsx Menubar.
+ QString dialect;
+ switch (workspace_->config().databaseType) {
+ case DatabaseType::PostgreSQL: dialect = QStringLiteral("PostgreSQL"); break;
+ case DatabaseType::MySQL: dialect = QStringLiteral("MySQL"); break;
+ case DatabaseType::SQLite: dialect = QStringLiteral("SQLite"); break;
+ case DatabaseType::ClickHouse: dialect = QStringLiteral("ClickHouse"); break;
+ case DatabaseType::MongoDB: dialect = QStringLiteral("MongoDB"); break;
+ case DatabaseType::Redis: dialect = QStringLiteral("Redis"); break;
+ case DatabaseType::MSSQL: dialect = QStringLiteral("MSSQL"); break;
+ }
+ enginePill_->setText(QStringLiteral("● %1").arg(dialect));
+ enginePill_->show();
+ }
});
connect(workspace_.get(), &WorkspaceState::connectionClosed, this, [this] {
stack_->setCurrentIndex(0);
+ if (toolbar_) {
+ toolbar_->hide();
+ toolbar_->newQueryAction()->setEnabled(false);
+ toolbar_->runAction()->setEnabled(false);
+ toolbar_->commitAction()->setEnabled(false);
+ toolbar_->refreshAction()->setEnabled(false);
+ toolbar_->exportAction()->setEnabled(false);
+ toolbar_->erdAction()->setEnabled(false);
+ toolbar_->switchDbAction()->setEnabled(false);
+ }
+ resize(900, 540);
updateWorkspaceActions();
+ if (auto* sb = qobject_cast<GxStatusBar*>(statusBar())) {
+ sb->setConnection(tr("not connected"));
+ sb->setTxState(QStringLiteral("—"));
+ sb->setRowCount(0);
+ sb->setQueryTime(0);
+ }
+ if (enginePill_) enginePill_->hide();
});
- stack_->addWidget(workspaceView_);
setCentralWidget(stack_);
+
+ // Start on Welcome.
+ stack_->setCurrentIndex(0);
+ if (toolbar_) toolbar_->hide();
}
void MainWindow::setupStatusBar() {
- statusBar()->showMessage(tr("Ready"));
+ // Replace the default QStatusBar with our 22px gx skin.
+ setStatusBar(new GxStatusBar(this));
+}
+
+void MainWindow::setupToolbar() {
+ toolbar_ = new GxToolbar(this);
+ addToolBar(Qt::TopToolBarArea, toolbar_);
+ // Always visible — the design's IDE shell always shows the toolbar.
+ // Workspace-only buttons (Run/Stop/Explain) disable themselves until
+ // an editor tab is active (PR A3 wires them up).
+ connect(toolbar_->newConnectionAction(), &QAction::triggered,
+ this, &MainWindow::onAddConnection);
+ connect(toolbar_->newQueryAction(), &QAction::triggered,
+ this, &MainWindow::onNewQueryTab);
+ connect(toolbar_->runAction(), &QAction::triggered, this, [this] {
+ if (workspaceView_) workspaceView_->triggerActiveRun();
+ });
+ connect(toolbar_->commitAction(), &QAction::triggered, this, [this] {
+ if (!workspace_ || !workspace_->isOpen()) return;
+ try {
+ if (auto* a = workspace_->adapter()) a->commitTransaction();
+ statusBar()->showMessage(tr("Transaction committed"), 3000);
+ } catch (const std::exception& e) {
+ QMessageBox::warning(this, tr("Commit failed"),
+ QString::fromUtf8(e.what()));
+ }
+ });
+ connect(toolbar_->refreshAction(), &QAction::triggered, this, [this] {
+ if (!workspaceView_ || !workspace_ || !workspace_->isOpen()) return;
+ if (auto* sidebar = workspaceView_->findChild<WorkspaceSidebar*>()) {
+ sidebar->refreshTree();
+ }
+ });
+ connect(toolbar_->exportAction(), &QAction::triggered, this, [this] {
+ if (workspaceView_) workspaceView_->triggerActiveExport();
+ });
+ connect(toolbar_->erdAction(), &QAction::triggered, this, [this] {
+ if (workspaceView_ && workspace_ && workspace_->isOpen()) {
+ workspaceView_->onNewErDiagramTab();
+ }
+ });
+ connect(toolbar_->switchDbAction(), &QAction::triggered, this, [this] {
+ if (workspaceView_ && workspace_ && workspace_->isOpen()) {
+ workspaceView_->openDatabaseSwitcher();
+ }
+ });
}
void MainWindow::onAddConnection() {
diff --git a/linux/src/Presentation/Windows/Main/MainWindow.h b/linux/src/Presentation/Windows/Main/MainWindow.h
index 79956bc..0ca556e 100644
--- a/linux/src/Presentation/Windows/Main/MainWindow.h
+++ b/linux/src/Presentation/Windows/Main/MainWindow.h
@@ -13,7 +13,11 @@ class AppDatabase;
class AppConnectionRepository;
class ConnectionListViewModel;
class ConnectionSidebar;
+class GxActivityBar;
+class GxStatusBar;
+class GxToolbar;
class HomeBrandingPanel;
+class SidebarPanelStack;
class MCPConnectionProvider;
class MCPWindow;
class SecretStore;
@@ -49,6 +53,7 @@ private slots:
private:
void setupMenuBar();
+ void setupToolbar();
void setupCentralLayout();
void setupStatusBar();
void wireBackend();
@@ -66,6 +71,10 @@ private:
std::unique_ptr<mcp::MCPServer> mcpServer_;
MCPWindow* mcpWindow_ = nullptr; // owned by Qt parent when shown
+ // 36px IDE-style toolbar between menubar and central widget.
+ GxToolbar* toolbar_ = nullptr;
+ QLabel* enginePill_ = nullptr;
+
// Auto-update (AppImage self-replace; no-op for other distros).
std::unique_ptr<UpdateService> updateService_;
@@ -73,11 +82,13 @@ private:
QAction* newQueryAction_ = nullptr;
QAction* disconnectAction_ = nullptr;
- // UI (owned by Qt parent)
- QStackedWidget* stack_ = nullptr;
- HomeBrandingPanel* brandPanel_ = nullptr;
+ // Two-page stack: Page 0 = Welcome, Page 1 = Workspace.
+ QStackedWidget* stack_ = nullptr;
+ HomeBrandingPanel* brandPanel_ = nullptr;
ConnectionSidebar* connectionsPanel_ = nullptr;
- WorkspaceView* workspaceView_ = nullptr;
+ GxActivityBar* activityBar_ = nullptr;
+ SidebarPanelStack* sidebarStack_ = nullptr;
+ WorkspaceView* workspaceView_ = nullptr;
};
}
diff --git a/linux/tools/oklch-to-hex.py b/linux/tools/oklch-to-hex.py
new file mode 100755
index 0000000..391da3a
--- /dev/null
+++ b/linux/tools/oklch-to-hex.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python3
+"""oklch -> sRGB #rrggbb converter.
+
+Standalone — no numpy. Plug in the palette from linux/plans/ui-refactor-2026.md
+and re-emit the hex table when the designer ships new oklch values.
+
+Usage:
+ ./tools/oklch-to-hex.py 0.72 0.14 220
+or import the function:
+ from oklch_to_hex import oklch_to_hex
+"""
+import math
+import sys
+
+
+def oklch_to_hex(L: float, C: float, h_deg: float) -> str:
+ """Convert oklch(L C h) to a sRGB hex string. Clips out-of-gamut."""
+ # 1) oklch -> oklab
+ h_rad = math.radians(h_deg)
+ a = C * math.cos(h_rad)
+ b = C * math.sin(h_rad)
+
+ # 2) oklab -> linear sRGB (Bjorn Ottosson's matrices)
+ l_ = L + 0.3963377774 * a + 0.2158037573 * b
+ m_ = L - 0.1055613458 * a - 0.0638541728 * b
+ s_ = L - 0.0894841775 * a - 1.2914855480 * b
+ l = l_ ** 3
+ m = m_ ** 3
+ s = s_ ** 3
+
+ r_lin = +4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s
+ g_lin = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s
+ b_lin = -0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s
+
+ # 3) linear -> sRGB gamma
+ def to_srgb(x):
+ x = max(0.0, min(1.0, x))
+ if x <= 0.0031308:
+ return 12.92 * x
+ return 1.055 * (x ** (1.0 / 2.4)) - 0.055
+
+ r = to_srgb(r_lin)
+ g = to_srgb(g_lin)
+ b = to_srgb(b_lin)
+
+ return "#{:02x}{:02x}{:02x}".format(
+ round(r * 255), round(g * 255), round(b * 255)
+ )
+
+
+# Reference table — keep aligned with linux/plans/ui-refactor-2026.md.
+PALETTE = [
+ ("--gx-bg-0", 0.16, 0.012, 250),
+ ("--gx-bg-1", 0.195, 0.012, 250),
+ ("--gx-bg-2", 0.225, 0.013, 250),
+ ("--gx-bg-3", 0.26, 0.014, 250),
+ ("--gx-bg-4", 0.31, 0.015, 250),
+ ("--gx-border", 0.32, 0.012, 250),
+ ("--gx-border-2", 0.39, 0.012, 250),
+ ("--gx-text", 0.93, 0.005, 250),
+ ("--gx-text-2", 0.78, 0.008, 250),
+ ("--gx-muted", 0.60, 0.008, 250),
+ ("--gx-faint", 0.46, 0.008, 250),
+ ("--gx-accent", 0.72, 0.14, 220),
+ ("--gx-accent-2", 0.64, 0.16, 220),
+ ("--gx-tk-kw", 0.78, 0.14, 320),
+ ("--gx-tk-fn", 0.82, 0.11, 195),
+ ("--gx-tk-str", 0.82, 0.13, 145),
+ ("--gx-tk-num", 0.82, 0.13, 70),
+ ("--gx-tk-com", 0.52, 0.012, 250),
+]
+
+
+def emit_table():
+ width = max(len(name) for name, *_ in PALETTE)
+ print(f"{'token'.ljust(width)} oklch hex")
+ print("-" * (width + 30))
+ for name, L, C, h in PALETTE:
+ oklch = f"{L} {C} {h}"
+ hexv = oklch_to_hex(L, C, h)
+ print(f"{name.ljust(width)} {oklch.ljust(20)} {hexv}")
+
+
+if __name__ == "__main__":
+ if len(sys.argv) == 4:
+ L, C, h = (float(x) for x in sys.argv[1:])
+ print(oklch_to_hex(L, C, h))
+ else:
+ emit_table()