make bar look like the one from qutebrowser
This commit is contained in:
@@ -34,7 +34,7 @@ The only tests are the Rust crate's (`nix develop -c sh -c 'cd adblock && cargo
|
||||
4. Hint mode swallows every key.
|
||||
5. Normal mode goes to `handleNormalModeKey`. Bindings are `if (text == "x")` chains, and two-key sequences (`gg`) use `m_pendingKeys`.
|
||||
- **Never change the page's size from UI chrome.** Every view resize makes the page re-layout, which on YouTube visibly jumps the player.
|
||||
- `CompletionView` is not in the layout. It floats over the bottom of the view (`placeCompletion`, re-run on the view's `Resize`).
|
||||
- `CompletionView` and `MessageView` are not in the layout. They float over the bottom of the view (`placeCompletion` / `placeMessages`, re-run on the view's `Resize`; `MessageView` emits `changed()` when a message comes or goes).
|
||||
- `StatusBar` and `CommandLine` share one fixed height.
|
||||
- Open the command line only through `openCommandLine`, which hides the status bar *before* showing the command line. Showing a widget re-runs the layout at once, so the other order shrinks and regrows the page.
|
||||
- **`setMode` is where entering and leaving a mode takes effect.** It updates the status line and focus. Leaving `Hint` also runs the hint-clear script.
|
||||
@@ -65,7 +65,8 @@ The only tests are the Rust crate's (`nix develop -c sh -c 'cd adblock && cargo
|
||||
- **Hardening** (`src/hardening.cpp`): `applyToProfile` sets the restrictive `QWebEngineSettings` and the third-party cookie filter. The filter runs on the network thread and must stay a pure function. `main.cpp` applies it right after creating the profile, and warns in the first window if `sandboxDisabledReason` finds the sandbox off. `StatusBar::setUrl` takes a `QUrl` so it can mark plain-HTTP pages (`insecure` property).
|
||||
- **User agent** (`src/useragent.cpp`): `useragent::apply` sets the profile's UA string *and* its `QWebEngineClientHints`, so the two don't contradict each other. Chromium sends the low-entropy hints (brands, platform, mobile) even with `setAllClientHintsEnabled(false)`, so every preset sets a platform; the brand ("Google Chrome", "Microsoft Edge") goes in through `setFullVersionList`. Chrome-based presets use the engine's own major version. `:useragent` completion reuses `CompletionView` with name / string columns.
|
||||
- **Settings** live as constants in `src/config.h` (`config::kZoomDefault`, `config::kZoomLevels`, `kBlockThirdPartyCookies`, `kPdfViewer`, `kUserAgent`, `kScrollStepPx`), named after qutebrowser's settings, until there's a config file. Zoom is per window: `setZoom` / `zoomStep` in `BrowserWindow`, applied before the first load. QtWebEngine keeps a view's zoom across navigations, so it doesn't need re-applying.
|
||||
- The UI stylesheet is the `kStyleSheet` string in `src/main.cpp`. Widgets are styled by `objectName` and by dynamic properties: `StatusBar` toggles `error` and re-polishes the label to pick up the change.
|
||||
- The UI stylesheet is the `kStyleSheet` string in `src/main.cpp`, with qutebrowser's default colours; `@FONT@` is replaced with `config::kFont` (the hint script does the same in its CSS). Stylesheet fonts and colours don't propagate to child widgets, so rules name the labels (`QWidget#statusBar QLabel`). Widgets are styled by `objectName` and by dynamic properties, re-polished on change: the status bar's `mode` (insert turns it green), the URL label's `state` (`https`/`error`/`hover`) and a message's `level`.
|
||||
- **Status bar** (`StatusBar`) is laid out like qutebrowser's: mode, key string (`m_pendingKeys`), URL (an eliding label, so a long URL can't widen the window), scroll position, progress bar. All messages go through `BrowserWindow::showMessage` to the `MessageView`, never to the bar. The scroll position comes from `QWebEnginePage::scrollPosition`/`contentsSize`, which are in *zoomed* pixels like the view's height, not CSS pixels.
|
||||
|
||||
**Windows, not tabs.** att_browser deliberately has no tab bar, because the user's window manager does the tabbing. Map qutebrowser's tab features onto top-level windows: `d` closes the window, `O` / `:open -w` (or `-t`) opens a new one. Each `BrowserWindow` is one page, with `WA_DeleteOnClose`. All windows share a `Session` (profile, `AdBlocker`, `History`) that `main()` owns. After `app.exec()`, `main()` deletes any window still alive before the history and profile go away. `:quit` closes all windows; `:close` closes one.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user