├── .github └── workflows │ ├── backup-to-gitlab.yml │ ├── call-auto-tag.yml │ ├── call-chatOps.yml │ ├── call-clacheck.yml │ ├── call-commitlint.yml │ ├── call-license-check.yml │ └── cppcheck.yml ├── .gitignore ├── .reuse └── dep5 ├── .tx ├── config ├── deepin.conf ├── transifex.yaml └── ts2desktop ├── CMakeLists.txt ├── LICENSE ├── LICENSES ├── CC-BY-4.0.txt ├── CC0-1.0.txt ├── GPL-3.0-or-later.txt └── LGPL-3.0-or-later.txt ├── README.md ├── README.zh_CN.md ├── arm64 └── linglong.yaml ├── assets └── deepin-reader │ └── document-viewer │ ├── common │ ├── +.svg │ ├── -.svg │ ├── A _big.svg │ ├── A _small.svg │ ├── Ctrl.svg │ ├── Down.svg │ ├── End.svg │ ├── Enter.svg │ ├── O.svg │ ├── P.svg │ ├── QM.svg │ ├── S.svg │ ├── Shift.svg │ ├── Up.svg │ ├── add.svg │ ├── attention.svg │ ├── bookmark.svg │ ├── bookmark_normal.svg │ ├── bookmarkbig_checked_light.svg │ ├── catalog.svg │ ├── choose_normal_light.svg │ ├── choose_small_normal.svg │ ├── close_icon.svg │ ├── commenticon_normal_light.svg │ ├── comments_normal.svg │ ├── comments_normal_light.svg │ ├── deepin-reader.svg │ ├── deepin_launcher.svg │ ├── deepin_reader_24.svg │ ├── hand_normal_light.svg │ ├── hand_small_normal_light.svg │ ├── icon_import_photo.svg │ ├── icon_menu.svg │ ├── maganifier.svg │ ├── magnifier_normal_light.svg │ ├── next.svg │ ├── nextdown.svg │ ├── notes.svg │ ├── plus_icon.svg │ ├── previous.svg │ ├── previousup.svg │ ├── search.svg │ ├── select .svg │ ├── setting_normal.svg │ ├── suspend_normal.svg │ ├── thumbnail_normal_light.svg │ ├── tips.svg │ ├── view_normal.svg │ └── view_normal_light.svg │ ├── en_US │ ├── document-viewer.md │ ├── eu_document-viewer.md │ ├── fig │ │ ├── add comment.png │ │ ├── hotkey.png │ │ ├── pageSetupdoc.png │ │ ├── previewdoc1.png │ │ └── printerdoc.png │ └── i_document-viewer.md │ ├── zh_CN │ ├── document-viewer.md │ ├── eu_document-viewer.md │ ├── fig │ │ ├── hotkey.png │ │ ├── printer.png │ │ └── setting.png │ └── i_document-viewer.md │ ├── zh_HK │ ├── document-viewer.md │ ├── eu_document-viewer.md │ ├── fig │ │ └── hotkey.png │ └── i_document-viewer.md │ └── zh_TW │ ├── document-viewer.md │ ├── eu_document-viewer.md │ ├── fig │ ├── hotkey.png │ ├── printer.png │ └── setting.png │ └── i_document-viewer.md ├── cmake └── translation-generate.cmake ├── debian ├── changelog ├── compat ├── control ├── copyright ├── deepin-reader.1 ├── manpages ├── rules └── source │ └── format ├── deepin_reader.pro ├── deploy_dep ├── htmltopdf ├── CMakeLists.txt ├── htmltopdf.pro ├── htmltopdfconverter.cpp ├── htmltopdfconverter.h └── main.cpp ├── install_dep ├── linglong.yaml ├── loong64 └── linglong.yaml ├── reader ├── Application.cpp ├── Application.h ├── CMakeLists.txt ├── MainWindow.cpp ├── MainWindow.h ├── app │ ├── DBusObject.cpp │ ├── DBusObject.h │ ├── Database.cpp │ ├── Database.h │ ├── DebugTimeManager.cpp │ ├── DebugTimeManager.h │ ├── Global.cpp │ ├── Global.h │ ├── MsgHeader.h │ ├── TMFunctionThread.cpp │ ├── TMFunctionThread.h │ ├── Utils.cpp │ ├── Utils.h │ ├── accessible.h │ ├── accessibledefine.h │ ├── app.pri │ ├── eventlogutils.cpp │ └── eventlogutils.h ├── browser │ ├── BrowserAnnotation.cpp │ ├── BrowserAnnotation.h │ ├── BrowserMagniFier.cpp │ ├── BrowserMagniFier.h │ ├── BrowserMenu.cpp │ ├── BrowserMenu.h │ ├── BrowserPage.cpp │ ├── BrowserPage.h │ ├── BrowserWord.cpp │ ├── BrowserWord.h │ ├── PageRenderThread.cpp │ ├── PageRenderThread.h │ ├── PageSearchThread.cpp │ ├── PageSearchThread.h │ ├── SheetBrowser.cpp │ ├── SheetBrowser.h │ └── browser.pri ├── deepin-reader.desktop ├── deepin-reader.svg ├── document │ ├── DjVuModel.cpp │ ├── DjVuModel.h │ ├── Model.cpp │ ├── Model.h │ ├── PDFModel.cpp │ ├── PDFModel.h │ └── document.pri ├── load_libs.c ├── load_libs.h ├── main.cpp ├── reader.pro ├── sidebar │ ├── BookMarkDelegate.cpp │ ├── BookMarkDelegate.h │ ├── BookMarkWidget.cpp │ ├── BookMarkWidget.h │ ├── CatalogTreeView.cpp │ ├── CatalogTreeView.h │ ├── CatalogWidget.cpp │ ├── CatalogWidget.h │ ├── NotesDelegate.cpp │ ├── NotesDelegate.h │ ├── NotesWidget.cpp │ ├── NotesWidget.h │ ├── ReaderImageThreadPoolManager.cpp │ ├── ReaderImageThreadPoolManager.h │ ├── SearchResDelegate.cpp │ ├── SearchResDelegate.h │ ├── SearchResWidget.cpp │ ├── SearchResWidget.h │ ├── SheetSidebar.cpp │ ├── SheetSidebar.h │ ├── SideBarImageListview.cpp │ ├── SideBarImageListview.h │ ├── SideBarImageViewModel.cpp │ ├── SideBarImageViewModel.h │ ├── ThumbnailDelegate.cpp │ ├── ThumbnailDelegate.h │ ├── ThumbnailWidget.cpp │ ├── ThumbnailWidget.h │ └── sidebar.pri ├── src.pri ├── uiframe │ ├── Central.cpp │ ├── Central.h │ ├── CentralDocPage.cpp │ ├── CentralDocPage.h │ ├── CentralNavPage.cpp │ ├── CentralNavPage.h │ ├── DocSheet.cpp │ ├── DocSheet.h │ ├── DocTabBar.cpp │ ├── DocTabBar.h │ ├── SheetRenderer.cpp │ ├── SheetRenderer.h │ ├── TitleMenu.cpp │ ├── TitleMenu.h │ ├── TitleWidget.cpp │ ├── TitleWidget.h │ └── uiframe.pri └── widgets │ ├── AttrScrollWidget.cpp │ ├── AttrScrollWidget.h │ ├── BaseWidget.cpp │ ├── BaseWidget.h │ ├── ColorWidgetAction.cpp │ ├── ColorWidgetAction.h │ ├── EncryptionPage.cpp │ ├── EncryptionPage.h │ ├── FileAttrWidget.cpp │ ├── FileAttrWidget.h │ ├── FindWidget.cpp │ ├── FindWidget.h │ ├── HandleMenu.cpp │ ├── HandleMenu.h │ ├── PagingWidget.cpp │ ├── PagingWidget.h │ ├── ProgressDialog.cpp │ ├── ProgressDialog.h │ ├── RoundColorWidget.cpp │ ├── RoundColorWidget.h │ ├── SaveDialog.cpp │ ├── SaveDialog.h │ ├── ScaleMenu.cpp │ ├── ScaleMenu.h │ ├── ScaleWidget.cpp │ ├── ScaleWidget.h │ ├── SecurityDialog.cpp │ ├── SecurityDialog.h │ ├── ShortCutShow.cpp │ ├── ShortCutShow.h │ ├── SlidePlayWidget.cpp │ ├── SlidePlayWidget.h │ ├── SlideWidget.cpp │ ├── SlideWidget.h │ ├── TextEditWidget.cpp │ ├── TextEditWidget.h │ ├── TipsWidget.cpp │ ├── TipsWidget.h │ ├── TransparentTextEdit.cpp │ ├── TransparentTextEdit.h │ ├── WordWrapLabel.cpp │ ├── WordWrapLabel.h │ └── widgets.pri ├── resources ├── CJK2Kangxi.dict ├── builtin │ ├── dark │ │ ├── actions │ │ │ ├── dr_defaultshape_small_16px.svg │ │ │ ├── dr_handleshape_small_16px.svg │ │ │ └── dr_import_photo_128px.svg │ │ ├── icons │ │ │ ├── close.svg │ │ │ ├── dr_a_big_14px.svg │ │ │ ├── dr_a_small_14px.svg │ │ │ ├── dr_bookmark_checked_39px.svg │ │ │ ├── dr_bookmark_hover_39px.svg │ │ │ ├── dr_bookmark_pressed_39px.svg │ │ │ ├── dr_close_24px.svg │ │ │ ├── dr_exception-logo_32px.svg │ │ │ ├── dr_exit_slider_36px.svg │ │ │ ├── dr_maganifier_244px.svg │ │ │ ├── dr_ok_26px.svg │ │ │ ├── dr_select_26px.svg │ │ │ └── dr_warning_26px.svg │ │ └── texts │ │ │ ├── dr_annotation_36px.svg │ │ │ ├── dr_bookmark_36px.svg │ │ │ ├── dr_button_add_12px.svg │ │ │ ├── dr_catalog_36px.svg │ │ │ ├── dr_defaultshape_36px.svg │ │ │ ├── dr_exit_normal_36px.svg │ │ │ ├── dr_handleshape_36px.svg │ │ │ ├── dr_magnifier_36px.svg │ │ │ ├── dr_next_normal_36px.svg │ │ │ ├── dr_play_normal_36px.svg │ │ │ ├── dr_previous_normal_36px.svg │ │ │ ├── dr_suspend_normal_36px.svg │ │ │ ├── dr_thumbnail_36px.svg │ │ │ ├── dr_thumbnails_36px.svg │ │ │ └── dr_viewchange_36px.svg │ ├── icons │ │ └── dr_compress_lock_128px.svg │ └── light │ │ ├── actions │ │ ├── dr_defaultshape_small_16px.svg │ │ ├── dr_handleshape_small_16px.svg │ │ └── dr_import_photo_128px.svg │ │ ├── icons │ │ ├── close.svg │ │ ├── dr_a_big_14px.svg │ │ ├── dr_a_small_14px.svg │ │ ├── dr_bookmark_checked_39px.svg │ │ ├── dr_bookmark_hover_39px.svg │ │ ├── dr_bookmark_pressed_39px.svg │ │ ├── dr_close_24px.svg │ │ ├── dr_exception-logo_32px.svg │ │ ├── dr_exit_slider_36px.svg │ │ ├── dr_maganifier_244px.svg │ │ ├── dr_ok_26px.svg │ │ ├── dr_select_26px.svg │ │ └── dr_warning_26px.svg │ │ └── texts │ │ ├── dr_annotation_36px.svg │ │ ├── dr_bookmark_36px.svg │ │ ├── dr_button_add_12px.svg │ │ ├── dr_catalog_36px.svg │ │ ├── dr_defaultshape_36px.svg │ │ ├── dr_exit_normal_36px.svg │ │ ├── dr_handleshape_36px.svg │ │ ├── dr_magnifier_36px.svg │ │ ├── dr_next_normal_36px.svg │ │ ├── dr_play_normal_36px.svg │ │ ├── dr_previous_normal_36px.svg │ │ ├── dr_suspend_normal_36px.svg │ │ ├── dr_thumbnail_36px.svg │ │ ├── dr_thumbnails_36px.svg │ │ └── dr_viewchange_36px.svg └── resources.qrc ├── tests ├── app │ ├── ut_database.cpp │ ├── ut_dbusobject.cpp │ ├── ut_debugtimemanager.cpp │ ├── ut_global.cpp │ └── ut_utils.cpp ├── browser │ ├── ut_browserannotation.cpp │ ├── ut_browsermagnifier.cpp │ ├── ut_browsermenu.cpp │ ├── ut_browserpage.cpp │ ├── ut_browserword.cpp │ ├── ut_pagerenderthread.cpp │ ├── ut_pagesearchthread.cpp │ └── ut_sheetbrowser.cpp ├── clean.sh ├── document │ ├── ut_djvumodel.cpp │ ├── ut_model.cpp │ └── ut_pdfmodel.cpp ├── files.qrc ├── files │ ├── 1.pdf │ ├── 2.pdf │ ├── 3.pdf │ ├── 4.pdf │ ├── 5_broken.pdf │ ├── 6_djvu.pdf │ ├── broken.djvu │ ├── broken.pdf │ ├── copy.txt │ ├── normal.djvu │ ├── normal.doc │ ├── normal.docx │ ├── normal.pdf │ ├── normal.png │ ├── normal.pptx │ └── normal.txt ├── include │ └── gtest │ │ ├── addr_pri.h │ │ └── stub.h ├── local-test.sh ├── main.cpp ├── qmake-lcov-test.sh ├── sidebar │ ├── ut_bookmarkdelegate.cpp │ ├── ut_bookmarkwidget.cpp │ ├── ut_catalogtreeview.cpp │ ├── ut_catalogwidget.cpp │ ├── ut_notesdelegate.cpp │ ├── ut_noteswidget.cpp │ ├── ut_readerimagethreadpoolmanager.cpp │ ├── ut_searchresdelegate.cpp │ ├── ut_searchreswidget.cpp │ ├── ut_sheetsidebar.cpp │ ├── ut_sidebarimagelistview.cpp │ ├── ut_sidebarimageviewmodel.cpp │ ├── ut_thumbnaildelegate.cpp │ └── ut_thumbnailwidget.cpp ├── test-prj-running.sh ├── tests.pro ├── uiframe │ ├── ut_central.cpp │ ├── ut_centraldocpage.cpp │ ├── ut_docsheet.cpp │ └── ut_doctabbar.cpp ├── ut_application.cpp ├── ut_common.cpp ├── ut_common.h ├── ut_defines.h ├── ut_mainwindow.cpp └── widgets │ ├── ut_attrscrollwidget.cpp │ ├── ut_basewidget.cpp │ ├── ut_colorwidgetaction.cpp │ ├── ut_encryptionpage.cpp │ ├── ut_fileattrwidget.cpp │ ├── ut_findwidget.cpp │ ├── ut_handlemenu.cpp │ ├── ut_pagingwidget.cpp │ ├── ut_progressdialog.cpp │ ├── ut_roundcolorwidget.cpp │ ├── ut_savedialog.cpp │ ├── ut_scalemenu.cpp │ ├── ut_scalewidget.cpp │ ├── ut_securitydialog.cpp │ ├── ut_shortcutshow.cpp │ ├── ut_slideplaywidget.cpp │ ├── ut_slidewidget.cpp │ ├── ut_texteditwidget.cpp │ ├── ut_tipswidget.cpp │ ├── ut_transparenttextedit.cpp │ └── ut_wordwraplabel.cpp ├── translate_generation.sh ├── translations ├── deepin-reader.ts ├── deepin-reader_ar.ts ├── deepin-reader_az.ts ├── deepin-reader_bn.ts ├── deepin-reader_bo.ts ├── deepin-reader_ca.ts ├── deepin-reader_cs.ts ├── deepin-reader_da.ts ├── deepin-reader_de.ts ├── deepin-reader_es.ts ├── deepin-reader_et.ts ├── deepin-reader_fi.ts ├── deepin-reader_fr.ts ├── deepin-reader_gl_ES.ts ├── deepin-reader_he.ts ├── deepin-reader_hi_IN.ts ├── deepin-reader_hr.ts ├── deepin-reader_hu.ts ├── deepin-reader_id.ts ├── deepin-reader_it.ts ├── deepin-reader_ko.ts ├── deepin-reader_lt.ts ├── deepin-reader_ms.ts ├── deepin-reader_nl.ts ├── deepin-reader_pl.ts ├── deepin-reader_pt.ts ├── deepin-reader_pt_BR.ts ├── deepin-reader_ro.ts ├── deepin-reader_ru.ts ├── deepin-reader_sl.ts ├── deepin-reader_sq.ts ├── deepin-reader_sr.ts ├── deepin-reader_tr.ts ├── deepin-reader_ug.ts ├── deepin-reader_uk.ts ├── deepin-reader_vi.ts ├── deepin-reader_zh_CN.ts ├── deepin-reader_zh_HK.ts ├── deepin-reader_zh_TW.ts └── desktop │ ├── desktop.ts │ ├── desktop_ar.ts │ ├── desktop_ast.ts │ ├── desktop_az.ts │ ├── desktop_bn.ts │ ├── desktop_bo.ts │ ├── desktop_ca.ts │ ├── desktop_cs.ts │ ├── desktop_da.ts │ ├── desktop_de.ts │ ├── desktop_es.ts │ ├── desktop_et.ts │ ├── desktop_fi.ts │ ├── desktop_fr.ts │ ├── desktop_gl_ES.ts │ ├── desktop_he.ts │ ├── desktop_hi_IN.ts │ ├── desktop_hr.ts │ ├── desktop_hu.ts │ ├── desktop_id.ts │ ├── desktop_it.ts │ ├── desktop_ko.ts │ ├── desktop_lt.ts │ ├── desktop_ms.ts │ ├── desktop_nl.ts │ ├── desktop_pa.ts │ ├── desktop_pl.ts │ ├── desktop_pt.ts │ ├── desktop_pt_BR.ts │ ├── desktop_ro.ts │ ├── desktop_ru.ts │ ├── desktop_sl.ts │ ├── desktop_sq.ts │ ├── desktop_sr.ts │ ├── desktop_tr.ts │ ├── desktop_ug.ts │ ├── desktop_uk.ts │ ├── desktop_vi.ts │ ├── desktop_zh_CN.ts │ ├── desktop_zh_HK.ts │ └── desktop_zh_TW.ts └── updateTranslation.sh /.github/workflows/backup-to-gitlab.yml: -------------------------------------------------------------------------------- 1 | name: backup to gitlab 2 | on: [push] 3 | 4 | concurrency: 5 | group: ${{ github.workflow }} 6 | cancel-in-progress: true 7 | 8 | jobs: 9 | backup-to-gitlabwh: 10 | uses: linuxdeepin/.github/.github/workflows/backup-to-gitlabwh.yml@master 11 | secrets: inherit 12 | 13 | backup-to-gitee: 14 | uses: linuxdeepin/.github/.github/workflows/backup-to-gitee.yml@master 15 | secrets: inherit 16 | -------------------------------------------------------------------------------- /.github/workflows/call-auto-tag.yml: -------------------------------------------------------------------------------- 1 | name: auto tag 2 | 3 | on: 4 | pull_request_target: 5 | types: [opened, synchronize, closed] 6 | paths: 7 | - "debian/changelog" 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | auto_tag: 15 | uses: linuxdeepin/.github/.github/workflows/auto-tag.yml@master 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /.github/workflows/call-chatOps.yml: -------------------------------------------------------------------------------- 1 | name: chatOps 2 | on: 3 | issue_comment: 4 | types: [created] 5 | 6 | jobs: 7 | chatopt: 8 | uses: linuxdeepin/.github/.github/workflows/chatOps.yml@master 9 | secrets: inherit 10 | -------------------------------------------------------------------------------- /.github/workflows/call-clacheck.yml: -------------------------------------------------------------------------------- 1 | name: Call CLA check 2 | on: 3 | issue_comment: 4 | types: [created] 5 | pull_request_target: 6 | types: [opened, closed, synchronize] 7 | 8 | concurrency: 9 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 10 | cancel-in-progress: true 11 | 12 | jobs: 13 | clacheck: 14 | uses: linuxdeepin/.github/.github/workflows/cla-check.yml@master 15 | secrets: inherit 16 | -------------------------------------------------------------------------------- /.github/workflows/call-commitlint.yml: -------------------------------------------------------------------------------- 1 | name: Call commitlint 2 | on: 3 | pull_request_target: 4 | 5 | concurrency: 6 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 7 | cancel-in-progress: true 8 | 9 | jobs: 10 | check_job: 11 | uses: linuxdeepin/.github/.github/workflows/commitlint.yml@master 12 | -------------------------------------------------------------------------------- /.github/workflows/call-license-check.yml: -------------------------------------------------------------------------------- 1 | name: Call License and README Check 2 | on: 3 | pull_request_target: 4 | types: [opened, synchronize, reopened] 5 | 6 | permissions: 7 | pull-requests: write 8 | contents: read 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | license-check: 16 | uses: linuxdeepin/.github/.github/workflows/license-check.yml@master 17 | -------------------------------------------------------------------------------- /.github/workflows/cppcheck.yml: -------------------------------------------------------------------------------- 1 | name: cppcheck 2 | on: 3 | pull_request_target: 4 | paths-ignore: 5 | - ".github/workflows/**" 6 | 7 | concurrency: 8 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | cppchceck: 13 | name: cppcheck 14 | runs-on: ubuntu-latest 15 | steps: 16 | - run: export 17 | - uses: actions/checkout@v3 18 | with: 19 | ref: ${{ github.event.pull_request.head.sha }} 20 | persist-credentials: false 21 | - uses: linuxdeepin/action-cppcheck@main 22 | with: 23 | github_token: ${{ secrets.GITHUB_TOKEN }} 24 | repository: ${{ github.repository }} 25 | pull_request_id: ${{ github.event.pull_request.number }} 26 | allow_approve: false 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Qt 2 | *.user 3 | 4 | *.qm 5 | 6 | moc_*.cpp 7 | 8 | moc_*.h 9 | 10 | qrc_*.cpp 11 | 12 | ui_*.h 13 | 14 | #lib 15 | *.so 16 | 17 | *.so.1 18 | 19 | *.so.1.0 20 | 21 | *.so.1.0.0 22 | 23 | #else 24 | *.autosave 25 | 26 | #linglong building dir 27 | linglong 28 | build 29 | 30 | # vscode 31 | .vscode 32 | 33 | # AI config files 34 | .roo/ 35 | .ruru/ 36 | .roomodes 37 | .kilocode/ -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: deepin-reader 3 | Upstream-Contact: UnionTech Software Technology Co., Ltd. <> 4 | Source: https://github.com/linuxdeepin/deepin-reader 5 | 6 | # ci 7 | Files: .github/* 8 | Copyright: None 9 | License: CC0-1.0 10 | 11 | # gitignore 12 | Files: .gitignore 13 | Copyright: None 14 | License: CC0-1.0 15 | 16 | # xml toml json conf yaml sh 17 | Files: *.toml *.json *conf *.yaml *.sh 18 | Copyright: None 19 | License: CC0-1.0 20 | 21 | # debian 22 | Files: debian/* 23 | Copyright: None 24 | License: CC0-1.0 25 | 26 | # patches 27 | Files: patches/* 28 | Copyright: None 29 | License: CC0-1.0 30 | 31 | # rpm 32 | Files: rpm/* 33 | Copyright: None 34 | License: CC0-1.0 35 | 36 | # Project file 37 | Files: *.pro *.prf *.pri *.qrc *CMakeLists.txt .tx/* *.cmake 38 | Copyright: None 39 | License: CC0-1.0 40 | 41 | # README 42 | Files: README.md README.zh_CN.md 43 | Copyright: UnionTech Software Technology Co., Ltd. 44 | License: CC-BY-4.0 45 | 46 | # assets 47 | Files: assets/* 48 | Copyright: None 49 | License: LGPL-3.0-or-later 50 | 51 | # translations 52 | Files: translations/* 53 | Copyright: UnionTech Software Technology Co., Ltd. 54 | License: LGPL-3.0-or-later 55 | 56 | # src 57 | Files: src/* 58 | Copyright: UnionTech Software Technology Co., Ltd. 59 | License: GPL-3.0-or-later 60 | 61 | # tests 62 | Files: tests/* 63 | Copyright: UnionTech Software Technology Co., Ltd. 64 | License: GPL-3.0-or-later 65 | 66 | # reader all files 67 | Files: reader/* 68 | Copyright: UnionTech Software Technology Co., Ltd. 69 | License: GPL-3.0-or-later 70 | 71 | # resources 72 | Files: resources/* 73 | Copyright: UnionTech Software Technology Co., Ltd. 74 | License: GPL-3.0-or-later 75 | 76 | # htmltopdf 77 | Files: htmltopdf/* 78 | Copyright: UnionTech Software Technology Co., Ltd. 79 | License: GPL-3.0-or-later 80 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | minimum_perc = 80 4 | mode = developer 5 | 6 | [deepin-document-viewer.deepin-document-viewer] 7 | file_filter = translations/deepin-reader_.ts 8 | source_file = translations/deepin-reader.ts 9 | source_lang = en 10 | type = QT 11 | 12 | [deepin-document-viewer.deepin-document-viewer-desktop-ts] 13 | file_filter = translations/desktop/desktop_.ts 14 | preTranslate_file = src/deepin-reader.desktop 15 | source_file = translations/desktop/desktop.ts 16 | source_lang = en 17 | type = QT 18 | 19 | -------------------------------------------------------------------------------- /.tx/deepin.conf: -------------------------------------------------------------------------------- 1 | [transifex] 2 | branch = m20 3 | -------------------------------------------------------------------------------- /.tx/transifex.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. 2 | # 3 | # SPDX-License-Identifier: CC0-1.0 4 | filters: 5 | - filter_type: file 6 | source_file: translations/deepin-reader.ts 7 | file_format: QT 8 | source_language: en_US 9 | translation_files_expression: translations/deepin-reader_.ts 10 | - filter_type: file 11 | source_file: translations/desktop/desktop.ts 12 | file_format: QT 13 | source_language: en_US 14 | translation_files_expression: translations/desktop/desktop_.ts 15 | settings: 16 | pr_branch_name: transifex_update_ 17 | -------------------------------------------------------------------------------- /.tx/ts2desktop: -------------------------------------------------------------------------------- 1 | DESKTOP_TEMP_FILE=src/deepin-reader.desktop.tmp 2 | DESKTOP_SOURCE_FILE=src/deepin-reader.desktop 3 | DESKTOP_DEST_FILE=src/deepin-reader.desktop 4 | DESKTOP_TS_DIR=translations/desktop 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deepin-reader 2 | 3 | deepin-reader is a small, fast and full-featured tool for viewing documents,supporting PDF and DJVU formats, multi-window and multi-tab management,thumbnail viewing, adding bookmarks and notes, magnifying, slide show,searching texts, rotation, etc. 4 | 5 | ## Dependencies 6 | 7 | In debian, use below command to install compile dependencies: 8 | 9 | `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` 10 | 11 | ## Install 12 | 13 | ```sh 14 | git clone 15 | cd deepin-reader 16 | qmake 17 | make 18 | sudo make install 19 | ``` 20 | 21 | ## Getting help 22 | 23 | Any usage issues can ask for help via 24 | 25 | * [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) 26 | * [IRC channel](https://webchat.freenode.net/?channels=deepin) 27 | * [Forum](https://bbs.deepin.org) 28 | * [WiKi](http://wiki.deepin.org/) 29 | 30 | ## Getting involved 31 | 32 | We encourage you to report issues and contribute changes 33 | 34 | * [Contribution guide for developers](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers-en). (English) 35 | * [开发者代码贡献指南](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers) (中文) 36 | 37 | ## License 38 | 39 | deepin-reader Viewer is licensed under [GPL-3.0-or-later](LICENSE). 40 | -------------------------------------------------------------------------------- /README.zh_CN.md: -------------------------------------------------------------------------------- 1 | # deepin-reader 2 | 3 | deepin-reader是一款小型、快速、功能齐全的工具,用于查看文档,支持PDF和DJVU格式、多窗口和多选项卡管理、缩略图查看、添加书签和注释、放大、幻灯片放映、搜索文本、旋转等. 4 | 5 | ## 依赖关系 6 | 7 | In debian, use below command to install compile dependencies: 8 | 9 | `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` 10 | 11 | ## 安装 12 | 13 | ```sh 14 | git clone 15 | cd deepin-reader 16 | qmake 17 | make 18 | sudo make install 19 | ``` 20 | 21 | ## 帮助 22 | 23 | Any usage issues can ask for help via 24 | 25 | * [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) 26 | * [IRC channel](https://webchat.freenode.net/?channels=deepin) 27 | * [Forum](https://bbs.deepin.org) 28 | * [WiKi](http://wiki.deepin.org/) 29 | 30 | ## 参与贡献 31 | 32 | We encourage you to report issues and contribute changes 33 | 34 | * [Contribution guide for developers](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers-en). (English) 35 | * [开发者代码贡献指南](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers) (中文) 36 | 37 | ## 证书 38 | 39 | deepin-reader Viewer根据[GPL-3.0-or-later](许可证)获得许可. 40 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/+.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | + 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/-.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | - 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/A _big.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A _big 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/A _small.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A _small 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/O.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | O 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/P.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/attention.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | attention 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/bookmark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmark_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/bookmark_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmark_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/bookmarkbig_checked_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmarkbig_checked_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/catalog.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | catalog 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/choose_normal_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | choose_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/choose_small_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | choose_small_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/close_icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Rectangle 9 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/comments_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | comments_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/comments_normal_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | comments_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/hand_normal_light.svg: -------------------------------------------------------------------------------- 1 | 画板 1 副本 -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/hand_small_normal_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | hand_small_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/magnifier_normal_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/next.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | next 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/nextdown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | next 7 | Created with Sketch. 8 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/notes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | notes 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/plus_icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/previous.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | previous 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/setting_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | setting_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/suspend_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | suspend_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/thumbnail_normal_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | thumbnail_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/tips.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | tips 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/view_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | view_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/common/view_normal_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | view_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/en_US/fig/add comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/en_US/fig/add comment.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/en_US/fig/hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/en_US/fig/hotkey.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/en_US/fig/pageSetupdoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/en_US/fig/pageSetupdoc.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/en_US/fig/previewdoc1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/en_US/fig/previewdoc1.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/en_US/fig/printerdoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/en_US/fig/printerdoc.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/zh_CN/fig/hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/zh_CN/fig/hotkey.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/zh_CN/fig/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/zh_CN/fig/printer.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/zh_CN/fig/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/zh_CN/fig/setting.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/zh_HK/fig/hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/zh_HK/fig/hotkey.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/zh_TW/fig/hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/zh_TW/fig/hotkey.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/zh_TW/fig/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/zh_TW/fig/printer.png -------------------------------------------------------------------------------- /assets/deepin-reader/document-viewer/zh_TW/fig/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/assets/deepin-reader/document-viewer/zh_TW/fig/setting.png -------------------------------------------------------------------------------- /cmake/translation-generate.cmake: -------------------------------------------------------------------------------- 1 | function(TRANSLATION_GENERATE QMS) 2 | find_package(Qt${QT_VERSION_MAJOR}LinguistTools QUIET) 3 | 4 | if (NOT Qt${QT_VERSION_MAJOR}_LRELEASE_EXECUTABLE) 5 | set(QT_LRELEASE "/lib/qt${QT_VERSION_MAJOR}/bin/lrelease") 6 | message(STATUS "NOT found lrelease, set QT_LRELEASE = ${QT_LRELEASE}") 7 | else() 8 | set(QT_LRELEASE "${Qt${QT_VERSION_MAJOR}_LRELEASE_EXECUTABLE}") 9 | endif() 10 | 11 | if(NOT ARGN) 12 | message(SEND_ERROR "Error: TRANSLATION_GENERATE() called without any .ts path") 13 | return() 14 | endif() 15 | 16 | # # 获取 translations 目录下的所有 .ts 文件 17 | # file(GLOB_RECURSE TS_FILES "${ARGN}/*.ts") 18 | # 获取指定目录下的所有 .ts 文件,不包括子目录 19 | file(GLOB TS_FILES "${ARGN}/*.ts") 20 | 21 | set(${QMS}) 22 | foreach(TSFIL ${TS_FILES}) 23 | get_filename_component(FIL_WE ${TSFIL} NAME_WE) 24 | # get_filename_component(TS_DIR ${TSFIL} DIRECTORY) 25 | set(QMFIL ${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.qm) 26 | list(APPEND ${QMS} ${QMFIL}) 27 | add_custom_command( 28 | OUTPUT ${QMFIL} 29 | # COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${CMAKE_SOURCE_DIR} -ts ${TSFIL} 30 | COMMAND ${QT_LRELEASE} ${TSFIL} -qm ${QMFIL} 31 | DEPENDS ${TSFIL} 32 | COMMENT "Running ${QT_LRELEASE} on ${TSFIL}" 33 | VERBATIM 34 | ) 35 | endforeach() 36 | 37 | set_source_files_properties(${${QMS}} PROPERTIES GENERATED TRUE) 38 | set(${QMS} ${${QMS}} PARENT_SCOPE) 39 | endfunction() 40 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 11 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | 2 | Source: deepin-reader 3 | Section: graphics 4 | Priority: optional 5 | Maintainer: deepin 6 | Build-Depends: 7 | debhelper (>= 11), 8 | pkg-config, 9 | qt6-5compat-dev [!mipsel !mips64el] | libqt5x11extras5-dev, 10 | qt6-base-dev [!mipsel !mips64el] | qtbase5-dev, 11 | qt6-tools-dev-tools [!mipsel !mips64el] | qttools5-dev-tools, 12 | qt6-tools-dev [!mipsel !mips64el] | qttools5-dev, 13 | qt6-svg-dev [!mipsel !mips64el] | libqt5svg5-dev, 14 | qt6-webengine-dev [!mipsel !mips64el] | qtwebengine5-dev, 15 | libdtk6widget-dev [!mipsel !mips64el] | libdtkwidget-dev, 16 | libdtk6gui-dev [!mipsel !mips64el] | libdtkgui-dev, 17 | libdtk6core-dev [!mipsel !mips64el] | libdtkcore-dev, 18 | libdeepin-pdfium-dev (>= 1.5.1) [!mipsel !mips64el] | libdeepin-pdfium5-dev (>= 1.5.1), 19 | libdjvulibre-dev, 20 | libtiff-dev, 21 | libjpeg-dev, 22 | libicu-dev, 23 | libpng-dev, 24 | zlib1g-dev, 25 | liblcms2-dev, 26 | libopenjp2-7-dev, 27 | libfreetype6-dev, 28 | libgtest-dev, 29 | libchardet-dev, 30 | Standards-Version: 4.5.0 31 | 32 | Package: deepin-reader 33 | Architecture: any 34 | Depends: 35 | ${shlibs:Depends}, 36 | ${misc:Depends}, 37 | pandoc, 38 | libqt6webenginecore6-bin [!mipsel !mips64el] | libqt5core5a 39 | Description: a tool for reading document files. 40 | Document Viewer is a tool for reading document files, supporting PDF, DJVU, DOCX etc. 41 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: deepin-reader 3 | Source: https://github.com/linuxdeepin/deepin-reader 4 | 5 | Files: * 6 | Copyright: 2020-2021 Deepin Technology Co., Ltd. 7 | License: BSD-3-Clause 8 | This package is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | . 13 | This package is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | . 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see 20 | . 21 | On Debian systems, the complete text of the GNU General 22 | Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". 23 | -------------------------------------------------------------------------------- /debian/deepin-reader.1: -------------------------------------------------------------------------------- 1 | .TH "deepin-reader" "1" "2021-1-28" "Deepin" 2 | .SH NAME 3 | deepin-reader 4 | .SH DESCRIPTION 5 | a tool for reading document files,supporting PDF, DJVU, DOCX etc 6 | .SH SYNOPSIS 7 | deepin-reader [FILE(s)...] [OPTIONS...] 8 | .SH OPTIONS 9 | .PP 10 | -thumbnail tell deepin-reader to generate thumbnail of PDF file 11 | .PP 12 | -f -filePath thumbnail source file,this option needs to be set after -thumbnail 13 | .PP 14 | -t -thumbnailPath thumbnail generation path,this option needs to be set after -thumbnail 15 | .SH SEE ALSO 16 | https://github.com/linuxdeepin/deepin-reader 17 | .SH AUTHOR 18 | .PP 19 | .B deepin-reader 20 | is written by Deepin Technology Co., Ltd. 21 | .PP 22 | This manual page was written by 23 | .MT zhangsong@\:uniontech.com 24 | ZhangSong 25 | .ME 26 | for the Debian Project (but may be used by others) 27 | -------------------------------------------------------------------------------- /debian/manpages: -------------------------------------------------------------------------------- 1 | debian/deepin-reader.1 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | include /usr/share/dpkg/default.mk 3 | 4 | # 有的Qt5环境需要设置环境变量,Qt6不需要 5 | export QT_SELECT=5 6 | 7 | # 检测当前安装的Qt版本,优先使用Qt6,否则使用Qt5 8 | define detect_qt_version 9 | ifneq (,$(shell which qmake6 2>/dev/null)) 10 | QT_DIR="/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/Qt6" 11 | else 12 | QT_DIR="/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/Qt5" 13 | endif 14 | endef 15 | 16 | # 调用检测Qt版本的命令 17 | $(eval $(call detect_qt_version)) 18 | 19 | # hardcode this if want to force build with sepecific Qt version 20 | # QT_DIR="/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/Qt5" 21 | 22 | DH_AUTO_ARGS = --parallel --buildsystem=cmake 23 | 24 | %: 25 | dh $@ --parallel 26 | 27 | override_dh_auto_configure: 28 | dh_auto_configure -- \ 29 | -DCMAKE_BUILD_TYPE=Release \ 30 | -DCMAKE_SAFETYTEST_ARG="CMAKE_SAFETYTEST_ARG_OFF" \ 31 | -DAPP_VERSION=$(DEB_VERSION_UPSTREAM) \ 32 | -DVERSION=$(DEB_VERSION_UPSTREAM) \ 33 | -DCMAKE_INSTALL_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \ 34 | -DQT_DIR=$(QT_DIR) -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /htmltopdf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 定义htmltopdf可执行文件 2 | add_executable(htmltopdf 3 | main.cpp 4 | htmltopdfconverter.cpp 5 | htmltopdfconverter.h 6 | ) 7 | 8 | # 启用自动moc处理 9 | set_target_properties(htmltopdf PROPERTIES 10 | AUTOMOC ON 11 | AUTORCC ON 12 | AUTOUIC ON 13 | ) 14 | 15 | find_package(Qt${QT_DESIRED_VERSION} REQUIRED COMPONENTS WebEngineWidgets) 16 | 17 | # 链接Qt模块 18 | target_link_libraries(htmltopdf PRIVATE 19 | Qt${QT_VERSION_MAJOR}::WebEngineWidgets 20 | Qt${QT_VERSION_MAJOR}::Core 21 | ) 22 | 23 | # 安全编译选项 24 | target_compile_options(htmltopdf PRIVATE 25 | -fstack-protector-strong 26 | -D_FORTIFY_SOURCE=2 27 | -fPIC 28 | -pie 29 | ) 30 | 31 | target_link_options(htmltopdf PRIVATE 32 | -pie 33 | ) 34 | 35 | # 特殊架构优化 36 | if(CMAKE_SYSTEM_PROCESSOR MATCHES "mips64") 37 | target_compile_options(htmltopdf PRIVATE 38 | -O3 39 | -ftree-vectorize 40 | -march=loongson3a 41 | -mhard-float 42 | -mno-micromips 43 | -mno-mips16 44 | -flax-vector-conversions 45 | -mloongson-ext2 46 | -mloongson-mmi 47 | ) 48 | endif() 49 | 50 | # 安装目标 51 | install(TARGETS htmltopdf 52 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/deepin-reader 53 | ) -------------------------------------------------------------------------------- /htmltopdf/htmltopdf.pro: -------------------------------------------------------------------------------- 1 | #config 2 | TEMPLATE = app 3 | 4 | TARGET = htmltopdf 5 | 6 | QT += webenginewidgets 7 | 8 | isEmpty(PREFIX) { 9 | PREFIX = /usr 10 | } 11 | DEFINES += QMAKE_INSTALL_PREFIX=\"\\\"$$PREFIX\\\"\" 12 | 13 | target.path = $$PREFIX/lib/deepin-reader 14 | 15 | INSTALLS += target 16 | 17 | ###安全漏洞检测 18 | #QMAKE_CXX += -g -fsanitize=undefined,address -O2 19 | #QMAKE_CXXFLAGS += -g -fsanitize=undefined,address -O2 20 | #QMAKE_LFLAGS += -g -fsanitize=undefined,address -O2 21 | 22 | #安全编译参数 23 | QMAKE_CFLAGS += -fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy 24 | QMAKE_CXXFLAGS += -fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy 25 | 26 | QMAKE_CXXFLAGS += -fPIE 27 | 28 | QMAKE_LFLAGS += -pie 29 | 30 | contains(QMAKE_HOST.arch, mips64):{ 31 | QMAKE_CXXFLAGS += "-O3 -ftree-vectorize -march=loongson3a -mhard-float -mno-micromips -mno-mips16 -flax-vector-conversions -mloongson-ext2 -mloongson-mmi" 32 | } 33 | 34 | CONFIG += c++11 35 | 36 | #code 37 | HEADERS += \ 38 | htmltopdfconverter.h 39 | 40 | SOURCES += \ 41 | main.cpp \ 42 | htmltopdfconverter.cpp 43 | -------------------------------------------------------------------------------- /htmltopdf/htmltopdfconverter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "htmltopdfconverter.h" 7 | 8 | #include 9 | 10 | HtmltoPdfConverter::HtmltoPdfConverter(const QString &inputPath, const QString &outputPath) 11 | : m_inputPath(inputPath) 12 | , m_outputPath(outputPath) 13 | , m_page(new QWebEnginePage) 14 | { 15 | qDebug() << "HtmltoPdfConverter initialized with input:" << inputPath << "output:" << outputPath; 16 | 17 | connect(m_page.data(), &QWebEnginePage::loadFinished, 18 | this, &HtmltoPdfConverter::loadFinished); 19 | connect(m_page.data(), &QWebEnginePage::pdfPrintingFinished, 20 | this, &HtmltoPdfConverter::pdfPrintingFinished); 21 | } 22 | 23 | int HtmltoPdfConverter::run() 24 | { 25 | qDebug() << "Starting HTML to PDF conversion process"; 26 | QUrl url = QUrl::fromUserInput(m_inputPath); 27 | qDebug() << "Loading HTML file from path:" << url; 28 | m_page->load(url); 29 | return QCoreApplication::exec(); 30 | } 31 | 32 | void HtmltoPdfConverter::loadFinished(bool ok) 33 | { 34 | if (!ok) { 35 | qWarning() << QString("Failed to load URL '%1'").arg(m_inputPath); 36 | QCoreApplication::exit(1); 37 | } 38 | qInfo() << QString("Successfully loaded URL '%1'").arg(m_inputPath); 39 | m_page->printToPdf(m_outputPath); 40 | } 41 | 42 | void HtmltoPdfConverter::pdfPrintingFinished(const QString &filePath, bool success) 43 | { 44 | if (!success) { 45 | qWarning() << QString("Failed to print to output file '%1'").arg(filePath); 46 | QCoreApplication::exit(1); 47 | } else { 48 | QCoreApplication::quit(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /htmltopdf/htmltopdfconverter.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef HTML2PDFCONVERTER_H 7 | #define HTML2PDFCONVERTER_H 8 | 9 | #include 10 | 11 | /** 12 | * @brief The HtmltoPdfConverter class 13 | * html文件转换为pdf格式文件功能 14 | */ 15 | class HtmltoPdfConverter : public QObject 16 | { 17 | Q_OBJECT 18 | public: 19 | explicit HtmltoPdfConverter(const QString &inputPath, const QString &outputPath); 20 | int run(); 21 | 22 | private slots: 23 | void loadFinished(bool ok); 24 | void pdfPrintingFinished(const QString &filePath, bool success); 25 | 26 | private: 27 | QString m_inputPath; //输入文件html 28 | QString m_outputPath; //输出文件pdf 29 | QScopedPointer m_page; 30 | }; 31 | 32 | #endif // HTML2PDFCONVERTER_H 33 | -------------------------------------------------------------------------------- /reader/Application.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef APPLICATION_H_ 7 | #define APPLICATION_H_ 8 | 9 | #include 10 | 11 | class AppInfo; 12 | 13 | #if defined(dApp) 14 | #undef dApp 15 | #endif 16 | #define dApp (static_cast(QCoreApplication::instance())) 17 | 18 | DWIDGET_USE_NAMESPACE 19 | 20 | class Application : public DApplication 21 | { 22 | Q_OBJECT 23 | public: 24 | Application(int &argc, char **argv); 25 | 26 | ~Application() override; 27 | 28 | void emitSheetChanged(); 29 | 30 | signals: 31 | void sigShowAnnotTextWidget(); 32 | 33 | void sigSetPasswdFocus(); 34 | 35 | protected: 36 | /** 37 | * @brief handleQuitAction 38 | * 通过菜单选项关闭所有 39 | */ 40 | void handleQuitAction() override; 41 | 42 | /** 43 | * @brief notify 44 | * 让无法响应的对象强行响应 45 | * @param object 46 | * @param event 47 | * @return 48 | */ 49 | bool notify(QObject *object, QEvent *event) override; 50 | }; 51 | 52 | #endif // APPLICATION_H_ 53 | -------------------------------------------------------------------------------- /reader/app/MsgHeader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef MSGHEADER_H 7 | #define MSGHEADER_H 8 | 9 | namespace { 10 | 11 | // 搜索框消息 12 | enum E_FIND_WIDGET_MSG { 13 | E_FIND_PREV, 14 | E_FIND_NEXT, 15 | E_FIND_EXIT, 16 | E_FIND_CONTENT, 17 | }; 18 | 19 | // 高亮&注释消息 20 | enum E_NOTE_MSG { 21 | MSG_NOTE_ADD = 0, 22 | MSG_NOTE_MOVE, 23 | MSG_NOTE_DELETE, 24 | MSG_ALL_NOTE_DELETE 25 | }; 26 | 27 | enum E_MENU_ACTION { 28 | E_HANDLE_SELECT_TEXT, 29 | E_HANDLE_HANDLE_TOOL, 30 | E_BOOKMARK_DELETE, 31 | E_BOOKMARK_DELETE_ALL, 32 | E_NOTE_COPY, 33 | E_NOTE_DELETE, 34 | E_NOTE_DELETE_ALL 35 | }; 36 | 37 | } 38 | #endif // MSGHEADER_H 39 | -------------------------------------------------------------------------------- /reader/app/TMFunctionThread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "TMFunctionThread.h" 7 | 8 | TMFunctionThread::TMFunctionThread(QObject *parent) : QThread(parent) 9 | { 10 | qDebug() << "Function thread created"; 11 | } 12 | 13 | TMFunctionThread::~TMFunctionThread() 14 | { 15 | qDebug() << "Destroying function thread"; 16 | this->wait(); 17 | qDebug() << "Function thread destroyed"; 18 | } 19 | 20 | void TMFunctionThread::run() 21 | { 22 | qDebug() << "Function thread started running"; 23 | result = func(); 24 | qDebug() << "Function execution completed, result:" << result; 25 | } 26 | -------------------------------------------------------------------------------- /reader/app/TMFunctionThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef TMFUNCTIONTHREAD_H 7 | #define TMFUNCTIONTHREAD_H 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | typedef std::function FNTemplate; 15 | class TMFunctionThread : public QThread 16 | { 17 | Q_OBJECT 18 | public: 19 | explicit TMFunctionThread(QObject *parent = nullptr); 20 | ~TMFunctionThread(); 21 | 22 | public: 23 | FNTemplate func; 24 | QVariant result; 25 | 26 | protected: 27 | void run() override; 28 | }; 29 | 30 | #endif // TMFUNCTIONTHREAD_H 31 | -------------------------------------------------------------------------------- /reader/app/app.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/DebugTimeManager.h \ 3 | $$PWD/Global.h \ 4 | $$PWD/Database.h \ 5 | $$PWD/Utils.h \ 6 | $$PWD/MsgHeader.h \ 7 | $$PWD/accessibledefine.h \ 8 | $$PWD/accessible.h \ 9 | $$PWD/TMFunctionThread.h \ 10 | $$PWD/DBusObject.h \ 11 | $$PWD/eventlogutils.h \ 12 | 13 | SOURCES += \ 14 | $$PWD/DebugTimeManager.cpp \ 15 | $$PWD/Global.cpp \ 16 | $$PWD/Database.cpp \ 17 | $$PWD/Utils.cpp \ 18 | $$PWD/TMFunctionThread.cpp \ 19 | $$PWD/DBusObject.cpp \ 20 | $$PWD/eventlogutils.cpp \ 21 | 22 | INCLUDEPATH += $$PWD 23 | 24 | -------------------------------------------------------------------------------- /reader/app/eventlogutils.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef EVENTLOGUTILS_H 7 | #define EVENTLOGUTILS_H 8 | 9 | #include 10 | #include 11 | 12 | class EventLogUtils 13 | { 14 | public: 15 | enum EventTID { 16 | OpeningTime = 1000000000, 17 | ClosingTime = 1000000001, 18 | Start = 1000000003, 19 | Quit = 1000000004 20 | }; 21 | 22 | static EventLogUtils &get(); 23 | void writeLogs(QJsonObject &data); 24 | 25 | private: 26 | bool (*init)(const std::string &packagename, bool enable_sig) = nullptr; 27 | void (*writeEventLog)(const std::string &eventdata) = nullptr; 28 | 29 | static EventLogUtils *mInstance; 30 | 31 | EventLogUtils(); 32 | }; 33 | 34 | #endif // EVENTLOGUTILS_H 35 | -------------------------------------------------------------------------------- /reader/browser/BrowserWord.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef BrowserWord_H 7 | #define BrowserWord_H 8 | 9 | #include "Model.h" 10 | 11 | #include 12 | #include 13 | 14 | class BrowserPage; 15 | 16 | /** 17 | * @brief 用于表示一页文档中的某个文字 18 | */ 19 | class BrowserWord : public QGraphicsItem 20 | { 21 | public: 22 | explicit BrowserWord(QGraphicsItem *parent, deepin_reader::Word word); 23 | 24 | QRectF boundingRect()const override; 25 | 26 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override; 27 | 28 | void mousePressEvent(QGraphicsSceneMouseEvent *event) override; 29 | 30 | void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; 31 | 32 | /** 33 | * @brief 获取文字文本 34 | * @return 35 | */ 36 | QString text(); 37 | 38 | /** 39 | * @brief 设置文字无法选中 40 | * @param enable 是否可以被选中 41 | */ 42 | void setSelectable(bool enable); 43 | 44 | /** 45 | * @brief 为了让文字占比固定,视图改变时需要设置缩放因子 46 | * @param scaleFactor 缩放因子 47 | */ 48 | void setScaleFactor(qreal scaleFactor); 49 | 50 | /** 51 | * @brief BrowserWord::boundingBox 52 | * 文字自身的区域 53 | * @return 54 | */ 55 | QRectF boundingBox()const; 56 | 57 | private: 58 | deepin_reader::Word m_word; 59 | 60 | qreal m_scaleFactor = 1; 61 | 62 | bool m_selectable = true; 63 | }; 64 | 65 | #endif // BrowserWord_H 66 | -------------------------------------------------------------------------------- /reader/browser/PageSearchThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef PAGESEARCHTHREAD_H 7 | #define PAGESEARCHTHREAD_H 8 | 9 | #include "Model.h" 10 | 11 | #include 12 | 13 | class BrowserPage; 14 | class DocSheet; 15 | class PageSearchThread : public QThread 16 | { 17 | Q_OBJECT 18 | public: 19 | explicit PageSearchThread(QObject *parent = nullptr); 20 | 21 | virtual ~PageSearchThread() override; 22 | 23 | public: 24 | void startSearch(DocSheet *sheet, QString text); 25 | 26 | void stopSearch(); 27 | 28 | signals: 29 | void sigSearchReady(const deepin_reader::SearchResult &res); 30 | 31 | /** 32 | * @brief sigSearchResultNotEmpty 33 | * 搜索结果不为空信号 34 | */ 35 | void sigSearchResultNotEmpty(); 36 | 37 | protected: 38 | void run() override; 39 | 40 | private: 41 | /** 42 | * @brief initCJKtoKangxi 43 | * 由于docx转换工具会将部分CJK字体转为康熙字典部首字体,需要在搜索时再搜索一遍这些康熙字典部首字体 44 | * 该函数会根据CJK与康熙字典部首匹配文件初始化m_cjktokangximap 45 | */ 46 | void initCJKtoKangxi(); 47 | 48 | private: 49 | bool m_quit = false; 50 | int m_startIndex = 0; 51 | QString m_searchText; 52 | DocSheet *m_sheet = nullptr; 53 | static QMap m_cjktokangximap; 54 | }; 55 | 56 | #endif // PAGESEARCHTHREAD_H 57 | -------------------------------------------------------------------------------- /reader/browser/browser.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/BrowserAnnotation.h \ 3 | $$PWD/BrowserMagniFier.h \ 4 | $$PWD/BrowserMenu.h \ 5 | $$PWD/BrowserPage.h \ 6 | $$PWD/BrowserWord.h \ 7 | $$PWD/SheetBrowser.h \ 8 | $$PWD/PageRenderThread.h \ 9 | $$PWD/PageSearchThread.h 10 | 11 | SOURCES += \ 12 | $$PWD/BrowserMagniFier.cpp \ 13 | $$PWD/BrowserPage.cpp \ 14 | $$PWD/BrowserAnnotation.cpp \ 15 | $$PWD/BrowserMenu.cpp \ 16 | $$PWD/BrowserWord.cpp \ 17 | $$PWD/SheetBrowser.cpp \ 18 | $$PWD/PageRenderThread.cpp \ 19 | $$PWD/PageSearchThread.cpp 20 | 21 | INCLUDEPATH += $$PWD 22 | -------------------------------------------------------------------------------- /reader/document/document.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/Model.h \ 3 | $$PWD/PDFModel.h \ 4 | $$PWD/DjVuModel.h 5 | 6 | SOURCES += \ 7 | $$PWD/PDFModel.cpp \ 8 | $$PWD/DjVuModel.cpp \ 9 | $$PWD/Model.cpp 10 | 11 | INCLUDEPATH += $$PWD 12 | 13 | DEFINES += INSTALL_PREFIX=\\\"$$PREFIX\\\" 14 | -------------------------------------------------------------------------------- /reader/load_libs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd. 3 | * 4 | * Author: shicetu 5 | * hujianbo 6 | * Maintainer: shicetu 7 | * hujianbo 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #ifndef LOAD_LIBS_H 23 | #define LOAD_LIBS_H 24 | #include 25 | 26 | typedef void (*uos_document_clip_copy)(const char *path, int *intercept); 27 | typedef void (*uos_document_close)(const char *path); 28 | 29 | typedef struct _LoadLibNames { 30 | char *chDocumentPr; 31 | } LoadLibNames; 32 | 33 | void setLibNames(LoadLibNames tmp); 34 | 35 | typedef struct _LoadLibs { 36 | uos_document_clip_copy m_document_clip_copy; 37 | uos_document_close m_document_close; 38 | } LoadLibs; 39 | 40 | LoadLibs *getLoadLibsInstance();//饿汉式不支持延迟加载 41 | 42 | 43 | #endif//LOAD_LIBS_H 44 | -------------------------------------------------------------------------------- /reader/sidebar/BookMarkDelegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef BOOKMARKDELEGATE_H 7 | #define BOOKMARKDELEGATE_H 8 | 9 | #include 10 | 11 | DWIDGET_USE_NAMESPACE 12 | 13 | /** 14 | * @brief The BookMarkDelegate class 15 | * 书签目录代理类 16 | */ 17 | class BookMarkDelegate : public DStyledItemDelegate 18 | { 19 | public: 20 | explicit BookMarkDelegate(QAbstractItemView *parent = nullptr); 21 | 22 | protected: 23 | /** 24 | * @brief paint 25 | * 书签目录节点绘制 26 | * @param painter 27 | * @param option 28 | * @param index 29 | */ 30 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; 31 | 32 | private: 33 | QAbstractItemView *m_parent = nullptr; 34 | }; 35 | 36 | #endif // BOOKMARKDELEGATE_H 37 | -------------------------------------------------------------------------------- /reader/sidebar/NotesDelegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef NOTESDELEGATE_H 7 | #define NOTESDELEGATE_H 8 | 9 | #include 10 | 11 | DWIDGET_USE_NAMESPACE 12 | /** 13 | * @brief The NotesDelegate class 14 | * 注释代理 15 | */ 16 | class NotesDelegate : public DStyledItemDelegate 17 | { 18 | public: 19 | explicit NotesDelegate(QAbstractItemView *parent = nullptr); 20 | 21 | protected: 22 | /** 23 | * @brief paint 24 | * 绘制 25 | * @param painter 26 | * @param option 27 | * @param index 28 | */ 29 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; 30 | 31 | /** 32 | * @brief sizeHint 33 | * 节点大小 34 | * @param option 35 | * @param index 36 | * @return 37 | */ 38 | QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; 39 | 40 | private: 41 | QAbstractItemView *m_parent = nullptr; 42 | }; 43 | 44 | #endif // NOTESDELEGATE_H 45 | -------------------------------------------------------------------------------- /reader/sidebar/SearchResDelegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef SEARCHRESDELEGATE_H 7 | #define SEARCHRESDELEGATE_H 8 | 9 | #include 10 | 11 | DWIDGET_USE_NAMESPACE 12 | /** 13 | * @brief The SearchResDelegate class 14 | * 搜索代理 15 | */ 16 | class SearchResDelegate : public DStyledItemDelegate 17 | { 18 | public: 19 | explicit SearchResDelegate(QAbstractItemView *parent = nullptr); 20 | 21 | protected: 22 | /** 23 | * @brief paint 24 | * 绘制事件 25 | * @param painter 26 | * @param option 27 | * @param index 28 | */ 29 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; 30 | 31 | /** 32 | * @brief sizeHint 33 | * 节点大小 34 | * @param option 35 | * @param index 36 | * @return 37 | */ 38 | QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; 39 | 40 | private: 41 | QAbstractItemView *m_parent = nullptr; 42 | }; 43 | 44 | #endif // SEARCHRESDELEGATE_H 45 | -------------------------------------------------------------------------------- /reader/sidebar/ThumbnailDelegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef IMAGEVIEWDELEGATE_H 7 | #define IMAGEVIEWDELEGATE_H 8 | 9 | #include 10 | 11 | DWIDGET_USE_NAMESPACE 12 | /** 13 | * @brief The ThumbnailDelegate class 14 | * 缩略图代理 15 | */ 16 | class ThumbnailDelegate : public DStyledItemDelegate 17 | { 18 | public: 19 | explicit ThumbnailDelegate(QAbstractItemView *parent = nullptr); 20 | 21 | protected: 22 | /** 23 | * @brief paint 24 | * 绘制事件 25 | * @param painter 26 | * @param option 27 | * @param index 28 | */ 29 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; 30 | 31 | /** 32 | * @brief sizeHint 33 | * 节点大小 34 | * @param option 35 | * @param index 36 | * @return 37 | */ 38 | QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; 39 | 40 | private: 41 | /** 42 | * @brief drawBookMark 43 | * 绘制书签图标 44 | * @param painter 45 | * @param rect 46 | * @param visible 47 | */ 48 | void drawBookMark(QPainter *painter, const QRect &rect, bool visible) const; 49 | 50 | private: 51 | QAbstractItemView *m_parent = nullptr; 52 | }; 53 | 54 | #endif // IMAGEVIEWDELEGATE_H 55 | -------------------------------------------------------------------------------- /reader/sidebar/sidebar.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/BookMarkDelegate.h \ 3 | $$PWD/BookMarkWidget.h \ 4 | $$PWD/CatalogTreeView.h \ 5 | $$PWD/CatalogWidget.h \ 6 | $$PWD/NotesDelegate.h \ 7 | $$PWD/NotesWidget.h \ 8 | $$PWD/ReaderImageThreadPoolManager.h \ 9 | $$PWD/SearchResDelegate.h \ 10 | $$PWD/SearchResWidget.h \ 11 | $$PWD/SheetSidebar.h \ 12 | $$PWD/SideBarImageListview.h \ 13 | $$PWD/SideBarImageViewModel.h \ 14 | $$PWD/ThumbnailDelegate.h \ 15 | $$PWD/ThumbnailWidget.h 16 | 17 | SOURCES += \ 18 | $$PWD/BookMarkDelegate.cpp \ 19 | $$PWD/BookMarkWidget.cpp \ 20 | $$PWD/CatalogTreeView.cpp \ 21 | $$PWD/CatalogWidget.cpp \ 22 | $$PWD/NotesDelegate.cpp \ 23 | $$PWD/NotesWidget.cpp \ 24 | $$PWD/ReaderImageThreadPoolManager.cpp \ 25 | $$PWD/SearchResDelegate.cpp \ 26 | $$PWD/SearchResWidget.cpp \ 27 | $$PWD/SheetSidebar.cpp \ 28 | $$PWD/SideBarImageListview.cpp \ 29 | $$PWD/SideBarImageViewModel.cpp \ 30 | $$PWD/ThumbnailDelegate.cpp \ 31 | $$PWD/ThumbnailWidget.cpp 32 | 33 | INCLUDEPATH += $$PWD 34 | -------------------------------------------------------------------------------- /reader/uiframe/CentralNavPage.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef CentralNavPage_H 7 | #define CentralNavPage_H 8 | 9 | #include "BaseWidget.h" 10 | 11 | /** 12 | * @brief The CentralNavPage class 13 | * 嵌入当前窗体中心控件的无文档默认页面 14 | */ 15 | class CentralNavPage : public BaseWidget 16 | { 17 | Q_OBJECT 18 | Q_DISABLE_COPY(CentralNavPage) 19 | 20 | public: 21 | explicit CentralNavPage(DWidget *parent = nullptr); 22 | 23 | signals: 24 | /** 25 | * @brief sigNeedOpenFilesExec 26 | * 请求阻塞式选择并打开文档 27 | */ 28 | void sigNeedOpenFilesExec(); 29 | 30 | private slots: 31 | /** 32 | * @brief onThemeChanged 33 | * 主题变化时处理 34 | */ 35 | void onThemeChanged(); 36 | 37 | }; 38 | 39 | #endif // OPENFILEWIDGET_H 40 | -------------------------------------------------------------------------------- /reader/uiframe/TitleWidget.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef TITLEWIDGET_H 6 | #define TITLEWIDGET_H 7 | 8 | #include "DocSheet.h" 9 | #include "BaseWidget.h" 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | class ScaleWidget; 18 | class DocSheet; 19 | 20 | /** 21 | * @brief The TitleWidget class 22 | * 窗体自定义标题栏 23 | */ 24 | class TitleWidget : public BaseWidget 25 | { 26 | Q_OBJECT 27 | Q_DISABLE_COPY(TitleWidget) 28 | 29 | public: 30 | explicit TitleWidget(DWidget *parent = nullptr); 31 | 32 | ~TitleWidget() override; 33 | 34 | public: 35 | /** 36 | * @brief setControlEnabled 37 | * 设置控件知否可用单元 38 | * @param enable 39 | */ 40 | void setControlEnabled(const bool &enable); 41 | 42 | public slots: 43 | /** 44 | * @brief onCurSheetChanged 45 | * 文档窗口切换单元 46 | */ 47 | void onCurSheetChanged(DocSheet *); 48 | 49 | /** 50 | * @brief onFindOperation 51 | * 搜索列表控制单元 52 | */ 53 | void onFindOperation(const int &); 54 | 55 | /** 56 | * @brief onThumbnailBtnClicked 57 | * 缩略图列表显隐按钮 58 | * @param checked 59 | */ 60 | void onThumbnailBtnClicked(bool checked); 61 | 62 | private: 63 | /** 64 | * @brief setBtnDisable 65 | * 设置按钮是否可用 66 | * @param bAble 67 | */ 68 | void setBtnDisable(const bool &bAble); 69 | 70 | protected: 71 | void keyPressEvent(QKeyEvent *event) override; 72 | 73 | private: 74 | QStringList shortKeyList; 75 | 76 | ScaleWidget *m_pSw = nullptr; 77 | DIconButton *m_pThumbnailBtn = nullptr; 78 | QPointer m_curSheet = nullptr; 79 | }; 80 | 81 | #endif // TITLEWIDGET_H 82 | -------------------------------------------------------------------------------- /reader/uiframe/uiframe.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/TitleWidget.h \ 3 | $$PWD/TitleMenu.h \ 4 | $$PWD/Central.h \ 5 | $$PWD/CentralNavPage.h \ 6 | $$PWD/CentralDocPage.h \ 7 | $$PWD/DocTabBar.h \ 8 | $$PWD/DocSheet.h \ 9 | $$PWD/SheetRenderer.h 10 | 11 | SOURCES += \ 12 | $$PWD/TitleMenu.cpp \ 13 | $$PWD/TitleWidget.cpp \ 14 | $$PWD/Central.cpp \ 15 | $$PWD/CentralNavPage.cpp \ 16 | $$PWD/CentralDocPage.cpp \ 17 | $$PWD/DocTabBar.cpp \ 18 | $$PWD/DocSheet.cpp \ 19 | $$PWD/SheetRenderer.cpp 20 | 21 | INCLUDEPATH += $$PWD 22 | -------------------------------------------------------------------------------- /reader/widgets/AttrScrollWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef ATTRSCROLLWIDGET_H 7 | #define ATTRSCROLLWIDGET_H 8 | 9 | #include 10 | #include 11 | 12 | class DocSheet; 13 | class QGridLayout; 14 | /** 15 | * @brief The AttrScrollWidget class 16 | * 文件属性展示控件 17 | */ 18 | class AttrScrollWidget : public Dtk::Widget::DFrame 19 | { 20 | Q_OBJECT 21 | Q_DISABLE_COPY(AttrScrollWidget) 22 | 23 | public: 24 | explicit AttrScrollWidget(DocSheet *sheet, Dtk::Widget::DWidget *parent = nullptr); 25 | 26 | private: 27 | /** 28 | * @brief createLabel 29 | * 创建展示Label子控件 30 | * @param layout 31 | * @param index 32 | * @param objName 33 | * @param sData 34 | */ 35 | void createLabel(QGridLayout *layout, const int &index, const QString &objName, const QString &sData); 36 | 37 | /** 38 | * @brief createLabel 39 | * 创建展示Label子控件 40 | * @param layout 41 | * @param index 42 | * @param objName 43 | * @param sData 44 | */ 45 | void createLabel(QGridLayout *layout, const int &index, const QString &objName, const QDateTime &sData); 46 | 47 | /** 48 | * @brief createLabel 49 | * 创建展示Label子控件 50 | * @param layout 51 | * @param index 52 | * @param objName 53 | * @param bData 54 | */ 55 | void createLabel(QGridLayout *layout, const int &index, const QString &objName, const bool &bData); 56 | 57 | protected: 58 | bool eventFilter(QObject *object, QEvent *event) override; 59 | 60 | QList m_leftWidgetlst; 61 | QList m_rightWidgetlst; 62 | }; 63 | 64 | #endif // ATTRSCROLLWIDGET_H 65 | -------------------------------------------------------------------------------- /reader/widgets/BaseWidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "BaseWidget.h" 7 | #include 8 | 9 | #include 10 | 11 | BaseWidget::BaseWidget(DWidget *parent) 12 | : DWidget(parent) 13 | { 14 | qDebug() << "BaseWidget created, parent:" << parent; 15 | setAutoFillBackground(true); 16 | setFocusPolicy(Qt::StrongFocus); 17 | setContextMenuPolicy(Qt::CustomContextMenu); 18 | qDebug() << "Widget theme updated"; 19 | } 20 | 21 | BaseWidget::~BaseWidget() 22 | { 23 | qDebug() << "BaseWidget destroyed"; 24 | } 25 | 26 | 27 | void BaseWidget::updateWidgetTheme() 28 | { 29 | qDebug() << "Updating widget theme"; 30 | Dtk::Gui::DPalette plt = Dtk::Gui::DGuiApplicationHelper::instance()->applicationPalette(); 31 | plt.setColor(Dtk::Gui::DPalette::Window, plt.color(Dtk::Gui::DPalette::Base)); 32 | setPalette(plt); 33 | } 34 | 35 | void BaseWidget::adaptWindowSize(const double &ratio) 36 | { 37 | qDebug() << "adaptWindowSize called with ratio:" << ratio; 38 | } 39 | -------------------------------------------------------------------------------- /reader/widgets/BaseWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef CUSTOMWIDGET_H 7 | #define CUSTOMWIDGET_H 8 | 9 | #include 10 | 11 | DWIDGET_USE_NAMESPACE 12 | 13 | class BaseWidget : public DWidget 14 | { 15 | Q_OBJECT 16 | Q_DISABLE_COPY(BaseWidget) 17 | 18 | public: 19 | explicit BaseWidget(DWidget *parent = nullptr); 20 | virtual ~BaseWidget(); 21 | 22 | public: 23 | /** 24 | * @brief CustomWidget::adaptWindowSize 25 | * 缩略图列表自适应视窗大小 26 | * @param scale 缩放因子 大于0的数 27 | */ 28 | virtual void adaptWindowSize(const double &); 29 | 30 | protected: 31 | /** 32 | * @brief updateWidgetTheme 33 | * 主题变换更新 34 | */ 35 | void updateWidgetTheme(); 36 | 37 | protected: 38 | bool bIshandOpenSuccess = false; 39 | }; 40 | 41 | #endif // CUSTOMWIDGET_H 42 | -------------------------------------------------------------------------------- /reader/widgets/ColorWidgetAction.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef COLORWIDGETACTION_H 7 | #define COLORWIDGETACTION_H 8 | 9 | #include 10 | 11 | #include 12 | 13 | DWIDGET_USE_NAMESPACE 14 | 15 | /** 16 | * @brief The ColorWidgetAction class 17 | * 颜色选项框Aciton 18 | */ 19 | class ColorWidgetAction : public QWidgetAction 20 | { 21 | Q_OBJECT 22 | Q_DISABLE_COPY(ColorWidgetAction) 23 | 24 | public: 25 | explicit ColorWidgetAction(DWidget *pParent = nullptr); 26 | 27 | signals: 28 | /** 29 | * @brief sigBtnGroupClicked 30 | * 颜色按钮点击信号 31 | */ 32 | void sigBtnGroupClicked(); 33 | 34 | private slots: 35 | /** 36 | * @brief slotBtnClicked 37 | * 响应颜色按钮点击 38 | */ 39 | void slotBtnClicked(int); 40 | 41 | private: 42 | /** 43 | * @brief initWidget 44 | * 控件初始化 45 | * @param pParent 46 | */ 47 | void initWidget(DWidget *pParent); 48 | }; 49 | 50 | #endif // COLORWIDGETACTION_H 51 | -------------------------------------------------------------------------------- /reader/widgets/EncryptionPage.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef ENCRYPTIONPAGE_H 7 | #define ENCRYPTIONPAGE_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | DWIDGET_USE_NAMESPACE 15 | 16 | /** 17 | * @brief The EncryptionPage class 18 | * 加密界面 19 | */ 20 | class EncryptionPage: public DWidget 21 | { 22 | Q_OBJECT 23 | public: 24 | explicit EncryptionPage(QWidget *parent = nullptr); 25 | ~EncryptionPage(); 26 | 27 | /** 28 | * @brief InitUI 29 | * 初始化控件 30 | */ 31 | void InitUI(); 32 | 33 | /** 34 | * @brief InitConnection 35 | * 初始化connect 36 | */ 37 | void InitConnection(); 38 | 39 | signals: 40 | /** 41 | * @brief sigExtractPassword 42 | * 密码输入确认信号 43 | * @param password 44 | */ 45 | void sigExtractPassword(const QString &password); 46 | 47 | public slots: 48 | /** 49 | * @brief nextbuttonClicked 50 | * 密码输入确认 51 | */ 52 | void nextbuttonClicked(); 53 | 54 | /** 55 | * @brief wrongPassWordSlot 56 | * 密码错误响应 57 | */ 58 | void wrongPassWordSlot(); 59 | 60 | /** 61 | * @brief onPasswordChanged 62 | * 密码输入框字符改变 63 | */ 64 | void onPasswordChanged(); 65 | 66 | /** 67 | * @brief onSetPasswdFocus 68 | * 设置密码输入框的焦点,在切换到当前窗口时 69 | */ 70 | void onSetPasswdFocus(); 71 | 72 | private slots: 73 | /** 74 | * @brief onUpdateTheme 75 | * 主题更新 76 | */ 77 | void onUpdateTheme(); 78 | 79 | private: 80 | DPushButton *m_nextbutton = nullptr; 81 | DPushButton *m_echoBtn = nullptr; 82 | DPasswordEdit *m_password = nullptr; 83 | }; 84 | 85 | #endif // ENCRYPTIONPAGE_H 86 | -------------------------------------------------------------------------------- /reader/widgets/FileAttrWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef FILEATTRWIDGET_H 7 | #define FILEATTRWIDGET_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | DWIDGET_USE_NAMESPACE 14 | class DocSheet; 15 | class QVBoxLayout; 16 | class ImageWidget; 17 | 18 | /** 19 | * @brief The FileAttrWidget class 20 | * 文件信息窗口 21 | */ 22 | class FileAttrWidget : public DAbstractDialog 23 | { 24 | Q_OBJECT 25 | Q_DISABLE_COPY(FileAttrWidget) 26 | 27 | public: 28 | explicit FileAttrWidget(DWidget *parent = nullptr); 29 | 30 | ~FileAttrWidget() override; 31 | 32 | /** 33 | * @brief setFileAttr 34 | * 设置文档对象 35 | * @param sheet 36 | */ 37 | void setFileAttr(DocSheet *sheet); 38 | 39 | /** 40 | * @brief showScreenCenter 41 | * 居中显示 42 | */ 43 | void showScreenCenter(); 44 | 45 | private: 46 | /** 47 | * @brief initWidget 48 | * 初始化控件 49 | */ 50 | void initWidget(); 51 | 52 | /** 53 | * @brief initCloseBtn 54 | * 初始化关闭按钮 55 | */ 56 | void initCloseBtn(); 57 | 58 | /** 59 | * @brief initImageLabel 60 | * 初始化图片显示控件 61 | */ 62 | void initImageLabel(); 63 | 64 | /** 65 | * @brief addTitleFrame 66 | * 添加标题控件 67 | */ 68 | void addTitleFrame(const QString &); 69 | 70 | private: 71 | QVBoxLayout *m_pVBoxLayout = nullptr; 72 | ImageWidget *frameImage = nullptr; 73 | }; 74 | 75 | #endif // FILEATTRWIDGET_H 76 | -------------------------------------------------------------------------------- /reader/widgets/HandleMenu.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef HANDLEMENU_H 7 | #define HANDLEMENU_H 8 | 9 | #include 10 | 11 | class DocSheet; 12 | /** 13 | * @brief The HandleMenu class 14 | * 选择工具菜单 15 | */ 16 | DWIDGET_USE_NAMESPACE 17 | class HandleMenu : public DMenu 18 | { 19 | Q_OBJECT 20 | Q_DISABLE_COPY(HandleMenu) 21 | 22 | public: 23 | explicit HandleMenu(DWidget *parent = nullptr); 24 | 25 | /** 26 | * @brief readCurDocParam 27 | * 读取文档数据 28 | * @param docSheet 29 | */ 30 | void readCurDocParam(DocSheet *docSheet); 31 | 32 | protected: 33 | /** 34 | * @brief initActions 35 | * 初始化Action 36 | */ 37 | void initActions(); 38 | 39 | private slots: 40 | /** 41 | * @brief onHandTool 42 | * 手型工具 43 | */ 44 | void onHandTool(); 45 | 46 | /** 47 | * @brief onSelectText 48 | * 文本选择工具 49 | */ 50 | void onSelectText(); 51 | 52 | private: 53 | QAction *m_textAction = nullptr; 54 | QAction *m_handAction = nullptr; 55 | DocSheet *m_docSheet = nullptr; 56 | }; 57 | 58 | #endif // HANDLEMENU_H 59 | -------------------------------------------------------------------------------- /reader/widgets/ProgressDialog.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "ProgressDialog.h" 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | ProgressDialog::ProgressDialog(QWidget *parent): DDialog(parent) 16 | { 17 | qDebug() << "ProgressDialog created, parent:" << parent; 18 | setFixedSize(440, 100); 19 | 20 | QMargins mar(0, 0, 0, 30); 21 | setContentLayoutContentsMargins(mar); 22 | 23 | Dtk::Widget::DLabel *label = new Dtk::Widget::DLabel(this); 24 | label->setText(tr("Converting")); 25 | label->move(20, 10); 26 | Dtk::Widget::DFontSizeManager::instance()->bind(label, Dtk::Widget::DFontSizeManager::T6, true); 27 | 28 | m_progress = new QProgressBar(this); 29 | m_progress->resize(400, 20); 30 | m_progress->move(20, 60); 31 | m_progress->setValue(50); 32 | } 33 | -------------------------------------------------------------------------------- /reader/widgets/ProgressDialog.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef PROGRESSDIALOG_H 6 | #define PROGRESSDIALOG_H 7 | 8 | #include 9 | 10 | class QProgressBar; 11 | class ProgressDialog : public Dtk::Widget::DDialog 12 | { 13 | Q_OBJECT 14 | public: 15 | explicit ProgressDialog(QWidget *parent = nullptr); 16 | 17 | private: 18 | QProgressBar *m_progress = nullptr; 19 | }; 20 | 21 | #endif // PROGRESSDIALOG_H 22 | -------------------------------------------------------------------------------- /reader/widgets/RoundColorWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef CUSTOMCONTROL_ROUNDCOLORWIDGET_H 7 | #define CUSTOMCONTROL_ROUNDCOLORWIDGET_H 8 | 9 | #include 10 | #include 11 | 12 | DWIDGET_USE_NAMESPACE 13 | 14 | /** 15 | * @brief The RoundColorWidget class 16 | * 颜色选项框控件 17 | */ 18 | class RoundColorWidget : public DWidget 19 | { 20 | Q_OBJECT 21 | Q_DISABLE_COPY(RoundColorWidget) 22 | 23 | public: 24 | explicit RoundColorWidget(const QColor &color, QWidget *parent = nullptr); 25 | 26 | /** 27 | * @brief setSelected 28 | * 设置是否选中 29 | * @param selected 30 | */ 31 | void setSelected(bool selected); 32 | 33 | /** 34 | * @brief setAllClickNotify 35 | * 点击是否发送点击信号 36 | * @param bnotify 37 | */ 38 | inline void setAllClickNotify(bool bnotify) {m_allnotify = bnotify;} 39 | 40 | Q_SIGNALS: 41 | /** 42 | * @brief clicked 43 | * 点击信号 44 | */ 45 | void clicked(); 46 | 47 | protected: 48 | /** 49 | * @brief mousePressEvent 50 | * 鼠标点击事件 51 | * @param event 52 | */ 53 | void mousePressEvent(QMouseEvent *event); 54 | 55 | /** 56 | * @brief paintEvent 57 | * 绘制事件 58 | * @param event 59 | */ 60 | void paintEvent(QPaintEvent *event); 61 | 62 | private: 63 | bool m_isSelected = false; 64 | QColor m_color; 65 | bool m_allnotify = false; 66 | }; 67 | 68 | #endif // CUSTOMCONTROL_ROUNDCOLORWIDGET_H 69 | -------------------------------------------------------------------------------- /reader/widgets/SaveDialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "SaveDialog.h" 7 | #include 8 | 9 | #include 10 | 11 | DWIDGET_USE_NAMESPACE 12 | 13 | SaveDialog::SaveDialog(QObject *parent) 14 | : QObject(parent) 15 | { 16 | qDebug() << "SaveDialog created, parent:" << parent; 17 | } 18 | 19 | int SaveDialog::showExitDialog(QString fileName, QWidget *parent) 20 | { 21 | qDebug() << "Showing save dialog for file:" << fileName << ", parent:" << parent; 22 | DDialog dlg(tr("Save the changes to \"%1\"?").arg(fileName), "", parent); 23 | dlg.setIcon(QIcon::fromTheme("deepin-reader")); 24 | dlg.addButtons(QStringList() << tr("Cancel", "button") << tr("Discard", "button")); 25 | dlg.addButton(tr("Save", "button"), true, DDialog::ButtonRecommend); 26 | QMargins mar(12, 12, 12, 12); 27 | dlg.setContentLayoutContentsMargins(mar); 28 | int nRes = dlg.exec(); 29 | qDebug() << "Save dialog result:" << nRes; 30 | return nRes; 31 | } 32 | 33 | int SaveDialog::showTipDialog(const QString &content, QWidget *parent) 34 | { 35 | qDebug() << "Showing tip dialog, content:" << content; 36 | DDialog dlg(content, "", parent); 37 | dlg.setIcon(QIcon::fromTheme("deepin-reader")); 38 | dlg.addButtons(QStringList() << tr("Cancel")); 39 | dlg.addButton(tr("Delete"), true, DDialog::ButtonRecommend); 40 | QMargins mar(12, 12, 12, 12); 41 | dlg.setContentLayoutContentsMargins(mar); 42 | int nRes = dlg.exec(); 43 | return nRes; 44 | } 45 | -------------------------------------------------------------------------------- /reader/widgets/SaveDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef SAVEDIALOG_H 7 | #define SAVEDIALOG_H 8 | 9 | #include 10 | 11 | /** 12 | * @brief The SaveDialog class 13 | * 保存提示窗口 14 | */ 15 | class SaveDialog : public QObject 16 | { 17 | Q_DISABLE_COPY(SaveDialog) 18 | Q_OBJECT 19 | public: 20 | explicit SaveDialog(QObject *parent = nullptr); 21 | 22 | /** 23 | * @brief showExitDialog 24 | * 退出保存提示窗口 25 | * @return 26 | */ 27 | static int showExitDialog(QString fileName, QWidget *parent = nullptr); 28 | 29 | /** 30 | * @brief showTipDialog 31 | * 提示窗口 32 | * @param content 33 | * @return 34 | */ 35 | static int showTipDialog(const QString &content, QWidget *parent = nullptr); 36 | }; 37 | 38 | #endif // SAVEDIALOG_H 39 | -------------------------------------------------------------------------------- /reader/widgets/SecurityDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef SECURITYDIALOG_H 7 | #define SECURITYDIALOG_H 8 | 9 | #include 10 | #include 11 | DWIDGET_USE_NAMESPACE 12 | 13 | struct NewStr { 14 | QStringList strList; 15 | QString resultStr; 16 | int fontHeifht = 0; 17 | }; 18 | 19 | NewStr autoCutText(const QString &text, DLabel *pDesLbl); 20 | 21 | class SecurityDialog : public Dtk::Widget::DDialog 22 | { 23 | Q_OBJECT 24 | public: 25 | explicit SecurityDialog(const QString &urlstr, QWidget *parent = nullptr); 26 | 27 | protected: 28 | void changeEvent(QEvent *event) override; 29 | 30 | private: 31 | /** 32 | * @brief autoFeed 自动换行 33 | */ 34 | void autoFeed(); 35 | /** 36 | * @brief setLabelColor 设置label颜色 37 | * @param label 38 | * @param alphaF 透明度 39 | */ 40 | void setLabelColor(DLabel *label, qreal alphaF); 41 | 42 | private: 43 | DLabel *NameLabel = nullptr; 44 | DLabel *ContentLabel = nullptr; 45 | QString m_strDesText; 46 | int m_iLabelOldHeight = 0; 47 | int m_iLabelOld1Height = 0; 48 | int m_iDialogOldHeight = 0; 49 | }; 50 | 51 | #endif // SECURITYDIALOG_H 52 | -------------------------------------------------------------------------------- /reader/widgets/WordWrapLabel.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "WordWrapLabel.h" 7 | #include 8 | 9 | #include 10 | 11 | WordWrapLabel::WordWrapLabel(QWidget *parent) 12 | : DLabel(parent) 13 | { 14 | qDebug() << "WordWrapLabel created, parent:" << parent; 15 | m_margin = 0; 16 | } 17 | 18 | void WordWrapLabel::setText(const QString &text) 19 | { 20 | qDebug() << "Setting label text, length:" << text.length(); 21 | m_text = text; 22 | update(); 23 | } 24 | 25 | void WordWrapLabel::setMargin(int margin) 26 | { 27 | qDebug() << "Setting label margin:" << margin; 28 | m_margin = margin; 29 | update(); 30 | } 31 | 32 | void WordWrapLabel::paintEvent(QPaintEvent *event) 33 | { 34 | DLabel::paintEvent(event); 35 | QPainter painter(this); 36 | painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); 37 | QTextOption option; 38 | adjustContent(); 39 | option.setAlignment(this->alignment()); 40 | option.setWrapMode(QTextOption::WrapAnywhere); 41 | painter.setFont(this->font()); 42 | painter.drawText(QRect(m_margin, 0, this->width() - 2 * m_margin, this->height()), m_text, option); 43 | } 44 | 45 | void WordWrapLabel::adjustContent() 46 | { 47 | qDebug() << "Adjusting label content height"; 48 | QFontMetrics fontMetris(this->font()); 49 | int wordHeight = fontMetris.boundingRect(0, 0, this->width() - 2 * m_margin, 0, static_cast(this->alignment() | Qt::TextWrapAnywhere), m_text).height(); 50 | if (this->height() == wordHeight) return; 51 | setFixedSize(this->width(), wordHeight); 52 | } 53 | -------------------------------------------------------------------------------- /reader/widgets/WordWrapLabel.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef WORDWRAPLABEL_H 7 | #define WORDWRAPLABEL_H 8 | 9 | #include 10 | 11 | DWIDGET_USE_NAMESPACE 12 | /** 13 | * @brief The WordWrapLabel class 14 | * 自动换行Label 15 | */ 16 | class WordWrapLabel : public DLabel 17 | { 18 | public: 19 | explicit WordWrapLabel(QWidget *parent = nullptr); 20 | 21 | /** 22 | * @brief setText 23 | * 设置内容 24 | * @param text 25 | */ 26 | void setText(const QString &text); 27 | 28 | /** 29 | * @brief setMargin 30 | * 设置间距 31 | * @param margin 32 | */ 33 | void setMargin(int margin); 34 | 35 | private: 36 | /** 37 | * @brief adjustContent 38 | * 自适应内容 39 | */ 40 | void adjustContent(); 41 | 42 | protected: 43 | /** 44 | * @brief paintEvent 45 | * 绘制事件 46 | * @param event 47 | */ 48 | void paintEvent(QPaintEvent *event); 49 | 50 | private: 51 | QString m_text; 52 | int m_margin; 53 | }; 54 | 55 | #endif // WORDWRAPLABEL_H 56 | -------------------------------------------------------------------------------- /reader/widgets/widgets.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/AttrScrollWidget.h \ 3 | $$PWD/ColorWidgetAction.h \ 4 | $$PWD/EncryptionPage.h \ 5 | $$PWD/FileAttrWidget.h \ 6 | $$PWD/FindWidget.h \ 7 | $$PWD/HandleMenu.h \ 8 | $$PWD/ScaleMenu.h \ 9 | $$PWD/SlidePlayWidget.h \ 10 | $$PWD/SlideWidget.h \ 11 | $$PWD/ScaleWidget.h \ 12 | $$PWD/SaveDialog.h \ 13 | $$PWD/ShortCutShow.h \ 14 | $$PWD/BaseWidget.h \ 15 | $$PWD/TipsWidget.h \ 16 | $$PWD/WordWrapLabel.h \ 17 | $$PWD/RoundColorWidget.h \ 18 | $$PWD/TransparentTextEdit.h \ 19 | $$PWD/TextEditWidget.h \ 20 | $$PWD/PagingWidget.h \ 21 | $$PWD/ProgressDialog.h \ 22 | $$PWD/SecurityDialog.h 23 | 24 | SOURCES += \ 25 | $$PWD/AttrScrollWidget.cpp \ 26 | $$PWD/ColorWidgetAction.cpp \ 27 | $$PWD/EncryptionPage.cpp \ 28 | $$PWD/FileAttrWidget.cpp \ 29 | $$PWD/FindWidget.cpp \ 30 | $$PWD/HandleMenu.cpp \ 31 | $$PWD/ScaleMenu.cpp \ 32 | $$PWD/SlidePlayWidget.cpp \ 33 | $$PWD/SlideWidget.cpp \ 34 | $$PWD/ScaleWidget.cpp \ 35 | $$PWD/SaveDialog.cpp \ 36 | $$PWD/ShortCutShow.cpp \ 37 | $$PWD/BaseWidget.cpp \ 38 | $$PWD/TipsWidget.cpp \ 39 | $$PWD/WordWrapLabel.cpp \ 40 | $$PWD/RoundColorWidget.cpp \ 41 | $$PWD/TransparentTextEdit.cpp \ 42 | $$PWD/TextEditWidget.cpp \ 43 | $$PWD/PagingWidget.cpp \ 44 | $$PWD/ProgressDialog.cpp \ 45 | $$PWD/SecurityDialog.cpp 46 | 47 | INCLUDEPATH += $$PWD 48 | -------------------------------------------------------------------------------- /resources/builtin/dark/actions/dr_defaultshape_small_16px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | choose_small_normal_dark 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/actions/dr_handleshape_small_16px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | hand_small_normal_dark 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/icons/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | close_hover_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/icons/dr_a_big_14px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A _big 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/icons/dr_a_small_14px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A _small 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/icons/dr_bookmark_checked_39px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmarkbig_checked_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /resources/builtin/dark/icons/dr_bookmark_hover_39px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmarkbig_hover_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/icons/dr_bookmark_pressed_39px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmarkbig_press_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/icons/dr_close_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | close_hover_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_annotation_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | comments_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_bookmark_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmark_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_button_add_12px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_catalog_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | catalog 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_defaultshape_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | choose_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_exit_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | exit_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_magnifier_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | magnifier_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_next_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | next_normal备份 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_play_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | play_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_previous_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | previous_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_suspend_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | suspend_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_thumbnail_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | view_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_thumbnails_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | thumbnail_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/dark/texts/dr_viewchange_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | setting_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /resources/builtin/light/actions/dr_defaultshape_small_16px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | choose_small_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/actions/dr_handleshape_small_16px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | hand_small_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/icons/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | close_hover_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/icons/dr_a_big_14px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A _big 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/icons/dr_a_small_14px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A _small 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/icons/dr_bookmark_checked_39px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmarkbig_checked_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /resources/builtin/light/icons/dr_bookmark_hover_39px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmarkbig_hover_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/icons/dr_bookmark_pressed_39px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmarkbig_press_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/icons/dr_close_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | close_hover_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_annotation_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | comments_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_bookmark_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bookmark_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_button_add_12px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_catalog_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | catalog 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_defaultshape_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | choose_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_exit_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | exit_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_handleshape_36px.svg: -------------------------------------------------------------------------------- 1 | 画板 1 副本 -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_magnifier_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | magnifier_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_next_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | next_normal备份 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_play_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | play_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_previous_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | previous_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_suspend_normal_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | suspend_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_thumbnail_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | view_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_thumbnails_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | thumbnail_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/builtin/light/texts/dr_viewchange_36px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | setting_normal_light 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/browser/ut_pagesearchthread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "PageSearchThread.h" 7 | #include "DocSheet.h" 8 | #include "stub.h" 9 | 10 | #include 11 | 12 | class UT_PageSearchThread : public ::testing::Test 13 | { 14 | public: 15 | UT_PageSearchThread(): m_tester(nullptr) {} 16 | 17 | public: 18 | virtual void SetUp() 19 | { 20 | m_tester = new PageSearchThread(); 21 | m_tester->disconnect(); 22 | } 23 | 24 | virtual void TearDown() 25 | { 26 | delete m_tester; 27 | } 28 | 29 | protected: 30 | PageSearchThread *m_tester; 31 | }; 32 | 33 | TEST_F(UT_PageSearchThread, initTest) 34 | { 35 | 36 | } 37 | 38 | TEST_F(UT_PageSearchThread, UT_PageSearchThread_startSearch) 39 | { 40 | QString strPath = UTSOURCEDIR; 41 | strPath += "/files/1.pdf"; 42 | DocSheet *sheet = new DocSheet(Dr::PDF, strPath, nullptr); 43 | 44 | m_tester->startSearch(sheet, "123"); 45 | EXPECT_TRUE(m_tester->m_sheet == sheet); 46 | EXPECT_TRUE(m_tester->m_searchText == "123"); 47 | delete sheet; 48 | } 49 | 50 | TEST_F(UT_PageSearchThread, UT_PageSearchThread_stopSearch) 51 | { 52 | m_tester->stopSearch(); 53 | EXPECT_TRUE(m_tester->m_quit == true); 54 | } 55 | 56 | TEST_F(UT_PageSearchThread, UT_PageSearchThread_run) 57 | { 58 | QString strPath = UTSOURCEDIR; 59 | strPath += "/files/1.pdf"; 60 | DocSheet *sheet = new DocSheet(Dr::PDF, strPath, nullptr); 61 | 62 | m_tester->startSearch(sheet, "123"); 63 | m_tester->run(); 64 | delete sheet; 65 | } 66 | 67 | TEST_F(UT_PageSearchThread, UT_PageSearchThread_initCJKtoKangxi) 68 | { 69 | m_tester->initCJKtoKangxi(); 70 | } 71 | -------------------------------------------------------------------------------- /tests/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 4 | # 5 | # SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | make clean 8 | 9 | rm *.gcno -r 10 | 11 | rm *.gcda -r 12 | 13 | rm *.o -r 14 | 15 | rm moc_* -r 16 | 17 | rm *Test -r 18 | 19 | rm report -r 20 | 21 | rm coverage -r 22 | 23 | rm .qmake.stash 24 | 25 | rm Makefile 26 | 27 | rm coverage.info 28 | 29 | rm test-deepin-reader 30 | 31 | rm nohup.out 32 | 33 | rm qrc_resources.cpp 34 | 35 | rm target_wrapper.sh 36 | 37 | rm copy.txt 38 | 39 | rm clean 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /tests/files.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | files/normal.doc 4 | files/1.pdf 5 | files/2.pdf 6 | files/3.pdf 7 | files/4.pdf 8 | files/5_broken.pdf 9 | files/6_djvu.pdf 10 | files/broken.djvu 11 | files/broken.pdf 12 | files/copy.txt 13 | files/normal.djvu 14 | files/normal.docx 15 | files/normal.pdf 16 | files/normal.png 17 | files/normal.pptx 18 | files/normal.txt 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/files/1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/1.pdf -------------------------------------------------------------------------------- /tests/files/2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/2.pdf -------------------------------------------------------------------------------- /tests/files/3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/3.pdf -------------------------------------------------------------------------------- /tests/files/4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/4.pdf -------------------------------------------------------------------------------- /tests/files/5_broken.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/5_broken.pdf -------------------------------------------------------------------------------- /tests/files/6_djvu.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/6_djvu.pdf -------------------------------------------------------------------------------- /tests/files/broken.djvu: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/broken.djvu -------------------------------------------------------------------------------- /tests/files/broken.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/broken.pdf -------------------------------------------------------------------------------- /tests/files/copy.txt: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /tests/files/normal.djvu: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/normal.djvu -------------------------------------------------------------------------------- /tests/files/normal.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/normal.doc -------------------------------------------------------------------------------- /tests/files/normal.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/normal.docx -------------------------------------------------------------------------------- /tests/files/normal.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/normal.pdf -------------------------------------------------------------------------------- /tests/files/normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/normal.png -------------------------------------------------------------------------------- /tests/files/normal.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-reader/b01dfa5eb2e5ce5745fad60088b55d627f57d8ee/tests/files/normal.pptx -------------------------------------------------------------------------------- /tests/files/normal.txt: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /tests/local-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 4 | # 5 | # SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | #workdir=$(cd ../../$(dirname $0)/build-filemanager-unknown-Debug/test; pwd) 8 | 9 | workdir=. 10 | 11 | executable=test-deepin-reader 12 | 13 | build_dir=$workdir 14 | 15 | result_coverage_dir=$build_dir/coverage 16 | 17 | result_report_dir=$build_dir/report/report.xml 18 | 19 | #下面二选1进行操作,一种正向操作,一种逆向操作 20 | 21 | extract_info="*/deepin-reader/*" 22 | 23 | remove_info="*/tests/*" 24 | 25 | $build_dir/$executable --gtest_output=xml:$result_report_dir 26 | 27 | lcov -d $build_dir -c -o $build_dir/coverage.info 28 | 29 | lcov --remove $build_dir/coverage.info $remove_info --output-file $build_dir/coverage.info 30 | 31 | lcov --extract $build_dir/coverage.info $extract_info --output-file $build_dir/coverage.info 32 | 33 | lcov --list-full-path -e $build_dir/coverage.info –o $build_dir/coverage-stripped.info 34 | 35 | genhtml -o $result_coverage_dir $build_dir/coverage.info 36 | 37 | nohup x-www-browser $result_coverage_dir/index.html & 38 | 39 | nohup x-www-browser $result_report_dir & 40 | 41 | lcov -d $build_dir –z 42 | 43 | exit 0 44 | -------------------------------------------------------------------------------- /tests/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "Application.h" 6 | #include "ut_defines.h" 7 | #include "Application.h" 8 | 9 | #include 10 | 11 | DWIDGET_USE_NAMESPACE 12 | 13 | #if defined(CMAKE_SAFETYTEST_ARG_ON) 14 | #include 15 | #endif 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | qputenv("QT_QPA_PLATFORM", "offscreen"); 20 | 21 | Application application(argc, argv); 22 | 23 | ::testing::InitGoogleTest(&argc, argv); 24 | 25 | int c = RUN_ALL_TESTS(); 26 | 27 | #if defined(CMAKE_SAFETYTEST_ARG_ON) 28 | __sanitizer_set_report_path("asan.log"); 29 | #endif 30 | 31 | return c; 32 | } 33 | -------------------------------------------------------------------------------- /tests/qmake-lcov-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 4 | # 5 | # SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | workdir=. #编译路径 8 | 9 | executable=test-deepin-reader #可执行程序的文件名 10 | 11 | build_dir=$workdir 12 | 13 | result_coverage_dir=$build_dir/coverage 14 | 15 | result_report_dir=$build_dir/report/report.xml 16 | 17 | $build_dir/$executable --gtest_output=xml:$result_report_dir 18 | 19 | lcov -d $build_dir -c -o $build_dir/coverage.info 20 | 21 | lcov --extract $build_dir/coverage.info '*/reader/*' -o $build_dir/coverage.info 22 | 23 | lcov --remove $build_dir/coverage.info '*/tests/*' -o $build_dir/coverage.info 24 | 25 | genhtml -o $result_coverage_dir $build_dir/coverage.info 26 | 27 | exit 0 28 | -------------------------------------------------------------------------------- /tests/sidebar/ut_bookmarkdelegate.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "BookMarkDelegate.h" 7 | #include "DocSheet.h" 8 | #include "SideBarImageListview.h" 9 | #include "SideBarImageViewModel.h" 10 | 11 | #include "stub.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | class UT_BookMarkDelegate : public ::testing::Test 19 | { 20 | public: 21 | UT_BookMarkDelegate() {} 22 | 23 | public: 24 | virtual void SetUp() 25 | { 26 | QString strPath = UTSOURCEDIR; 27 | strPath += "/files/1.pdf"; 28 | m_sheet = new DocSheet(Dr::PDF, strPath, nullptr); 29 | m_pView = new SideBarImageListView(m_sheet); 30 | m_tester = new BookMarkDelegate(m_pView); 31 | m_pView->setItemDelegate(m_tester); 32 | m_tester->disconnect(); 33 | } 34 | 35 | virtual void TearDown() 36 | { 37 | delete m_tester; 38 | delete m_pView; 39 | delete m_sheet; 40 | } 41 | 42 | protected: 43 | DocSheet *m_sheet = nullptr; 44 | BookMarkDelegate *m_tester = nullptr; 45 | SideBarImageListView *m_pView = nullptr; 46 | }; 47 | 48 | TEST_F(UT_BookMarkDelegate, initTest) 49 | { 50 | 51 | } 52 | 53 | TEST_F(UT_BookMarkDelegate, UT_BookMarkDelegate_paint) 54 | { 55 | m_pView->getImageModel()->insertPageIndex(1); 56 | QPainter *painter = new QPainter; 57 | QStyleOptionViewItem option; 58 | m_tester->paint(painter, option, m_pView->getImageModel()->index(0, 0)); 59 | EXPECT_TRUE(m_tester->m_parent == m_pView); 60 | delete painter; 61 | } 62 | -------------------------------------------------------------------------------- /tests/sidebar/ut_notesdelegate.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "NotesDelegate.h" 7 | #include "SideBarImageListview.h" 8 | #include "SideBarImageViewModel.h" 9 | #include "DocSheet.h" 10 | 11 | #include "stub.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | class UT_NotesDelegate : public ::testing::Test 19 | { 20 | public: 21 | UT_NotesDelegate() {} 22 | 23 | public: 24 | virtual void SetUp() 25 | { 26 | QString strPath = UTSOURCEDIR; 27 | strPath += "/files/1.pdf"; 28 | m_sheet = new DocSheet(Dr::PDF, strPath, nullptr); 29 | m_pView = new SideBarImageListView(m_sheet); 30 | m_tester = new NotesDelegate(m_pView); 31 | m_pView->setItemDelegate(m_tester); 32 | m_tester->disconnect(); 33 | } 34 | 35 | virtual void TearDown() 36 | { 37 | delete m_tester; 38 | delete m_pView; 39 | delete m_sheet; 40 | } 41 | 42 | protected: 43 | DocSheet *m_sheet = nullptr; 44 | NotesDelegate *m_tester = nullptr; 45 | SideBarImageListView *m_pView = nullptr; 46 | }; 47 | 48 | TEST_F(UT_NotesDelegate, initTest) 49 | { 50 | 51 | } 52 | 53 | TEST_F(UT_NotesDelegate, UT_NotesDelegate_paint) 54 | { 55 | m_pView->getImageModel()->insertPageIndex(1); 56 | QPainter *painter = new QPainter; 57 | QStyleOptionViewItem option; 58 | m_tester->paint(painter, option, m_pView->getImageModel()->index(0, 0)); 59 | EXPECT_TRUE(m_tester->m_parent == m_pView); 60 | delete painter; 61 | } 62 | -------------------------------------------------------------------------------- /tests/sidebar/ut_readerimagethreadpoolmanager.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "ReaderImageThreadPoolManager.h" 7 | 8 | #include "ut_common.h" 9 | 10 | #include "stub.h" 11 | 12 | #include 13 | 14 | class UT_ReadImageTask : public ::testing::Test 15 | { 16 | public: 17 | UT_ReadImageTask(): m_tester(nullptr) {} 18 | 19 | public: 20 | virtual void SetUp() 21 | { 22 | m_tester = new ReadImageTask(); 23 | } 24 | 25 | virtual void TearDown() 26 | { 27 | delete m_tester; 28 | } 29 | 30 | protected: 31 | ReadImageTask *m_tester; 32 | }; 33 | 34 | TEST_F(UT_ReadImageTask, initTest) 35 | { 36 | 37 | } 38 | 39 | TEST_F(UT_ReadImageTask, UT_ReadImageTask_addgetDocImageTask) 40 | { 41 | ReaderImageParam_t readImageParam; 42 | readImageParam.pageIndex = 1; 43 | m_tester->addgetDocImageTask(readImageParam); 44 | EXPECT_TRUE(m_tester->m_docParam.pageIndex == 1); 45 | } 46 | 47 | TEST_F(UT_ReadImageTask, UT_ReadImageTask_setThreadPoolManager) 48 | { 49 | QObject *object = new QObject(); 50 | m_tester->setThreadPoolManager(object); 51 | EXPECT_TRUE(m_tester->m_threadpoolManager == object); 52 | delete object; 53 | } 54 | -------------------------------------------------------------------------------- /tests/sidebar/ut_searchresdelegate.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "SearchResDelegate.h" 7 | #include "DocSheet.h" 8 | #include "SideBarImageListview.h" 9 | #include "SideBarImageViewModel.h" 10 | 11 | #include "stub.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | class UT_SearchResDelegate : public ::testing::Test 19 | { 20 | public: 21 | UT_SearchResDelegate() {} 22 | 23 | public: 24 | virtual void SetUp() 25 | { 26 | QString strPath = UTSOURCEDIR; 27 | strPath += "/files/1.pdf"; 28 | m_sheet = new DocSheet(Dr::PDF, strPath, nullptr); 29 | m_pView = new SideBarImageListView(m_sheet); 30 | m_tester = new SearchResDelegate(m_pView); 31 | m_pView->setItemDelegate(m_tester); 32 | m_tester->disconnect(); 33 | } 34 | 35 | virtual void TearDown() 36 | { 37 | delete m_tester; 38 | delete m_pView; 39 | delete m_sheet; 40 | } 41 | 42 | protected: 43 | DocSheet *m_sheet = nullptr; 44 | SearchResDelegate *m_tester = nullptr; 45 | SideBarImageListView *m_pView = nullptr; 46 | }; 47 | 48 | TEST_F(UT_SearchResDelegate, initTest) 49 | { 50 | 51 | } 52 | 53 | TEST_F(UT_SearchResDelegate, UT_SearchResDelegate_paint) 54 | { 55 | m_pView->getImageModel()->insertPageIndex(1); 56 | QPainter *painter = new QPainter; 57 | QStyleOptionViewItem option; 58 | m_tester->paint(painter, option, m_pView->getImageModel()->index(0, 0)); 59 | EXPECT_TRUE(m_tester->m_parent == m_pView); 60 | delete painter; 61 | } 62 | -------------------------------------------------------------------------------- /tests/test-prj-running.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 4 | # 5 | # SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | builddir=build 8 | reportdir=build-ut 9 | rm -rf $builddir 10 | rm -rf ../$builddir 11 | rm -rf $reportdir 12 | rm -rf ../$reportdir 13 | mkdir ../$builddir 14 | mkdir ../$reportdir 15 | cd ../$builddir 16 | #编译 17 | qmake DEFINES+=CMAKE_SAFETYTEST_ARG_ON ../deepin_reader.pro 18 | make -j8 19 | #生成asan日志和ut测试xml结果 20 | ./tests/test-deepin-reader --gtest_output=xml:./report/report_deepin-reader.xml 21 | 22 | workdir=$(cd ../$(dirname $0)/$builddir; pwd) 23 | 24 | mkdir -p report 25 | #统计代码覆盖率并生成html报告 26 | lcov -d $workdir -c -o ./coverage.info 27 | 28 | lcov --extract ./coverage.info '*/reader/*' -o ./coverage.info 29 | 30 | lcov --remove ./coverage.info '*/tests/*' -o ./coverage.info 31 | 32 | genhtml -o ./html ./coverage.info 33 | 34 | mv ./html/index.html ./html/cov_deepin-reader.html 35 | #对asan、ut、代码覆盖率结果收集至指定文件夹 36 | cp -r html ../$reportdir/ 37 | cp -r report ../$reportdir/ 38 | cp -r asan*.log* ../$reportdir/asan_deepin-reader.log 39 | 40 | exit 0 41 | -------------------------------------------------------------------------------- /tests/ut_application.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /tests/ut_common.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "ut_common.h" 7 | 8 | #include 9 | 10 | #include 11 | 12 | DWIDGET_USE_NAMESPACE 13 | 14 | bool g_QWidget_isVisible_result = false;; // QWidget isVisible返回值 15 | 16 | UTCommon::UTCommon() 17 | { 18 | 19 | } 20 | 21 | UTCommon::~UTCommon() 22 | { 23 | 24 | } 25 | 26 | int qWidget_isVisible_stub() 27 | { 28 | return g_QWidget_isVisible_result; 29 | } 30 | 31 | QAction *dmenu_exec_stub(const QPoint &, QAction *) 32 | { 33 | return nullptr; 34 | } 35 | 36 | bool qProcess_startDetached_stub(const QString &, const QStringList &) 37 | { 38 | return true; 39 | } 40 | 41 | void UTCommon::stub_DMenu_exec(Stub &stub) 42 | { 43 | stub.set((QAction * (DMenu::*)(const QPoint &, QAction * at))ADDR(DMenu, exec), dmenu_exec_stub); 44 | } 45 | 46 | void UTCommon::stub_QWidget_isVisible(Stub &stub, bool isVisible) 47 | { 48 | g_QWidget_isVisible_result = isVisible; 49 | stub.set(ADDR(QWidget, isVisible), qWidget_isVisible_stub); 50 | } 51 | 52 | void UTCommon::stub_QProcess_startDetached(Stub &stub) 53 | { 54 | #if !defined(Q_QDOC) 55 | stub.set((bool(*)(const QString &, const QStringList &))ADDR(QProcess, startDetached), qProcess_startDetached_stub); 56 | #endif 57 | } 58 | -------------------------------------------------------------------------------- /tests/ut_common.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef UT_COMMON_H 7 | #define UT_COMMON_H 8 | 9 | #include "stub.h" 10 | 11 | extern bool g_QWidget_isVisible_result; // QWidget isVisible返回值 12 | 13 | class UTCommon 14 | { 15 | public: 16 | UTCommon(); 17 | ~UTCommon(); 18 | 19 | /** 20 | * @brief stub_DMenu_exec 针对DMenu的exec打桩 21 | * @param stub 22 | * @return 23 | */ 24 | static void stub_DMenu_exec(Stub &stub); 25 | 26 | /** 27 | * @brief stub_QWidget_isVisible 针对QWidget的isVisible打桩 28 | * @param stub 29 | * @param isVisible 30 | */ 31 | static void stub_QWidget_isVisible(Stub &stub, bool isVisible); 32 | 33 | /** 34 | * @brief stub_QProcess_startDetached 针对QProcess的startDetached打桩 35 | * @param stub 36 | */ 37 | static void stub_QProcess_startDetached(Stub &stub); 38 | }; 39 | 40 | 41 | #endif // UT_COMMON_H 42 | -------------------------------------------------------------------------------- /tests/ut_defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef UT_DEFINES_TEST_H 6 | #define UT_DEFINES_TEST_H 7 | 8 | #include 9 | #include 10 | 11 | #define UT_FILE_TEST_FILE_1 "1.pdf" 12 | 13 | #define UT_FILE_TEST_FILE_2 "2.pdf" 14 | 15 | #define UT_FILE_TEST_FILE_3 "3.pdf" 16 | 17 | #define UT_FILE_TEST_FILE_4 "4.pdf" 18 | 19 | #define UT_FILE_TEST_FILE_5 "5_broken.pdf" 20 | 21 | #define UT_FILE_TEST_FILE_6 "6_djvu.pdf" 22 | 23 | #define UT_FILE_TXT "normal.txt" 24 | 25 | #define UT_FILE_COPYTXT "copy.txt" //不存在 26 | 27 | #define UT_FILE_PNG "normal.png" 28 | 29 | #define UT_FILE_PDF "normal.pdf" 30 | 31 | #define UT_FILE_PDF_BROKEN "broken.pdf" 32 | 33 | #define UT_FILE_PDF_SAVE "save.pdf" 34 | 35 | #define UT_FILE_PDF_SAVEAS "saveas.pdf" 36 | 37 | #define UT_FILE_DJVU "normal.djvu" 38 | 39 | #define UT_FILE_DJVU_BROKEN "broken.djvu" 40 | 41 | #define UT_FILE_DJVU_SAVEAS "saveas.djvu" 42 | 43 | #define UT_FILE_DJVU_SAVE "save.djvu" 44 | 45 | #define UT_FILE_DOC "normal.doc" 46 | 47 | #define UT_FILE_DOC_BROKEN "broken.doc" 48 | 49 | #define UT_FILE_DOC_SAVE "save.doc" 50 | 51 | #define UT_FILE_DOC_SAVEAS "saveas.doc" 52 | 53 | #define UT_FILE_DOCX "normal.docx" 54 | 55 | #define UT_FILE_PPTX "normal.pptx" 56 | 57 | #define UT_FILE_NONE "none" 58 | 59 | #endif // UT_DEFINES_TEST_H 60 | -------------------------------------------------------------------------------- /tests/widgets/ut_attrscrollwidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "AttrScrollWidget.h" 7 | #include "DocSheet.h" 8 | #include "Global.h" 9 | 10 | #include "stub.h" 11 | 12 | #include 13 | #include 14 | 15 | class TestAttrScrollWidget : public ::testing::Test 16 | { 17 | public: 18 | TestAttrScrollWidget(): m_tester(nullptr) {} 19 | 20 | public: 21 | virtual void SetUp() 22 | { 23 | sheet = new DocSheet(Dr::FileType::PDF, "1.pdf", m_tester); 24 | m_tester = new AttrScrollWidget(sheet, m_tester); 25 | m_tester->disconnect(); 26 | } 27 | 28 | virtual void TearDown() 29 | { 30 | delete sheet; 31 | delete m_tester; 32 | } 33 | 34 | protected: 35 | DocSheet *sheet = nullptr; 36 | AttrScrollWidget *m_tester = nullptr; 37 | }; 38 | 39 | TEST_F(TestAttrScrollWidget, initTest) 40 | { 41 | 42 | } 43 | -------------------------------------------------------------------------------- /tests/widgets/ut_basewidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "BaseWidget.h" 7 | #include "stub.h" 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | class TestBaseWidget : public ::testing::Test 15 | { 16 | public: 17 | TestBaseWidget(): m_tester(nullptr) {} 18 | 19 | public: 20 | virtual void SetUp() 21 | { 22 | m_tester = new BaseWidget(); 23 | m_tester->disconnect(); 24 | } 25 | 26 | virtual void TearDown() 27 | { 28 | delete m_tester; 29 | } 30 | 31 | protected: 32 | BaseWidget *m_tester; 33 | }; 34 | 35 | TEST_F(TestBaseWidget, initTest) 36 | { 37 | 38 | } 39 | 40 | TEST_F(TestBaseWidget, testupdateWidgetTheme) 41 | { 42 | m_tester->updateWidgetTheme(); 43 | Dtk::Gui::DPalette plt = m_tester->palette(); 44 | EXPECT_TRUE(plt.color(Dtk::Gui::DPalette::Background) == plt.color(Dtk::Gui::DPalette::Base)); 45 | } 46 | 47 | TEST_F(TestBaseWidget, testadaptWindowSize) 48 | { 49 | m_tester->adaptWindowSize(1.0); 50 | } 51 | -------------------------------------------------------------------------------- /tests/widgets/ut_colorwidgetaction.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "ColorWidgetAction.h" 7 | 8 | #include "stub.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | class TestColorWidgetAction : public ::testing::Test 15 | { 16 | public: 17 | TestColorWidgetAction(): m_tester(nullptr) {} 18 | 19 | public: 20 | virtual void SetUp() 21 | { 22 | m_tester = new ColorWidgetAction(); 23 | m_tester->disconnect(); 24 | } 25 | 26 | virtual void TearDown() 27 | { 28 | delete m_tester; 29 | } 30 | 31 | protected: 32 | ColorWidgetAction *m_tester; 33 | }; 34 | 35 | TEST_F(TestColorWidgetAction, initTest) 36 | { 37 | 38 | } 39 | 40 | TEST_F(TestColorWidgetAction, testslotBtnClicked) 41 | { 42 | QSignalSpy spy(m_tester, SIGNAL(sigBtnGroupClicked())); 43 | m_tester->slotBtnClicked(0); 44 | EXPECT_EQ(spy.count(), 1); 45 | } 46 | -------------------------------------------------------------------------------- /tests/widgets/ut_progressdialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "ProgressDialog.h" 7 | 8 | #include "stub.h" 9 | 10 | #include 11 | #include 12 | 13 | class TestProgressDialog : public ::testing::Test 14 | { 15 | public: 16 | TestProgressDialog(): m_tester(nullptr) {} 17 | 18 | public: 19 | virtual void SetUp() 20 | { 21 | m_tester = new ProgressDialog(); 22 | m_tester->disconnect(); 23 | } 24 | 25 | virtual void TearDown() 26 | { 27 | delete m_tester; 28 | } 29 | 30 | protected: 31 | ProgressDialog *m_tester; 32 | }; 33 | 34 | TEST_F(TestProgressDialog, initTest) 35 | { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /tests/widgets/ut_roundcolorwidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "RoundColorWidget.h" 7 | 8 | #include 9 | 10 | #include 11 | 12 | class UT_RoundColorWidget : public ::testing::Test 13 | { 14 | public: 15 | UT_RoundColorWidget(): m_tester(nullptr) {} 16 | 17 | public: 18 | virtual void SetUp() 19 | { 20 | m_tester = new RoundColorWidget(Qt::red); 21 | m_tester->disconnect(); 22 | } 23 | 24 | virtual void TearDown() 25 | { 26 | delete m_tester; 27 | } 28 | 29 | protected: 30 | RoundColorWidget *m_tester; 31 | }; 32 | 33 | TEST_F(UT_RoundColorWidget, initTest) 34 | { 35 | 36 | } 37 | 38 | TEST_F(UT_RoundColorWidget, UT_RoundColorWidget_setSelected_001) 39 | { 40 | m_tester->setSelected(true); 41 | EXPECT_TRUE(m_tester->m_isSelected == true); 42 | } 43 | 44 | TEST_F(UT_RoundColorWidget, UT_RoundColorWidget_setSelected_002) 45 | { 46 | m_tester->setSelected(false); 47 | EXPECT_TRUE(m_tester->m_isSelected == false); 48 | } 49 | 50 | TEST_F(UT_RoundColorWidget, UT_RoundColorWidget_mousePressEvent) 51 | { 52 | QSignalSpy spy(m_tester, SIGNAL(clicked())); 53 | m_tester->m_isSelected = false; 54 | QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, QPointF(50, 50), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); 55 | m_tester->mousePressEvent(event); 56 | delete event; 57 | EXPECT_TRUE(spy.count() == 1); 58 | } 59 | 60 | TEST_F(UT_RoundColorWidget, UT_RoundColorWidget_paintEvent) 61 | { 62 | m_tester->m_isSelected = true; 63 | QPaintEvent paint(QRect(m_tester->rect())); 64 | m_tester->paintEvent(&paint); 65 | EXPECT_FALSE(m_tester->grab().isNull()); 66 | } 67 | -------------------------------------------------------------------------------- /tests/widgets/ut_savedialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "SaveDialog.h" 7 | 8 | #include "stub.h" 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | DWIDGET_USE_NAMESPACE 16 | 17 | class TestSaveDialog : public ::testing::Test 18 | { 19 | public: 20 | TestSaveDialog(): m_tester(nullptr) {} 21 | 22 | public: 23 | virtual void SetUp() 24 | { 25 | m_tester = new SaveDialog(); 26 | m_tester->disconnect(); 27 | } 28 | 29 | virtual void TearDown() 30 | { 31 | delete m_tester; 32 | } 33 | 34 | protected: 35 | SaveDialog *m_tester; 36 | }; 37 | static QString g_funcname; 38 | int dialog_exec_stub() 39 | { 40 | g_funcname = __FUNCTION__; 41 | return 0; 42 | } 43 | 44 | TEST_F(TestSaveDialog, initTest) 45 | { 46 | 47 | } 48 | 49 | TEST_F(TestSaveDialog, testshowExitDialog) 50 | { 51 | Stub stub; 52 | typedef int (*fptr)(DDialog *); 53 | fptr A_foo = (fptr)(&DDialog::exec); //获取虚函数地址 54 | stub.set(A_foo, dialog_exec_stub); 55 | 56 | EXPECT_EQ(m_tester->showExitDialog("1.pdf"), 0); 57 | EXPECT_TRUE(g_funcname == "dialog_exec_stub"); 58 | } 59 | 60 | TEST_F(TestSaveDialog, testshowTipDialog) 61 | { 62 | Stub stub; 63 | typedef int (*fptr)(DDialog *); 64 | fptr A_foo = (fptr)(&DDialog::exec); //获取虚函数地址 65 | stub.set(A_foo, dialog_exec_stub); 66 | 67 | EXPECT_EQ(m_tester->showTipDialog("1.pdf"), 0); 68 | EXPECT_TRUE(g_funcname == "dialog_exec_stub"); 69 | } 70 | -------------------------------------------------------------------------------- /tests/widgets/ut_securitydialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "SecurityDialog.h" 7 | 8 | #include "stub.h" 9 | 10 | #include 11 | #include 12 | 13 | class TestSecurityDialog : public ::testing::Test 14 | { 15 | public: 16 | TestSecurityDialog(): m_tester(nullptr) {} 17 | 18 | public: 19 | virtual void SetUp() 20 | { 21 | m_tester = new SecurityDialog("123456789"); 22 | m_tester->disconnect(); 23 | } 24 | 25 | virtual void TearDown() 26 | { 27 | delete m_tester; 28 | } 29 | 30 | protected: 31 | SecurityDialog *m_tester; 32 | }; 33 | 34 | TEST_F(TestSecurityDialog, initTest) 35 | { 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /tests/widgets/ut_wordwraplabel.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "WordWrapLabel.h" 7 | 8 | #include 9 | 10 | #include 11 | 12 | class UT_WordWrapLabel : public ::testing::Test 13 | { 14 | public: 15 | UT_WordWrapLabel(): m_tester(nullptr) {} 16 | 17 | public: 18 | virtual void SetUp() 19 | { 20 | m_tester = new WordWrapLabel(); 21 | m_tester->disconnect(); 22 | } 23 | 24 | virtual void TearDown() 25 | { 26 | delete m_tester; 27 | } 28 | 29 | protected: 30 | WordWrapLabel *m_tester; 31 | }; 32 | 33 | TEST_F(UT_WordWrapLabel, initTest) 34 | { 35 | 36 | } 37 | 38 | TEST_F(UT_WordWrapLabel, UT_WordWrapLabel_setText) 39 | { 40 | m_tester->setText("123"); 41 | EXPECT_TRUE(m_tester->m_text == "123"); 42 | } 43 | 44 | TEST_F(UT_WordWrapLabel, UT_WordWrapLabel_setMargin) 45 | { 46 | m_tester->setMargin(1); 47 | EXPECT_TRUE(m_tester->m_margin == 1); 48 | } 49 | 50 | TEST_F(UT_WordWrapLabel, UT_WordWrapLabelt_paintEvent) 51 | { 52 | QPaintEvent paint(QRect(m_tester->rect())); 53 | m_tester->paintEvent(&paint); 54 | EXPECT_FALSE(m_tester->grab().isNull()); 55 | } 56 | 57 | TEST_F(UT_WordWrapLabel, UT_WordWrapLabel_adjustContent) 58 | { 59 | QFontMetrics fontMetris(m_tester->font()); 60 | int wordHeight = fontMetris.boundingRect(0, 0, m_tester->width() - 2 * m_tester->m_margin, 0, static_cast(m_tester->alignment() | Qt::TextWrapAnywhere), m_tester->m_text).height(); 61 | m_tester->adjustContent(); 62 | EXPECT_TRUE(m_tester->height() == wordHeight); 63 | } 64 | -------------------------------------------------------------------------------- /translate_generation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # this file is used to auto-generate .qm file from .ts file. 3 | # author: shibowen at linuxdeepin.com 4 | 5 | # 获取传入的QT版本参数 6 | QT_VERSION_MAJOR=$1 7 | 8 | # 确保QT_VERSION_MAJOR是一个整数 9 | if ! [[ "$QT_VERSION_MAJOR" =~ ^[0-9]+$ ]]; then 10 | echo "Error: QT_VERSION_MAJOR is not a valid integer." 11 | exit 1 12 | fi 13 | 14 | ts_list=(`ls translations/*.ts`) 15 | 16 | for ts in "${ts_list[@]}" 17 | do 18 | printf "\nprocess ${ts}\n" 19 | # 根据QT版本选择lrelease命令 20 | if [ "$QT_VERSION_MAJOR" -eq 6 ]; then 21 | /usr/lib/qt6/bin/lrelease "${ts}" 22 | else 23 | lrelease "${ts}" 24 | fi 25 | done -------------------------------------------------------------------------------- /translations/desktop/desktop.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerDocument Viewer -------------------------------------------------------------------------------- /translations/desktop/desktop_ar.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewerعارض المستندات -------------------------------------------------------------------------------- /translations/desktop/desktop_ast.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerVisor de documentos -------------------------------------------------------------------------------- /translations/desktop/desktop_az.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerSənədlərə baxış -------------------------------------------------------------------------------- /translations/desktop/desktop_bn.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewerপাঠ্য দেখার প্রদর্শক -------------------------------------------------------------------------------- /translations/desktop/desktop_bo.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewerཡིག་ཚགས་ལྟ་ཆས། -------------------------------------------------------------------------------- /translations/desktop/desktop_ca.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerVisualitzador de documents -------------------------------------------------------------------------------- /translations/desktop/desktop_cs.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerProhlížeč dokumentů -------------------------------------------------------------------------------- /translations/desktop/desktop_da.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerDokumentfremviser -------------------------------------------------------------------------------- /translations/desktop/desktop_de.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerDokumentbetrachter -------------------------------------------------------------------------------- /translations/desktop/desktop_es.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerVisor de documentos -------------------------------------------------------------------------------- /translations/desktop/desktop_et.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerDokumenti vaataja -------------------------------------------------------------------------------- /translations/desktop/desktop_fi.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerAsiakirjat -------------------------------------------------------------------------------- /translations/desktop/desktop_fr.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerVisionneuse de documents -------------------------------------------------------------------------------- /translations/desktop/desktop_gl_ES.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerVisor de documentos -------------------------------------------------------------------------------- /translations/desktop/desktop_he.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewerצופר דוקומנטים -------------------------------------------------------------------------------- /translations/desktop/desktop_hi_IN.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewerप्रलेख प्रदर्शक -------------------------------------------------------------------------------- /translations/desktop/desktop_hr.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerPreglednik dokumenata -------------------------------------------------------------------------------- /translations/desktop/desktop_hu.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerDokumentum Megjelenítő -------------------------------------------------------------------------------- /translations/desktop/desktop_id.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerPenampil Dokumen -------------------------------------------------------------------------------- /translations/desktop/desktop_it.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerLettore documenti -------------------------------------------------------------------------------- /translations/desktop/desktop_ko.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewer문서 보기도구 -------------------------------------------------------------------------------- /translations/desktop/desktop_lt.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerDokumentų žiūryklė -------------------------------------------------------------------------------- /translations/desktop/desktop_ms.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerPelihat Dokumen -------------------------------------------------------------------------------- /translations/desktop/desktop_nl.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerDocumentweergave -------------------------------------------------------------------------------- /translations/desktop/desktop_pa.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewerਡੌਕੂਮੈਂਟ ਦਰਸ਼ਕ -------------------------------------------------------------------------------- /translations/desktop/desktop_pl.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerPrzeglądarka dokumentów -------------------------------------------------------------------------------- /translations/desktop/desktop_pt.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerVisualizador de Documentos -------------------------------------------------------------------------------- /translations/desktop/desktop_pt_BR.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerVisualizador de Documentos -------------------------------------------------------------------------------- /translations/desktop/desktop_ro.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerVizualizator de Documente -------------------------------------------------------------------------------- /translations/desktop/desktop_ru.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerПросмотрщик документов -------------------------------------------------------------------------------- /translations/desktop/desktop_sl.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerPregledovalnik dokumentov -------------------------------------------------------------------------------- /translations/desktop/desktop_sq.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerParës Dokumentesh -------------------------------------------------------------------------------- /translations/desktop/desktop_sr.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerПрегледач Докумената -------------------------------------------------------------------------------- /translations/desktop/desktop_tr.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerBelge Görüntüleyici -------------------------------------------------------------------------------- /translations/desktop/desktop_ug.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewerھۆججەت كۆرگۈچ -------------------------------------------------------------------------------- /translations/desktop/desktop_uk.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerПереглядач документів -------------------------------------------------------------------------------- /translations/desktop/desktop_vi.ts: -------------------------------------------------------------------------------- 1 | desktopDocument ViewerXem文件 -------------------------------------------------------------------------------- /translations/desktop/desktop_zh_CN.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewer文档查看器 -------------------------------------------------------------------------------- /translations/desktop/desktop_zh_HK.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewer文檔查看器 -------------------------------------------------------------------------------- /translations/desktop/desktop_zh_TW.ts: -------------------------------------------------------------------------------- 1 | desktopDocument Viewer文件查看器 -------------------------------------------------------------------------------- /updateTranslation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #update ts or qm 3 | #If you enter ts, update ts, otherwise update qm 4 | 5 | if [ "$1" = "ts" ] 6 | then 7 | #1. update ts 8 | echo "update ts" 9 | lupdate ./reader ./3rdparty -ts ./translations/*.ts -no-obsolete 10 | else 11 | #2. update qm 12 | echo "update qm" 13 | lrelease ./translations/*.ts 14 | fi 15 | 16 | read -s -t 2 -p "Please input Enter! " 17 | --------------------------------------------------------------------------------