Skip to content

Commit 5f22d37

Browse files
pir0c0pter0ruvnet
andcommitted
docs: refresh architecture section, document QuickLookActivation modes
- README "How It Works": reflect the refactor. New file list now includes quicklookcontroller, quicklookcontenthandler, and quicklookimagehandler. Modified-files list updates DolphinView to the narrow signal seam, adds DolphinTabPage (owns the per-tab controller + split-view retarget), and the kcfg entry. Architecture diagram redrawn around QuickLookController ⇒ overlay ⇒ polymorphic content handler, with the DolphinView seam split out. Step-by-step flow rewritten around aboutToActivateItem / consumeActivation / activeViewChanged instead of the old slotItemActivated surgery. - README + USAGE: add an Activation Mode section documenting QuickLookActivation=DoubleClickOnly (the default, bare double-click opens the preview) vs. PrimeThenDoubleClick (opt-in, Space-priming required). Scope: ~/.config/dolphinrc under [General]; close keys are the same in both modes. Co-Authored-By: claude-flow <ruv@ruv.net>
1 parent dfe0aea commit 5f22d37

2 files changed

Lines changed: 52 additions & 18 deletions

File tree

README.md

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ No external apps. No popups. Everything happens inside Dolphin.
100100
| Right-click while zoomed | Reset zoom to 1x |
101101
| Up/Down arrows (PDF) | Navigate pages |
102102

103+
## Activation Mode
104+
105+
The default is **double-click** — tap any supported file twice and the preview opens immediately. Single Space on a selected item is also accepted (as an opt-in "prime then double-click" flow for users who prefer an explicit arm-then-open gesture).
106+
107+
Set in `~/.config/dolphinrc` under `[General]`:
108+
109+
```ini
110+
[General]
111+
QuickLookActivation=DoubleClickOnly # default — double-click opens preview right away
112+
# QuickLookActivation=PrimeThenDoubleClick # opt-in — double-click only opens preview if Space was pressed first (otherwise normal open)
113+
```
114+
115+
Close keys (`Escape`, `Space`, double-click on the preview) are the same in both modes.
116+
103117
## Installation
104118

105119
### Quick Install (Recommended)
@@ -201,17 +215,22 @@ The patch adds new files and modifies existing ones in Dolphin's source:
201215

