Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ui_*.h
#linglong building dir
linglong
build
obj-x86_64-linux-gnu/

# vscode
.vscode
Expand Down
4 changes: 3 additions & 1 deletion reader/app/Global.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd.
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -145,5 +145,7 @@ const QString key_ctrl_shift_s = "Ctrl+Shift+S"; // 另存为
const QString key_ctrl_shift_slash = "Ctrl+Shift+/";
const QString key_ctrl_home = "Ctrl+Home"; //第一页
const QString key_ctrl_end = "Ctrl+End"; //最后一页

const int key_scroll_step_pixels = 20; // 上下键滚动步长(像素)
}
#endif // GLOBAL_H
24 changes: 22 additions & 2 deletions reader/browser/SheetBrowser.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2019 ~ 2026 Uniontech Software Technology Co.,Ltd.
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -48,6 +48,7 @@ DWIDGET_USE_NAMESPACE

#define REPEAT_MOVE_DELAY 500
const qreal deltaManhattanLength = 12.0;

SheetBrowser::SheetBrowser(DocSheet *parent) : DGraphicsView(parent), m_sheet(parent)
{
qCDebug(appLog) << "SheetBrowser constructor started";
Expand Down Expand Up @@ -766,6 +767,17 @@ void SheetBrowser::keyPressEvent(QKeyEvent *event)
m_sheet->jumpToPrevPage();
return;
}

if (event->key() == Qt::Key_Down) {
event->accept();
verticalScrollBar()->setValue(verticalScrollBar()->value() + Dr::key_scroll_step_pixels);
return;
}
if (event->key() == Qt::Key_Up) {
event->accept();
verticalScrollBar()->setValue(verticalScrollBar()->value() - Dr::key_scroll_step_pixels);
return;
}
}
DGraphicsView::keyPressEvent(event);
}
Expand Down Expand Up @@ -1657,6 +1669,9 @@ int SheetBrowser::currentPage()
int SheetBrowser::currentScrollValueForPage()
{
// qCDebug(appLog) << "SheetBrowser::currentScrollValueForPage() - Current scroll value for page";
if (m_items.isEmpty())
return 1;

int value = verticalScrollBar()->value();

int index = 0;
Expand All @@ -1680,7 +1695,12 @@ int SheetBrowser::currentScrollValueForPage()
}
}

return index + 1;
// 确保页码在有效范围内 [1, m_items.count()]
int page = index + 1;
if (page < 1) page = 1;
if (page > m_items.count()) page = m_items.count();

return page;
}

void SheetBrowser::setCurrentPage(int page)
Expand Down
15 changes: 14 additions & 1 deletion reader/uiframe/CentralDocPage.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd.
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -22,12 +22,13 @@
#include <QVBoxLayout>
#include <QStackedLayout>
#include <QDesktopServices>
#include <QScreen>

Check warning on line 25 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScreen> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 25 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QScreen> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QUrl>

Check warning on line 26 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QUrl> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 26 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QUrl> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDesktopServices>

Check warning on line 27 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDesktopServices> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 27 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QDesktopServices> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QScrollBar>

Check warning on line 28 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScrollBar> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 28 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QScrollBar> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QStackedLayout>

Check warning on line 29 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QStackedLayout> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 29 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QStackedLayout> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QMimeType>

Check warning on line 30 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QMimeType> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 30 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QMimeType> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QMimeDatabase>

