Skip to content

Add MDK-based multimedia player plugin - #25

Open
pplupo wants to merge 227 commits into
doublecmd:masterfrom
pplupo:mdk
Open

Add MDK-based multimedia player plugin#25
pplupo wants to merge 227 commits into
doublecmd:masterfrom
pplupo:mdk

Conversation

@pplupo

@pplupo pplupo commented May 12, 2026

Copy link
Copy Markdown
Contributor

Description:
This PR adds a new WLX plugin powered by the MDK SDK and pure Qt6. It is designed to be a high-performance alternative for previewing a wide array of video and audio formats without suffering from the LCL/Qt6 compatibility crashes often seen on Wayland.

Key Features:

  • Out-of-Process Isolation: Dynamically loads MDK via dlopen to prevent dependency conflicts with the host application.
  • Hardware Acceleration: Automatically attempts to use VAAPI, VDPAU, CUDA, etc.
  • Includes a built-in control bar with playback controls and a seek slider.

Recent Updates:

  • Integrated into the root build.sh script to automate building and release packaging.

Changes included:

  • C++ and Pascal source files.
  • Lazarus project files for the Pascal wrapper.
  • Makefile for compilation.
  • Comprehensive documentation including a technical proposal.

pplupo and others added 30 commits May 12, 2026 10:08
This commit introduces the mpv_wayland WLX (Lister) plugin for Double
Commander. It enables native video playback in the Quick View panel
using the libmpv Render API and QOpenGLWidget. It is specifically
designed for seamless integration on Wayland and HiDPI displays.

Committed files:
- Source code (src/) implementing Qt6/mpv integration
- SDK headers (sdk/) for plugin interface
- CMakeLists.txt for build configuration
- README.md with installation instructions and embedded screenshot
- mpv_wayland.png screenshot asset
- Integration into root build.sh for automated release packaging
This commit introduces the MDK WLX plugin, a high-performance media
viewer powered by the MDK SDK and pure Qt6. It allows instant preview
of video and audio files. A key feature is its out-of-process isolation
via dlopen, ensuring that MDK's dependencies do not conflict with
Double Commander.

Committed files:
- C++ source (plugin.cpp) and Pascal wrappers (mdk.pas, etc.)
- Lazarus project files (.lpi, .lpr)
- Makefile for building the C++ shared object
- SDK headers (sdk/)
- README.md and proposal.md documentation
- Integration into root build.sh for automated release packaging
This commit introduces a specialized log viewer WLX plugin built with
Qt6 and C++20. It is designed to handle massive log files without
freezing Double Commander, utilizing zero-copy file loading (mmap),
fast regex searching (RE2), and a robust focus-isolation architecture
for Wayland.

Committed files:
- Source code (src/) for the log model and viewer widget
- CMakeLists.txt for build configuration
- README.md and detailed design doc (double commander wlx log viewer.md)
- logviewer.png screenshot asset
- Integration into root build.sh for automated release packaging
This commit introduces the kpart WLX plugin. It acts as a host for
KDE KParts, effectively allowing Double Commander to leverage any
installed KDE viewer (like Okular for PDFs or LibreOffice for docs)
directly within the Quick View panel natively on Wayland/Qt6.

Committed files:
- Source code (src/) for KPart hosting logic
- SDK headers (sdk/)
- CMakeLists.txt for build configuration
- README.md with screenshots
- test.svg and screenshot assets (kpart_md.png, kpart_svg.png)
- Integration into root build.sh for automated release packaging
…ete row editing, TSV support, and context menu

- Display CSV/TSV files in an interactive QTableWidget grid
- Auto-detect separator (comma, semicolon, tab); fall back to file extension
- Header Row toggle button: interprets first line as header or data row,
  reloads file on toggle; controls whether copies include the header line
- Ctrl+C: copy selection as TSV (includes header when Header Row is on)
- Right-click context menu: Copy as TSV, Copy as CSV, Delete Selected Rows,
  Insert from Clipboard
- Ctrl+V: insert clipboard rows at selected position; validates column count;
  skips clipboard header line when it matches the current header (Header Row on)
- Delete: remove selected rows
- Ctrl+S: save file; correctly handles editing vs non-editing state without
  disturbing Double Commander focus
- Inline cell editing with Save / Save As / Reload toolbar actions
- Enca encoding auto-detection with Glib conversion fallback
- Double-quoted field parsing per CSV RFC
- F7 search support
- Full README with screenshots, feature docs, and configuration reference
- Attribution to original author j2969719
…nd highlighting