202216
| File | Purpose |
203217
|------|---------|
204-
| `src/views/quicklook/quicklookoverlay.h/cpp` | Overlay orchestrator: content loading, animation, rendering, input, zoom |
218+
| `src/views/quicklook/quicklookcontroller.h/cpp` | Owns the overlay, the Space-prime timer, and the container eventFilter; reattaches across panes in split view |
219+
| `src/views/quicklook/quicklookoverlay.h/cpp` | Overlay widget (pImpl'd): animation, rendering, input, zoom — dispatches to content handlers |
220+
| `src/views/quicklook/quicklookcontenthandler.h/cpp` | Abstract base for content backends (open / close / statusText / logicalContentSize …) |
221+
| `src/views/quicklook/quicklookimagehandler.h/cpp` | Image backend: progressive decode + async hi-res crossfade rerender |
222+
| `src/views/quicklook/quicklookpdfhandler.h/cpp` | PDF backend: Qt PDF rendering, page cache, async loading, password support |
223+
| `src/views/quicklook/quicklookmediahandler.h/cpp` | Media backend: video playback, audio with vinyl/FFT visualization |
205224
| `src/views/quicklook/quicklookconstants.h` | Shared layout constants (ContentPadding, BottomExtraSpace, FrameIntervalMs…) |
206-
| `src/views/quicklook/quicklookpdfhandler.h/cpp` | PDF engine: Qt PDF rendering, page cache, async loading, password support |
207-
| `src/views/quicklook/quicklookmediahandler.h/cpp` | Media engine: video playback, audio with vinyl/FFT visualization |
208225

209226
### Modified Files
210227

211228
| File | Change |
212229
|------|--------|
213-
| `src/views/dolphinview.h` | Added `QuickLookOverlay` member and forward declaration |
214-
| `src/views/dolphinview.cpp` | Intercepts double-click on supported files to show overlay instead of opening external app |
230+
| `src/views/dolphinview.h` | Narrow seam: `aboutToActivateItem` signal, `consumeActivation()` slot, `itemListContainer()` accessor — no `QuickLook` string anywhere in the class |
231+
| `src/views/dolphinview.cpp` | `slotItemActivated` emits `aboutToActivateItem` before the normal `itemActivated`, honours `consumeActivation()` |
232+
| `src/dolphintabpage.h/cpp` | Owns `std::unique_ptr<QuickLookController>` per tab; retargets it via `activeViewChanged` so split view just works |
233+
| `src/settings/dolphin_generalsettings.kcfg` | New `QuickLookActivation` enum (`DoubleClickOnly` default / `PrimeThenDoubleClick` opt-in) |
215234
| `src/CMakeLists.txt` | Added Quick Look sources, optional Qt PDF / Qt Multimedia |
216235
| `CMakeLists.txt` | Added optional `find_package` for Qt PDF and Qt Multimedia |
217236

@@ -220,23 +239,29 @@ The patch adds new files and modifies existing ones in Dolphin's source:
220239
### Architecture
221240

222241
```
223-
DolphinView
224-
└── m_topLayout (QVBoxLayout)
225-
└── m_container (KItemListContainer) <- file list lives here
226-
└── QuickLookOverlay <- our overlay, parented to container
227-
├── QPainter <- rendering (no OpenGL)
228-
├── QuickLookPdfHandler <- PDF engine (Qt PDF)
229-
└── QuickLookMediaHandler <- Video/audio engine (QtMultimedia)
242+
DolphinTabPage
243+
└── std::unique_ptr<QuickLookController> <- one per tab, split-view aware
244+
└── QuickLookOverlay <- pImpl'd widget, reparented to active pane's container
245+
└── QuickLookContentHandler * <- polymorphic slot
246+
├── QuickLookImageHandler <- images (QImageReader + progressive hi-res)
247+
├── QuickLookPdfHandler <- PDFs (Qt PDF)
248+
└── QuickLookMediaHandler <- video / audio (Qt Multimedia)
249+
250+
DolphinView <- narrow seam only
251+
+ Q_SIGNAL aboutToActivateItem(KFileItem) <- intercept point
252+
+ Q_SLOT consumeActivation() <- controller suppresses the default itemActivated
253+
+ accessor itemListContainer() <- controller uses it for reparenting + eventFilter
230254
```
231255

232256
When a supported file is double-clicked:
233257

234-
1. `DolphinView::slotItemActivated()` checks the MIME type
235-
2. If supported, `QuickLookOverlay::showPreview()` routes to the right handler (image / PDF / video / audio)
236-
3. The overlay resizes to fill the container and animates in (250ms cubic ease-out, scale 0.3→1.0)
237-
4. Content is rendered via QPainter and composited with background, shadow, and rounded corners
238-
5. The file list remains underneath — just covered by the overlay
239-
6. Double-click or `Escape` triggers `hidePreview()` which animates back out
258+
1. `DolphinView::slotItemActivated` emits `aboutToActivateItem(item)` *before* the normal `itemActivated` emit
259+
2. `QuickLookController::onAboutToActivateItem` checks the MIME type and activation mode (`DoubleClickOnly` always allows; `PrimeThenDoubleClick` requires a prior Space-press to arm the prime timer)
260+
3. If allowed, the controller reparents and resizes the overlay to the active pane's container, calls `QuickLookOverlay::showPreview(url)`, and on success calls `view->consumeActivation()` so the normal `itemActivated` emit is suppressed
261+
4. `QuickLookOverlay` routes through `QuickLookContentHandler *` to the right backend (image / PDF / video / audio) and animates in (250ms cubic ease-out, scale 0.3→1.0)
262+
5. Content renders via QPainter over the dark overlay with rounded corners and a dynamic shadow
263+
6. Double-click, `Escape`, or `Space` triggers `hidePreview()` which animates back out; on finish the overlay emits `previewClosed()` and releases content
264+
7. Split view: `DolphinTabPage::activeViewChanged` fires whenever the user toggles panes; the controller detaches from the old view, reparents the overlay to the new pane's container, and re-wires its eventFilter — no second overlay needed
240265

241266
## Supported Formats
242267

USAGE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ Supported content types:
3333

3434
If the file is not a supported type, Dolphin opens it normally with the default application.
3535

36+
### Activation Mode
37+
38+
| Mode | Behaviour | Set via `~/.config/dolphinrc` |
39+
|------|-----------|-------------------------------|
40+
| `DoubleClickOnly` (**default**) | Double-click opens the preview immediately | `QuickLookActivation=DoubleClickOnly` |
41+
| `PrimeThenDoubleClick` (opt-in) | Select the file, tap `Space` to arm, then double-click — a bare double-click opens the file normally | `QuickLookActivation=PrimeThenDoubleClick` |
42+
43+
Put the line under `[General]`. The prime timer auto-expires after a couple of seconds, so the armed state doesn't linger if you change your mind.
44+
3645
## Closing a Preview
3746

3847
Any of these will close the preview with a fade-out animation:

0 commit comments

Comments
 (0)