Check warning on line 31 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QMimeDatabase> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 31 in reader/uiframe/CentralDocPage.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QMimeDatabase> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QProcess>
#include <QUuid>
#include <QTimer>
Expand Down Expand Up @@ -737,6 +738,18 @@
} else if (s == Dr::key_alt_a) {
qCInfo(appLog) << "s == Dr::key_alt_a";
sheet->addSelectedTextHightlightAnnotation();
} else if (s == Dr::key_down) {
// 上下键按固定像素滚动(每次约一行)
if (sheet->getSheetBrowser()) {
sheet->getSheetBrowser()->verticalScrollBar()->setValue(
sheet->getSheetBrowser()->verticalScrollBar()->value() + Dr::key_scroll_step_pixels);
}
} else if (s == Dr::key_up) {
// 上下键按固定像素滚动(每次约一行)
if (sheet->getSheetBrowser()) {
sheet->getSheetBrowser()->verticalScrollBar()->setValue(
sheet->getSheetBrowser()->verticalScrollBar()->value() - Dr::key_scroll_step_pixels);
}
}
// 屏蔽右侧区域的切页快捷键,使用默认的滚动效果
/*else if (s == Dr::key_left) {
Expand Down
4 changes: 3 additions & 1 deletion reader/widgets/ShortCutShow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd.
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -125,6 +125,8 @@ void ShortCutShow::initPDF()
{Dr::key_ctrl_smaller , tr("Zoom out") },
{Dr::key_pgUp , tr("Page up") },
{Dr::key_pgDown , tr("Page down") },
{Dr::key_up , tr("Scroll up one line") },
{Dr::key_down , tr("Scroll down one line") },
{Dr::key_ctrl_home , tr("Move to the beginning") },
{Dr::key_ctrl_end , tr("Move to the end") },
{Dr::key_esc , tr("Exit") }}},
Expand Down
2 changes: 1 addition & 1 deletion translations/deepin-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<message>
<location filename="../reader/Application.cpp" line="40"/>
<source>Document Viewer is a tool for reading document files, supporting %1.</source>
<translation type="unfinished"></translation>
<translation>Document Viewer is a tool for reading document files, supporting %1.</translation>
</message>
</context>
<context>
Expand Down
11 changes: 11 additions & 0 deletions translations/deepin-reader_ady.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,17 @@
<source>Move to the end</source>
<translation>نۇرغۇن چەق</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Зэкъо гупэм елъэӀу</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Зэкъо лъэныкъом елъэӀу</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Select text</source>
Expand Down
13 changes: 12 additions & 1 deletion translations/deepin-reader_af.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,17 @@
<source>Move to the end</source>
<translation>Verplaats na die einde</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Scroll up one line</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Scroll down one line</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Select text</source>
Expand Down Expand Up @@ -827,7 +838,7 @@
<message>
<location filename="../reader/main.cpp" line="49"/>
<source>Generate thumbnail.</source>
<translation type="unfinished"></translation>
<translation>Generate thumbnail.</translation>
</message>
</context>
</TS>
11 changes: 11 additions & 0 deletions translations/deepin-reader_am_ET.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,17 @@
<source>Move to the end</source>
<translation>გადატანა ბოლოში</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Scroll up one line</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Scroll down one line</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Select text</source>
Expand Down
13 changes: 12 additions & 1 deletion translations/deepin-reader_ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<message>
<location filename="../reader/Application.cpp" line="40"/>
<source>Document Viewer is a tool for reading document files, supporting %1.</source>
<translation type="unfinished"/>
<translation>Document Viewer is a tool for reading document files, supporting %1.</translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -635,6 +635,17 @@
<source>Rotate right</source>
<translation>تدوير لليمين</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Scroll up one line</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Scroll down one line</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Move to the beginning</source>
Expand Down
11 changes: 11 additions & 0 deletions translations/deepin-reader_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,17 @@
<source>Rotate right</source>
<translation>الدوران إلى اليمين</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Mover una llinia p'arriba</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Mover una llinia p'abaxo</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Move to the beginning</source>
Expand Down
13 changes: 12 additions & 1 deletion translations/deepin-reader_az.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<message>
<location filename="../reader/Application.cpp" line="40"/>
<source>Document Viewer is a tool for reading document files, supporting %1.</source>
<translation type="unfinished"/>
<translation>Document Viewer is a tool for reading document files, supporting %1.</translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -635,6 +635,17 @@
<source>Rotate right</source>
<translation>Sağa döndərin</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Scroll up one line</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Scroll down one line</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Move to the beginning</source>
Expand Down
11 changes: 11 additions & 0 deletions translations/deepin-reader_bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,17 @@
<source>Move to the end</source>
<translation>Преместете към края</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Scroll up one line</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Scroll down one line</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Select text</source>
Expand Down
13 changes: 12 additions & 1 deletion translations/deepin-reader_bn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<message>
<location filename="../reader/Application.cpp" line="40"/>
<source>Document Viewer is a tool for reading document files, supporting %1.</source>
<translation type="unfinished"/>
<translation>Document Viewer is a tool for reading document files, supporting %1.</translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -636,6 +636,17 @@
<source>Rotate right</source>
<translation>ডানে ঘুরান</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Scroll up one line</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Scroll down one line</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Move to the beginning</source>
Expand Down
11 changes: 11 additions & 0 deletions translations/deepin-reader_bo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,17 @@
<source>Rotate right</source>
<translation>གཡས་སུ་སྐོར་བ།</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>གྲལ་ཐིག་གཅིག་གྱེར་འདྲེན་བྱེད།</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>གྲལ་ཐིག་གཅིག་མར་འདྲེན་བྱེད།</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Move to the beginning</source>
Expand Down
11 changes: 11 additions & 0 deletions translations/deepin-reader_bqi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,17 @@
<source>Move to the end</source>
<translation>النقل إلى النهاية</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Scroll up one line</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Scroll down one line</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Select text</source>
Expand Down
11 changes: 11 additions & 0 deletions translations/deepin-reader_br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,17 @@
<source>Move to the end</source>
<translation>الانتقال إلى نهاية</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Scroll up one line</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Scroll down one line</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Select text</source>
Expand Down
11 changes: 11 additions & 0 deletions translations/deepin-reader_ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,17 @@
<source>Rotate right</source>
<translation>Gira cap a la dreta</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Scroll up one line</source>
<translation>Scroll up one line</translation>
</message>
<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="129"/>
<source>Scroll down one line</source>
<translation>Scroll down one line</translation>
</message>

<message>
<location filename="../reader/widgets/ShortCutShow.cpp" line="128"/>
<source>Move to the beginning</source>
Expand Down
Loading
Loading