- Export ListSetDefaultParams to retrieve and bind the host's INI file path.
- Add HighlightRule structure and fast RE2-based line matching directly on memory-mapped offsets.
- Create Highlighting Rules SettingsDialog modal with an inline-colored rules list.
- Enable ExtendedSelection on the rules list to support deleting or moving multiple rules up/down, maintaining selection state using QItemSelectionModel.
- Connect double-click on any rule row to open the editing window.
- Write Foreground/Background labels above color picker buttons in RuleDialog.
- Implement session persistence under [HighlightRules] in the INI file.
- Prevent default rules from overriding empty rule configurations on restart.
- Add context-aware "Add Default Rules" button to prepend default log levels relative to the current selection.
- Create sample.log matching each level for diagnostics.
This commit introduces a premium editor WLX plugin based on Native Qt6
and KDE's KTextEditor framework. It brings full syntax highlighting,
code folding, and advanced editing capabilities to Double Commander's
viewer panel without LCL compatibility crashes on Wayland.

Committed files:
- Source code (src/) wrapping KTextEditor
- CMakeLists.txt for build configuration
- README.md with screenshots
- defects.md tracking known issues and resolutions
- Screenshot assets (kate_java.png, kate_md.png, kate_py.png)
- Integration into root build.sh for automated release packaging
…yles, preserve selection, and fix Proper/Title Case logic
…nd highlighting

- Export ListSetDefaultParams to retrieve and bind the host's INI file path.
- Add HighlightRule structure and fast RE2-based line matching directly on memory-mapped offsets.
- Create Highlighting Rules SettingsDialog modal with an inline-colored rules list.
- Enable ExtendedSelection on the rules list to support deleting or moving multiple rules up/down, maintaining selection state using QItemSelectionModel.
- Connect double-click on any rule row to open the editing window.
- Write Foreground/Background labels above color picker buttons in RuleDialog.
- Implement session persistence under [HighlightRules] in the INI file.
- Prevent default rules from overriding empty rule configurations on restart.
- Add context-aware "Add Default Rules" button to prepend default log levels relative to the current selection.
- Create sample.log matching each level for diagnostics.
Manually merged unique changes from all editor-related branches:

- editor-features: focus management (NoFocus on menuBar, focus restoration,
  focus-stealing prevention), Save/Save As/Save Copy As actions with toolbar
  button, Print action with toolbar button, font zoom controls (Ctrl++/Ctrl+-/
  Ctrl+0) with native KTE action fallback, Force RTL Direction toggle, Ctrl+Shift+S
  Save As shortcut precedence fix, QTimer-based focus restoration

- kate-case-conversion: Capitalization submenu replacing flat menu items,
  improved Title Case with minor-word handling, fixed Proper Case (toLower
  instead of preserve), renamed snail_case to snake_case, added PascalCase,
  SCREAMING_SNAKE_CASE, kebab-case, Sentence case, SCREAMING-KEBAB-CASE,
  dot.case, path/case, replaceSelectionPreservingRange helper to restore
  selection after text replacement

- fix-redo-and-write-lock: Ctrl+Shift+Z redo shortcut (in addition to Ctrl+Y),
  extracted toggleReadOnly() helper, Alt+Shift+R shortcut for read-only toggle,
  fixed double-trigger bug by switching QAction::toggled to QAction::triggered,
  added shortcut labels to read-only menu action
…agation

- Remove non-standard `lc_focus` definition from `sdk/wlxplugin.h` and its handler in `wlx_plugin.cpp`.

- Remove custom `hostSetFocus` method from `EditorWidget`.

- Set the editor view as the focus proxy for the main widget.

- Use native Qt event filtering and focus change listeners to handle active state transitions.
This makes the plugin standalone by compiling and linking libenca statically, removing the need for users to manually install libenca.so.0.
Adds ability to insert empty rows or clipboard rows above/below current selection or clicked row.
pplupo and others added 30 commits July 13, 2026 10:20
Signed-off-by: Peter P. Lupo <pplupo@gmail.com>
Signed-off-by: Peter P. Lupo <pplupo@gmail.com>
Focus/input:
- Add lc_focus (5) to the shared wlxplugin.h SDK header, previously missing
  entirely on this branch, so ListSendCommand could handle DC's focus
  hand-off signal at all.
- Port QtWlPlugin::FocusManager (from wayland_qt_base) into officeview for
  both the x2t/PdfViewerWidget and LibreOfficeKit/LOKContainerWidget paths,
  replacing ad-hoc focus handling that left keyboard shortcuts and panel
  switching unreliable.
