Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3600c4e
feat(reader): add OFD document support via rofd C ABI
Sep 7, 2026
6ffe7b4
build: depend on distro librofd-ffi packages for OFD support
Sep 9, 2026
b933a80
fix(sidebar): align thumbnail appearance with eye protection mode
Sep 9, 2026
a4df2dc
feat(ofd): integrate semantic text support
Sep 10, 2026
cb6c64d
fix(ofd): expose search in reader UI
Sep 10, 2026
b46b281
feat(ofd): render page regions with bounded memory
Sep 10, 2026
2db5d6f
feat(ofd): expose document metadata and identifiers
Sep 10, 2026
a62e17c
feat(ofd): surface document parsing warnings
Sep 10, 2026
43b1783
docs(ofd): record semantic text integration design and plan
Sep 11, 2026
dd71914
docs(ofd): define outline and page link integration
Sep 11, 2026
0a4db28
docs(ofd): plan navigation and page link integration
Sep 11, 2026
edf7931
feat(reader): add typed navigation targets and view calculations
Sep 11, 2026
73a4886
feat(ofd): adapt outline trees and navigation destinations
Sep 11, 2026
480271a
feat(reader): expose full OFD catalogs and typed navigation
Sep 11, 2026
6ad67a7
feat(ofd): connect page links to typed navigation
Sep 11, 2026
7e07bc2
docs(ofd): record navigation integration verification
Sep 11, 2026
57f1735
fix(reader): preserve explicit navigation during state restoration
Sep 11, 2026
362d900
test(sidebar): detect Qt version in focused appearance checks
Sep 11, 2026
1952fcb
docs(ofd): document post-rebase compatibility checks
Sep 11, 2026
5cdc915
[skip CI] Translate deepin-reader.ts in fi
transifex-integration[bot] Sep 2, 2026
4215f12
fix(reader): clamp OFD render slices to page canvas
add-uos Sep 14, 2026
7eb905e
chore(docs): remove non-standard docs/superpowers directory
add-uos Sep 14, 2026
5de3f0d
feat(batch-print): add headless batch print for pdf/docx/djvu/xps
pengfeixx Sep 15, 2026
8cd3399
fix(reader): pin render task lifetime to renderer ref and uuid
add-uos Sep 15, 2026
16be356
fix(database): synchronize cleanup of bookmarks and tab groups in orp…
add-uos Sep 15, 2026
506d798
fix(reader): invert sidebar thumbnails only under dark theme
add-uos Sep 15, 2026
9fc57e1
fix(batchprint): link OfdModel and rofd into batch print converter
add-uos Sep 15, 2026
5c62504
fix(icon): simplify import_photo svg structure
F-windy Aug 17, 2026
74f0aae
fix(icon): remove dead defs and invalid xlink:href
F-windy Aug 17, 2026
223d0b5
fix(icon): remove fill to resolve dark-theme overlap
F-windy Aug 17, 2026
720aa90
fix(icon): resolve dark-theme icon overlap via merged path
F-windy Aug 17, 2026
a0acd1b
fix(icon): add accessibility attributes to svg
F-windy Aug 17, 2026
92a7370
fix(sidebar): align catalog scrollbar to far-right edge
F-windy Aug 27, 2026
ae9cc07
fix(catalog): use default text color for page numbers
F-windy Aug 28, 2026
13821ae
chore: Update version to 6.6.0
add-uos Sep 17, 2026
2713c9e
fix(reader): correct null-page guard operator in render callback slots
pengfeixx Sep 18, 2026
8721086
fix: replace unsafe strcpy with memcpy in setLibNames
pengfeixx Sep 18, 2026
9e61ce2
fix: guard null sidebar pointer in setAlive close path
pengfeixx Sep 18, 2026
122ea00
fix(reader): guard null annotation and event pointers
pengfeixx Sep 20, 2026
e7bc32c
feat(build): add sources to rofd to support OFD
add-uos Sep 18, 2026
ac1d2d8
fix(batchprint): send DBus notification with correct argument signature
pengfeixx Sep 20, 2026
c2d5d95
chore: update version to 6.6.1
pengfeixx Sep 20, 2026
1ad0608
chore: migrate linglong packaging to declarative buildext apt deps
add-uos Sep 28, 2026
4cf24f8
test: add tests for deepin-reader batch 1 (7/7 classes)
add-uos Sep 29, 2026
b6349b0
chore: Update version to 6.6.2
add-uos Sep 29, 2026
9e1f6ad
fix: clear *pprocess when file copy fails in DocumentFactory::getDocu…
add-uos Sep 30, 2026
9061ecb
fix: walk the parent chain safely in CentralDocPage
add-uos Sep 30, 2026
97457f8
fix: correct batch print context menu text
pengfeixx Oct 9, 2026
78314f4
test: add tests for deepin-reader batch 2 (20 bugs, 38 cases)
add-uos Oct 9, 2026
b84d3e7
test(sidebar): isolate bookmark UT cases from shared test data
dengzhongyuan365-dev Oct 12, 2026
439f73c
docs(manual): update user manual for OFD support and new features
add-uos Oct 13, 2026
19f6d86
fix: replace function-static pinch state with member variables
add-uos Oct 10, 2026
df66b81
docs: declare DPdfDoc::page ownership contract in headers
add-uos Oct 10, 2026
d896442
fix: replace mechanical-safe Qt6 deprecated API usages
add-uos Oct 10, 2026
f92e8a4
[skip CI] Translate deepin-reader.ts in ru
transifex-integration[bot] Oct 8, 2026
5afe64b
fix: sync CMake version to 6.6.2
pengfeixx Oct 16, 2026
40e8563
chore: update version to 6.6.3
pengfeixx Oct 20, 2026
0d6a90c
fix(log): unify all logs to category appLog for DConfig filtering
add-uos Oct 20, 2026
94d0520
fix: shorten file manager batch print menu name
pengfeixx Oct 27, 2026
376999f
chore: update version to 6.6.4
pengfeixx Oct 29, 2026
08d0863
[skip CI] Translate deepin-reader.ts in pt
transifex-integration[bot] Nov 12, 2026
9d4f32e
[skip CI] Translate deepin-reader.ts in pt
transifex-integration[bot] Nov 12, 2026
927baf3
fix: skip fsync on network filesystem paths to prevent UI freeze
dengzhongyuan365-dev Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 3rdparty/deepin-pdfium/include/dpdfdoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class DPdfDoc : public QObject
/**
* @brief 创建新的page返回
* @param i
* @return
* @return 所有权归文档:返回的 DPdfPage 由文档缓存并在析构时释放,
* 调用方不得 delete(重复释放将导致 double-free)。
*/
DPdfPage *page(int i, qreal xRes, qreal yRes);

Expand Down
7 changes: 7 additions & 0 deletions 3rdparty/deepin-pdfium/include/dpdfpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
class DPdfAnnot;
class DPdfPagePrivate;
class DPdfDocHandler;
/**
* @brief PDF 页面对象
*
* 所有权契约:DPdfPage 实例由 DPdfDoc::page() 创建并缓存于文档内部,
* 生命周期由所属 DPdfDoc 管理(文档析构时统一释放)。
* 调用方不得 delete 该指针,否则将与文档析构产生双重释放。
*/
class DPdfPage : public QObject
{
Q_OBJECT
Expand Down
33 changes: 25 additions & 8 deletions 3rdparty/deepin-pdfium/src/dpdfdoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "dpdfdoc.h"
#include "dpdflog.h"
#include "dpdfpage.h"

#include "public/fpdfview.h"
Expand All @@ -20,6 +21,7 @@
#include <QFile>
#include <QTemporaryDir>
#include <QUuid>
#include <QStorageInfo>
#include <unistd.h>

/**
Expand Down Expand Up @@ -131,14 +133,14 @@ DPdfDoc::Status DPdfDocPrivate::loadFile(const QString &filePath, const QString

DPdfMutexLocker locker("DPdfDocPrivate::loadFile");

qDebug() << "deepin-pdfium正在加载PDF文档... 文档名称: " << filePath;
qCDebug(dpfLog) << "deepin-pdfium正在加载PDF文档... 文档名称: " << filePath;
void *ptr = FPDF_LoadDocument(m_filePath.toUtf8().constData(),
password.toUtf8().constData());

m_docHandler = static_cast<DPdfDocHandler *>(ptr);

m_status = m_docHandler ? DPdfDoc::SUCCESS : parseError(static_cast<int>(FPDF_GetLastError()));
qDebug() << "文档(" << filePath << ")文档加载状态: " << m_status;
qCDebug(dpfLog) << "文档(" << filePath << ")文档加载状态: " << m_status;

if (m_docHandler) {
m_pageCount = FPDF_GetPageCount(reinterpret_cast<FPDF_DOCUMENT>(m_docHandler));
Expand Down Expand Up @@ -202,7 +204,7 @@ bool DPdfDoc::isLinearized(const QString &fileName)
{
QFile file(fileName);
if (!file.open(QFile::ReadOnly)) {
qInfo() << "file open failed when isLinearized" << fileName;
qCInfo(dpfLog) << "file open failed when isLinearized" << fileName;
}
QByteArray content = file.readAll();
int len = content.length();
Expand Down Expand Up @@ -231,6 +233,19 @@ bool DPdfDoc::isLinearized(const QString &fileName)

static QFile saveWriter;

static bool isNetworkFileSystem(const QString &path)
{
if (path.contains(QLatin1String("/gvfs/")))
return true;

QStorageInfo storage(path);
QByteArray fsType = storage.fileSystemType();
if (fsType.contains("cifs") || fsType.contains("smb") || fsType.contains("fuse.gvfs"))
return true;

return false;
}

int writeFile(struct FPDF_FILEWRITE_* pThis, const void *pData, unsigned long size)
{
Q_UNUSED(pThis)
Expand Down Expand Up @@ -279,15 +294,15 @@ bool DPdfDoc::save()
// Rename original file to backup instead of deleting (avoids SMB file handle issues)
if (targetFile.exists()) {
if (!targetFile.rename(backupPath)) {
qWarning() << "Failed to rename original file to backup:" << targetPath;
qCWarning(dpfLog) << "Failed to rename original file to backup:" << targetPath;
return false;
}
}

// Write new file
QFile newFile(targetPath);
if (!newFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
qWarning() << "Failed to open file for writing:" << targetPath;
qCWarning(dpfLog) << "Failed to open file for writing:" << targetPath;
// Restore original file on failure
if (QFile::exists(backupPath)) {
QFile::rename(backupPath, targetPath);
Expand All @@ -296,7 +311,7 @@ bool DPdfDoc::save()
}

if (array.size() != newFile.write(array)) {
qWarning() << "Failed to write data to file:" << targetPath;
qCWarning(dpfLog) << "Failed to write data to file:" << targetPath;
result = false;
newFile.close();
newFile.remove();
Expand All @@ -308,7 +323,8 @@ bool DPdfDoc::save()
}

newFile.flush(); // Flush user buffer to kernel buffer
fsync(newFile.handle()); // Sync kernel buffer to disk
if (!isNetworkFileSystem(targetPath))
fsync(newFile.handle()); // Sync kernel buffer to disk (skip on network FS to avoid UI freeze)
newFile.close();

// Remove backup file after successful write
Expand All @@ -335,7 +351,8 @@ bool DPdfDoc::saveAs(const QString &filePath)
locker.unlock();

saveWriter.flush(); // Flush user buffer to kernel buffer
fsync(saveWriter.handle()); // Sync kernel buffer to disk
if (!isNetworkFileSystem(filePath))
fsync(saveWriter.handle()); // Sync kernel buffer to disk (skip on network FS to avoid UI freeze)
saveWriter.close();

return result;
Expand Down
9 changes: 6 additions & 3 deletions 3rdparty/deepin-pdfium/src/dpdfglobal.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

#include <QtCore>
#include <QString>
#include <QDebug>
#include "dpdfglobal.h"
#include "dpdflog.h"
#include "public/fpdfview.h"

#include <chardet.h>

Q_LOGGING_CATEGORY(dpfLog, "org.deepin.reader.pdfium")

static bool initialized = false;

const static DPdfGlobal instance = DPdfGlobal();
Expand Down Expand Up @@ -60,11 +63,11 @@ DPdfMutexLocker::DPdfMutexLocker(const QString &tmpLog): QMutexLocker<QRecursive
#endif
{
m_log = tmpLog;
qInfo() << m_log + " begin ";
qCInfo(dpfLog) << m_log + " begin ";
m_timer.start();
}

DPdfMutexLocker::~DPdfMutexLocker()
{
qInfo() << m_log + " end time = " << m_timer.elapsed();
qCInfo(dpfLog) << m_log + " end time = " << m_timer.elapsed();
}
14 changes: 14 additions & 0 deletions 3rdparty/deepin-pdfium/src/dpdflog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

#ifndef DPDFLOG_H
#define DPDFLOG_H

#include <QLoggingCategory>

// deepin-pdfium 日志分类:挂在 org.deepin.reader 前缀下,
// 可被 DConfig(log_rules) 的 org.deepin.reader* 通配规则统一过滤
Q_DECLARE_LOGGING_CATEGORY(dpfLog)

#endif // DPDFLOG_H
107 changes: 106 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13)

# 项目基本信息
project(deepin-reader
VERSION 1.0.0
VERSION ${VERSION}
DESCRIPTION "Deepin Document Viewer"
LANGUAGES CXX C
)
Expand Down Expand Up @@ -62,6 +62,105 @@ else()
unset(XPS_DEPS_CFLAGS_OTHER)
endif()

# OFD支持选项(依赖发行版提供的 rofd C ABI 库,见 debian/control 的 librofd-ffi-dev)
option(OFD_SUPPORT "Enable OFD document format support" ON)
set(ROFD_ROOT "" CACHE PATH "Path to the rofd repository checkout or install prefix, overrides the system install")

set(OFD_SUPPORT_RESOLVED ${OFD_SUPPORT})

if (OFD_SUPPORT)
# 默认走系统路径:librofd-ffi-dev 提供 /usr/include/rofd.h 与 lib/<multiarch>/librofd_ffi.so
set(ROFD_ROOT_HINTS "")
if (ROFD_ROOT)
list(APPEND ROFD_ROOT_HINTS ${ROFD_ROOT})
endif()
if (EXISTS "${CMAKE_SOURCE_DIR}/../rofd")
list(APPEND ROFD_ROOT_HINTS "${CMAKE_SOURCE_DIR}/../rofd")
endif()

set(ROFD_LIB_SUFFIXES target/release target/debug lib)
if (CMAKE_LIBRARY_ARCHITECTURE)
list(APPEND ROFD_LIB_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
endif()

find_path(ROFD_INCLUDE_DIR rofd.h
HINTS ${ROFD_ROOT_HINTS}
PATH_SUFFIXES crates/rofd-ffi/include include
)
find_library(ROFD_FFI_LIBRARY NAMES rofd_ffi
HINTS ${ROFD_ROOT_HINTS}
PATH_SUFFIXES ${ROFD_LIB_SUFFIXES}
)
pkg_check_modules(OFD_CAIRO QUIET cairo)

if (ROFD_INCLUDE_DIR AND ROFD_FFI_LIBRARY AND OFD_CAIRO_FOUND)
# Require the reader APIs shipped in 0.4.0. Probe declarations and linked
# symbols as well, so mismatched headers and libraries fail at configure.
include(CheckCSourceCompiles)
include(CMakePushCheckState)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${ROFD_INCLUDE_DIR} ${OFD_CAIRO_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${ROFD_FFI_LIBRARY} ${OFD_CAIRO_LIBRARIES})
unset(ROFD_READER_APIS_AVAILABLE CACHE)
check_c_source_compiles([=[
#include <rofd.h>
int main(void) {
rofd_pixel_rect_t viewport;
rofd_metadata_t *metadata = 0;
rofd_warning_list_t *warnings = 0;
rofd_outline_t *outline = 0;
rofd_link_list_t *links = 0;
rofd_outline_node_t node = {0};
rofd_action_t action = {0};
rofd_destination_t destination = {0};
rofd_rect_t region = {0};
size_t count = 0;
int32_t w = 0, h = 0;
rofd_pixel_rect_init(&viewport, sizeof(viewport));
rofd_renderer_get_pixel_canvas_size(0, 0, 0, &w, &h, 0);
rofd_renderer_render_page_region_cairo(0, 0, 0, 0, &viewport, 0, 0);
rofd_document_get_metadata(0, &metadata, 0);
rofd_metadata_get_document_id(metadata);
rofd_metadata_free(metadata);
rofd_document_get_warnings(0, &warnings, 0);
rofd_warning_list_free(warnings);
rofd_document_get_outline(0, &outline, 0);
node.struct_size = sizeof(node);
action.struct_size = sizeof(action);
destination.struct_size = sizeof(destination);
rofd_outline_get_count(outline, &count, 0);
rofd_outline_get_node(outline, 0, &node, 0);
rofd_outline_get_action(outline, 0, 0, &action, 0);
rofd_outline_get_action_destination(outline, 0, 0, &destination, 0);
rofd_outline_free(outline);
rofd_page_get_links(0, &links, 0);
rofd_link_list_get_count(links, &count, 0);
rofd_link_list_get_region_count(links, 0, &count, 0);
rofd_link_list_get_region(links, 0, 0, &region, 0);
rofd_link_list_get_action_count(links, 0, &count, 0);
rofd_link_list_get_action(links, 0, 0, &action, 0);
rofd_link_list_get_action_destination(links, 0, 0, &destination, 0);
rofd_link_list_free(links);
return 0;
}
]=] ROFD_READER_APIS_AVAILABLE)
cmake_pop_check_state()
if (NOT ROFD_READER_APIS_AVAILABLE)
message(FATAL_ERROR "rofd headers/library lack the required region, metadata, warning, outline or page-link APIs. Install matching rofd >= 0.4.0 headers and library, and set ROFD_INCLUDE_DIR/ROFD_FFI_LIBRARY accordingly.")
endif()
message(STATUS ">>> OFD support enabled (rofd_ffi: ${ROFD_FFI_LIBRARY})")
add_compile_definitions(OFD_SUPPORT_ENABLED)
set(OFD_SUPPORT_RESOLVED ON)
else()
message(WARNING ">>> OFD support disabled: install librofd-ffi-dev, or pass -DROFD_ROOT=<rofd checkout>")
set(OFD_SUPPORT_RESOLVED OFF)
endif()
else()
message(STATUS ">>> OFD support disabled by configuration")
endif()

set(OFD_SUPPORT_ENABLED ${OFD_SUPPORT_RESOLVED})

include(GNUInstallDirs)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX /usr)
Expand Down Expand Up @@ -166,6 +265,12 @@ if (USE_PDFIUM_BUNDLE)
add_subdirectory(3rdparty/deepin-pdfium)
endif()

add_subdirectory(batch-print)

# Install context-menus (batch print)
install(FILES src/context-menus/deepin-reader-batchprint.conf
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/context-menus)

# 单元测试(可选)
option(BUILD_TESTS "Build unit tests" OFF)
if (BUILD_TESTS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ deepin-reader is a small, fast and full-featured tool for viewing documents,supp

In debian, use below command to install compile dependencies:

`sudo apt install debhelper (>= 11),pkg-config,libspectre-dev, libdjvulibre-dev, qt5-qmake, qt5-default,libtiff-dev, libkf5archive-dev, libdtkwidget-dev,qttools5-dev-tools,qtbase5-private-dev,libjpeg-dev,libicu-dev,libpng-dev,zlib1g-dev`
`sudo apt install debhelper (>= 11),pkg-config,libspectre-dev, libdjvulibre-dev, qt5-qmake, qt5-default,libtiff-dev, libkf5archive-dev, libdtkwidget-dev,qttools5-dev-tools,qtbase5-private-dev,libjpeg-dev,libicu-dev,libpng-dev,zlib1g-dev,librofd-ffi-dev`

## Install

Expand Down
2 changes: 1 addition & 1 deletion README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ deepin-reader是一款小型、快速、功能齐全的工具,用于查看文

In debian, use below command to install compile dependencies:

`sudo apt install debhelper (>= 11),pkg-config,libspectre-dev, libdjvulibre-dev, qt5-qmake, qt5-default,libtiff-dev, libkf5archive-dev, libdtkwidget-dev,qttools5-dev-tools,qtbase5-private-dev,libjpeg-dev,libicu-dev,libpng-dev,zlib1g-dev`
`sudo apt install debhelper (>= 11),pkg-config,libspectre-dev, libdjvulibre-dev, qt5-qmake, qt5-default,libtiff-dev, libkf5archive-dev, libdtkwidget-dev,qttools5-dev-tools,qtbase5-private-dev,libjpeg-dev,libicu-dev,libpng-dev,zlib1g-dev,librofd-ffi-dev`

## 安装

Expand Down
Loading
Loading