├── synctex ├── synctex_parser_version.txt ├── synctex_parser.c ├── synctex_parser_local.h └── synctex_parser_utils.h ├── .bzrignore ├── icons ├── qpdfview_os2.rc ├── qpdfview_win32.rc ├── qpdfview_os2.ico ├── qpdfview_win32.ico ├── zoom-out.svg ├── two-pages.svg ├── continuous.svg ├── zoom-original.svg ├── zoom-in.svg ├── go-previous.svg ├── go-jump.svg ├── object-rotate-right.svg ├── go-up.svg ├── go-next.svg ├── mail-attachment.svg ├── go-down.svg ├── right-to-left.svg ├── object-rotate-left.svg ├── go-last.svg ├── go-first.svg ├── two-pages-with-cover-page.svg ├── fit-to-page-width.svg ├── media-seek-backward.svg ├── media-seek-forward.svg ├── process-stop.svg ├── tab-new.svg ├── fit-to-page-size.svg ├── multiple-pages.svg ├── view-fullscreen.svg ├── image-missing.svg ├── edit-copy.svg ├── folder.svg └── view-refresh.svg ├── TODO ├── miscellaneous ├── qpdfview.desktop.in └── qpdfview.appdata.xml ├── qpdfview.pri ├── ps-plugin.pro ├── djvu-plugin.pro ├── fitz-plugin.pro ├── sources ├── fontsdialog.h ├── signalhandler.h ├── recentlyclosedmenu.h ├── bookmarkdialog.h ├── helpdialog.h ├── recentlyusedmenu.h ├── printdialog.h ├── searchtask.h ├── bookmarkmenu.h ├── printoptions.h ├── recentlyclosedmenu.cpp ├── rendertask.h ├── annotationwidgets.h ├── pluginhandler.h ├── database.h ├── bookmarkmodel.h ├── thumbnailitem.h ├── fontsdialog.cpp ├── signalhandler.cpp ├── bookmarkdialog.cpp ├── shortcuthandler.h ├── tileitem.h ├── fitzmodel.h ├── presentationview.h ├── global.h ├── recentlyusedmenu.cpp ├── djvumodel.h ├── psmodel.h ├── bookmarkmenu.cpp ├── searchmodel.h ├── documentlayout.h ├── searchtask.cpp ├── helpdialog.cpp ├── formfieldwidgets.h ├── bookmarkmodel.cpp ├── annotationwidgets.cpp ├── thumbnailitem.cpp └── settingsdialog.h ├── pdf-plugin.pro ├── icons.qrc ├── qpdfview.pro ├── README └── CONTRIBUTORS /synctex/synctex_parser_version.txt: -------------------------------------------------------------------------------- 1 | 1.17 -------------------------------------------------------------------------------- /.bzrignore: -------------------------------------------------------------------------------- 1 | qpdfview.pro.user 2 | !libqpdfview_* 3 | -------------------------------------------------------------------------------- /icons/qpdfview_os2.rc: -------------------------------------------------------------------------------- 1 | ICON 1 DISCARDABLE "qpdfview_os2.ico" 2 | -------------------------------------------------------------------------------- /icons/qpdfview_win32.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "qpdfview_win32.ico" 2 | -------------------------------------------------------------------------------- /icons/qpdfview_os2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bendikro/qpdfview/HEAD/icons/qpdfview_os2.ico -------------------------------------------------------------------------------- /icons/qpdfview_win32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bendikro/qpdfview/HEAD/icons/qpdfview_win32.ico -------------------------------------------------------------------------------- /synctex/synctex_parser.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bendikro/qpdfview/HEAD/synctex/synctex_parser.c -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | * improve DjVu support 2 | * add DVI support 3 | * add ePUB support 4 | * add CHM support 5 | 6 | * extend search dock 7 | * add annotations dock 8 | 9 | * rewrite tool support 10 | 11 | * improve text-selection support 12 | * improve link support 13 | * improve annotation support 14 | * improve form support 15 | 16 | * add code documentation 17 | * investigate integration with KDE Frameworks 18 | 19 | -------------------------------------------------------------------------------- /miscellaneous/qpdfview.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Terminal=false 4 | Name=qpdfview 5 | Icon=qpdfview 6 | GenericName=tabbed document viewer 7 | Comment=A tabbed document viewer using Qt and the Poppler library. 8 | Categories=Viewer;Office; 9 | Keywords=viewer;document;presentation;pdf;ps;djvu; 10 | TryExec=qpdfview 11 | Exec=qpdfview --unique %F 12 | MimeType=MIME_TYPES 13 | Actions=ChooseInstance;NonUniqueInstance; 14 | 15 | [Desktop Action ChooseInstance] 16 | Name=Choose instance 17 | Exec=qpdfview --unique --choose-instance %F 18 | 19 | [Desktop Action NonUniqueInstance] 20 | Name=Non-unique instance 21 | Exec=qpdfview %F 22 | -------------------------------------------------------------------------------- /qpdfview.pri: -------------------------------------------------------------------------------- 1 | isEmpty(APPLICATION_VERSION):APPLICATION_VERSION = 0.4.13.99 2 | 3 | isEmpty(TARGET_INSTALL_PATH):TARGET_INSTALL_PATH = /usr/bin 4 | isEmpty(PLUGIN_INSTALL_PATH):PLUGIN_INSTALL_PATH = /usr/lib/qpdfview 5 | isEmpty(DATA_INSTALL_PATH):DATA_INSTALL_PATH = /usr/share/qpdfview 6 | isEmpty(MANUAL_INSTALL_PATH):MANUAL_INSTALL_PATH = /usr/share/man/man1 7 | isEmpty(ICON_INSTALL_PATH):ICON_INSTALL_PATH = /usr/share/icons/hicolor/scalable/apps 8 | isEmpty(LAUNCHER_INSTALL_PATH):LAUNCHER_INSTALL_PATH = /usr/share/applications 9 | isEmpty(APPDATA_INSTALL_PATH):APPDATA_INSTALL_PATH = /usr/share/appdata 10 | 11 | win32:include(qpdfview_win32.pri) 12 | os2:include(qpdfview_os2.pri) 13 | -------------------------------------------------------------------------------- /ps-plugin.pro: -------------------------------------------------------------------------------- 1 | include(qpdfview.pri) 2 | 3 | TARGET = qpdfview_ps 4 | TEMPLATE = lib 5 | CONFIG += plugin 6 | static_ps_plugin:CONFIG += static 7 | 8 | TARGET_SHORT = qpdfps 9 | !isEmpty(PLUGIN_DESTDIR): DESTDIR = $$PLUGIN_DESTDIR 10 | 11 | OBJECTS_DIR = objects-ps 12 | MOC_DIR = moc-ps 13 | 14 | HEADERS = sources/global.h sources/model.h sources/psmodel.h 15 | SOURCES = sources/psmodel.cpp 16 | 17 | QT += core gui 18 | 19 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 20 | 21 | !without_pkgconfig { 22 | CONFIG += link_pkgconfig 23 | PKGCONFIG += libspectre 24 | } else { 25 | DEFINES += $$PS_PLUGIN_DEFINES 26 | INCLUDEPATH += $$PS_PLUGIN_INCLUDEPATH 27 | LIBS += $$PS_PLUGIN_LIBS 28 | } 29 | 30 | !static_ps_plugin { 31 | target.path = $${PLUGIN_INSTALL_PATH} 32 | INSTALLS += target 33 | } 34 | -------------------------------------------------------------------------------- /djvu-plugin.pro: -------------------------------------------------------------------------------- 1 | include(qpdfview.pri) 2 | 3 | TARGET = qpdfview_djvu 4 | TEMPLATE = lib 5 | CONFIG += plugin 6 | static_djvu_plugin:CONFIG += static 7 | 8 | TARGET_SHORT = qpdfdjvu 9 | !isEmpty(PLUGIN_DESTDIR): DESTDIR = $$PLUGIN_DESTDIR 10 | 11 | OBJECTS_DIR = objects-djvu 12 | MOC_DIR = moc-dvju 13 | 14 | HEADERS = sources/global.h sources/model.h sources/djvumodel.h 15 | SOURCES = sources/djvumodel.cpp 16 | 17 | QT += core gui 18 | 19 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 20 | 21 | !without_pkgconfig { 22 | CONFIG += link_pkgconfig 23 | PKGCONFIG += ddjvuapi 24 | } else { 25 | DEFINES += $$DJVU_PLUGIN_DEFINES 26 | INCLUDEPATH += $$DJVU_PLUGIN_INCLUDEPATH 27 | LIBS += $$DJVU_PLUGIN_LIBS 28 | } 29 | 30 | !static_dvju_plugin { 31 | target.path = $${PLUGIN_INSTALL_PATH} 32 | INSTALLS += target 33 | } 34 | -------------------------------------------------------------------------------- /fitz-plugin.pro: -------------------------------------------------------------------------------- 1 | include(qpdfview.pri) 2 | 3 | TARGET = qpdfview_fitz 4 | TEMPLATE = lib 5 | CONFIG += plugin 6 | static_fitz_plugin:CONFIG += static 7 | 8 | TARGET_SHORT = qpdffitz 9 | !isEmpty(PLUGIN_DESTDIR): DESTDIR = $$PLUGIN_DESTDIR 10 | 11 | OBJECTS_DIR = objects-fitz 12 | MOC_DIR = moc-fitz 13 | 14 | HEADERS = sources/global.h sources/model.h sources/fitzmodel.h 15 | SOURCES = sources/fitzmodel.cpp 16 | 17 | QT += core gui 18 | 19 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 20 | 21 | DEFINES += $$FITZ_PLUGIN_DEFINES 22 | INCLUDEPATH += $$FITZ_PLUGIN_INCLUDEPATH 23 | 24 | isEmpty(FITZ_PLUGIN_LIBS) { 25 | LIBS += -lmupdf -lfreetype -ljbig2dec -ljpeg -lz -lm 26 | } else { 27 | LIBS += $$FITZ_PLUGIN_LIBS 28 | } 29 | 30 | !static_fitz_plugin { 31 | target.path = $${PLUGIN_INSTALL_PATH} 32 | INSTALLS += target 33 | } 34 | -------------------------------------------------------------------------------- /icons/zoom-out.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /sources/fontsdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef FONTSDIALOG_H 23 | #define FONTSDIALOG_H 24 | 25 | #include 26 | 27 | class QDialogButtonBox; 28 | class QStandardItemModel; 29 | class QTableView; 30 | 31 | namespace qpdfview 32 | { 33 | 34 | class FontsDialog : public QDialog 35 | { 36 | Q_OBJECT 37 | 38 | public: 39 | FontsDialog(QStandardItemModel* model, QWidget* parent = 0); 40 | ~FontsDialog(); 41 | 42 | private: 43 | Q_DISABLE_COPY(FontsDialog) 44 | 45 | QTableView* m_tableView; 46 | 47 | QDialogButtonBox* m_dialogButtonBox; 48 | 49 | }; 50 | 51 | } // qpdfview 52 | 53 | #endif // FONTSDIALOG_H 54 | -------------------------------------------------------------------------------- /sources/signalhandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef SIGNALHANDLER_H 23 | #define SIGNALHANDLER_H 24 | 25 | #include 26 | 27 | class QSocketNotifier; 28 | 29 | namespace qpdfview 30 | { 31 | 32 | class SignalHandler : public QObject 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | static bool prepareSignals(); 38 | 39 | explicit SignalHandler(QObject* parent = 0); 40 | 41 | signals: 42 | void sigIntReceived(); 43 | void sigTermReceived(); 44 | 45 | private slots: 46 | void on_socketNotifier_activated(); 47 | 48 | private: 49 | Q_DISABLE_COPY(SignalHandler) 50 | 51 | static int s_sockets[2]; 52 | 53 | static void handleSignals(int sigNumber); 54 | 55 | QSocketNotifier* m_socketNotifier; 56 | 57 | }; 58 | 59 | } // qpdfview 60 | 61 | #endif // SIGNALHANDLER_H 62 | -------------------------------------------------------------------------------- /icons/two-pages.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /icons/continuous.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /pdf-plugin.pro: -------------------------------------------------------------------------------- 1 | include(qpdfview.pri) 2 | 3 | TARGET = qpdfview_pdf 4 | TEMPLATE = lib 5 | CONFIG += plugin 6 | static_pdf_plugin:CONFIG += static 7 | 8 | TARGET_SHORT = qpdfpdf 9 | !isEmpty(PLUGIN_DESTDIR): DESTDIR = $$PLUGIN_DESTDIR 10 | 11 | OBJECTS_DIR = objects-pdf 12 | MOC_DIR = moc-pdf 13 | 14 | HEADERS = sources/global.h sources/model.h sources/pdfmodel.h sources/annotationwidgets.h sources/formfieldwidgets.h 15 | SOURCES = sources/pdfmodel.cpp sources/annotationwidgets.cpp sources/formfieldwidgets.cpp 16 | 17 | QT += core xml gui 18 | 19 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 20 | 21 | !without_pkgconfig { 22 | poppler_qt_pkg = poppler-qt$${QT_MAJOR_VERSION} 23 | 24 | CONFIG += link_pkgconfig 25 | PKGCONFIG += $${poppler_qt_pkg} 26 | 27 | system(pkg-config --atleast-version=0.14 $${poppler_qt_pkg}):DEFINES += HAS_POPPLER_14 28 | system(pkg-config --atleast-version=0.18 $${poppler_qt_pkg}):DEFINES += HAS_POPPLER_18 29 | system(pkg-config --atleast-version=0.20.1 $${poppler_qt_pkg}):DEFINES += HAS_POPPLER_20 30 | system(pkg-config --atleast-version=0.22 $${poppler_qt_pkg}):DEFINES += HAS_POPPLER_22 31 | system(pkg-config --atleast-version=0.24 $${poppler_qt_pkg}):DEFINES += HAS_POPPLER_24 32 | system(pkg-config --atleast-version=0.26 $${poppler_qt_pkg}):DEFINES += HAS_POPPLER_26 33 | } else { 34 | DEFINES += $$PDF_PLUGIN_DEFINES 35 | INCLUDEPATH += $$PDF_PLUGIN_INCLUDEPATH 36 | LIBS += $$PDF_PLUGIN_LIBS 37 | } 38 | 39 | !static_pdf_plugin { 40 | target.path = $${PLUGIN_INSTALL_PATH} 41 | INSTALLS += target 42 | } 43 | -------------------------------------------------------------------------------- /sources/recentlyclosedmenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef RECENTLYCLOSEDMENU_H 23 | #define RECENTLYCLOSEDMENU_H 24 | 25 | #include 26 | 27 | namespace qpdfview 28 | { 29 | 30 | class RecentlyClosedMenu : public QMenu 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit RecentlyClosedMenu(int count, QWidget *parent = 0); 36 | 37 | void addTabAction(QAction* tabAction); 38 | 39 | signals: 40 | void tabActionTriggered(QAction* tabAction); 41 | 42 | protected slots: 43 | void on_tabAction_triggered(QAction* tabAction); 44 | void on_clearList_triggered(); 45 | 46 | private: 47 | Q_DISABLE_COPY(RecentlyClosedMenu) 48 | 49 | int m_count; 50 | 51 | QActionGroup* m_tabActionGroup; 52 | QAction* m_separatorAction; 53 | QAction* m_clearListAction; 54 | 55 | }; 56 | 57 | } // qpdfview 58 | 59 | #endif // RECENTLYCLOSEDMENU_H 60 | -------------------------------------------------------------------------------- /sources/bookmarkdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef BOOKMARKDIALOG_H 23 | #define BOOKMARKDIALOG_H 24 | 25 | #include 26 | 27 | class QDialogButtonBox; 28 | class QLineEdit; 29 | class QTextEdit; 30 | 31 | namespace qpdfview 32 | { 33 | 34 | struct BookmarkItem; 35 | 36 | class BookmarkDialog : public QDialog 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | BookmarkDialog(BookmarkItem& bookmark, QWidget* parent = 0); 42 | 43 | public slots: 44 | void accept(); 45 | 46 | protected: 47 | void showEvent(QShowEvent*); 48 | 49 | private: 50 | Q_DISABLE_COPY(BookmarkDialog) 51 | 52 | BookmarkItem& m_bookmark; 53 | 54 | QLineEdit* m_pageEdit; 55 | QLineEdit* m_labelEdit; 56 | QTextEdit* m_commentEdit; 57 | QLineEdit* m_modifiedEdit; 58 | 59 | QDialogButtonBox* m_dialogButtonBox; 60 | 61 | }; 62 | 63 | } // qpdfview 64 | 65 | #endif // BOOKMARKDIALOG_H 66 | -------------------------------------------------------------------------------- /sources/helpdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Benjamin Eltzner 4 | Copyright 2013 Adam Reichold 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #ifndef HELPDIALOG_H 24 | #define HELPDIALOG_H 25 | 26 | #include 27 | 28 | class QDialogButtonBox; 29 | class QTextBrowser; 30 | class QLineEdit; 31 | 32 | namespace qpdfview 33 | { 34 | 35 | class HelpDialog : public QDialog 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit HelpDialog(QWidget* parent = 0); 41 | ~HelpDialog(); 42 | 43 | protected slots: 44 | void on_findPrevious_triggered(); 45 | void on_findNext_triggered(); 46 | void on_search_textEdited(); 47 | 48 | private: 49 | Q_DISABLE_COPY(HelpDialog) 50 | 51 | QTextBrowser* m_textBrowser; 52 | 53 | QDialogButtonBox* m_dialogButtonBox; 54 | 55 | QLineEdit* m_searchLineEdit; 56 | QPushButton* m_findPreviousButton; 57 | QPushButton* m_findNextButton; 58 | 59 | }; 60 | 61 | } // qpdfview 62 | 63 | #endif // HELPDIALOG_H 64 | -------------------------------------------------------------------------------- /icons/zoom-original.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 1:1 20 | 21 | -------------------------------------------------------------------------------- /icons/zoom-in.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /sources/recentlyusedmenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef RECENTLYUSEDMENU_H 23 | #define RECENTLYUSEDMENU_H 24 | 25 | #include 26 | 27 | class QFileInfo; 28 | 29 | namespace qpdfview 30 | { 31 | 32 | class RecentlyUsedMenu : public QMenu 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | explicit RecentlyUsedMenu(const QStringList& filePaths, int count, QWidget* parent = 0); 38 | 39 | void addOpenAction(const QFileInfo& fileInfo); 40 | void removeOpenAction(const QString& filePath); 41 | 42 | QStringList filePaths() const; 43 | 44 | signals: 45 | void openTriggered(const QString& filePath); 46 | 47 | protected slots: 48 | void on_open_triggered(QAction* action); 49 | void on_clearList_triggered(); 50 | 51 | private: 52 | Q_DISABLE_COPY(RecentlyUsedMenu) 53 | 54 | int m_count; 55 | 56 | QActionGroup* m_openActionGroup; 57 | QAction* m_separatorAction; 58 | QAction* m_clearListAction; 59 | 60 | }; 61 | 62 | } // qpdfview 63 | 64 | #endif // RECENTLYUSEDMENU_H 65 | -------------------------------------------------------------------------------- /icons/go-previous.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /icons/go-jump.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /icons/object-rotate-right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /icons.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/qpdfview.svg 4 | icons/image-loading.svg 5 | icons/image-missing.svg 6 | icons/document-open.svg 7 | icons/tab-new.svg 8 | icons/folder.svg 9 | icons/view-refresh.svg 10 | icons/document-print.svg 11 | icons/document-save.svg 12 | icons/document-save-as.svg 13 | icons/go-previous.svg 14 | icons/go-next.svg 15 | icons/go-first.svg 16 | icons/go-last.svg 17 | icons/go-jump.svg 18 | icons/media-seek-backward.svg 19 | icons/media-seek-forward.svg 20 | icons/edit-find.svg 21 | icons/go-up.svg 22 | icons/go-down.svg 23 | icons/process-stop.svg 24 | icons/edit-copy.svg 25 | icons/mail-attachment.svg 26 | icons/continuous.svg 27 | icons/two-pages.svg 28 | icons/two-pages-with-cover-page.svg 29 | icons/multiple-pages.svg 30 | icons/right-to-left.svg 31 | icons/zoom-in.svg 32 | icons/zoom-out.svg 33 | icons/zoom-original.svg 34 | icons/fit-to-page-width.svg 35 | icons/fit-to-page-size.svg 36 | icons/object-rotate-left.svg 37 | icons/object-rotate-right.svg 38 | icons/view-fullscreen.svg 39 | icons/x-office-presentation.svg 40 | 41 | 42 | -------------------------------------------------------------------------------- /icons/go-up.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /icons/go-next.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /icons/mail-attachment.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /sources/printdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef PRINTDIALOG_H 23 | #define PRINTDIALOG_H 24 | 25 | #include 26 | 27 | class QCheckBox; 28 | class QComboBox; 29 | class QFormLayout; 30 | class QLineEdit; 31 | class QPrinter; 32 | 33 | namespace qpdfview 34 | { 35 | 36 | struct PrintOptions; 37 | class Settings; 38 | 39 | class PrintDialog : public QPrintDialog 40 | { 41 | Q_OBJECT 42 | 43 | public: 44 | static QPrinter* createPrinter(); 45 | 46 | PrintDialog(QPrinter* printer, QWidget* parent = 0); 47 | 48 | PrintOptions printOptions() const; 49 | 50 | public slots: 51 | void accept(); 52 | 53 | private: 54 | Q_DISABLE_COPY(PrintDialog) 55 | 56 | static Settings* s_settings; 57 | 58 | QWidget* m_printOptionsWidget; 59 | QFormLayout* m_printOptionsLayout; 60 | 61 | QCheckBox* m_fitToPageCheckBox; 62 | 63 | QLineEdit* m_pageRangesLineEdit; 64 | 65 | #if QT_VERSION < QT_VERSION_CHECK(5,2,0) 66 | 67 | QComboBox* m_pageSetComboBox; 68 | 69 | QComboBox* m_numberUpComboBox; 70 | QComboBox* m_numberUpLayoutComboBox; 71 | 72 | #endif // QT_VERSION 73 | 74 | }; 75 | 76 | } // qpdfview 77 | 78 | #endif // PRINTDIALOG_H 79 | -------------------------------------------------------------------------------- /synctex/synctex_parser_local.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr 3 | 4 | This file is part of the SyncTeX package. 5 | 6 | Latest Revision: Tue Jun 14 08:23:30 UTC 2011 7 | 8 | Version: 1.17 9 | 10 | See synctex_parser_readme.txt for more details 11 | 12 | License: 13 | -------- 14 | Permission is hereby granted, free of charge, to any person 15 | obtaining a copy of this software and associated documentation 16 | files (the "Software"), to deal in the Software without 17 | restriction, including without limitation the rights to use, 18 | copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the 20 | Software is furnished to do so, subject to the following 21 | conditions: 22 | 23 | The above copyright notice and this permission notice shall be 24 | included in all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 28 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 30 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 31 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 32 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 33 | OTHER DEALINGS IN THE SOFTWARE 34 | 35 | Except as contained in this notice, the name of the copyright holder 36 | shall not be used in advertising or otherwise to promote the sale, 37 | use or other dealings in this Software without prior written 38 | authorization from the copyright holder. 39 | 40 | */ 41 | 42 | /* This local header file is for TEXLIVE, use your own header to fit your system */ 43 | # include /* for inline && HAVE_xxx */ 44 | /* No inlining for synctex tool in texlive. */ 45 | # define SYNCTEX_INLINE 46 | -------------------------------------------------------------------------------- /icons/go-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /icons/right-to-left.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /icons/object-rotate-left.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /sources/searchtask.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef SEARCHTASK_H 23 | #define SEARCHTASK_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace qpdfview 30 | { 31 | 32 | namespace Model 33 | { 34 | class Page; 35 | } 36 | 37 | class SearchTask : public QThread 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | explicit SearchTask(QObject* parent = 0); 43 | 44 | bool wasCanceled() const; 45 | int progress() const; 46 | 47 | inline QString text() const { return m_text; } 48 | inline bool matchCase() const { return m_matchCase; } 49 | 50 | void run(); 51 | 52 | signals: 53 | void progressChanged(int progress); 54 | 55 | void resultsReady(int index, QList< QRectF > results); 56 | 57 | public slots: 58 | void start(const QVector< Model::Page* >& pages, 59 | const QString& text, bool matchCase, int beginAtPage = 1); 60 | 61 | void cancel(); 62 | 63 | private: 64 | Q_DISABLE_COPY(SearchTask) 65 | 66 | QAtomicInt m_wasCanceled; 67 | mutable QAtomicInt m_progress; 68 | 69 | QVector< Model::Page* > m_pages; 70 | 71 | QString m_text; 72 | bool m_matchCase; 73 | int m_beginAtPage; 74 | 75 | }; 76 | 77 | } // qpdfview 78 | 79 | #endif // SEARCHTHREAD_H 80 | -------------------------------------------------------------------------------- /icons/go-last.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /icons/go-first.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /qpdfview.pro: -------------------------------------------------------------------------------- 1 | include(qpdfview.pri) 2 | 3 | TEMPLATE = subdirs 4 | CONFIG += ordered 5 | 6 | !without_pdf { 7 | SUBDIRS += pdf-plugin.pro 8 | application.pro.depends = pdf-plugin.pro 9 | } 10 | 11 | !without_ps { 12 | SUBDIRS += ps-plugin.pro 13 | application.pro.depends = ps-plugin.pro 14 | } 15 | 16 | !without_djvu { 17 | SUBDIRS += djvu-plugin.pro 18 | application.pro.depends = djvu-plugin.pro 19 | } 20 | 21 | with_fitz { 22 | SUBDIRS += fitz-plugin.pro 23 | application.pro.depends = fitz-plugin.pro 24 | } 25 | 26 | SUBDIRS += application.pro 27 | 28 | TRANSLATIONS += \ 29 | translations/qpdfview_ast.ts \ 30 | translations/qpdfview_az.ts \ 31 | translations/qpdfview_be.ts \ 32 | translations/qpdfview_bg.ts \ 33 | translations/qpdfview_bs.ts \ 34 | translations/qpdfview_ca.ts \ 35 | translations/qpdfview_cs.ts \ 36 | translations/qpdfview_da.ts \ 37 | translations/qpdfview_de.ts \ 38 | translations/qpdfview_el.ts \ 39 | translations/qpdfview_en_GB.ts \ 40 | translations/qpdfview_eo.ts \ 41 | translations/qpdfview_es.ts \ 42 | translations/qpdfview_eu.ts \ 43 | translations/qpdfview_fi.ts \ 44 | translations/qpdfview_fr.ts \ 45 | translations/qpdfview_gl.ts \ 46 | translations/qpdfview_he.ts \ 47 | translations/qpdfview_hr.ts \ 48 | translations/qpdfview_id.ts \ 49 | translations/qpdfview_it.ts \ 50 | translations/qpdfview_kk.ts \ 51 | translations/qpdfview_ky.ts \ 52 | translations/qpdfview_lt.ts \ 53 | translations/qpdfview_ms.ts \ 54 | translations/qpdfview_my.ts \ 55 | translations/qpdfview_pl.ts \ 56 | translations/qpdfview_pt.ts \ 57 | translations/qpdfview_pt_BR.ts \ 58 | translations/qpdfview_ro.ts \ 59 | translations/qpdfview_ru.ts \ 60 | translations/qpdfview_sk.ts \ 61 | translations/qpdfview_sv.ts \ 62 | translations/qpdfview_th.ts \ 63 | translations/qpdfview_tr.ts \ 64 | translations/qpdfview_ug.ts \ 65 | translations/qpdfview_uk.ts \ 66 | translations/qpdfview_vi.ts \ 67 | translations/qpdfview_zh_CN.ts 68 | -------------------------------------------------------------------------------- /sources/bookmarkmenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 S. Razi Alavizadeh 4 | Copyright 2012-2014 Adam Reichold 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #ifndef BOOKMARKMENU_H 24 | #define BOOKMARKMENU_H 25 | 26 | #include 27 | 28 | #include 29 | 30 | class QFileInfo; 31 | 32 | #include "global.h" 33 | 34 | namespace qpdfview 35 | { 36 | 37 | class BookmarkMenu : public QMenu 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | BookmarkMenu(const QFileInfo& fileInfo, QWidget* parent = 0); 43 | 44 | inline QString absoluteFilePath() const { return menuAction()->data().toString(); } 45 | 46 | void addJumpToPageAction(int page, const QString& label); 47 | void removeJumpToPageAction(int page); 48 | 49 | signals: 50 | void openTriggered(const QString& filePath); 51 | void openInNewTabTriggered(const QString& filePath); 52 | void jumpToPageTriggered(const QString& filePath, int page); 53 | void removeBookmarkTriggered(const QString& filePath); 54 | 55 | protected slots: 56 | void on_open_triggered(); 57 | void on_openInNewTab_triggered(); 58 | void on_jumpToPage_triggered(QAction* action); 59 | void on_removeBookmark_triggered(); 60 | 61 | private: 62 | Q_DISABLE_COPY(BookmarkMenu) 63 | 64 | QAction* m_openAction; 65 | QAction* m_openInNewTabAction; 66 | QActionGroup* m_jumpToPageActionGroup; 67 | QAction* m_separatorAction; 68 | QAction* m_removeBookmarkAction; 69 | 70 | }; 71 | 72 | } // qpdfview 73 | 74 | #endif // BOOKMARKMENU_H 75 | -------------------------------------------------------------------------------- /sources/printoptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | Copyright 2013 Alexander Volkov 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #ifndef PRINTOPTIONS_H 24 | #define PRINTOPTIONS_H 25 | 26 | namespace qpdfview 27 | { 28 | 29 | struct PrintOptions 30 | { 31 | bool fitToPage; 32 | 33 | QString pageRanges; 34 | 35 | #if QT_VERSION < QT_VERSION_CHECK(5,2,0) 36 | 37 | enum PageSet 38 | { 39 | AllPages = 0, 40 | EvenPages = 1, 41 | OddPages = 2 42 | }; 43 | 44 | PageSet pageSet; 45 | 46 | enum NumberUp 47 | { 48 | SinglePage = 0, 49 | TwoPages = 1, 50 | FourPages = 2, 51 | SixPages = 3, 52 | NinePages = 4, 53 | SixteenPages = 5 54 | }; 55 | 56 | NumberUp numberUp; 57 | 58 | enum NumberUpLayout 59 | { 60 | BottomTopLeftRight = 0, 61 | BottomTopRightLeft = 1, 62 | LeftRightBottomTop = 2, 63 | LeftRightTopBottom = 3, 64 | RightLeftBottomTop = 4, 65 | RightLeftTopBottom = 5, 66 | TopBottomLeftRight = 6, 67 | TopBottomRightLeft = 7 68 | }; 69 | 70 | NumberUpLayout numberUpLayout; 71 | 72 | PrintOptions() : fitToPage(false), pageRanges(), pageSet(AllPages), numberUp(SinglePage), numberUpLayout(LeftRightTopBottom) {} 73 | 74 | #else // QT_VERSION 75 | 76 | PrintOptions() : fitToPage(false), pageRanges() {} 77 | 78 | #endif // QT_VERSION 79 | 80 | }; 81 | 82 | } // qpdfview 83 | 84 | #endif // PRINTOPTIONS_H 85 | -------------------------------------------------------------------------------- /icons/two-pages-with-cover-page.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /miscellaneous/qpdfview.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | qpdfview.desktop 5 | CC0-1.0 6 | GPL-2.0+ 7 | qpdfview 8 | tabbed document viewer 9 | 10 |