- Fix a click-activation bug where the ancestry check used the wrong
  QObject in the propagation chain (QWidgetWindow isn't a QWidget), causing
  some documents to require two clicks before Ctrl+C worked.
- Add a grace-period guard (setActiveFromHost) so DC's own lc_focus(0)
  can't immediately undo a legitimate click-based activation.
- Retry LOK's getTextSelection after SelectAll instead of a single fixed
  wait, fixing intermittent empty-clipboard copies.
- Scope LOK copy/context-menu actions to the specific sheet/slide clicked
  or currently visible, instead of whatever part LOK's internal cursor
  last happened to be on.

Rendering:
- Give ODF documents their own LibreOfficeKit-side zoom, copy, and context
  menu instead of silently borrowing x2t's, since ODF stays on LibreOffice
  deliberately (better fidelity than x2t for this format family).
- Fix spreadsheet sheet-tab extraction to exclude hidden sheets, which
  otherwise mismatched x2t's actual visible-sheet PDF output and silently
  hid the tab bar.
- Add per-sheet pagination for xlsx/xlsm: convert each sheet separately
  (patching its own temp copy's activeTab so x2t paginates it fully,
  instead of squeezing every sheet onto a single page via printPages:all)
  and merge with qpdf, tracking real per-sheet start pages instead of
  assuming one page per sheet.
- Switch the PDF view to always use MultiPage mode; SinglePage mode hid a
  sheet's later pages behind the tab bar with no obvious way to reach them.
- Apply 2x supersampled LOK tile rendering to reduce font aliasing.

Config:
- Add a per-extension file size limit (officeview.conf), skipping
  conversion entirely for files over the limit; 0 disables an extension.
- Restructure officeview.conf into [Paths]/[Engines]/[FileSizeLimits]
  sections (previously a flat list that only grew entries lazily, so it
  never had all supported extensions) with paths first and a comment
  explaining the size-limit semantics.

Signed-off-by: Peter P. Lupo <pplupo@gmail.com>
QPdfView's page-layout/coordinate-mapping internals are private API with
no public hook to map a click to a page + point-within-page, which meant
copy was limited to whole-page/whole-selection text with no way to
highlight or select an arbitrary run of text. MuPDF's structured-text API
(fz_highlight_selection / fz_copy_selection) exposes that directly.

- Add MuPdfWidget/MuPdfContainerWidget, mirroring LOKWidget/
  LOKContainerWidget's structure (continuous page stacking, only visible
  pages rendered, same FocusManager/zoom/wheel-event wiring) so all three
  rendering paths share one interface for ListSendCommand.
- Remove PdfViewerWidget and the Qt6::Pdf/PdfWidgets dependency entirely;
  replace the one QPdfDocument use (page counting for the per-sheet merge
  pipeline) with a small MuPDF-based helper.
- Fix tab-bar desync: sheetStartPages holds page *indices*, but three
  places compared it directly against the scrollbar's pixel position, so
  a few pixels of scroll could exceed a page-index number like 14 or 15
  and snap the active tab to the last sheet. Convert through
  pageYOffset()/pageAtY() so both sides of every comparison share units.
- Fix font aliasing on fractional-scaling displays: page rendering had no
  devicePixelRatio handling, so Qt stretched the under-resolution image up
  to fill the widget's real physical pixels. Render at
  zoom*devicePixelRatioF() and mark the QImage's devicePixelRatio so Qt
  draws it 1:1 instead of scaling it.

Links dynamically against the system libmupdf for now; static linking is
a separate follow-up.

Signed-off-by: Peter P. Lupo <pplupo@gmail.com>
Also update the compiled binary to match the current MuPDF-based build.

Signed-off-by: Peter P. Lupo <pplupo@gmail.com>
rclone's Google Drive VFS mount leaves native Google Docs/Sheets/Slides
as 0-byte stub files on disk, since it can't materialize their content
transparently on read like a regular file. When ListLoad hits a 0-byte
file for a supported extension, it now checks /proc/mounts for a
covering fuse.rclone mount, and if found runs `rclone copyto` to export
the real content before handing it to the usual OOXML/ODF rendering
path. If the file isn't under an rclone mount, it fails gracefully
with a short message instead of trying to render nothing.

Google Drive exports get their own independently configurable engine
preference (EngineForGDrive), and any of the four Engines keys can now
be set to Disabled to skip that format family entirely.

