sioyek: update to 1.5.0.

This commit is contained in:
icp 2022-11-03 22:35:22 +05:30 committed by Leah Neukirchen
parent c8849c1218
commit ccc79bfe5f
3 changed files with 73 additions and 73 deletions

View File

@ -1,7 +1,7 @@
From 35fa37f9485bf933e754b995902f69d53dac1670 Mon Sep 17 00:00:00 2001
From: lennonhill <31923882+lennonhill@users.noreply.github.com>
Date: Tue, 28 Jun 2022 18:01:36 +0200
Subject: [PATCH 1/2] Parse mupdf 1.20 links
From 310c7c65cf85d1eee4515ef67b9a89c939ae9492 Mon Sep 17 00:00:00 2001
From: hrdl <31923882+lennonhill@users.noreply.github.com>
Date: Mon, 29 Aug 2022 12:43:31 +0200
Subject: [PATCH] Parse mupdf 1.20 links
---
pdf_viewer/document_view.cpp | 2 +-
@ -11,23 +11,23 @@ Subject: [PATCH 1/2] Parse mupdf 1.20 links
4 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/pdf_viewer/document_view.cpp b/pdf_viewer/document_view.cpp
index 9a7d8ea2..d8305620 100644
index ace3f161d..1362ee4b5 100644
--- a/pdf_viewer/document_view.cpp
+++ b/pdf_viewer/document_view.cpp
@@ -1013,7 +1013,7 @@ std::optional<DocumentPos> DocumentView::find_line_definition() {
@@ -1077,7 +1077,7 @@ std::vector<DocumentPos> DocumentView::find_line_definitions() {
std::optional<PdfLink> pdf_link = current_document->get_link_in_page_rect(get_center_page_number(), line_rects[line_index]);
if (pdf_link.has_value()) {
- auto parsed_uri = parse_uri(pdf_link.value().uri);
+ auto parsed_uri = parse_uri(mupdf_context, pdf_link.value().uri);
DocumentPos res;
res.page = parsed_uri.page-1;
res.x = parsed_uri.x;
result.push_back({ parsed_uri.page - 1, parsed_uri.x, parsed_uri.y });
return result;
}
diff --git a/pdf_viewer/main_widget.cpp b/pdf_viewer/main_widget.cpp
index 9e02e2c6..5bd7ed1f 100644
index 5265398d2..707d11b30 100644
--- a/pdf_viewer/main_widget.cpp
+++ b/pdf_viewer/main_widget.cpp
@@ -135,7 +135,7 @@ void MainWidget::set_overview_position(int page, float offset) {
@@ -153,7 +153,7 @@ void MainWidget::set_overview_position(int page, float offset) {
void MainWidget::set_overview_link(PdfLink link) {
@ -36,16 +36,16 @@ index 9e02e2c6..5bd7ed1f 100644
if (page >= 1) {
set_overview_position(page - 1, offset_y);
}
@@ -2647,7 +2647,7 @@ void MainWidget::handle_pending_text_command(std::wstring text) {
@@ -2861,7 +2861,7 @@ void MainWidget::handle_pending_text_command(std::wstring text) {
open_web_url(utf8_decode(selected_link->uri));
}
else{
- auto [page, offset_x, offset_y] = parse_uri(selected_link->uri);
+ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, selected_link->uri);
long_jump_to_destination(page-1, offset_y);
}
}
if ((link_index >= 0) && (link_index < static_cast<int>(visible_page_links.size()))) {
auto [selected_page, selected_link] = visible_page_links[link_index];
- auto [page, offset_x, offset_y] = parse_uri(selected_link->uri);
+ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, selected_link->uri);
long_jump_to_destination(page-1, offset_y);
}
}
@@ -3223,7 +3223,7 @@ void MainWidget::handle_link_click(const PdfLink& link) {
@@ -3472,7 +3472,7 @@ void MainWidget::handle_link_click(const PdfLink& link) {
return;
}
@ -55,7 +55,7 @@ index 9e02e2c6..5bd7ed1f 100644
// convert one indexed page to zero indexed page
page--;
diff --git a/pdf_viewer/utils.cpp b/pdf_viewer/utils.cpp
index be9d2e76..505b7d12 100644
index a25d18f10..e416737ba 100644
--- a/pdf_viewer/utils.cpp
+++ b/pdf_viewer/utils.cpp
@@ -24,6 +24,8 @@
@ -87,13 +87,13 @@ index be9d2e76..505b7d12 100644
-
- return { page, offset_x, offset_y };
+ParsedUri parse_uri(fz_context* mupdf_context, std::string uri) {
+ fz_link_dest dest = pdf_parse_link_uri(mupdf_context, uri.c_str());
+ return { dest.loc.page + 1, dest.x, dest.y };
+ fz_link_dest dest = pdf_parse_link_uri(mupdf_context, uri.c_str());
+ return { dest.loc.page + 1, dest.x, dest.y };
}
char get_symbol(int key, bool is_shift_pressed, const std::vector<char>& special_symbols) {
diff --git a/pdf_viewer/utils.h b/pdf_viewer/utils.h
index 919ff6eb..f7934b7f 100644
index 4d551c35a..aa0d0d61b 100644
--- a/pdf_viewer/utils.h
+++ b/pdf_viewer/utils.h
@@ -33,7 +33,7 @@ void get_flat_toc(const std::vector<TocNode*>& roots, std::vector<std::wstring>&
@ -105,48 +105,3 @@ index 919ff6eb..f7934b7f 100644
char get_symbol(int key, bool is_shift_pressed, const std::vector<char>&special_symbols);
template<typename T>
From 5b2488e7cd9a454faf0ff488ba97c11f22805e25 Mon Sep 17 00:00:00 2001
From: lennonhill <31923882+lennonhill@users.noreply.github.com>
Date: Tue, 28 Jun 2022 19:18:53 +0200
Subject: [PATCH 2/2] Upgrade mupdf to 1.20
---
pdf_viewer/document.cpp | 4 ++--
pdf_viewer/pdf_renderer.cpp | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pdf_viewer/document.cpp b/pdf_viewer/document.cpp
index f1585ad3..e906594a 100644
--- a/pdf_viewer/document.cpp
+++ b/pdf_viewer/document.cpp
@@ -542,14 +542,14 @@ void Document::convert_toc_tree(fz_outline* root, std::vector<TocNode*>& output)
current_node->title = utf8_decode(root->title);
current_node->x = root->x;
current_node->y = root->y;
- if (root->page == -1) {
+ if (root->page.page == -1) {
float xp, yp;
fz_location loc = fz_resolve_link(context, doc, root->uri, &xp, &yp);
int chapter_page = accum_chapter_pages[loc.chapter];
current_node->page = chapter_page + loc.page;
}
else {
- current_node->page = root->page;
+ current_node->page = root->page.page;
}
convert_toc_tree(root->down, current_node->children);
diff --git a/pdf_viewer/pdf_renderer.cpp b/pdf_viewer/pdf_renderer.cpp
index de4c43fc..9adbc998 100644
--- a/pdf_viewer/pdf_renderer.cpp
+++ b/pdf_viewer/pdf_renderer.cpp
@@ -315,7 +315,7 @@ void PdfRenderer::run_search(int thread_index)
const int max_hits_per_page = 20;
fz_quad hitboxes[max_hits_per_page];
- int num_results = fz_search_page(mupdf_context, page, utf8_encode(req.search_term).c_str(), hitboxes, max_hits_per_page);
+ int num_results = fz_search_page(mupdf_context, page, utf8_encode(req.search_term).c_str(), nullptr, hitboxes, max_hits_per_page);
if (num_results > 0) {
req.search_results_mutex->lock();

View File

@ -0,0 +1,44 @@
From 7a9e876fb2dcd3c82d619316e1cf8959521d4071 Mon Sep 17 00:00:00 2001
From: ahrm <a.hr.mostafavi@gmail.com>
Date: Mon, 29 Aug 2022 14:57:02 +0430
Subject: [PATCH] Fix some compatibility issues with mupdf 1.20.0
---
pdf_viewer/document.cpp | 4 ++--
pdf_viewer/pdf_renderer.cpp | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pdf_viewer/document.cpp b/pdf_viewer/document.cpp
index 083e40244..61375d598 100644
--- a/pdf_viewer/document.cpp
+++ b/pdf_viewer/document.cpp
@@ -559,14 +559,14 @@ void Document::convert_toc_tree(fz_outline* root, std::vector<TocNode*>& output)
current_node->title = utf8_decode(root->title);
current_node->x = root->x;
current_node->y = root->y;
- if (root->page == -1) {
+ if (root->page.page == -1) {
float xp, yp;
fz_location loc = fz_resolve_link(context, doc, root->uri, &xp, &yp);
int chapter_page = accum_chapter_pages[loc.chapter];
current_node->page = chapter_page + loc.page;
}
else {
- current_node->page = root->page;
+ current_node->page = root->page.page;
}
convert_toc_tree(root->down, current_node->children);
diff --git a/pdf_viewer/pdf_renderer.cpp b/pdf_viewer/pdf_renderer.cpp
index cc8a89d16..fd17a52c4 100644
--- a/pdf_viewer/pdf_renderer.cpp
+++ b/pdf_viewer/pdf_renderer.cpp
@@ -315,7 +315,7 @@ void PdfRenderer::run_search(int thread_index)
const int max_hits_per_page = 20;
fz_quad hitboxes[max_hits_per_page];
- int num_results = fz_search_page(mupdf_context, page, utf8_encode(req.search_term).c_str(), hitboxes, max_hits_per_page);
+ int num_results = fz_search_page(mupdf_context, page, utf8_encode(req.search_term).c_str(), nullptr, hitboxes, max_hits_per_page);
if (num_results > 0) {
req.search_results_mutex->lock();

View File

@ -1,20 +1,21 @@
# Template file for 'sioyek'
pkgname=sioyek
version=1.4.0
version=1.5.0
revision=1
archs="i686* x86_64*"
build_style=qmake
hostmakedepends="qt5-qmake qt5-host-tools
qt5-opengl qt5-gui qt5-widgets qt5-network"
makedepends="zlib-devel qt5-3d-devel qt5-gamepad-devel mupdf-devel
gumbo-parser-devel harfbuzz-devel qt5-opengl mujs-devel"
gumbo-parser-devel harfbuzz-devel qt5-opengl mujs-devel freetype-devel
libjbig2dec libjpeg-turbo-devel libopenjpeg2-devel"
depends="mupdf"
short_desc="PDF viewer designed for reading research papers and technical books"
maintainer="dkwo <npiazza@disroot.org>"
license="GPL-3.0-or-later"
homepage="https://sioyek.info/"
distfiles="https://github.com/ahrm/sioyek/archive/refs/tags/v${version}.tar.gz"
checksum=44d49aec28e49bb79c2d0fb7cefd26aecc53b60136bf02dfec9863ac586aacd0
nocross="fails to configure"
checksum=2d01c757953c3f2d98428376e642d13b8a9edeba8fee506477e8aa178756f16b
do_build() {
qmake pdf_viewer_build_config.pro