11 | qpdfview is a simple tabbed document viewer which uses the Poppler library for PDF rendering and CUPS for printing and provides a clear and simple Qt graphical user interface. Support for the DjVu and PostScript formats can be added via plugins. 12 |

13 |

14 | The current feature set includes: 15 |

16 |
    17 |
  • Outline, properties and thumbnail panes
  • 18 |
  • Scale, rotate and fit
  • 19 |
  • Fullscreen and presentation views
  • 20 |
  • Continuous and multi-page layouts
  • 21 |
  • Persistent per-file settings
  • 22 |
  • Configurable keyboard shortcuts
  • 23 |
  • Configurable tool bars
  • 24 |
  • Support for DjVu and PostScript documents via plug-ins
  • 25 |
  • Search for text (PDF and DjVu only)
  • 26 |
  • SyncTeX support (PDF only)
  • 27 |
  • Partial annotation support (PDF only, Poppler version 0.20.1 or newer)
  • 28 |
  • Partial form support (PDF only)
  • 29 |
30 |
31 | 32 | http://screenshots.debian.net/screenshots/q/qpdfview/10731_large.png 33 | http://screenshots.debian.net/screenshots/q/qpdfview/9700_large.png 34 | http://screenshots.debian.net/screenshots/q/qpdfview/9701_large.png 35 | http://screenshots.debian.net/screenshots/q/qpdfview/9399_large.png 36 | 37 | https://launchpad.net/qpdfview 38 | qpdfview@lists.launchpad.net 39 |
40 | -------------------------------------------------------------------------------- /sources/recentlyclosedmenu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #include "recentlyclosedmenu.h" 23 | 24 | #include "documentview.h" 25 | 26 | namespace qpdfview 27 | { 28 | 29 | RecentlyClosedMenu::RecentlyClosedMenu(int count, QWidget* parent) : QMenu(parent), 30 | m_count(count) 31 | { 32 | menuAction()->setText(tr("&Recently closed")); 33 | 34 | m_tabActionGroup = new QActionGroup(this); 35 | connect(m_tabActionGroup, SIGNAL(triggered(QAction*)), SLOT(on_tabAction_triggered(QAction*))); 36 | 37 | m_separatorAction = addSeparator(); 38 | 39 | m_clearListAction = addAction(tr("&Clear list")); 40 | connect(m_clearListAction, SIGNAL(triggered()), SLOT(on_clearList_triggered())); 41 | } 42 | 43 | void RecentlyClosedMenu::addTabAction(QAction* tabAction) 44 | { 45 | if(m_tabActionGroup->actions().count() >= m_count) 46 | { 47 | QAction* first = m_tabActionGroup->actions().first(); 48 | 49 | removeAction(first); 50 | m_tabActionGroup->removeAction(first); 51 | 52 | delete static_cast< DocumentView* >(first->parent()); 53 | } 54 | 55 | insertAction(actions().first(), tabAction); 56 | m_tabActionGroup->addAction(tabAction); 57 | } 58 | 59 | void RecentlyClosedMenu::on_tabAction_triggered(QAction* tabAction) 60 | { 61 | removeAction(tabAction); 62 | m_tabActionGroup->removeAction(tabAction); 63 | 64 | emit tabActionTriggered(tabAction); 65 | } 66 | 67 | void RecentlyClosedMenu::on_clearList_triggered() 68 | { 69 | foreach(QAction* action, m_tabActionGroup->actions()) 70 | { 71 | delete static_cast< DocumentView* >(action->parent()); 72 | } 73 | } 74 | 75 | } // qpdfview 76 | -------------------------------------------------------------------------------- /sources/rendertask.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef RENDERTASK_H 23 | #define RENDERTASK_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "global.h" 32 | 33 | namespace qpdfview 34 | { 35 | 36 | namespace Model 37 | { 38 | class Page; 39 | } 40 | 41 | class RenderTask : public QObject, QRunnable 42 | { 43 | Q_OBJECT 44 | 45 | public: 46 | explicit RenderTask(Model::Page* page, QObject* parent = 0); 47 | 48 | void wait(); 49 | 50 | bool isRunning() const; 51 | 52 | bool wasCanceled() const; 53 | bool wasCanceledNormally() const; 54 | bool wasCanceledForcibly() const; 55 | 56 | void run(); 57 | 58 | signals: 59 | void finished(); 60 | 61 | void imageReady(const RenderParam& renderParam, 62 | const QRect& rect, bool prefetch, 63 | QImage image, QRectF cropRect); 64 | 65 | public slots: 66 | void start(const RenderParam& renderParam, 67 | const QRect& rect, bool prefetch, 68 | bool trimMargins, const QColor& paperColor); 69 | 70 | void cancel(bool force = false); 71 | 72 | private: 73 | Q_DISABLE_COPY(RenderTask) 74 | 75 | mutable QMutex m_mutex; 76 | QWaitCondition m_waitCondition; 77 | 78 | bool m_isRunning; 79 | QAtomicInt m_wasCanceled; 80 | 81 | void finish(); 82 | 83 | 84 | Model::Page* m_page; 85 | 86 | RenderParam m_renderParam; 87 | 88 | QRect m_rect; 89 | bool m_prefetch; 90 | 91 | bool m_trimMargins; 92 | QColor m_paperColor; 93 | 94 | }; 95 | 96 | } // qpdfview 97 | 98 | #endif // RENDERTASK_H 99 | -------------------------------------------------------------------------------- /icons/fit-to-page-width.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /sources/annotationwidgets.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef ANNOTATIONWIDGETS_H 23 | #define ANNOTATIONWIDGETS_H 24 | 25 | #include 26 | #include 27 | 28 | class QMutex; 29 | 30 | namespace Poppler 31 | { 32 | class Annotation; 33 | class FileAttachmentAnnotation; 34 | } 35 | 36 | namespace qpdfview 37 | { 38 | 39 | class AnnotationWidget : public QPlainTextEdit 40 | { 41 | Q_OBJECT 42 | 43 | public: 44 | AnnotationWidget(QMutex* mutex, Poppler::Annotation* annotation, QWidget* parent = 0); 45 | 46 | signals: 47 | void wasModified(); 48 | 49 | protected: 50 | void keyPressEvent(QKeyEvent* event); 51 | 52 | protected slots: 53 | void on_textChanged(); 54 | 55 | private: 56 | Q_DISABLE_COPY(AnnotationWidget) 57 | 58 | QMutex* m_mutex; 59 | Poppler::Annotation* m_annotation; 60 | 61 | }; 62 | 63 | 64 | class FileAttachmentAnnotationWidget : public QToolButton 65 | { 66 | Q_OBJECT 67 | 68 | public: 69 | FileAttachmentAnnotationWidget(QMutex* mutex, Poppler::FileAttachmentAnnotation* annotation, QWidget* parent = 0); 70 | 71 | protected: 72 | void keyPressEvent(QKeyEvent* event); 73 | 74 | protected slots: 75 | void on_aboutToShow(); 76 | void on_aboutToHide(); 77 | 78 | void on_save_triggered(); 79 | void on_saveAndOpen_triggered(); 80 | 81 | private: 82 | Q_DISABLE_COPY(FileAttachmentAnnotationWidget) 83 | 84 | QMutex* m_mutex; 85 | Poppler::FileAttachmentAnnotation* m_annotation; 86 | 87 | void save(bool open = false); 88 | 89 | QMenu* m_menu; 90 | QAction* m_saveAction; 91 | QAction* m_saveAndOpenAction; 92 | 93 | }; 94 | 95 | } // qpdfview 96 | 97 | #endif // ANNOTATIONWIDGETS_H 98 | -------------------------------------------------------------------------------- /sources/pluginhandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef PLUGINHANDLER_H 23 | #define PLUGINHANDLER_H 24 | 25 | #include 26 | #include 27 | 28 | class QString; 29 | class QWidget; 30 | 31 | namespace qpdfview 32 | { 33 | 34 | namespace Model 35 | { 36 | class Document; 37 | } 38 | 39 | class SettingsWidget; 40 | class Plugin; 41 | 42 | class PluginHandler : public QObject 43 | { 44 | Q_OBJECT 45 | 46 | public: 47 | static PluginHandler* instance(); 48 | ~PluginHandler(); 49 | 50 | enum FileType 51 | { 52 | Unknown = 0, 53 | PDF = 1, 54 | PS = 2, 55 | DjVu = 3 56 | }; 57 | 58 | static QString fileTypeName(FileType fileType) 59 | { 60 | switch(fileType) 61 | { 62 | default: 63 | case PluginHandler::Unknown: 64 | return QLatin1String("Unknown"); 65 | case PluginHandler::PDF: 66 | return QLatin1String("PDF"); 67 | case PluginHandler::PS: 68 | return QLatin1String("PS"); 69 | case PluginHandler::DjVu: 70 | return QLatin1String("DjVu"); 71 | } 72 | } 73 | 74 | Model::Document* loadDocument(const QString& filePath); 75 | 76 | SettingsWidget* createSettingsWidget(FileType fileType, QWidget* parent = 0); 77 | 78 | private: 79 | Q_DISABLE_COPY(PluginHandler) 80 | 81 | static PluginHandler* s_instance; 82 | PluginHandler(QObject* parent = 0); 83 | 84 | QMap< FileType, Plugin* > m_plugins; 85 | 86 | QMultiMap< FileType, QString > m_objectNames; 87 | QMultiMap< FileType, QString > m_fileNames; 88 | 89 | bool loadPlugin(FileType fileType); 90 | 91 | }; 92 | 93 | } // qpdfview 94 | 95 | #endif // PLUGINHANDLER_H 96 | -------------------------------------------------------------------------------- /sources/database.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 S. Razi Alavizadeh 4 | Copyright 2013-2014 Adam Reichold 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #ifndef DATABASE_H 24 | #define DATABASE_H 25 | 26 | #include 27 | 28 | #ifdef WITH_SQL 29 | 30 | #include 31 | 32 | #endif // WITH_SQL 33 | 34 | class QDateTime; 35 | 36 | #include "global.h" 37 | 38 | namespace qpdfview 39 | { 40 | 41 | class DocumentView; 42 | 43 | class Database : public QObject 44 | { 45 | Q_OBJECT 46 | 47 | public: 48 | static Database* instance(); 49 | ~Database(); 50 | 51 | QStringList loadInstanceNames(); 52 | 53 | void restoreTabs(); 54 | void saveTabs(const QList< DocumentView* >& tabs); 55 | void clearTabs(); 56 | 57 | void restoreBookmarks(); 58 | void saveBookmarks(); 59 | void clearBookmarks(); 60 | 61 | void restorePerFileSettings(DocumentView* tab); 62 | void savePerFileSettings(const DocumentView* tab); 63 | 64 | signals: 65 | void tabRestored(const QString& absoluteFilePath, bool continuousMode, LayoutMode layoutMode, bool rightToLeftMode, ScaleMode scaleMode, qreal scaleFactor, Rotation rotation, int currentPage); 66 | 67 | private: 68 | Q_DISABLE_COPY(Database) 69 | 70 | static Database* s_instance; 71 | Database(QObject* parent = 0); 72 | 73 | static QString instanceName(); 74 | 75 | #ifdef WITH_SQL 76 | 77 | bool prepareTabs_v3(); 78 | bool prepareBookmarks_v3(); 79 | bool preparePerFileSettings_v3(); 80 | 81 | void migrateTabs_v2_v3(); 82 | void migrateTabs_v1_v3(); 83 | void migrateBookmarks_v2_v3(); 84 | void migrateBookmarks_v1_v3(); 85 | void migratePerFileSettings_v2_v3(); 86 | void migratePerFileSettings_v1_v3(); 87 | 88 | void limitPerFileSettings(); 89 | 90 | QSqlDatabase m_database; 91 | 92 | #endif // WITH_SQL 93 | 94 | }; 95 | 96 | } // qpdfview 97 | 98 | #endif // DATABASE_H 99 | -------------------------------------------------------------------------------- /sources/bookmarkmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef BOOKMARKMODEL_H 23 | #define BOOKMARKMODEL_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | namespace qpdfview 30 | { 31 | 32 | struct BookmarkItem 33 | { 34 | int page; 35 | 36 | QString label; 37 | QString comment; 38 | QDateTime modified; 39 | 40 | BookmarkItem(int page, const QString& label = QString(), const QString& comment = QString(), const QDateTime& modified = QDateTime::currentDateTime()) : 41 | page(page), 42 | label(label), 43 | comment(comment), 44 | modified(modified) {} 45 | 46 | }; 47 | 48 | class BookmarkModel : public QAbstractListModel 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | explicit BookmarkModel(QObject* parent = 0); 54 | 55 | 56 | inline bool isEmpty() const { return m_bookmarks.isEmpty(); } 57 | 58 | void addBookmark(const BookmarkItem& bookmark); 59 | void removeBookmark(const BookmarkItem& bookmark); 60 | 61 | void findBookmark(BookmarkItem& bookmark) const; 62 | 63 | 64 | static BookmarkModel* fromPath(const QString& path, bool create = false); 65 | 66 | static QList< QString > knownPaths(); 67 | 68 | static void forgetPath(const QString& path); 69 | static void forgetAllPaths(); 70 | 71 | 72 | enum 73 | { 74 | PageRole = Qt::UserRole + 1, 75 | LabelRole, 76 | CommentRole, 77 | ModifiedRole 78 | }; 79 | 80 | Qt::ItemFlags flags(const QModelIndex&) const; 81 | 82 | int columnCount(const QModelIndex& parent = QModelIndex()) const; 83 | int rowCount(const QModelIndex& parent = QModelIndex()) const; 84 | 85 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; 86 | 87 | private: 88 | QList< BookmarkItem > m_bookmarks; 89 | 90 | }; 91 | 92 | } // qpdfview 93 | 94 | #endif // BOOKMARKMODEL_H 95 | -------------------------------------------------------------------------------- /sources/thumbnailitem.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef THUMBNAILITEM_H 23 | #define THUMBNAILITEM_H 24 | 25 | #include 26 | 27 | #if QT_VERSION >= QT_VERSION_CHECK(4,7,0) 28 | 29 | #include 30 | 31 | #endif // QT_VERSION 32 | 33 | #include "pageitem.h" 34 | 35 | namespace qpdfview 36 | { 37 | 38 | namespace Model 39 | { 40 | class Page; 41 | } 42 | 43 | class ThumbnailItem : public PageItem 44 | { 45 | Q_OBJECT 46 | 47 | public: 48 | ThumbnailItem(Model::Page* page, const QString& text, int index, QGraphicsItem* parent = 0); 49 | 50 | QRectF boundingRect() const; 51 | void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget); 52 | 53 | #if QT_VERSION >= QT_VERSION_CHECK(4,7,0) 54 | 55 | inline QString text() const { return m_text.text(); } 56 | void setText(const QString& text) { m_text.setText(text); } 57 | 58 | #else 59 | 60 | inline QString text() const { return m_text; } 61 | void setText(const QString& text) { m_text = text; } 62 | 63 | #endif // QT_VERSION 64 | 65 | inline bool isHighlighted() const { return m_isHighlighted; } 66 | void setHighlighted(bool highlighted); 67 | 68 | protected: 69 | void mousePressEvent(QGraphicsSceneMouseEvent* event); 70 | void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*); 71 | void mouseMoveEvent(QGraphicsSceneMouseEvent*); 72 | void mouseReleaseEvent(QGraphicsSceneMouseEvent*); 73 | 74 | void contextMenuEvent(QGraphicsSceneContextMenuEvent*); 75 | 76 | private slots: 77 | void loadInteractiveElements(); 78 | 79 | private: 80 | Q_DISABLE_COPY(ThumbnailItem) 81 | 82 | #if QT_VERSION >= QT_VERSION_CHECK(4,7,0) 83 | 84 | QStaticText m_text; 85 | 86 | #else 87 | 88 | QString m_text; 89 | 90 | #endif // QT_VERSION 91 | 92 | bool m_isHighlighted; 93 | 94 | }; 95 | 96 | } // qpdfview 97 | 98 | #endif // THUMBNAILITEM_H 99 | -------------------------------------------------------------------------------- /icons/media-seek-backward.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /sources/fontsdialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #include "fontsdialog.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "settings.h" 31 | 32 | namespace qpdfview 33 | { 34 | 35 | FontsDialog::FontsDialog(QStandardItemModel* model, QWidget* parent) : QDialog(parent) 36 | { 37 | setWindowTitle(tr("Fonts") + QLatin1String(" - qpdfview")); 38 | 39 | m_tableView = new QTableView(this); 40 | m_tableView->setModel(model); 41 | 42 | m_tableView->setAlternatingRowColors(true); 43 | m_tableView->setSortingEnabled(true); 44 | m_tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); 45 | m_tableView->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); 46 | 47 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 48 | 49 | m_tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); 50 | m_tableView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); 51 | 52 | #else 53 | 54 | m_tableView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); 55 | m_tableView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); 56 | 57 | #endif // QT_VERSION 58 | 59 | m_tableView->verticalHeader()->setVisible(false); 60 | 61 | m_dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, this); 62 | connect(m_dialogButtonBox, SIGNAL(accepted()), SLOT(accept())); 63 | connect(m_dialogButtonBox, SIGNAL(rejected()), SLOT(reject())); 64 | 65 | setLayout(new QVBoxLayout(this)); 66 | layout()->addWidget(m_tableView); 67 | layout()->addWidget(m_dialogButtonBox); 68 | 69 | resize(Settings::instance()->mainWindow().fontsDialogSize(sizeHint())); 70 | } 71 | 72 | FontsDialog::~FontsDialog() 73 | { 74 | Settings::instance()->mainWindow().setFontsDialogSize(size()); 75 | } 76 | 77 | } // qpdfview 78 | -------------------------------------------------------------------------------- /icons/media-seek-forward.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /sources/signalhandler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #include "signalhandler.h" 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace qpdfview 31 | { 32 | 33 | int SignalHandler::s_sockets[2]; 34 | 35 | bool SignalHandler::prepareSignals() 36 | { 37 | if(socketpair(AF_UNIX, SOCK_STREAM, 0, s_sockets) != 0) 38 | { 39 | return false; 40 | } 41 | 42 | struct sigaction sigAction; 43 | 44 | sigAction.sa_handler = SignalHandler::handleSignals; 45 | sigemptyset(&sigAction.sa_mask); 46 | sigAction.sa_flags = SA_RESTART; 47 | 48 | if(sigaction(SIGINT, &sigAction, 0) != 0) 49 | { 50 | close(s_sockets[0]); 51 | close(s_sockets[1]); 52 | 53 | return false; 54 | } 55 | 56 | if(sigaction(SIGTERM, &sigAction, 0) != 0) 57 | { 58 | close(s_sockets[0]); 59 | close(s_sockets[1]); 60 | 61 | return false; 62 | } 63 | 64 | return true; 65 | } 66 | 67 | SignalHandler::SignalHandler(QObject* parent) : QObject(parent), 68 | m_socketNotifier(0) 69 | { 70 | m_socketNotifier = new QSocketNotifier(s_sockets[1], QSocketNotifier::Read, this); 71 | connect(m_socketNotifier, SIGNAL(activated(int)), SLOT(on_socketNotifier_activated())); 72 | } 73 | 74 | void SignalHandler::on_socketNotifier_activated() 75 | { 76 | m_socketNotifier->setEnabled(false); 77 | 78 | int sigNumber; 79 | Q_UNUSED(read(s_sockets[1], &sigNumber, sizeof(int))); 80 | 81 | switch(sigNumber) 82 | { 83 | case SIGINT: 84 | emit sigIntReceived(); 85 | break; 86 | case SIGTERM: 87 | emit sigTermReceived(); 88 | break; 89 | } 90 | 91 | m_socketNotifier->setEnabled(true); 92 | } 93 | 94 | void SignalHandler::handleSignals(int sigNumber) 95 | { 96 | Q_UNUSED(write(s_sockets[0], &sigNumber, sizeof(int))); 97 | } 98 | 99 | } // qpdfview 100 | -------------------------------------------------------------------------------- /sources/bookmarkdialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #include "bookmarkdialog.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "global.h" 31 | #include "bookmarkmodel.h" 32 | 33 | namespace qpdfview 34 | { 35 | 36 | BookmarkDialog::BookmarkDialog(BookmarkItem& bookmark, QWidget* parent) : QDialog(parent), 37 | m_bookmark(bookmark) 38 | { 39 | setWindowTitle(tr("Bookmark")); 40 | 41 | QFormLayout* formLayout = new QFormLayout(this); 42 | setLayout(formLayout); 43 | 44 | m_pageEdit = new QLineEdit(this); 45 | m_pageEdit->setReadOnly(true); 46 | m_pageEdit->setText(QString::number(m_bookmark.page)); 47 | 48 | formLayout->addRow(tr("Page:"), m_pageEdit); 49 | 50 | m_labelEdit = new QLineEdit(this); 51 | m_labelEdit->setText(m_bookmark.label); 52 | 53 | formLayout->addRow(tr("Label:"), m_labelEdit); 54 | 55 | m_commentEdit = new QTextEdit(this); 56 | m_commentEdit->setPlainText(m_bookmark.comment); 57 | 58 | formLayout->addRow(tr("Comment:"), m_commentEdit); 59 | 60 | m_modifiedEdit = new QLineEdit(this); 61 | m_modifiedEdit->setReadOnly(true); 62 | m_modifiedEdit->setText(m_bookmark.modified.toString(Qt::SystemLocaleLongDate)); 63 | 64 | formLayout->addRow(tr("Modified:"), m_modifiedEdit); 65 | 66 | m_dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); 67 | connect(m_dialogButtonBox, SIGNAL(accepted()), SLOT(accept())); 68 | connect(m_dialogButtonBox, SIGNAL(rejected()), SLOT(reject())); 69 | 70 | formLayout->addWidget(m_dialogButtonBox); 71 | } 72 | 73 | void BookmarkDialog::accept() 74 | { 75 | QDialog::accept(); 76 | 77 | m_bookmark.label = m_labelEdit->text(); 78 | m_bookmark.comment = m_commentEdit->toPlainText(); 79 | 80 | m_bookmark.modified = QDateTime::currentDateTime(); 81 | } 82 | 83 | void BookmarkDialog::showEvent(QShowEvent*) 84 | { 85 | m_labelEdit->setFocus(); 86 | } 87 | 88 | } // qpdfview 89 | -------------------------------------------------------------------------------- /sources/shortcuthandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef SHORTCUTHANDLER_H 23 | #define SHORTCUTHANDLER_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | class QSettings; 30 | 31 | namespace qpdfview 32 | { 33 | 34 | class ShortcutHandler : public QAbstractTableModel 35 | { 36 | Q_OBJECT 37 | 38 | public: 39 | static ShortcutHandler* instance(); 40 | ~ShortcutHandler(); 41 | 42 | void registerAction(QAction* action); 43 | 44 | int columnCount(const QModelIndex& parent) const; 45 | int rowCount(const QModelIndex& parent) const; 46 | 47 | Qt::ItemFlags flags(const QModelIndex& index) const; 48 | 49 | QVariant headerData(int section, Qt::Orientation orientation, int role) const; 50 | 51 | QVariant data(const QModelIndex& index, int role) const; 52 | bool setData(const QModelIndex& index, const QVariant& value, int role); 53 | 54 | bool matchesSkipBackward(const QKeySequence& keySequence) const; 55 | bool matchesSkipForward(const QKeySequence& keySequence) const; 56 | 57 | bool matchesMoveUp(const QKeySequence& keySequence) const; 58 | bool matchesMoveDown(const QKeySequence& keySequence) const; 59 | bool matchesMoveLeft(const QKeySequence& keySequence) const; 60 | bool matchesMoveRight(const QKeySequence& keySequence) const; 61 | 62 | public slots: 63 | bool submit(); 64 | void revert(); 65 | 66 | void reset(); 67 | 68 | private: 69 | Q_DISABLE_COPY(ShortcutHandler) 70 | 71 | static ShortcutHandler* s_instance; 72 | ShortcutHandler(QObject* parent = 0); 73 | 74 | QSettings* m_settings; 75 | 76 | QList< QAction* > m_actions; 77 | 78 | QMap< QAction*, QList< QKeySequence > > m_shortcuts; 79 | QMap< QAction*, QList< QKeySequence > > m_defaultShortcuts; 80 | 81 | QAction* m_skipBackwardAction; 82 | QAction* m_skipForwardAction; 83 | 84 | QAction* m_moveUpAction; 85 | QAction* m_moveDownAction; 86 | QAction* m_moveLeftAction; 87 | QAction* m_moveRightAction; 88 | 89 | }; 90 | 91 | } // qpdfview 92 | 93 | #endif // SHORTCUTHANDLER_H 94 | -------------------------------------------------------------------------------- /icons/process-stop.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /sources/tileitem.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef TILEITEM_H 23 | #define TILEITEM_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "global.h" 30 | 31 | namespace qpdfview 32 | { 33 | 34 | class Settings; 35 | class RenderTask; 36 | class PageItem; 37 | 38 | class TileItem : public QObject 39 | { 40 | Q_OBJECT 41 | 42 | public: 43 | TileItem(QObject* parent = 0); 44 | ~TileItem(); 45 | 46 | inline const QRect& rect() const { return m_rect; } 47 | inline void setRect(const QRect& rect) { m_rect = rect; } 48 | 49 | inline const QRectF& cropRect() const { return m_cropRect; } 50 | void setCropRect(const QRectF& cropRect); 51 | 52 | inline void dropPixmap() { m_pixmap = QPixmap(); } 53 | inline void dropObsoletePixmap() { m_obsoletePixmap = QPixmap(); } 54 | 55 | static void dropCachedPixmaps(PageItem* page); 56 | 57 | void paint(QPainter* painter, const QPointF& topLeft); 58 | 59 | public slots: 60 | void refresh(bool keepObsoletePixmaps = false); 61 | 62 | int startRender(bool prefetch = false); 63 | void cancelRender(); 64 | 65 | void deleteAfterRender(); 66 | 67 | protected slots: 68 | void on_renderTask_finished(); 69 | void on_renderTask_imageReady(const RenderParam& renderParam, 70 | const QRect& rect, bool prefetch, 71 | QImage image, QRectF cropRect); 72 | 73 | private: 74 | Q_DISABLE_COPY(TileItem) 75 | 76 | static Settings* s_settings; 77 | 78 | typedef QPair< PageItem*, QByteArray > CacheKey; 79 | typedef QPair< QPixmap, QRectF > CacheObject; 80 | 81 | static QCache< CacheKey, CacheObject > s_cache; 82 | 83 | PageItem* parentPage() const; 84 | CacheKey cacheKey() const; 85 | 86 | QRect m_rect; 87 | QRectF m_cropRect; 88 | 89 | bool m_pixmapError; 90 | QPixmap m_pixmap; 91 | QPixmap m_obsoletePixmap; 92 | 93 | QPixmap takePixmap(); 94 | 95 | RenderTask* m_renderTask; 96 | 97 | }; 98 | 99 | } // qpdfview 100 | 101 | #endif // PAGEITEM_H 102 | -------------------------------------------------------------------------------- /icons/tab-new.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /icons/fit-to-page-size.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | qpdfview is a tabbed document viewer using Poppler, libspectre, DjVuLibre, CUPS and Qt, licensed under GPL version 2 or later. 2 | 3 | The project homepage is "https://launchpad.net/qpdfview". The project maintainer is "Adam Reichold ". 4 | 5 | It depends on libQtCore, libQtGui. It also depends on libQtSvg, libQtSql, libQtDBus, libcups, resp. libz if SVG, SQL, D-Bus, CUPS, resp. SyncTeX support is enabled. It also depends on libmagic if Qt version 4 is used and libmagic support is enabled. The PDF plug-in depends on libQtCore, libQtXml, libQtGui and libpoppler-qt4 or libpoppler-qt5. The PS plug-in depends on libQtCore, libQtGui and libspectre. The DjVu plug-in depends on libQtCore, libQtGui and libdjvulibre. The Fitz plug-in depends on libQtCore, libQtGui and libmupdf. 6 | 7 | It is built using "lrelease qpdfview.pro", "qmake qpdfview.pro" and "make". It is installed using "make install". The installation paths are defined in "qpdfview.pri". 8 | 9 | The following build-time options are available: 10 | * 'without_svg' disables SVG support, i.e. fallback and application-specific icons will not be available. 11 | * 'without_sql' disables SQL support, i.e. restoring tabs, bookmarks and per-file settings will not be available. 12 | * 'without_dbus' disables D-Bus support, i.e. the '--unique' command-line option will not be available. 13 | * 'without_pkgconfig' disables the use of pkg-config, i.e. compiler and linker options have to be configured manually in "qpdfview.pri". 14 | * 'without_pdf' disables PDF support, i.e. the PDF plug-in using Poppler will not be built. 15 | * 'without_ps' disables PS support, i.e. the PS plug-in using libspectre will not be built. 16 | * 'without_djvu' disables DjVu support, i.e. the DjVu plug-in using DjVuLibre will not be built. 17 | * 'with_fitz' enables Fitz support, i.e. the Fitz plug-in using MuPDF will be built. 18 | * 'static_pdf_plugin' links the PDF plug-in statically (This could lead to linker dependency collisions.) 19 | * 'static_ps_plugin' links the PS plug-in statically. (This could lead to linker dependency collisions.) 20 | * 'static_djvu_plugin' links the DjVu plug-in statically. (This could lead to linker dependency collisions.) 21 | * 'static_fitz_plugin' links the Fitz plug-in statically. (This could lead to linker dependency collisions.) 22 | * 'without_cups' disables CUPS support, i.e. the program will attempt to rasterize the document instead of requesting CUPS to print the document file. 23 | * 'without_synctex' disables SyncTeX support, i.e. the program will not perform forward and inverse search for sources. 24 | * 'without_magic' disables libmagic support, i.e. the program will determine file type using the file suffix. 25 | * 'without_signals' disabled support for UNIX signals, i.e. the program will not save bookmarks, tabs and per-file settings on receiving SIGINT or SIGTERM. 26 | 27 | For example, if one wants to build the program without support for CUPS and PostScript, one could run "qmake CONFIG+="without_cups without_ps" qpdfview.pro" instead of "qmake qpdfview.pro". 28 | 29 | The fallback and application-specific icons are derived from the Tango icon theme available at "http://tango.freedesktop.org". 30 | -------------------------------------------------------------------------------- /sources/fitzmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef FITZMODEL_H 23 | #define FITZMODEL_H 24 | 25 | #include 26 | 27 | extern "C" 28 | { 29 | 30 | #include 31 | 32 | typedef struct fz_page_s fz_page; 33 | typedef struct fz_document_s fz_document; 34 | 35 | } 36 | 37 | #include "model.h" 38 | 39 | namespace qpdfview 40 | { 41 | 42 | class FitzPlugin; 43 | 44 | namespace Model 45 | { 46 | class FitzPage : public Page 47 | { 48 | friend class FitzDocument; 49 | 50 | public: 51 | ~FitzPage(); 52 | 53 | QSizeF size() const; 54 | 55 | QImage render(qreal horizontalResolution, qreal verticalResolution, Rotation rotation, const QRect& boundingRect) const; 56 | 57 | QList< Link* > links() const; 58 | 59 | private: 60 | Q_DISABLE_COPY(FitzPage) 61 | 62 | FitzPage(const class FitzDocument* parent, fz_page* page); 63 | 64 | const class FitzDocument* m_parent; 65 | 66 | fz_page* m_page; 67 | 68 | }; 69 | 70 | class FitzDocument : public Document 71 | { 72 | friend class FitzPage; 73 | friend class qpdfview::FitzPlugin; 74 | 75 | public: 76 | ~FitzDocument(); 77 | 78 | int numberOfPages() const; 79 | 80 | Page* page(int index) const; 81 | 82 | bool canBePrintedUsingCUPS() const; 83 | 84 | void setPaperColor(const QColor &paperColor); 85 | 86 | void loadOutline(QStandardItemModel* outlineModel) const; 87 | 88 | private: 89 | Q_DISABLE_COPY(FitzDocument) 90 | 91 | FitzDocument(fz_context* context, fz_document* document); 92 | 93 | mutable QMutex m_mutex; 94 | fz_context* m_context; 95 | fz_document* m_document; 96 | 97 | QColor m_paperColor; 98 | 99 | }; 100 | } 101 | 102 | class FitzPlugin : public QObject, Plugin 103 | { 104 | Q_OBJECT 105 | Q_INTERFACES(qpdfview::Plugin) 106 | 107 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 108 | 109 | Q_PLUGIN_METADATA(IID "local.qpdfview.Plugin") 110 | 111 | #endif // QT_VERSION 112 | 113 | public: 114 | FitzPlugin(QObject* parent = 0); 115 | ~FitzPlugin(); 116 | 117 | Model::Document* loadDocument(const QString& filePath) const; 118 | 119 | private: 120 | QMutex m_mutex[FZ_LOCK_MAX]; 121 | fz_locks_context m_locks_context; 122 | fz_context* m_context; 123 | 124 | static void lock(void* user, int lock); 125 | static void unlock(void* user, int lock); 126 | 127 | }; 128 | 129 | } // qpdfview 130 | 131 | #endif // FITZMODEL_H 132 | -------------------------------------------------------------------------------- /icons/multiple-pages.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /sources/presentationview.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef PRESENTATIONVIEW_H 23 | #define PRESENTATIONVIEW_H 24 | 25 | #include 26 | 27 | #include "global.h" 28 | 29 | namespace qpdfview 30 | { 31 | 32 | namespace Model 33 | { 34 | class Page; 35 | } 36 | 37 | class Settings; 38 | class PageItem; 39 | 40 | class PresentationView : public QGraphicsView 41 | { 42 | Q_OBJECT 43 | 44 | public: 45 | PresentationView(const QVector< Model::Page* >& pages, QWidget* parent = 0); 46 | ~PresentationView(); 47 | 48 | int numberOfPages() const; 49 | int currentPage() const; 50 | 51 | ScaleMode scaleMode() const; 52 | void setScaleMode(ScaleMode scaleMode); 53 | 54 | qreal scaleFactor() const; 55 | void setScaleFactor(qreal scaleFactor); 56 | 57 | Rotation rotation() const; 58 | void setRotation(Rotation rotation); 59 | 60 | bool invertColors() const; 61 | void setInvertColors(bool invertColors); 62 | 63 | signals: 64 | void currentPageChanged(int currentPage, bool trackChange = false); 65 | 66 | void scaleModeChanged(ScaleMode scaleMode); 67 | void scaleFactorChanged(qreal scaleFactor); 68 | void rotationChanged(Rotation rotation); 69 | 70 | void invertColorsChanged(bool invertColors); 71 | 72 | public slots: 73 | void show(); 74 | 75 | void previousPage(); 76 | void nextPage(); 77 | void firstPage(); 78 | void lastPage(); 79 | 80 | void jumpToPage(int page, bool trackChange = true); 81 | 82 | void jumpBackward(); 83 | void jumpForward(); 84 | 85 | void zoomIn(); 86 | void zoomOut(); 87 | void originalSize(); 88 | 89 | void rotateLeft(); 90 | void rotateRight(); 91 | 92 | protected slots: 93 | void on_prefetch_timeout(); 94 | 95 | void on_pages_cropRectChanged(); 96 | 97 | void on_pages_linkClicked(bool newTab, int page, qreal left, qreal top); 98 | 99 | protected: 100 | void resizeEvent(QResizeEvent* event); 101 | 102 | void keyPressEvent(QKeyEvent* event); 103 | void wheelEvent(QWheelEvent* event); 104 | 105 | private: 106 | Q_DISABLE_COPY(PresentationView) 107 | 108 | static Settings* s_settings; 109 | 110 | QTimer* m_prefetchTimer; 111 | 112 | QVector< Model::Page* > m_pages; 113 | 114 | int m_currentPage; 115 | 116 | QList< int > m_past; 117 | QList< int > m_future; 118 | 119 | ScaleMode m_scaleMode; 120 | qreal m_scaleFactor; 121 | Rotation m_rotation; 122 | 123 | bool m_invertColors; 124 | 125 | QVector< PageItem* > m_pageItems; 126 | 127 | void preparePages(); 128 | void prepareBackground(); 129 | 130 | void prepareScene(); 131 | void prepareView(); 132 | 133 | }; 134 | 135 | } // qpdfview 136 | 137 | #endif // PRESENTATIONVIEW_H 138 | -------------------------------------------------------------------------------- /sources/global.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | Copyright 2013 Alexander Volkov 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #ifndef GLOBAL_H 24 | #define GLOBAL_H 25 | 26 | namespace qpdfview 27 | { 28 | 29 | enum Rotation 30 | { 31 | RotateBy0 = 0, 32 | RotateBy90 = 1, 33 | RotateBy180 = 2, 34 | RotateBy270 = 3, 35 | NumberOfRotations = 4 36 | }; 37 | 38 | struct RenderResolution 39 | { 40 | int resolutionX; 41 | int resolutionY; 42 | qreal devicePixelRatio; 43 | 44 | RenderResolution(int resolutionX = 72, int resolutionY = 72, 45 | qreal devicePixelRatio = 1.0) : 46 | resolutionX(resolutionX), 47 | resolutionY(resolutionY), 48 | devicePixelRatio(devicePixelRatio) {} 49 | 50 | bool operator==(const RenderResolution& other) const 51 | { 52 | return resolutionX == other.resolutionX 53 | && resolutionY == other.resolutionY 54 | && qFuzzyCompare(devicePixelRatio, other.devicePixelRatio); 55 | } 56 | 57 | bool operator!=(const RenderResolution& other) const { return !operator==(other); } 58 | 59 | }; 60 | 61 | struct RenderParam 62 | { 63 | RenderResolution resolution; 64 | 65 | qreal scaleFactor; 66 | Rotation rotation; 67 | 68 | bool invertColors; 69 | bool convertToGrayscale; 70 | 71 | RenderParam(const RenderResolution& resolution = RenderResolution(), 72 | qreal scaleFactor = 1.0, Rotation rotation = RotateBy0, 73 | bool invertColors = false, bool convertToGrayscale = false) : 74 | resolution(resolution), 75 | scaleFactor(scaleFactor), 76 | rotation(rotation), 77 | invertColors(invertColors), 78 | convertToGrayscale(convertToGrayscale) {} 79 | 80 | bool operator==(const RenderParam& other) const 81 | { 82 | return resolution == other.resolution 83 | && qFuzzyCompare(scaleFactor, other.scaleFactor) 84 | && rotation == other.rotation 85 | && invertColors == other.invertColors 86 | && convertToGrayscale == other.convertToGrayscale; 87 | } 88 | 89 | bool operator!=(const RenderParam& other) const { return !operator==(other); } 90 | 91 | }; 92 | 93 | enum RubberBandMode 94 | { 95 | ModifiersMode = 0, 96 | CopyToClipboardMode = 1, 97 | AddAnnotationMode = 2, 98 | ZoomToSelectionMode = 3, 99 | NumberOfRubberBandModes = 4 100 | }; 101 | 102 | enum LayoutMode 103 | { 104 | SinglePageMode = 0, 105 | TwoPagesMode = 1, 106 | TwoPagesWithCoverPageMode = 2, 107 | MultiplePagesMode = 3, 108 | NumberOfLayoutModes = 4 109 | }; 110 | 111 | enum ScaleMode 112 | { 113 | ScaleFactorMode = 0, 114 | FitToPageWidthMode = 1, 115 | FitToPageSizeMode = 2, 116 | NumberOfScaleModes = 3 117 | }; 118 | 119 | } // qpdfview 120 | 121 | #endif // GLOBAL_H 122 | -------------------------------------------------------------------------------- /icons/view-fullscreen.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /icons/image-missing.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /icons/edit-copy.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /sources/recentlyusedmenu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2014 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #include "recentlyusedmenu.h" 23 | 24 | #include 25 | 26 | namespace qpdfview 27 | { 28 | 29 | RecentlyUsedMenu::RecentlyUsedMenu(const QStringList& absoluteFilePaths, int count, QWidget* parent) : QMenu(parent), 30 | m_count(count) 31 | { 32 | menuAction()->setText(tr("Recently &used")); 33 | menuAction()->setIcon(QIcon::fromTheme("document-open-recent")); 34 | menuAction()->setIconVisibleInMenu(true); 35 | 36 | m_openActionGroup = new QActionGroup(this); 37 | connect(m_openActionGroup, SIGNAL(triggered(QAction*)), SLOT(on_open_triggered(QAction*))); 38 | 39 | m_separatorAction = addSeparator(); 40 | 41 | m_clearListAction = addAction(tr("&Clear list")); 42 | connect(m_clearListAction, SIGNAL(triggered()), SLOT(on_clearList_triggered())); 43 | 44 | foreach(const QString& absoluteFilePath, absoluteFilePaths) 45 | { 46 | addOpenAction(QFileInfo(absoluteFilePath)); 47 | } 48 | } 49 | 50 | void RecentlyUsedMenu::addOpenAction(const QFileInfo& fileInfo) 51 | { 52 | foreach(QAction* action, m_openActionGroup->actions()) 53 | { 54 | if(action->data().toString() == fileInfo.absoluteFilePath()) 55 | { 56 | removeAction(action); 57 | m_openActionGroup->removeAction(action); 58 | 59 | insertAction(actions().first(), action); 60 | m_openActionGroup->addAction(action); 61 | 62 | return; 63 | } 64 | } 65 | 66 | if(m_openActionGroup->actions().count() >= m_count) 67 | { 68 | QAction* first = m_openActionGroup->actions().first(); 69 | 70 | removeAction(first); 71 | m_openActionGroup->removeAction(first); 72 | 73 | delete first; 74 | } 75 | 76 | QAction* action = new QAction(fileInfo.completeBaseName(), this); 77 | action->setToolTip(fileInfo.absoluteFilePath()); 78 | action->setData(fileInfo.absoluteFilePath()); 79 | 80 | insertAction(actions().first(), action); 81 | m_openActionGroup->addAction(action); 82 | } 83 | 84 | void RecentlyUsedMenu::removeOpenAction(const QString& filePath) 85 | { 86 | const QFileInfo fileInfo(filePath); 87 | 88 | foreach(QAction* action, m_openActionGroup->actions()) 89 | { 90 | if(action->data().toString() == fileInfo.absoluteFilePath()) 91 | { 92 | delete action; 93 | 94 | break; 95 | } 96 | } 97 | } 98 | 99 | QStringList RecentlyUsedMenu::filePaths() const 100 | { 101 | QStringList filePaths; 102 | 103 | foreach(const QAction* action, m_openActionGroup->actions()) 104 | { 105 | filePaths.append(action->data().toString()); 106 | } 107 | 108 | return filePaths; 109 | } 110 | 111 | void RecentlyUsedMenu::on_open_triggered(QAction* action) 112 | { 113 | emit openTriggered(action->data().toString()); 114 | } 115 | 116 | void RecentlyUsedMenu::on_clearList_triggered() 117 | { 118 | qDeleteAll(m_openActionGroup->actions()); 119 | } 120 | 121 | } // qpdfview 122 | -------------------------------------------------------------------------------- /sources/djvumodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Adam Reichold 4 | Copyright 2013 Alexander Volkov 5 | 6 | This file is part of qpdfview. 7 | 8 | The implementation is based on KDjVu by Pino Toscano. 9 | 10 | qpdfview is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | qpdfview is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with qpdfview. If not, see . 22 | 23 | */ 24 | 25 | #ifndef DJVUMODEL_H 26 | #define DJVUMODEL_H 27 | 28 | #include 29 | #include 30 | 31 | typedef struct ddjvu_context_s ddjvu_context_t; 32 | typedef struct ddjvu_format_s ddjvu_format_t; 33 | typedef struct ddjvu_document_s ddjvu_document_t; 34 | typedef struct ddjvu_pageinfo_s ddjvu_pageinfo_t; 35 | 36 | #include "model.h" 37 | 38 | namespace qpdfview 39 | { 40 | 41 | class DjVuPlugin; 42 | 43 | namespace Model 44 | { 45 | class DjVuPage : public Page 46 | { 47 | friend class DjVuDocument; 48 | 49 | public: 50 | ~DjVuPage(); 51 | 52 | QSizeF size() const; 53 | 54 | QImage render(qreal horizontalResolution, qreal verticalResolution, Rotation rotation, const QRect& boundingRect) const; 55 | 56 | QList< Link* > links() const; 57 | 58 | QString text(const QRectF& rect) const; 59 | QList< QRectF > search(const QString& text, bool matchCase) const; 60 | 61 | private: 62 | Q_DISABLE_COPY(DjVuPage) 63 | 64 | DjVuPage(const class DjVuDocument* parent, int index, const ddjvu_pageinfo_t& pageinfo); 65 | 66 | const class DjVuDocument* m_parent; 67 | 68 | int m_index; 69 | QSizeF m_size; 70 | int m_resolution; 71 | 72 | }; 73 | 74 | class DjVuDocument : public Document 75 | { 76 | friend class DjVuPage; 77 | friend class qpdfview::DjVuPlugin; 78 | 79 | public: 80 | ~DjVuDocument(); 81 | 82 | int numberOfPages() const; 83 | 84 | Page* page(int index) const; 85 | 86 | QStringList saveFilter() const; 87 | 88 | bool canSave() const; 89 | bool save(const QString& filePath, bool withChanges) const; 90 | 91 | void loadOutline(QStandardItemModel* outlineModel) const; 92 | void loadProperties(QStandardItemModel* propertiesModel) const; 93 | 94 | private: 95 | Q_DISABLE_COPY(DjVuDocument) 96 | 97 | DjVuDocument(QMutex* globalMutex, ddjvu_context_t* context, ddjvu_document_t* document); 98 | 99 | mutable QMutex m_mutex; 100 | mutable QMutex* m_globalMutex; 101 | 102 | ddjvu_context_t* m_context; 103 | ddjvu_document_t* m_document; 104 | ddjvu_format_t* m_format; 105 | 106 | QHash< QString, int > m_indexByName; 107 | 108 | void prepareIndexByName(); 109 | 110 | }; 111 | } 112 | 113 | class DjVuPlugin : public QObject, Plugin 114 | { 115 | Q_OBJECT 116 | Q_INTERFACES(qpdfview::Plugin) 117 | 118 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 119 | 120 | Q_PLUGIN_METADATA(IID "local.qpdfview.Plugin") 121 | 122 | #endif // QT_VERSION 123 | 124 | public: 125 | DjVuPlugin(QObject* parent = 0); 126 | 127 | Model::Document* loadDocument(const QString& filePath) const; 128 | 129 | private: 130 | mutable QMutex m_globalMutex; 131 | 132 | }; 133 | 134 | } // qpdfview 135 | 136 | #endif // DJVUMODEL_H 137 | -------------------------------------------------------------------------------- /sources/psmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Alexander Volkov 4 | Copyright 2013 Adam Reichold 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #ifndef PSMODEL_H 24 | #define PSMODEL_H 25 | 26 | #include 27 | #include 28 | 29 | class QFormLayout; 30 | class QSettings; 31 | class QSpinBox; 32 | 33 | struct SpectrePage; 34 | struct SpectreDocument; 35 | struct SpectreRenderContext; 36 | 37 | #include "model.h" 38 | 39 | namespace qpdfview 40 | { 41 | 42 | class PsPlugin; 43 | 44 | namespace Model 45 | { 46 | class PsPage : public Page 47 | { 48 | friend class PsDocument; 49 | 50 | public: 51 | ~PsPage(); 52 | 53 | QSizeF size() const; 54 | 55 | QImage render(qreal horizontalResolution, qreal verticalResolution, Rotation rotation, const QRect& boundingRect) const; 56 | 57 | private: 58 | Q_DISABLE_COPY(PsPage) 59 | 60 | PsPage(QMutex* mutex, SpectrePage* page, SpectreRenderContext* renderContext); 61 | 62 | mutable QMutex* m_mutex; 63 | SpectrePage* m_page; 64 | SpectreRenderContext* m_renderContext; 65 | 66 | }; 67 | 68 | class PsDocument : public Document 69 | { 70 | Q_DECLARE_TR_FUNCTIONS(Model::PsDocument) 71 | 72 | friend class qpdfview::PsPlugin; 73 | 74 | public: 75 | ~PsDocument(); 76 | 77 | int numberOfPages() const; 78 | 79 | Page* page(int index) const; 80 | 81 | QStringList saveFilter() const; 82 | 83 | bool canSave() const; 84 | bool save(const QString& filePath, bool withChanges) const; 85 | 86 | bool canBePrintedUsingCUPS() const; 87 | 88 | void loadProperties(QStandardItemModel* propertiesModel) const; 89 | 90 | private: 91 | Q_DISABLE_COPY(PsDocument) 92 | 93 | PsDocument(SpectreDocument* document, SpectreRenderContext* renderContext); 94 | 95 | mutable QMutex m_mutex; 96 | SpectreDocument* m_document; 97 | SpectreRenderContext* m_renderContext; 98 | 99 | }; 100 | } 101 | 102 | class PsSettingsWidget : public SettingsWidget 103 | { 104 | Q_OBJECT 105 | 106 | public: 107 | PsSettingsWidget(QSettings* settings, QWidget* parent = 0); 108 | 109 | void accept(); 110 | void reset(); 111 | 112 | private: 113 | Q_DISABLE_COPY(PsSettingsWidget) 114 | 115 | QSettings* m_settings; 116 | 117 | QFormLayout* m_layout; 118 | 119 | QSpinBox* m_graphicsAntialiasBitsSpinBox; 120 | QSpinBox* m_textAntialisBitsSpinBox; 121 | 122 | }; 123 | 124 | class PsPlugin : public QObject, Plugin 125 | { 126 | Q_OBJECT 127 | Q_INTERFACES(qpdfview::Plugin) 128 | 129 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 130 | 131 | Q_PLUGIN_METADATA(IID "local.qpdfview.Plugin") 132 | 133 | #endif // QT_VERSION 134 | 135 | public: 136 | PsPlugin(QObject* parent = 0); 137 | 138 | Model::Document* loadDocument(const QString& filePath) const; 139 | 140 | SettingsWidget* createSettingsWidget(QWidget* parent) const; 141 | 142 | private: 143 | Q_DISABLE_COPY(PsPlugin) 144 | 145 | QSettings* m_settings; 146 | 147 | }; 148 | 149 | } // qpdfview 150 | 151 | #endif // PSMODEL_H 152 | -------------------------------------------------------------------------------- /sources/bookmarkmenu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 S. Razi Alavizadeh 4 | Copyright 2012-2014 Adam Reichold 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #include "bookmarkmenu.h" 24 | 25 | #include 26 | 27 | namespace qpdfview 28 | { 29 | 30 | BookmarkMenu::BookmarkMenu(const QFileInfo& fileInfo, QWidget* parent) : QMenu(parent) 31 | { 32 | menuAction()->setText(fileInfo.completeBaseName()); 33 | menuAction()->setToolTip(fileInfo.absoluteFilePath()); 34 | 35 | menuAction()->setData(fileInfo.absoluteFilePath()); 36 | 37 | m_openAction = addAction(tr("&Open")); 38 | m_openAction->setIcon(QIcon::fromTheme("document-open", QIcon(":icons/document-open.svg"))); 39 | m_openAction->setIconVisibleInMenu(true); 40 | connect(m_openAction, SIGNAL(triggered()), SLOT(on_open_triggered())); 41 | 42 | m_openInNewTabAction = addAction(tr("Open in new &tab")); 43 | m_openInNewTabAction->setIcon(QIcon::fromTheme("tab-new", QIcon(":icons/tab-new.svg"))); 44 | m_openInNewTabAction->setIconVisibleInMenu(true); 45 | connect(m_openInNewTabAction, SIGNAL(triggered()), SLOT(on_openInNewTab_triggered())); 46 | 47 | m_jumpToPageActionGroup = new QActionGroup(this); 48 | connect(m_jumpToPageActionGroup, SIGNAL(triggered(QAction*)), SLOT(on_jumpToPage_triggered(QAction*))); 49 | 50 | m_separatorAction = addSeparator(); 51 | 52 | m_removeBookmarkAction = addAction(tr("&Remove bookmark")); 53 | connect(m_removeBookmarkAction, SIGNAL(triggered()), SLOT(on_removeBookmark_triggered())); 54 | } 55 | 56 | void BookmarkMenu::addJumpToPageAction(int page, const QString& label) 57 | { 58 | QAction* before = m_separatorAction; 59 | 60 | foreach(QAction* action, m_jumpToPageActionGroup->actions()) 61 | { 62 | if(action->data().toInt() == page) 63 | { 64 | action->setText(label); 65 | 66 | return; 67 | } 68 | else if(action->data().toInt() > page) 69 | { 70 | before = action; 71 | 72 | break; 73 | } 74 | } 75 | 76 | QAction* action = new QAction(label, this); 77 | action->setIcon(QIcon::fromTheme("go-jump", QIcon(":icons/go-jump.svg"))); 78 | action->setIconVisibleInMenu(true); 79 | action->setData(page); 80 | 81 | insertAction(before, action); 82 | m_jumpToPageActionGroup->addAction(action); 83 | } 84 | 85 | void BookmarkMenu::removeJumpToPageAction(int page) 86 | { 87 | foreach(QAction* action, m_jumpToPageActionGroup->actions()) 88 | { 89 | if(action->data().toInt() == page) 90 | { 91 | delete action; 92 | 93 | break; 94 | } 95 | } 96 | } 97 | 98 | void BookmarkMenu::on_open_triggered() 99 | { 100 | emit openTriggered(absoluteFilePath()); 101 | } 102 | 103 | void BookmarkMenu::on_openInNewTab_triggered() 104 | { 105 | emit openInNewTabTriggered(absoluteFilePath()); 106 | } 107 | 108 | void BookmarkMenu::on_jumpToPage_triggered(QAction* action) 109 | { 110 | emit jumpToPageTriggered(absoluteFilePath(), action->data().toInt()); 111 | } 112 | 113 | void BookmarkMenu::on_removeBookmark_triggered() 114 | { 115 | emit removeBookmarkTriggered(absoluteFilePath()); 116 | } 117 | 118 | } // qpdfview 119 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Eetu Aalto 2 | S. Razi Alavizadeh 3 | Automatizatorius 4 | abuyop 5 | Rashid Aliyev 6 | Claudio Arseni 7 | Şâkir Aşçı 8 | athmakrigiannis 9 | Dennis Baudys 10 | Adolfo Jayme Barrientos 11 | blacktext 12 | Hélion du Mas des Bourboux 13 | Miguel Anxo Bouzada 14 | Tobias B. 15 | Átila Camurça 16 | Marc Coll Carrillo 17 | Andi Chandler 18 | Abdellah Chelli 19 | Dominique Chomet 20 | Yuri Chornoivan 21 | George Christofis 22 | DAG Software 23 | Ivlev Denis 24 | Kenan Dervišević 25 | Glad Deschrijver 26 | Kyrill Detinov 27 | Wang Dianjin 28 | Dante Díaz 29 | Dorian 30 | Daniel Ejsing-Duun 31 | Eliovir 32 | Benjamin Eltzner 33 | Thomas Etter 34 | Aaron Farias 35 | fbn69 36 | Baptiste Fontaine 37 | fossfreedom 38 | freedomrun 39 | Franz Fellner 40 | Pavel Fric 41 | Sylvie Gallet 42 | gogo 43 | Giovanni Grieco 44 | Abdul Munif Hanafi 45 | Anthony Harrington 46 | Tanguy Herrmann 47 | HsH 48 | isamu715 49 | Aputsiaq Niels Janussen 50 | Evo Jimmy 51 | Aleksey Kabanov 52 | KL 53 | A. Kohl 54 | Oleg Koptev 55 | Atanas Kovachki 56 | Marcos Lans 57 | Ask Hjorth Larsen 58 | Jerome Laurens 59 | Martin Linder 60 | Litty 61 | Mateusz Łukasik 62 | manolox 63 | Eugene Marshal 64 | Sérgio Marques 65 | Mike08 66 | mjjzf 67 | Paco Molinero 68 | Baurzhan Muftakhidinov 69 | Rizal Muttaqin 70 | Rafael Neri 71 | Fábio Nogueira 72 | Sandor Ortegon 73 | Quentin Pagès 74 | Trisno Pamuji 75 | Nkolay Parukhin 76 | Vlad Paul Paval 77 | Kévin Peignot 78 | Paolo Pelesk 79 | Gisele Perreault 80 | Blagovest Petrov 81 | Fabian Pijcke 82 | Eugene Pivnev 83 | Boris Popov 84 | Adam Reichold 85 | Lucas Reis 86 | Aurélien Ribeiro 87 | Rockworld 88 | Donald Rogers 89 | Leo Romanovski 90 | Sahran 91 | Asier Iturralde Sarasola 92 | Xuacu Saturio 93 | Andi Cristian Șerbănescu 94 | Silvan Scherrer 95 | Arnaud Schmittbuhl 96 | Dorian Scholz 97 | Yaron Shahrabani 98 | Pierre Slamich 99 | Mark Smith 100 | Phillipe Smith 101 | Vladimir Smolyar 102 | Smonff 103 | Pyae Sone 104 | Pierre Soulat 105 | Martin Spacek 106 | Piotr Strębski 107 | Sébastien Szymanski 108 | Teromene 109 | Gheyret T.Kenji 110 | Michał Trybus 111 | Tubuntu 112 | Khang Mạnh Tử 113 | VPablo 114 | Alexander Volkov 115 | Thomas Worofsky 116 | Yury Yatsynovich 117 | Xiaoxing Ye 118 | Chris Young 119 | Rodrigo Zimmermann 120 | -------------------------------------------------------------------------------- /sources/searchmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 S. Razi Alavizadeh 4 | Copyright 2014 Adam Reichold 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #ifndef SEARCHMODEL_H 24 | #define SEARCHMODEL_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | namespace qpdfview 32 | { 33 | 34 | class DocumentView; 35 | 36 | class SearchModel : public QAbstractItemModel 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | static SearchModel* instance(); 42 | ~SearchModel(); 43 | 44 | 45 | QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const; 46 | 47 | QModelIndex parent(const QModelIndex& child) const; 48 | 49 | int rowCount(const QModelIndex& parent = QModelIndex()) const; 50 | int columnCount(const QModelIndex& parent = QModelIndex()) const; 51 | 52 | enum 53 | { 54 | CountRole = Qt::UserRole + 1, 55 | ProgressRole, 56 | PageRole, 57 | RectRole, 58 | TextRole, 59 | MatchCaseRole, 60 | SurroundingTextRole 61 | }; 62 | 63 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; 64 | 65 | 66 | DocumentView* viewForIndex(const QModelIndex& index) const; 67 | 68 | 69 | bool hasResults(DocumentView* view) const; 70 | bool hasResultsOnPage(DocumentView* view, int page) const; 71 | int numberOfResultsOnPage(DocumentView* view, int page) const; 72 | QList< QRectF > resultsOnPage(DocumentView* view, int page) const; 73 | 74 | enum FindDirection 75 | { 76 | FindNext, 77 | FindPrevious 78 | }; 79 | 80 | QPersistentModelIndex findResult(DocumentView* view, const QPersistentModelIndex& currentResult, int currentPage, FindDirection direction) const; 81 | 82 | void insertResults(DocumentView* view, int page, const QList< QRectF >& resultsOnPage); 83 | void clearResults(DocumentView* view); 84 | 85 | void updateProgress(DocumentView* view); 86 | 87 | protected slots: 88 | void on_fetchSurroundingText_finished(); 89 | 90 | private: 91 | Q_DISABLE_COPY(SearchModel) 92 | 93 | static SearchModel* s_instance; 94 | SearchModel(QObject* parent = 0); 95 | 96 | QList< DocumentView* > m_views; 97 | 98 | QModelIndex findView(DocumentView* view) const; 99 | QModelIndex findOrInsertView(DocumentView* view); 100 | 101 | 102 | typedef QPair< int, QRectF > Result; 103 | typedef QList< Result > Results; 104 | 105 | QHash< DocumentView*, Results* > m_results; 106 | 107 | 108 | typedef QPair< DocumentView*, QByteArray > TextCacheKey; 109 | typedef QString TextCacheObject; 110 | 111 | struct TextJob 112 | { 113 | TextCacheKey key; 114 | TextCacheObject* object; 115 | 116 | TextJob() : key(), object(0) {} 117 | TextJob(const TextCacheKey& key, TextCacheObject* object) : key(key), object(object) {} 118 | 119 | }; 120 | 121 | typedef QFutureWatcher< TextJob > TextWatcher; 122 | 123 | mutable QCache< TextCacheKey, TextCacheObject > m_textCache; 124 | mutable QHash< TextCacheKey, TextWatcher* > m_textWatchers; 125 | 126 | QString fetchSurroundingText(DocumentView* view, const Result& result) const; 127 | 128 | static TextCacheKey textCacheKey(DocumentView* view, const Result& result); 129 | static TextJob textJob(const TextCacheKey& key, const Result& result); 130 | 131 | }; 132 | 133 | } // qpdfview 134 | 135 | #endif // SEARCHMODEL_H 136 | -------------------------------------------------------------------------------- /sources/documentlayout.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 S. Razi Alavizadeh 4 | Copyright 2013-2014 Adam Reichold 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #ifndef DOCUMENTLAYOUT_H 24 | #define DOCUMENTLAYOUT_H 25 | 26 | #include 27 | #include 28 | 29 | #include "global.h" 30 | 31 | class QRectF; 32 | 33 | namespace qpdfview 34 | { 35 | 36 | class Settings; 37 | class PageItem; 38 | 39 | struct DocumentLayout 40 | { 41 | DocumentLayout(); 42 | virtual ~DocumentLayout() {} 43 | 44 | static DocumentLayout* fromLayoutMode(LayoutMode layoutMode); 45 | 46 | virtual LayoutMode layoutMode() const = 0; 47 | 48 | virtual int currentPage(int page) const = 0; 49 | virtual int previousPage(int page) const = 0; 50 | virtual int nextPage(int page, int count) const = 0; 51 | 52 | bool isCurrentPage(const QRectF& visibleRect, const QRectF& pageRect) const; 53 | 54 | virtual QPair< int, int > prefetchRange(int page, int count) const = 0; 55 | 56 | virtual int leftIndex(int index) const = 0; 57 | virtual int rightIndex(int index, int count) const = 0; 58 | 59 | virtual qreal visibleWidth(int viewportWidth) const = 0; 60 | qreal visibleHeight(int viewportHeight) const; 61 | 62 | virtual void prepareLayout(const QVector< PageItem* >& pageItems, bool rightToLeft, 63 | qreal& left, qreal& right, qreal& height) = 0; 64 | 65 | protected: 66 | static Settings* s_settings; 67 | 68 | }; 69 | 70 | struct SinglePageLayout : public DocumentLayout 71 | { 72 | LayoutMode layoutMode() const { return SinglePageMode; } 73 | 74 | int currentPage(int page) const; 75 | int previousPage(int page) const; 76 | int nextPage(int page, int count) const; 77 | 78 | QPair< int, int > prefetchRange(int page, int count) const; 79 | 80 | int leftIndex(int index) const; 81 | int rightIndex(int index, int count) const; 82 | 83 | qreal visibleWidth(int viewportWidth) const; 84 | 85 | void prepareLayout(const QVector< PageItem* >& pageItems, bool rightToLeft, 86 | qreal& left, qreal& right, qreal& height); 87 | 88 | }; 89 | 90 | struct TwoPagesLayout : public DocumentLayout 91 | { 92 | LayoutMode layoutMode() const { return TwoPagesMode; } 93 | 94 | int currentPage(int page) const; 95 | int previousPage(int page) const; 96 | int nextPage(int page, int count) const; 97 | 98 | QPair< int, int > prefetchRange(int page, int count) const; 99 | 100 | int leftIndex(int index) const; 101 | int rightIndex(int index, int count) const; 102 | 103 | qreal visibleWidth(int viewportWidth) const; 104 | 105 | void prepareLayout(const QVector< PageItem* >& pageItems, bool rightToLeft, 106 | qreal& left, qreal& right, qreal& height); 107 | 108 | }; 109 | 110 | struct TwoPagesWithCoverPageLayout : public TwoPagesLayout 111 | { 112 | LayoutMode layoutMode() const { return TwoPagesWithCoverPageMode; } 113 | 114 | int currentPage(int page) const; 115 | 116 | int leftIndex(int index) const; 117 | int rightIndex(int index, int count) const; 118 | 119 | }; 120 | 121 | struct MultiplePagesLayout : public DocumentLayout 122 | { 123 | LayoutMode layoutMode() const { return MultiplePagesMode; } 124 | 125 | int currentPage(int page) const; 126 | int previousPage(int page) const; 127 | int nextPage(int page, int count) const; 128 | 129 | QPair< int, int > prefetchRange(int page, int count) const; 130 | 131 | int leftIndex(int index) const; 132 | int rightIndex(int index, int count) const; 133 | 134 | qreal visibleWidth(int viewportWidth) const; 135 | 136 | void prepareLayout(const QVector< PageItem* >& pageItems, bool rightToLeft, 137 | qreal& left, qreal& right, qreal& height); 138 | 139 | }; 140 | 141 | } // qpdfview 142 | 143 | #endif // DOCUMENTLAYOUT_H 144 | -------------------------------------------------------------------------------- /icons/folder.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sources/searchtask.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #include "searchtask.h" 23 | 24 | #include "model.h" 25 | 26 | namespace 27 | { 28 | 29 | using namespace qpdfview; 30 | 31 | enum 32 | { 33 | NotCanceled = 0, 34 | Canceled = 1 35 | }; 36 | 37 | void setCancellation(QAtomicInt& wasCanceled) 38 | { 39 | #if QT_VERSION > QT_VERSION_CHECK(5,0,0) 40 | 41 | wasCanceled.storeRelease(Canceled); 42 | 43 | #else 44 | 45 | wasCanceled.fetchAndStoreRelease(Canceled); 46 | 47 | #endif // QT_VERSION 48 | } 49 | 50 | void resetCancellation(QAtomicInt& wasCanceled) 51 | { 52 | #if QT_VERSION > QT_VERSION_CHECK(5,0,0) 53 | 54 | wasCanceled.storeRelease(NotCanceled); 55 | 56 | #else 57 | 58 | wasCanceled.fetchAndStoreRelease(NotCanceled); 59 | 60 | #endif // QT_VERSION 61 | } 62 | 63 | bool testCancellation(QAtomicInt& wasCanceled) 64 | { 65 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 66 | 67 | return wasCanceled.load() != NotCanceled; 68 | 69 | #else 70 | 71 | return !wasCanceled.testAndSetRelaxed(NotCanceled, NotCanceled); 72 | 73 | #endif // QT_VERSION 74 | } 75 | 76 | int loadWasCanceled(const QAtomicInt& wasCanceled) 77 | { 78 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 79 | 80 | return wasCanceled.load(); 81 | 82 | #else 83 | 84 | return wasCanceled; 85 | 86 | #endif // QT_VERSION 87 | } 88 | 89 | void releaseProgress(QAtomicInt& progress, int value) 90 | { 91 | #if QT_VERSION > QT_VERSION_CHECK(5,0,0) 92 | 93 | progress.storeRelease(value); 94 | 95 | #else 96 | 97 | progress.fetchAndStoreRelease(value); 98 | 99 | #endif // QT_VERSION 100 | } 101 | 102 | int acquireProgress(QAtomicInt& progress) 103 | { 104 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 105 | 106 | return progress.loadAcquire(); 107 | 108 | #else 109 | 110 | return progress.fetchAndAddAcquire(0); 111 | 112 | #endif // QT_VERSION 113 | } 114 | 115 | int loadProgress(const QAtomicInt& progress) 116 | { 117 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 118 | 119 | return progress.load(); 120 | #else 121 | 122 | return progress; 123 | 124 | #endif // QT_VERSION 125 | } 126 | 127 | } // anonymous 128 | 129 | namespace qpdfview 130 | { 131 | 132 | SearchTask::SearchTask(QObject* parent) : QThread(parent), 133 | m_wasCanceled(NotCanceled), 134 | m_progress(0), 135 | m_pages(), 136 | m_text(), 137 | m_matchCase(false), 138 | m_beginAtPage(1) 139 | { 140 | } 141 | 142 | bool SearchTask::wasCanceled() const 143 | { 144 | return loadWasCanceled(m_wasCanceled) != NotCanceled; 145 | } 146 | 147 | int SearchTask::progress() const 148 | { 149 | return acquireProgress(m_progress); 150 | } 151 | 152 | void SearchTask::run() 153 | { 154 | for(int index = m_beginAtPage - 1; index < m_pages.count() + m_beginAtPage - 1; ++index) 155 | { 156 | if(testCancellation(m_wasCanceled)) 157 | { 158 | break; 159 | } 160 | 161 | const QList< QRectF > results = m_pages.at(index % m_pages.count())->search(m_text, m_matchCase); 162 | 163 | emit resultsReady(index % m_pages.count(), results); 164 | 165 | releaseProgress(m_progress, 100 * (index + 1 - m_beginAtPage + 1) / m_pages.count()); 166 | 167 | emit progressChanged(loadProgress(m_progress)); 168 | } 169 | 170 | releaseProgress(m_progress, 0); 171 | } 172 | 173 | void SearchTask::start(const QVector< Model::Page* >& pages, 174 | const QString& text, bool matchCase, int beginAtPage) 175 | { 176 | m_pages = pages; 177 | 178 | m_text = text; 179 | m_matchCase = matchCase; 180 | m_beginAtPage = beginAtPage; 181 | 182 | resetCancellation(m_wasCanceled); 183 | releaseProgress(m_progress, 0); 184 | 185 | QThread::start(); 186 | } 187 | 188 | void SearchTask::cancel() 189 | { 190 | setCancellation(m_wasCanceled); 191 | } 192 | 193 | } // qpdfview 194 | -------------------------------------------------------------------------------- /sources/helpdialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2013 Benjamin Eltzner 4 | Copyright 2013 Adam Reichold 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #include "helpdialog.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "settings.h" 34 | 35 | namespace qpdfview 36 | { 37 | 38 | HelpDialog::HelpDialog(QWidget* parent) : QDialog(parent) 39 | { 40 | setWindowTitle(tr("Help") + QLatin1String(" - qpdfview")); 41 | 42 | m_textBrowser = new QTextBrowser(this); 43 | m_textBrowser->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::TextSelectableByKeyboard); 44 | m_textBrowser->setSearchPaths(QStringList() << QDir(QApplication::applicationDirPath()).filePath("data") << DATA_INSTALL_PATH); 45 | 46 | //: Please replace by file name of localized help if available, e.g. "help_fr.html". 47 | m_textBrowser->setSource(QUrl::fromLocalFile(tr("help.html"))); 48 | 49 | if(m_textBrowser->document()->isEmpty()) 50 | { 51 | m_textBrowser->setSource(QUrl::fromLocalFile("help.html")); 52 | } 53 | 54 | m_dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this); 55 | connect(m_dialogButtonBox, SIGNAL(accepted()), SLOT(accept())); 56 | connect(m_dialogButtonBox, SIGNAL(rejected()), SLOT(reject())); 57 | 58 | m_searchLineEdit = new QLineEdit(this); 59 | connect(m_searchLineEdit, SIGNAL(returnPressed()), SLOT(on_findNext_triggered())); 60 | connect(m_searchLineEdit, SIGNAL(textEdited(QString)), SLOT(on_search_textEdited())); 61 | 62 | m_findPreviousButton = m_dialogButtonBox->addButton(tr("Find previous"), QDialogButtonBox::ActionRole); 63 | m_findPreviousButton->setShortcut(QKeySequence::FindPrevious); 64 | connect(m_findPreviousButton, SIGNAL(clicked()), SLOT(on_findPrevious_triggered())); 65 | 66 | m_findNextButton = m_dialogButtonBox->addButton(tr("Find next"), QDialogButtonBox::ActionRole); 67 | m_findNextButton->setShortcut(QKeySequence::FindNext); 68 | connect(m_findNextButton, SIGNAL(clicked()), SLOT(on_findNext_triggered())); 69 | 70 | // Default buttons would interfere with search funtionality... 71 | foreach(QAbstractButton* abstractButton, m_dialogButtonBox->buttons()) 72 | { 73 | QPushButton* pushButton = qobject_cast< QPushButton* >(abstractButton); 74 | 75 | if(pushButton != 0) 76 | { 77 | pushButton->setAutoDefault(false); 78 | pushButton->setDefault(false); 79 | } 80 | } 81 | 82 | setLayout(new QVBoxLayout(this)); 83 | layout()->addWidget(m_textBrowser); 84 | layout()->addWidget(m_searchLineEdit); 85 | layout()->addWidget(m_dialogButtonBox); 86 | 87 | resize(Settings::instance()->mainWindow().contentsDialogSize(sizeHint())); 88 | 89 | m_searchLineEdit->setFocus(); 90 | } 91 | 92 | HelpDialog::~HelpDialog() 93 | { 94 | Settings::instance()->mainWindow().setContentsDialogSize(size()); 95 | } 96 | 97 | void HelpDialog::on_findPrevious_triggered() 98 | { 99 | if(!m_searchLineEdit->text().isEmpty() && m_textBrowser->find(m_searchLineEdit->text(), QTextDocument::FindBackward)) 100 | { 101 | m_textBrowser->setFocus(); 102 | 103 | m_searchLineEdit->setStyleSheet(QLatin1String("background-color: #80ff80")); 104 | } 105 | else 106 | { 107 | m_searchLineEdit->setStyleSheet(QLatin1String("background-color: #ff8080")); 108 | } 109 | } 110 | 111 | void HelpDialog::on_findNext_triggered() 112 | { 113 | if(!m_searchLineEdit->text().isEmpty() && m_textBrowser->find(m_searchLineEdit->text())) 114 | { 115 | m_textBrowser->setFocus(); 116 | 117 | m_searchLineEdit->setStyleSheet(QLatin1String("background-color: #80ff80")); 118 | } 119 | else 120 | { 121 | m_searchLineEdit->setStyleSheet(QLatin1String("background-color: #ff8080")); 122 | 123 | } 124 | } 125 | 126 | void HelpDialog::on_search_textEdited() 127 | { 128 | m_searchLineEdit->setStyleSheet(QString()); 129 | } 130 | 131 | } // qpdfview 132 | -------------------------------------------------------------------------------- /icons/view-refresh.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /sources/formfieldwidgets.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #ifndef FORMFIELDWIDGETS_H 23 | #define FORMFIELDWIDGETS_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | class QMutex; 33 | 34 | namespace Poppler 35 | { 36 | class FormField; 37 | class FormFieldText; 38 | class FormFieldChoice; 39 | class FormFieldButton; 40 | } 41 | 42 | namespace qpdfview 43 | { 44 | 45 | class NormalTextFieldWidget : public QLineEdit 46 | { 47 | Q_OBJECT 48 | 49 | public: 50 | NormalTextFieldWidget(QMutex* mutex, Poppler::FormFieldText* formField, QWidget* parent = 0); 51 | 52 | signals: 53 | void wasModified(); 54 | 55 | protected: 56 | void keyPressEvent(QKeyEvent* event); 57 | 58 | protected slots: 59 | void on_textChanged(const QString& text); 60 | 61 | private: 62 | Q_DISABLE_COPY(NormalTextFieldWidget) 63 | 64 | QMutex* m_mutex; 65 | Poppler::FormFieldText* m_formField; 66 | 67 | }; 68 | 69 | class MultilineTextFieldWidget : public QPlainTextEdit 70 | { 71 | Q_OBJECT 72 | 73 | public: 74 | MultilineTextFieldWidget(QMutex* mutex, Poppler::FormFieldText* formField, QWidget* parent = 0); 75 | 76 | signals: 77 | void wasModified(); 78 | 79 | protected: 80 | void keyPressEvent(QKeyEvent* event); 81 | 82 | protected slots: 83 | void on_textChanged(); 84 | 85 | private: 86 | Q_DISABLE_COPY(MultilineTextFieldWidget) 87 | 88 | QMutex* m_mutex; 89 | Poppler::FormFieldText* m_formField; 90 | 91 | }; 92 | 93 | class ComboBoxChoiceFieldWidget : public QComboBox 94 | { 95 | Q_OBJECT 96 | 97 | public: 98 | ComboBoxChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldChoice* formField, QWidget* parent = 0); 99 | 100 | signals: 101 | void wasModified(); 102 | 103 | protected: 104 | void keyPressEvent(QKeyEvent* event); 105 | 106 | void showPopup(); 107 | void hidePopup(); 108 | 109 | protected slots: 110 | void on_currentIndexChanged(int index); 111 | void on_currentTextChanged(const QString& text); 112 | 113 | private: 114 | Q_DISABLE_COPY(ComboBoxChoiceFieldWidget) 115 | 116 | QMutex* m_mutex; 117 | Poppler::FormFieldChoice* m_formField; 118 | 119 | }; 120 | 121 | class ListBoxChoiceFieldWidget : public QListWidget 122 | { 123 | Q_OBJECT 124 | 125 | public: 126 | ListBoxChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldChoice* formField, QWidget* parent = 0); 127 | 128 | signals: 129 | void wasModified(); 130 | 131 | protected: 132 | void keyPressEvent(QKeyEvent* event); 133 | 134 | protected slots: 135 | void on_itemSelectionChanged(); 136 | 137 | private: 138 | Q_DISABLE_COPY(ListBoxChoiceFieldWidget) 139 | 140 | QMutex* m_mutex; 141 | Poppler::FormFieldChoice* m_formField; 142 | 143 | }; 144 | 145 | class CheckBoxChoiceFieldWidget : public QCheckBox 146 | { 147 | Q_OBJECT 148 | 149 | public: 150 | CheckBoxChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldButton* formField, QWidget* parent = 0); 151 | 152 | signals: 153 | void wasModified(); 154 | 155 | protected: 156 | void keyPressEvent(QKeyEvent* event); 157 | 158 | protected slots: 159 | void on_toggled(bool checked); 160 | 161 | protected slots: 162 | 163 | private: 164 | Q_DISABLE_COPY(CheckBoxChoiceFieldWidget) 165 | 166 | QMutex* m_mutex; 167 | Poppler::FormFieldButton* m_formField; 168 | 169 | }; 170 | 171 | class RadioChoiceFieldWidget : public QRadioButton 172 | { 173 | Q_OBJECT 174 | 175 | public: 176 | RadioChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldButton* formField, QWidget* parent = 0); 177 | ~RadioChoiceFieldWidget(); 178 | 179 | signals: 180 | void wasModified(); 181 | 182 | protected: 183 | void keyPressEvent(QKeyEvent* event); 184 | 185 | protected slots: 186 | void on_toggled(bool checked); 187 | 188 | private: 189 | Q_DISABLE_COPY(RadioChoiceFieldWidget) 190 | 191 | typedef QMap< QPair< QMutex*, int >, RadioChoiceFieldWidget* > Siblings; 192 | static Siblings s_siblings; 193 | 194 | QMutex* m_mutex; 195 | Poppler::FormFieldButton* m_formField; 196 | 197 | }; 198 | 199 | } // qpdfview 200 | 201 | #endif // FORMFIELDWIDGETS_H 202 | -------------------------------------------------------------------------------- /sources/bookmarkmodel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #include "bookmarkmodel.h" 23 | 24 | #include 25 | #include 26 | 27 | namespace 28 | { 29 | 30 | using namespace qpdfview; 31 | 32 | inline bool operator<(int page, const BookmarkItem& bookmark) { return page < bookmark.page; } 33 | inline bool operator<(const BookmarkItem& bookmark, int page) { return bookmark.page < page; } 34 | 35 | QHash< QString, BookmarkModel* > modelsByPath; 36 | 37 | } 38 | 39 | namespace qpdfview 40 | { 41 | 42 | BookmarkModel::BookmarkModel(QObject* parent) : QAbstractListModel(parent), 43 | m_bookmarks() 44 | { 45 | } 46 | 47 | void BookmarkModel::addBookmark(const BookmarkItem& bookmark) 48 | { 49 | QList< BookmarkItem >::iterator at = qBinaryFind(m_bookmarks.begin(), m_bookmarks.end(), bookmark.page); 50 | int row = at - m_bookmarks.begin(); 51 | 52 | if(at != m_bookmarks.end()) 53 | { 54 | *at = bookmark; 55 | 56 | emit dataChanged(createIndex(row, 0), createIndex(row, 1)); 57 | } 58 | else 59 | { 60 | at = qUpperBound(m_bookmarks.begin(), m_bookmarks.end(), bookmark.page); 61 | row = at - m_bookmarks.begin(); 62 | 63 | beginInsertRows(QModelIndex(), row, row); 64 | 65 | m_bookmarks.insert(at, bookmark); 66 | 67 | endInsertRows(); 68 | } 69 | } 70 | 71 | void BookmarkModel::removeBookmark(const BookmarkItem& bookmark) 72 | { 73 | const QList< BookmarkItem >::iterator at = qBinaryFind(m_bookmarks.begin(), m_bookmarks.end(), bookmark.page); 74 | const int row = at - m_bookmarks.begin(); 75 | 76 | if(at != m_bookmarks.end()) 77 | { 78 | beginRemoveRows(QModelIndex(), row, row); 79 | 80 | m_bookmarks.erase(at); 81 | 82 | endRemoveRows(); 83 | } 84 | } 85 | 86 | void BookmarkModel::findBookmark(BookmarkItem& bookmark) const 87 | { 88 | const QList< BookmarkItem >::const_iterator at = qBinaryFind(m_bookmarks.constBegin(), m_bookmarks.constEnd(), bookmark.page); 89 | 90 | if(at != m_bookmarks.constEnd()) 91 | { 92 | bookmark = *at; 93 | } 94 | } 95 | 96 | BookmarkModel* BookmarkModel::fromPath(const QString& path, bool create) 97 | { 98 | BookmarkModel* model = modelsByPath.value(path, 0); 99 | 100 | if(create && model == 0) 101 | { 102 | model = new BookmarkModel(qApp); 103 | 104 | modelsByPath.insert(path, model); 105 | } 106 | 107 | return model; 108 | } 109 | 110 | QList< QString > BookmarkModel::knownPaths() 111 | { 112 | return modelsByPath.keys(); 113 | } 114 | 115 | void BookmarkModel::forgetPath(const QString& path) 116 | { 117 | QHash< QString, BookmarkModel* >::iterator at = modelsByPath.find(path); 118 | 119 | if(at != modelsByPath.end()) 120 | { 121 | delete at.value(); 122 | 123 | modelsByPath.erase(at); 124 | } 125 | } 126 | 127 | void BookmarkModel::forgetAllPaths() 128 | { 129 | qDeleteAll(modelsByPath); 130 | modelsByPath.clear(); 131 | } 132 | 133 | Qt::ItemFlags BookmarkModel::flags(const QModelIndex&) const 134 | { 135 | return Qt::ItemIsEnabled | Qt::ItemIsSelectable; 136 | } 137 | 138 | int BookmarkModel::columnCount(const QModelIndex&) const 139 | { 140 | return 2; 141 | } 142 | 143 | int BookmarkModel::rowCount(const QModelIndex& parent) const 144 | { 145 | return !parent.isValid() ? m_bookmarks.count() : 0; 146 | } 147 | 148 | QVariant BookmarkModel::data(const QModelIndex& index, int role) const 149 | { 150 | if(!index.isValid() || index.row() >= m_bookmarks.count()) 151 | { 152 | return QVariant(); 153 | } 154 | 155 | const BookmarkItem& bookmark = m_bookmarks.at(index.row()); 156 | 157 | switch(role) 158 | { 159 | default: 160 | return QVariant(); 161 | case PageRole: 162 | return bookmark.page; 163 | case LabelRole: 164 | case Qt::DisplayRole: 165 | return index.column() == 0 ? bookmark.label : QString::number(bookmark.page); 166 | case CommentRole: 167 | case Qt::ToolTipRole: 168 | return bookmark.comment; 169 | case ModifiedRole: 170 | return bookmark.modified; 171 | case Qt::TextAlignmentRole: 172 | return index.column() == 0 ? Qt::AlignLeft : Qt::AlignRight; 173 | } 174 | } 175 | 176 | } // qpdfview 177 | -------------------------------------------------------------------------------- /sources/annotationwidgets.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #include "annotationwidgets.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 34 | 35 | #include 36 | 37 | #else 38 | 39 | #include 40 | 41 | #endif // QT_VERSION 42 | 43 | #include 44 | 45 | #ifndef HAS_POPPLER_24 46 | 47 | #define LOCK_ANNOTATION QMutexLocker mutexLocker(m_mutex); 48 | 49 | #else 50 | 51 | #define LOCK_ANNOTATION 52 | 53 | #endif // HAS_POPPLER_24 54 | 55 | namespace 56 | { 57 | 58 | bool hideOnEscape(QWidget* widget, QKeyEvent* event) 59 | { 60 | if(event->key() == Qt::Key_Escape) 61 | { 62 | widget->hide(); 63 | 64 | event->accept(); 65 | return true; 66 | } 67 | 68 | return false; 69 | } 70 | 71 | } // anonymous 72 | 73 | namespace qpdfview 74 | { 75 | 76 | AnnotationWidget::AnnotationWidget(QMutex* mutex, Poppler::Annotation* annotation, QWidget* parent) : QPlainTextEdit(parent), 77 | m_mutex(mutex), 78 | m_annotation(annotation) 79 | { 80 | LOCK_ANNOTATION 81 | 82 | setTabChangesFocus(true); 83 | setPlainText(m_annotation->contents()); 84 | 85 | connect(this, SIGNAL(textChanged()), SLOT(on_textChanged())); 86 | connect(this, SIGNAL(textChanged()), SIGNAL(wasModified())); 87 | 88 | moveCursor(QTextCursor::End); 89 | } 90 | 91 | void AnnotationWidget::keyPressEvent(QKeyEvent* event) 92 | { 93 | if(!hideOnEscape(this, event)) 94 | { 95 | QPlainTextEdit::keyPressEvent(event); 96 | } 97 | } 98 | 99 | void AnnotationWidget::on_textChanged() 100 | { 101 | LOCK_ANNOTATION 102 | 103 | m_annotation->setContents(toPlainText()); 104 | } 105 | 106 | 107 | FileAttachmentAnnotationWidget::FileAttachmentAnnotationWidget(QMutex* mutex, Poppler::FileAttachmentAnnotation* annotation, QWidget* parent) : QToolButton(parent), 108 | m_mutex(mutex), 109 | m_annotation(annotation) 110 | { 111 | m_menu = new QMenu(this); 112 | m_saveAction = m_menu->addAction(tr("Save...")); 113 | m_saveAndOpenAction = m_menu->addAction(tr("Save and open...")); 114 | 115 | setMenu(m_menu); 116 | setPopupMode(QToolButton::InstantPopup); 117 | setIcon(QIcon::fromTheme(QLatin1String("mail-attachment"), QIcon(QLatin1String(":icons/mail-attachment.svg")))); 118 | 119 | connect(m_menu, SIGNAL(aboutToShow()), SLOT(on_aboutToShow())); 120 | connect(m_menu, SIGNAL(aboutToHide()), SLOT(on_aboutToHide())); 121 | 122 | connect(m_saveAction, SIGNAL(triggered()), SLOT(on_save_triggered())); 123 | connect(m_saveAndOpenAction, SIGNAL(triggered()), SLOT(on_saveAndOpen_triggered())); 124 | } 125 | 126 | void FileAttachmentAnnotationWidget::keyPressEvent(QKeyEvent *event) 127 | { 128 | if(!hideOnEscape(this, event)) 129 | { 130 | QToolButton::keyPressEvent(event); 131 | } 132 | } 133 | 134 | void FileAttachmentAnnotationWidget::on_aboutToShow() 135 | { 136 | graphicsProxyWidget()->setZValue(1.0); 137 | } 138 | 139 | void FileAttachmentAnnotationWidget::on_aboutToHide() 140 | { 141 | graphicsProxyWidget()->setZValue(0.0); 142 | } 143 | 144 | void FileAttachmentAnnotationWidget::on_save_triggered() 145 | { 146 | save(false); 147 | } 148 | 149 | void FileAttachmentAnnotationWidget::on_saveAndOpen_triggered() 150 | { 151 | save(true); 152 | } 153 | 154 | void FileAttachmentAnnotationWidget::save(bool open) 155 | { 156 | LOCK_ANNOTATION 157 | 158 | Poppler::EmbeddedFile* embeddedFile = m_annotation->embeddedFile(); 159 | 160 | QString filePath = QFileDialog::getSaveFileName(0, tr("Save file attachment"), embeddedFile->name()); 161 | 162 | if(!filePath.isEmpty()) 163 | { 164 | QFile file(filePath); 165 | 166 | if(file.open(QIODevice::WriteOnly | QIODevice::Truncate)) 167 | { 168 | file.write(embeddedFile->data()); 169 | 170 | file.close(); 171 | 172 | if(open) 173 | { 174 | if(!QDesktopServices::openUrl(QUrl::fromLocalFile(filePath))) 175 | { 176 | QMessageBox::warning(0, tr("Warning"), tr("Could not open file attachment saved to '%1'.").arg(filePath)); 177 | } 178 | } 179 | } 180 | else 181 | { 182 | QMessageBox::warning(0, tr("Warning"), tr("Could not save file attachment to '%1'.").arg(filePath)); 183 | } 184 | } 185 | } 186 | 187 | } // qpdfview 188 | -------------------------------------------------------------------------------- /sources/thumbnailitem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2014 Adam Reichold 4 | 5 | This file is part of qpdfview. 6 | 7 | qpdfview is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | qpdfview is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with qpdfview. If not, see . 19 | 20 | */ 21 | 22 | #include "thumbnailitem.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace qpdfview 30 | { 31 | 32 | ThumbnailItem::ThumbnailItem(Model::Page* page, const QString& text, int index, QGraphicsItem* parent) : PageItem(page, index, PageItem::ThumbnailMode, parent), 33 | m_text(text), 34 | m_isHighlighted(false) 35 | { 36 | setAcceptHoverEvents(false); 37 | } 38 | 39 | QRectF ThumbnailItem::boundingRect() const 40 | { 41 | #if QT_VERSION >= QT_VERSION_CHECK(4,7,0) 42 | 43 | return PageItem::boundingRect().adjusted(0.0, 0.0, 0.0, 2.0 * m_text.size().height()); 44 | 45 | #else 46 | 47 | return PageItem::boundingRect().adjusted(0.0, 0.0, 0.0, 2.0 * QFontMetrics(QFont()).height()); 48 | 49 | #endif // QT_VERSION 50 | } 51 | 52 | void ThumbnailItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) 53 | { 54 | const QRectF boundingRect = PageItem::boundingRect(); 55 | 56 | 57 | painter->save(); 58 | 59 | painter->setClipping(true); 60 | painter->setClipRect(boundingRect); 61 | 62 | PageItem::paint(painter, option, widget); 63 | 64 | painter->restore(); 65 | 66 | 67 | #if QT_VERSION >= QT_VERSION_CHECK(4,7,0) 68 | 69 | const QSizeF textSize = m_text.size(); 70 | 71 | QPointF pos = boundingRect.bottomLeft(); 72 | pos.rx() += 0.5 * (boundingRect.width() - textSize.width()); 73 | pos.ry() += 0.5 * textSize.height(); 74 | 75 | painter->drawStaticText(pos, m_text); 76 | 77 | #else 78 | 79 | const QFontMetrics fontMetrics = QFontMetrics(QFont()); 80 | 81 | QPointF pos = boundingRect.bottomLeft(); 82 | pos.rx() += 0.5 * (boundingRect.width() - fontMetrics.width(m_text)); 83 | pos.ry() += fontMetrics.height(); 84 | 85 | painter->drawText(pos, m_text); 86 | 87 | #endif // QT_VERSION 88 | 89 | if(m_isHighlighted) 90 | { 91 | painter->save(); 92 | 93 | painter->setCompositionMode(QPainter::CompositionMode_Multiply); 94 | painter->fillRect(boundingRect, widget->palette().highlight()); 95 | 96 | painter->restore(); 97 | } 98 | } 99 | 100 | void ThumbnailItem::setHighlighted(bool highlighted) 101 | { 102 | if(m_isHighlighted != highlighted) 103 | { 104 | m_isHighlighted = highlighted; 105 | 106 | update(); 107 | } 108 | } 109 | 110 | void ThumbnailItem::mousePressEvent(QGraphicsSceneMouseEvent* event) 111 | { 112 | if(event->modifiers() == Qt::NoModifier 113 | && (event->button() == Qt::LeftButton || event->button() == Qt::MidButton)) 114 | { 115 | emit linkClicked(event->button() == Qt::MidButton, index() + 1); 116 | 117 | event->accept(); 118 | return; 119 | } 120 | 121 | event->ignore(); 122 | } 123 | 124 | void ThumbnailItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) 125 | { 126 | } 127 | 128 | void ThumbnailItem::mouseMoveEvent(QGraphicsSceneMouseEvent*) 129 | { 130 | } 131 | 132 | void ThumbnailItem::mouseReleaseEvent(QGraphicsSceneMouseEvent*) 133 | { 134 | } 135 | 136 | void ThumbnailItem::contextMenuEvent(QGraphicsSceneContextMenuEvent*) 137 | { 138 | } 139 | 140 | void ThumbnailItem::loadInteractiveElements() 141 | { 142 | const qreal width = size().width() / 72.0 * 25.4; 143 | const qreal height = size().height() / 72.0 * 25.4; 144 | 145 | const qreal longEdge = qMax(width, height); 146 | const qreal shortEdge = qMin(width, height); 147 | 148 | QString paperSize; 149 | 150 | if(qAbs(longEdge - 279.4) <= 1.0 && qAbs(shortEdge - 215.9) <= 1.0) 151 | { 152 | paperSize = QLatin1String(" (Letter)"); 153 | } 154 | else 155 | { 156 | qreal longEdgeA = 1189.0; 157 | qreal shortEdgeA = 841.0; 158 | 159 | qreal longEdgeB = 1414.0; 160 | qreal shortEdgeB = 1000.0; 161 | 162 | for(int i = 0; i <= 10; ++i) 163 | { 164 | if(qAbs(longEdge - longEdgeA) <= 1.0 && qAbs(shortEdge - shortEdgeA) <= 1.0) 165 | { 166 | paperSize = QString(" (A%1)").arg(i); 167 | break; 168 | } 169 | else if(qAbs(longEdge - longEdgeB) <= 1.0 && qAbs(shortEdge - shortEdgeB) <= 1.0) 170 | { 171 | paperSize = QString(" (B%1)").arg(i); 172 | break; 173 | } 174 | 175 | longEdgeA = shortEdgeA; 176 | shortEdgeA /= qSqrt(2.0); 177 | 178 | longEdgeB = shortEdgeB; 179 | shortEdgeB /= qSqrt(2.0); 180 | } 181 | } 182 | 183 | setToolTip(QString("%1 mm x %2 mm%3").arg(width, 0, 'f', 1).arg(height, 0, 'f', 1).arg(paperSize)); 184 | } 185 | 186 | } // qpdfview 187 | -------------------------------------------------------------------------------- /sources/settingsdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2012-2013 Adam Reichold 4 | Copyright 2012 Alexander Volkov 5 | 6 | This file is part of qpdfview. 7 | 8 | qpdfview 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 2 of the License, or 11 | (at your option) any later version. 12 | 13 | qpdfview 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 qpdfview. If not, see . 20 | 21 | */ 22 | 23 | #ifndef SETTINGSDIALOG_H 24 | #define SETTINGSDIALOG_H 25 | 26 | #include 27 | 28 | class QCheckBox; 29 | class QComboBox; 30 | class QDialogButtonBox; 31 | class QDoubleSpinBox; 32 | class QFormLayout; 33 | class QLineEdit; 34 | class QSpinBox; 35 | class QTableView; 36 | class QTabWidget; 37 | 38 | namespace qpdfview 39 | { 40 | 41 | class Settings; 42 | class SettingsWidget; 43 | 44 | class SettingsDialog : public QDialog 45 | { 46 | Q_OBJECT 47 | 48 | public: 49 | SettingsDialog(QWidget* parent = 0); 50 | ~SettingsDialog(); 51 | 52 | public slots: 53 | void accept(); 54 | void reset(); 55 | void resetCurrentTab(); 56 | 57 | private: 58 | Q_DISABLE_COPY(SettingsDialog) 59 | 60 | static Settings* s_settings; 61 | 62 | QTabWidget* m_graphicsTabWidget; 63 | QFormLayout* m_graphicsLayout; 64 | 65 | SettingsWidget* m_pdfSettingsWidget; 66 | SettingsWidget* m_psSettingsWidget; 67 | SettingsWidget* m_djvuSettingsWidget; 68 | 69 | QTableView* m_shortcutsTableView; 70 | 71 | QTabWidget* m_tabWidget; 72 | QDialogButtonBox* m_dialogButtonBox; 73 | QPushButton* m_defaultsButton; 74 | QPushButton* m_defaultsOnCurrentTabButton; 75 | 76 | QFormLayout* m_behaviorLayout; 77 | QFormLayout* m_interfaceLayout; 78 | QFormLayout* m_modifiersLayout; 79 | 80 | // behavior 81 | 82 | QCheckBox* m_openUrlCheckBox; 83 | 84 | QCheckBox* m_autoRefreshCheckBox; 85 | 86 | QCheckBox* m_trackRecentlyUsedCheckBox; 87 | QCheckBox* m_keepRecentlyClosedCheckBox; 88 | 89 | QCheckBox* m_restoreTabsCheckBox; 90 | QCheckBox* m_restoreBookmarksCheckBox; 91 | QCheckBox* m_restorePerFileSettingsCheckBox; 92 | QSpinBox* m_saveDatabaseInterval; 93 | 94 | QCheckBox* m_synchronizePresentationCheckBox; 95 | QSpinBox* m_presentationScreenSpinBox; 96 | 97 | QCheckBox* m_synchronizeOutlineViewCheckBox; 98 | 99 | QDoubleSpinBox* m_zoomFactorSpinBox; 100 | 101 | QSpinBox* m_highlightDurationSpinBox; 102 | QComboBox* m_highlightColorComboBox; 103 | QComboBox* m_annotationColorComboBox; 104 | 105 | QLineEdit* m_sourceEditorLineEdit; 106 | 107 | void createBehaviorTab(); 108 | void acceptBehaivorTab(); 109 | void resetBehaviorTab(); 110 | 111 | // graphics 112 | 113 | QCheckBox* m_useTilingCheckBox; 114 | QCheckBox* m_keepObsoletePixmapsCheckBox; 115 | 116 | #if QT_VERSION >= QT_VERSION_CHECK(5,1,0) 117 | 118 | QCheckBox* m_useDevicePixelRatioCheckBox; 119 | 120 | #endif // QT_VERSION 121 | 122 | QCheckBox* m_trimMarginsCheckBox; 123 | 124 | QCheckBox* m_decoratePagesCheckBox; 125 | QCheckBox* m_decorateLinksCheckBox; 126 | QCheckBox* m_decorateFormFieldsCheckBox; 127 | 128 | QComboBox* m_backgroundColorComboBox; 129 | QComboBox* m_paperColorComboBox; 130 | QComboBox* m_presentationBackgroundColorComboBox; 131 | 132 | QSpinBox* m_pagesPerRowSpinBox; 133 | 134 | QDoubleSpinBox* m_pageSpacingSpinBox; 135 | QDoubleSpinBox* m_thumbnailSpacingSpinBox; 136 | 137 | QDoubleSpinBox* m_thumbnailSizeSpinBox; 138 | 139 | QComboBox* m_cacheSizeComboBox; 140 | QCheckBox* m_prefetchCheckBox; 141 | QSpinBox* m_prefetchDistanceSpinBox; 142 | 143 | void createGraphicsTab(); 144 | void acceptGraphicsTab(); 145 | void resetGraphicsTab(); 146 | 147 | // interface 148 | 149 | QCheckBox* m_extendedSearchDock; 150 | 151 | QCheckBox* m_annotationOverlayCheckBox; 152 | QCheckBox* m_formFieldOverlayCheckBox; 153 | 154 | QComboBox* m_tabPositionComboBox; 155 | QComboBox* m_tabVisibilityComboBox; 156 | QCheckBox* m_spreadTabsCheckBox; 157 | 158 | QCheckBox* m_newTabNextToCurrentTabCheckBox; 159 | QCheckBox* m_exitAfterLastTabCheckBox; 160 | 161 | QSpinBox* m_recentlyUsedCountSpinBox; 162 | QSpinBox* m_recentlyClosedCountSpinBox; 163 | 164 | QLineEdit* m_fileToolBarLineEdit; 165 | QLineEdit* m_editToolBarLineEdit; 166 | QLineEdit* m_viewToolBarLineEdit; 167 | 168 | QCheckBox* m_scrollableMenusCheckBox; 169 | QCheckBox* m_toggleToolAndMenuBarsWithFullscreenCheckBox; 170 | 171 | QCheckBox* m_usePageLabelCheckBox; 172 | QCheckBox* m_documentTitleAsTabTitleCheckBox; 173 | 174 | QCheckBox* m_currentPageInWindowTitleCheckBox; 175 | QCheckBox* m_instanceNameInWindowTitleCheckBox; 176 | 177 | QCheckBox* m_highlightCurrentThumbnailCheckBox; 178 | QCheckBox* m_limitThumbnailsToResultsCheckBox; 179 | 180 | void createInterfaceTab(); 181 | void acceptInterfaceTab(); 182 | void resetInterfaceTab(); 183 | 184 | // modifiers 185 | 186 | QComboBox* m_zoomModifiersComboBox; 187 | QComboBox* m_rotateModifiersComboBox; 188 | QComboBox* m_scrollModifiersComboBox; 189 | 190 | QComboBox* m_copyToClipboardModifiersComboBox; 191 | QComboBox* m_addAnnotationModifiersComboBox; 192 | QComboBox* m_zoomToSelectionModifiersComboBox; 193 | 194 | void createModifiersTab(); 195 | void acceptModifiersTab(); 196 | void resetModifiersTab(); 197 | 198 | // helper methods 199 | 200 | void createColorComboBox(QComboBox*& comboBox, const QColor& color); 201 | void createModifiersComboBox(QComboBox*& comboBox, const Qt::KeyboardModifiers& modifiers); 202 | 203 | }; 204 | 205 | } // qpdfview 206 | 207 | #endif // SETTINGSDIALOG_H 208 | -------------------------------------------------------------------------------- /synctex/synctex_parser_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, 2009, 2010, 2011 jerome DOT laurens AT u-bourgogne DOT fr 3 | 4 | This file is part of the SyncTeX package. 5 | 6 | Latest Revision: Tue Jun 14 08:23:30 UTC 2011 7 | 8 | Version: 1.17 9 | 10 | See synctex_parser_readme.txt for more details 11 | 12 | License: 13 | -------- 14 | Permission is hereby granted, free of charge, to any person 15 | obtaining a copy of this software and associated documentation 16 | files (the "Software"), to deal in the Software without 17 | restriction, including without limitation the rights to use, 18 | copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the 20 | Software is furnished to do so, subject to the following 21 | conditions: 22 | 23 | The above copyright notice and this permission notice shall be 24 | included in all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 28 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 30 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 31 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 32 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 33 | OTHER DEALINGS IN THE SOFTWARE 34 | 35 | Except as contained in this notice, the name of the copyright holder 36 | shall not be used in advertising or otherwise to promote the sale, 37 | use or other dealings in this Software without prior written 38 | authorization from the copyright holder. 39 | 40 | */ 41 | 42 | /* The utilities declared here are subject to conditional implementation. 43 | * All the operating system special stuff goes here. 44 | * The problem mainly comes from file name management: path separator, encoding... 45 | */ 46 | 47 | # define synctex_bool_t int 48 | # define synctex_YES -1 49 | # define synctex_ADD_QUOTES -1 50 | # define synctex_COMPRESS -1 51 | # define synctex_NO 0 52 | # define synctex_DONT_ADD_QUOTES 0 53 | # define synctex_DONT_COMPRESS 0 54 | 55 | #ifndef __SYNCTEX_PARSER_UTILS__ 56 | # define __SYNCTEX_PARSER_UTILS__ 57 | 58 | #include 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | #define FALSE 0 65 | #define TRUE !FALSE 66 | 67 | # if _WIN32 68 | # define SYNCTEX_CASE_SENSITIVE_PATH FALSE 69 | # define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c || '\\' == c) 70 | # else 71 | # define SYNCTEX_CASE_SENSITIVE_PATH TRUE 72 | # define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c) 73 | # endif 74 | 75 | # if _WIN32 76 | # define SYNCTEX_IS_DOT(c) ('.' == c) 77 | # else 78 | # define SYNCTEX_IS_DOT(c) ('.' == c) 79 | # endif 80 | 81 | # if SYNCTEX_CASE_SENSITIVE_PATH 82 | # define SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(left,right) (left != right) 83 | # else 84 | # define SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(left,right) (toupper(left) != toupper(right)) 85 | # endif 86 | 87 | /* This custom malloc functions initializes to 0 the newly allocated memory. 88 | * There is no bzero function on windows. */ 89 | void *_synctex_malloc(size_t size); 90 | 91 | /* This is used to log some informational message to the standard error stream. 92 | * On Windows, the stderr stream is not exposed and another method is used. 93 | * The return value is the number of characters printed. */ 94 | int _synctex_error(const char * reason,...); 95 | 96 | /* strip the last extension of the given string, this string is modified! 97 | * This function depends on the OS because the path separator may differ. 98 | * This should be discussed more precisely. */ 99 | void _synctex_strip_last_path_extension(char * string); 100 | 101 | /* Compare two file names, windows is sometimes case insensitive... 102 | * The given strings may differ stricto sensu, but represent the same file name. 103 | * It might not be the real way of doing things. 104 | * The return value is an undefined non 0 value when the two file names are equivalent. 105 | * It is 0 otherwise. */ 106 | synctex_bool_t _synctex_is_equivalent_file_name(const char *lhs, const char *rhs); 107 | 108 | /* Description forthcoming.*/ 109 | synctex_bool_t _synctex_path_is_absolute(const char * name); 110 | 111 | /* Description forthcoming...*/ 112 | const char * _synctex_last_path_component(const char * name); 113 | 114 | /* Description forthcoming...*/ 115 | const char * _synctex_base_name(const char *path); 116 | 117 | /* If the core of the last path component of src is not already enclosed with double quotes ('"') 118 | * and contains a space character (' '), then a new buffer is created, the src is copied and quotes are added. 119 | * In all other cases, no destination buffer is created and the src is not copied. 120 | * 0 on success, which means no error, something non 0 means error, mainly due to memory allocation failure, or bad parameter. 121 | * This is used to fix a bug in the first version of pdftex with synctex (1.40.9) for which names with spaces 122 | * were not managed in a standard way. 123 | * On success, the caller owns the buffer pointed to by dest_ref (is any) and 124 | * is responsible of freeing the memory when done. 125 | * The size argument is the size of the src buffer. On return the dest_ref points to a buffer sized size+2.*/ 126 | int _synctex_copy_with_quoting_last_path_component(const char * src, char ** dest_ref, size_t size); 127 | 128 | /* These are the possible extensions of the synctex file */ 129 | extern const char * synctex_suffix; 130 | extern const char * synctex_suffix_gz; 131 | 132 | typedef unsigned int synctex_io_mode_t; 133 | 134 | typedef enum { 135 | synctex_io_append_mask = 1, 136 | synctex_io_gz_mask = synctex_io_append_mask<<1 137 | } synctex_io_mode_masks_t; 138 | 139 | typedef enum { 140 | synctex_compress_mode_none = 0, 141 | synctex_compress_mode_gz = 1 142 | } synctex_compress_mode_t; 143 | 144 | int _synctex_get_name(const char * output, const char * build_directory, char ** synctex_name_ref, synctex_io_mode_t * io_mode_ref); 145 | 146 | /* returns the correct mode required by fopen and gzopen from the given io_mode */ 147 | const char * _synctex_get_io_mode_name(synctex_io_mode_t io_mode); 148 | 149 | synctex_bool_t synctex_ignore_leading_dot_slash_in_path(const char ** name); 150 | 151 | #ifdef __cplusplus 152 | } 153 | #endif 154 | 155 | #endif 156 | --------------------------------------------------------------------------------