The file-size-limit disable sentinel changes from 0 to -1, since 0 is
now a legitimate size for an unmaterialized rclone stub rather than
something to reject outright.

README updated to document all of the above.

Signed-off-by: Peter P. Lupo <pplupo@gmail.com>
Per the GTK porting plan's de-Qtify phase (§2.1): mdk was already the
lowest-Qt-coupling plugin in the suite (its libmdk usage went through a
plain dlopen/dlsym wrapper, not through any Qt SQL/model machinery), but
that wrapper and all mdkPlayerAPI lifecycle/control logic lived inline in
the Qt6 QOpenGLWidget file itself, with no separated core and no CMake
build at all (just a bare Makefile hardcoded to one machine's paths).

- Extract MdkEngine (src/core/MdkEngine.{h,cpp}): the dlopen loader,
  mdkPlayerAPI lifecycle, and all playback control (play/pause/seek/
  loop/position/duration). Zero Qt — verified via `nm` on the built
  static lib (0 Qt/QObject/QWidget symbols). Rendering itself stays
  toolkit-specific by design: the core just forwards a caller-populated
  mdkRenderAPI struct through to libmdk, since building that struct
  requires a live GL context from whichever widget owns the surface.

- src/qt6/plugin_qt6.cpp: same QOpenGLWidget/UI code as before, now using
  MdkEngine instead of inline dlopen/mdkPlayerAPI calls. Behavior
  unchanged — same dlopen search order, same VAAPI/VDPAU/CUDA/dav1d/
  FFmpeg decoder priority list, same GL render API setup.

- Add a proper CMakeLists.txt (ENABLE_QT6/ENABLE_GTK3 options, matching
  the pattern used by other plugins) replacing the old bare Makefile,
  which hardcoded one developer's home directory paths and had no GTK
  path at all. GTK3 variant left as a not-yet-implemented FATAL_ERROR
  stub for the next commit.

Verified: full build succeeds (mdk_core static lib + mdk_qt6.wlx), and
mdk_qt6.wlx's dynamic dependencies are unchanged from before (Qt6 +
OpenGL only — libmdk itself is still dlopen'd at runtime, not linked).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Second half of the plugin's two-commit workflow (de-Qtify landed in
9e14672). Adds src/gtk3/plugin_gtk3.cpp: a GtkGLArea-based video widget
plus transport controls (play/pause, loop toggle, seek scale, time
label), built entirely on MdkEngine — the same core used by the Qt6
build, unmodified.

Notable GTK-specific pieces:
- Frame-ready notifications from MDK's internal thread are marshaled
  onto the GLib main loop via g_idle_add (GTK's equivalent of Qt's
  QMetaObject::invokeMethod(..., Qt::QueuedConnection)), guarded by a
  weak_ptr "alive" flag since GTK has no automatic signal/slot
  disconnection on object teardown the way Qt does.
- Player lifetime is tied to the root GtkWidget via
  g_object_set_data_full, so ListCloseWindow's gtk_widget_destroy()
  drives all cleanup (GL context teardown, timer removal) from one place.
- render API setup (mdkGLRenderAPI) mirrors the Qt6 build's fields
  exactly; opaque is only used by MDK's optional getProcAddress/
  getCurrentNativeContext callbacks, neither of which either build sets,
  so its exact value doesn't affect correctness here.

Enabled ENABLE_GTK3 by default in CMakeLists.txt, replacing the
not-yet-implemented FATAL_ERROR stub.

Verified: mdk_gtk3.wlx builds and links clean. Confirmed via ldd that it
has ZERO Qt dependency — genuinely pure GTK (gtk+-3.0, glib, epoxy only).
This is the first plugin in the suite to actually achieve that; compare
markdownview_gtk3, which still transitively links the full Qt6 runtime
until its own de-Qtify lands.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
libmdk.so is a dlopen()-at-runtime soft dependency (MdkEngine.cpp) --
never vendored or linked against by this project -- and it isn't
packaged by apt on Ubuntu 24.04, the target GTK3 test environment.
Building mdk_wlx_gtk3 there just produces a plugin with nothing to
load against; DC's own error dialog reports it cleanly ("cannot open
shared object file") rather than crashing, but there's no way to
functionally test or ship it from this environment.

ENABLE_GTK3 now defaults OFF for this plugin specifically (every other
plugin's GTK3 default is untouched). Still buildable by anyone who has
the vendor lib installed via -DENABLE_GTK3=ON.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants