diff --git a/INSTALL.txt b/INSTALL.txt index 8c65b479..55eef0b0 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,8 +1,3 @@ -INSTALLATION GUIDE FOR LINUX USERS (BINARY PACKAGE) -********************************** -YACReader and YACReaderLibraries binaries are compiled under Ubuntu 13.10 and uses Qt5 and libpoppler-qt5. - - COMPILATION GUIDE FOR LINUX/UNIX USERS ********************************** YACReader and YACReaderLibrary are build using qmake. To build and install the program, run: @@ -25,7 +20,13 @@ Default values: PREFIX=/usr INSTALL_ROOT="" +On embedded devices that don't support desktop OpenGL, it is recommended to use the no_opengl config option: + +qmake CONFIG+=no_opengl + +This will remove any dependency on desktop OpenGL. + DO YOU WANT TO HELP YACREADER? ****************************** -If you have experience creating packages, please help to create a package for your favourite distro! Send me an e-mail to: info@yacreader.com +If you have experience creating packages, please help to create a package for your favourite Linux distro! Send me an e-mail to: info@yacreader.com diff --git a/YACReader/YACReader.pri b/YACReader/YACReader.pri index b4c9ba4e..446932e8 100644 --- a/YACReader/YACReader.pri +++ b/YACReader/YACReader.pri @@ -4,35 +4,35 @@ INCLUDEPATH += . INCLUDEPATH += $$PWD/../common \ $$PWD/../custom_widgets +CONFIG(legacy_gl_widget) { + INCLUDEPATH += ../common/gl_legacy \ +} else { + INCLUDEPATH += ../common/gl \ +} + win32 { LIBS += -L$$PWD/../dependencies/poppler/lib -loleaut32 -lole32 -isEqual(QT_MAJOR_VERSION, 5) { LIBS += -lpoppler-qt5 INCLUDEPATH += ../dependencies/poppler/include/qt5 -} -else { -LIBS += -lpoppler-qt4 -INCLUDEPATH += ../dependencies/poppler/include/qt4 -} -QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL +QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT +!CONFIG(no_opengl) { + QMAKE_CXXFLAGS_RELEASE += /GL +} QMAKE_LFLAGS_RELEASE += /LTCG CONFIG -= embed_manifest_exe } unix:!macx{ -isEqual(QT_MAJOR_VERSION, 5) { INCLUDEPATH += /usr/include/poppler/qt5 LIBS += -L/usr/lib -lpoppler-qt5 -} -else { -INCLUDEPATH += /usr/include/poppler/qt4 -LIBS += -L/usr/lib -lpoppler-qt4 +!CONFIG(no_opengl) { + LIBS += -lGLU } -LIBS += -lGLU + } macx{ @@ -53,19 +53,17 @@ LIBS += -framework Foundation -framework ApplicationServices -framework AppKit OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm HEADERS += $$PWD/../common/pdf_comic.h - - } -QT += network opengl +QT += network widgets core +!CONFIG(no_opengl) { + QT += opengl +} + #CONFIG += release CONFIG -= flat -isEqual(QT_MAJOR_VERSION, 5) { - QT += multimedia -} else { - QT += phonon -} +QT += multimedia # Input HEADERS += $$PWD/../common/comic.h \ @@ -81,7 +79,6 @@ HEADERS += $$PWD/../common/comic.h \ $$PWD/render.h \ $$PWD/shortcuts_dialog.h \ $$PWD/translator.h \ - $$PWD/goto_flow_gl.h \ $$PWD/goto_flow_widget.h \ $$PWD/page_label_widget.h \ $$PWD/goto_flow_toolbar.h \ @@ -92,7 +89,6 @@ HEADERS += $$PWD/../common/comic.h \ $$PWD/../common/custom_widgets.h \ $$PWD/../common/check_new_version.h \ $$PWD/../common/qnaturalsorting.h \ - $$PWD/../common/yacreader_flow_gl.h \ $$PWD/../common/yacreader_global.h \ $$PWD/../common/onstart_flow_selection_dialog.h \ $$PWD/../common/comic_db.h \ @@ -102,7 +98,17 @@ HEADERS += $$PWD/../common/comic.h \ $$PWD/../common/http_worker.h \ $$PWD/../common/exit_check.h \ $$PWD/../common/scroll_management.h - + +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("using legacy YACReaderFlowGL (QGLWidget) header") + HEADERS += ../common/gl_legacy/yacreader_flow_gl.h + } else { + HEADERS += ../common/gl/yacreader_flow_gl.h + } + HEADERS += $$PWD/goto_flow_gl.h +} + SOURCES += $$PWD/../common/comic.cpp \ $$PWD/configuration.cpp \ $$PWD/goto_dialog.cpp \ @@ -116,7 +122,6 @@ SOURCES += $$PWD/../common/comic.cpp \ $$PWD/render.cpp \ $$PWD/shortcuts_dialog.cpp \ $$PWD/translator.cpp \ - $$PWD/goto_flow_gl.cpp \ $$PWD/goto_flow_widget.cpp \ $$PWD/page_label_widget.cpp \ $$PWD/goto_flow_toolbar.cpp \ @@ -127,7 +132,6 @@ SOURCES += $$PWD/../common/comic.cpp \ $$PWD/../common/custom_widgets.cpp \ $$PWD/../common/check_new_version.cpp \ $$PWD/../common/qnaturalsorting.cpp \ - $$PWD/../common/yacreader_flow_gl.cpp \ $$PWD/../common/onstart_flow_selection_dialog.cpp \ $$PWD/../common/comic_db.cpp \ $$PWD/../common/folder.cpp \ @@ -138,6 +142,16 @@ SOURCES += $$PWD/../common/comic.cpp \ $$PWD/../common/exit_check.cpp \ $$PWD/../common/scroll_management.cpp +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("using legacy YACReaderFlowGL (QGLWidget) source code") + SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp + } else { + SOURCES += ../common/gl/yacreader_flow_gl.cpp + } + SOURCES += $$PWD/goto_flow_gl.cpp +} + include($$PWD/../custom_widgets/custom_widgets_yacreader.pri) include($$PWD/../compressed_archive/wrapper.pri) include($$PWD/../shortcuts_management/shortcuts_management.pri) diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro index 1b189b16..31378ae9 100644 --- a/YACReader/YACReader.pro +++ b/YACReader/YACReader.pro @@ -1,5 +1,5 @@ # ##################################################################### -# Automatically generated by qmake (2.01a) mié 8. oct 20:54:05 2008 +# Automatically generated by qmake (2.01a) mié 8. oct 20:54:05 2008 # ##################################################################### TEMPLATE = app TARGET = YACReader @@ -8,21 +8,183 @@ DEPENDPATH += . \ DEFINES += NOMINMAX YACREADER +CONFIG(no_opengl) { + DEFINES += NO_OPENGL +} + + unix:!macx{ QMAKE_CXXFLAGS += -std=c++11 } -isEqual(QT_MAJOR_VERSION, 5) { - Release:DESTDIR = ../release5 - Debug:DESTDIR = ../debug5 - -} else { - Release:DESTDIR = ../release - Debug:DESTDIR = ../debug -} +Release:DESTDIR = ../release +Debug:DESTDIR = ../debug SOURCES += main.cpp -include(YACReader.pri) + +INCLUDEPATH += ../common \ + ../custom_widgets + +CONFIG(legacy_gl_widget) { + INCLUDEPATH += ../common/gl_legacy \ +} else { + INCLUDEPATH += ../common/gl \ +} + +win32 { +LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 + +LIBS += -lpoppler-qt5 +INCLUDEPATH += ../dependencies/poppler/include/qt5 + +QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT +!CONFIG(no_opengl) { + QMAKE_CXXFLAGS_RELEASE += /GL +} +QMAKE_LFLAGS_RELEASE += /LTCG +CONFIG -= embed_manifest_exe +} + +unix:!macx{ + +INCLUDEPATH += /usr/include/poppler/qt5 +LIBS += -L/usr/lib -lpoppler-qt5 + +!CONFIG(no_opengl) { + LIBS += -lGLU +} + +} + +macx{ +#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include" +#isEqual(QT_MAJOR_VERSION, 5) { +#INCLUDEPATH += /usr/local/include/poppler/qt5 +#LIBS += -L/usr/local/lib -lpoppler-qt5 +#} +#else { +#INCLUDEPATH += /usr/local/include/poppler/qt4 +#LIBS += -L/usr/local/lib -lpoppler-qt4 +#} +CONFIG += objective_c +QT += macextras gui-private + + +LIBS += -framework Foundation -framework ApplicationServices -framework AppKit + +OBJECTIVE_SOURCES += ../common/pdf_comic.mm +HEADERS += ../common/pdf_comic.h +} + +QT += network widgets core +!CONFIG(no_opengl) { + QT += opengl +} + +#CONFIG += release +CONFIG -= flat + +QT += multimedia + +# Input +HEADERS += ../common/comic.h \ + configuration.h \ + goto_dialog.h \ + magnifying_glass.h \ + main_window_viewer.h \ + viewer.h \ + goto_flow.h \ + options_dialog.h \ + ../common/bookmarks.h \ + bookmarks_dialog.h \ + render.h \ + shortcuts_dialog.h \ + translator.h \ + goto_flow_widget.h \ + page_label_widget.h \ + goto_flow_toolbar.h \ + goto_flow_decorationbar.h \ + width_slider.h \ + notifications_label_widget.h \ + ../common/pictureflow.h \ + ../common/custom_widgets.h \ + ../common/check_new_version.h \ + ../common/qnaturalsorting.h \ + ../common/yacreader_global.h \ + ../common/onstart_flow_selection_dialog.h \ + ../common/comic_db.h \ + ../common/folder.h \ + ../common/library_item.h \ + yacreader_local_client.h \ + ../common/http_worker.h \ + ../common/exit_check.h \ + ../common/scroll_management.h + +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("using legacy YACReaderFlowGL (QGLWidget) header") + HEADERS += ../common/gl_legacy/yacreader_flow_gl.h + } else { + HEADERS += ../common/gl/yacreader_flow_gl.h + } + HEADERS += goto_flow_gl.h +} + +SOURCES += ../common/comic.cpp \ + configuration.cpp \ + goto_dialog.cpp \ + magnifying_glass.cpp \ + main_window_viewer.cpp \ + viewer.cpp \ + goto_flow.cpp \ + options_dialog.cpp \ + ../common/bookmarks.cpp \ + bookmarks_dialog.cpp \ + render.cpp \ + shortcuts_dialog.cpp \ + translator.cpp \ + goto_flow_widget.cpp \ + page_label_widget.cpp \ + goto_flow_toolbar.cpp \ + goto_flow_decorationbar.cpp \ + width_slider.cpp \ + notifications_label_widget.cpp \ + ../common/pictureflow.cpp \ + ../common/custom_widgets.cpp \ + ../common/check_new_version.cpp \ + ../common/qnaturalsorting.cpp \ + ../common/onstart_flow_selection_dialog.cpp \ + ../common/comic_db.cpp \ + ../common/folder.cpp \ + ../common/library_item.cpp \ + yacreader_local_client.cpp \ + ../common/http_worker.cpp \ + ../common/yacreader_global.cpp \ + ../common/exit_check.cpp \ + ../common/scroll_management.cpp + +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("using legacy YACReaderFlowGL (QGLWidget) source code") + SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp + } else { + SOURCES += ../common/gl/yacreader_flow_gl.cpp + } + SOURCES += goto_flow_gl.cpp +} + +include(../custom_widgets/custom_widgets_yacreader.pri) +include(../compressed_archive/wrapper.pri) +include(../shortcuts_management/shortcuts_management.pri) + +RESOURCES += yacreader_images.qrc \ + yacreader_files.qrc + +win32:RESOURCES += yacreader_images_win.qrc +unix:!macx:RESOURCES += yacreader_images_win.qrc +macx:RESOURCES += yacreader_images_osx.qrc + + include(../QsLog/QsLog.pri) RC_FILE = icon.rc @@ -91,7 +253,7 @@ icon.path = $$DATADIR/yacreader icon.files = ../images/icon.png desktop.path = $$DATADIR/applications -desktop.extra = desktop-file-edit --set-icon=$$DATADIR/yacreader/icon.png $$PWD/../YACReader.desktop +desktop.extra = desktop-file-edit --set-icon=$$DATADIR/yacreader/icon.png ../YACReader.desktop desktop.files = ../YACReader.desktop #TODO: icons should be located at /usr/share/icons and have the same basename as their application diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 782f4b33..bf86809b 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -578,6 +578,7 @@ void MainWindowViewer::createToolBars() viewer->addAction(leftRotationAction); viewer->addAction(rightRotationAction); viewer->addAction(doublePageAction); + viewer->addAction(doubleMangaPageAction); YACReader::addSperator(viewer); viewer->addAction(showMagnifyingGlassAction); @@ -711,20 +712,29 @@ void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId) void MainWindowViewer::openComicFromPath(QString pathFile) { - QFileInfo fi(pathFile); - currentDirectory = fi.dir().absolutePath(); - getSiblingComics(fi.absolutePath(),fi.fileName()); - - setWindowTitle("YACReader - " + fi.fileName()); - - enableActions(); - - viewer->open(pathFile); - - isClient = false; - + openComic(pathFile); + isClient = false; //this method is used for direct openings } +//isClient shouldn't be modified when a siblinig comic is opened +void MainWindowViewer::openSiblingComic(QString pathFile) +{ + openComic(pathFile); +} + +void MainWindowViewer::openComic(QString pathFile) +{ + QFileInfo fi(pathFile); + currentDirectory = fi.dir().absolutePath(); + getSiblingComics(fi.absolutePath(),fi.fileName()); + + setWindowTitle("YACReader - " + fi.fileName()); + + enableActions(); + + viewer->open(pathFile); + } + void MainWindowViewer::openFolder() { QFileDialog openDialog; @@ -888,54 +898,37 @@ void MainWindowViewer::toggleFullScreen() Configuration::getConfiguration().setFullScreen(fullscreen = !fullscreen); } -//QTBUG-41883 void MainWindowViewer::toFullScreen() { - _size = size(); - _pos = pos(); - hide(); - fromMaximized = this->isMaximized(); + fromMaximized = this->isMaximized(); - hideToolBars(); - viewer->hide(); - viewer->fullscreen = true;//TODO, change by the right use of windowState(); - - setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); - setWindowState(windowState() | Qt::WindowFullScreen); - resize(windowHandle()->screen()->size()-QSize(0,1)); - - viewer->show(); - if(viewer->magnifyingGlassIsVisible()) - viewer->showMagnifyingGlass(); - - show(); + hideToolBars(); + viewer->hide(); + viewer->fullscreen = true;//TODO, change by the right use of windowState(); + showFullScreen(); + viewer->show(); + if(viewer->magnifyingGlassIsVisible()) + viewer->showMagnifyingGlass(); } -//QTBUG-41883 void MainWindowViewer::toNormal() { - hide(); - //show all - viewer->hide(); - viewer->fullscreen = false;//TODO, change by the right use of windowState(); - //viewer->hideMagnifyingGlass(); - setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint); - setWindowState(windowState() & ~Qt::WindowFullScreen); - resize(_size); - move(_pos); + //show all + viewer->hide(); + viewer->fullscreen = false;//TODO, change by the right use of windowState(); + //viewer->hideMagnifyingGlass(); if(fromMaximized) showMaximized(); else showNormal(); - if(Configuration::getConfiguration().getShowToolbars()) - showToolBars(); + if(Configuration::getConfiguration().getShowToolbars()) + showToolBars(); viewer->show(); - if(viewer->magnifyingGlassIsVisible()) + if(viewer->magnifyingGlassIsVisible()) viewer->showMagnifyingGlass(); - - show(); } + void MainWindowViewer::toggleToolBars() { toolbars?hideToolBars():showToolBars(); @@ -1246,11 +1239,7 @@ void MainWindowViewer::openPreviousComic() } if(!previousComicPath.isEmpty()) { - viewer->open(previousComicPath); - QFileInfo fi(previousComicPath); - getSiblingComics(fi.absolutePath(),fi.fileName()); - - setWindowTitle("YACReader - " + fi.fileName()); + openSiblingComic(previousComicPath); } } @@ -1273,11 +1262,7 @@ void MainWindowViewer::openNextComic() } if(!nextComicPath.isEmpty()) { - viewer->open(nextComicPath); - QFileInfo fi(nextComicPath); - getSiblingComics(fi.absolutePath(),fi.fileName()); - - setWindowTitle("YACReader - " + fi.fileName()); + openSiblingComic(nextComicPath); } } diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index 255acadf..6f27c75b 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -48,9 +48,11 @@ class EditShortcutsDialog; void newVersion(); void openPreviousComic(); void openNextComic(); - void openComicFromPath(QString pathFile); - void openFolderFromPath(QString pathDir); - void openFolderFromPath(QString pathFile, QString atFileName); + void openComicFromPath(QString pathFile); + void openSiblingComic(QString pathFile); + void openComic(QString pathFile); + void openFolderFromPath(QString pathDir); + void openFolderFromPath(QString pathFile, QString atFileName); void alwaysOnTopSwitch(); void adjustToFullSizeSwitch(); void reloadOptions(); @@ -68,7 +70,8 @@ class EditShortcutsDialog; void next(); void updatePage();*/ - private: + + private: //!State bool fullscreen; bool toolbars; @@ -162,6 +165,5 @@ signals: public: MainWindowViewer(); ~MainWindowViewer(); - -}; + }; #endif diff --git a/YACReader/options_dialog.cpp b/YACReader/options_dialog.cpp index 3a6e751f..2ed4eee2 100644 --- a/YACReader/options_dialog.cpp +++ b/YACReader/options_dialog.cpp @@ -14,7 +14,9 @@ #include "yacreader_spin_slider_widget.h" #include "yacreader_flow_config_widget.h" +#ifndef NO_OPENGL #include "yacreader_gl_flow_config_widget.h" +#endif OptionsDialog::OptionsDialog(QWidget * parent) :YACReaderOptionsDialog(parent) @@ -116,8 +118,10 @@ OptionsDialog::OptionsDialog(QWidget * parent) layoutGeneral->addWidget(shortcutsBox); layoutGeneral->addStretch(); layoutFlow->addWidget(sw); +#ifndef NO_OPENGL layoutFlow->addWidget(gl); layoutFlow->addWidget(useGL); +#endif layoutFlow->addStretch(); layoutImage->addWidget(new QLabel(tr("Brightness")),0,0); layoutImage->addWidget(new QLabel(tr("Contrast")),1,0); @@ -151,8 +155,9 @@ OptionsDialog::OptionsDialog(QWidget * parent) setLayout(layout); //disable vSyncCheck +#ifndef NO_OPENGL gl->vSyncCheck->hide(); - +#endif //restoreOptions(); //load options //resize(400,0); setModal (true); diff --git a/YACReader/render.cpp b/YACReader/render.cpp index 5f311657..9ae7cf36 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -849,7 +849,7 @@ void Render::nextPage() update(); emit pageChanged(currentIndex); } - else + else if (hasLoadedComic() && (currentIndex == numPages()-1)) { emit isLast(); } @@ -873,7 +873,7 @@ void Render::nextDoublePage() update(); emit pageChanged(currentIndex); } - else + else if (hasLoadedComic() && (currentIndex >= numPages()-2)) { emit isLast(); } @@ -894,7 +894,7 @@ void Render::previousPage() update(); emit pageChanged(currentIndex); } - else + else if (hasLoadedComic() && (currentIndex == 0)) { emit isCover(); } @@ -937,25 +937,31 @@ void Render::setNumPages(unsigned int numPages) void Render::pageRawDataReady(int page) { - pagesEmited.push_back(page); - if(pageRenders.size()>0) - { - for(int i=0;i currentIndex-numLeftPages)) || - ((pagesEmited.at(i) > currentIndex) && (pagesEmited.at(i) < currentIndex+numRightPages)) ) - { - fillBuffer(); - } - } - } - pagesEmited.clear(); - } + if (!hasLoadedComic()) + return; + + pagesEmited.push_back(page); + if(pageRenders.size()>0) + { + for(int i=0;i= pagesReady.size()) + return; //Oooops, something went wrong + + pagesReady[pagesEmited.at(i)] = true; + if(pagesEmited.at(i) == currentIndex) + update(); + else + { + if ( ((pagesEmited.at(i) < currentIndex) && (pagesEmited.at(i) > currentIndex-numLeftPages)) || + ((pagesEmited.at(i) > currentIndex) && (pagesEmited.at(i) < currentIndex+numRightPages)) ) + { + fillBuffer(); + } + } + } + pagesEmited.clear(); + } } //sólo se renderiza la página, si ha habido un cambio de página diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 44ab17bf..c4391e20 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -3,7 +3,11 @@ #include "configuration.h" #include "magnifying_glass.h" #include "goto_flow.h" +#ifndef NO_OPENGL #include "goto_flow_gl.h" +#else +#include +#endif #include "bookmarks_dialog.h" #include "render.h" #include "goto_dialog.h" @@ -67,6 +71,7 @@ shouldOpenPrevious(false) QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat); //CONFIG GOTO_FLOW-------------------------------------------------------- +#ifndef NO_OPENGL if(!settings->contains(USE_OPEN_GL)) { settings->setValue(USE_OPEN_GL,2); @@ -76,7 +81,9 @@ shouldOpenPrevious(false) goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType()); else goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType()); - +#else + goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType()); +#endif goToFlow->setFocusPolicy(Qt::StrongFocus); goToFlow->hide(); showGoToFlowAnimation = new QPropertyAnimation(goToFlow,"pos"); diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index be62fe6d..bd0659ba 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -14,36 +14,40 @@ INCLUDEPATH += ../common \ ./comic_vine/model DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY - + +CONFIG(no_opengl) { + DEFINES += NO_OPENGL +} + +CONFIG(legacy_gl_widget) { + INCLUDEPATH += ../common/gl_legacy \ +} else { + INCLUDEPATH += ../common/gl \ +} + win32 { LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -isEqual(QT_MAJOR_VERSION, 5) { LIBS += -lpoppler-qt5 INCLUDEPATH += ../dependencies/poppler/include/qt5 -} -else { -LIBS += -lpoppler-qt4 -INCLUDEPATH += ../dependencies/poppler/include/qt4 -} -QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL +QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT +!CONFIG(no_opengl) { + QMAKE_CXXFLAGS_RELEASE += /GL +} QMAKE_LFLAGS_RELEASE += /LTCG CONFIG -= embed_manifest_exe } unix:!macx{ -isEqual(QT_MAJOR_VERSION, 5) { INCLUDEPATH += /usr/include/poppler/qt5 LIBS += -L/usr/lib -lpoppler-qt5 -} -else { -INCLUDEPATH += /usr/include/poppler/qt4 -LIBS += -L/usr/lib -lpoppler-qt4 -} -LIBS += -lGLU + +!CONFIG(no_opengl) { + LIBS += -lGLU + } } macx{ @@ -72,7 +76,10 @@ QMAKE_CXXFLAGS += -std=c++11 #CONFIG += release CONFIG -= flat -QT += sql network opengl script +QT += sql network widgets script +!CONFIG(no_opengl) { + QT += opengl +} # Input HEADERS += comic_flow.h \ @@ -105,7 +112,6 @@ HEADERS += comic_flow.h \ ../common/pictureflow.h \ ../common/custom_widgets.h \ ../common/qnaturalsorting.h \ - ../common/yacreader_flow_gl.h \ ../common/yacreader_global.h \ ../common/onstart_flow_selection_dialog.h \ no_libraries_widget.h \ @@ -134,6 +140,14 @@ HEADERS += comic_flow.h \ empty_reading_list_widget.h \ ../common/scroll_management.h +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("using legacy YACReaderFlowGL (QGLWidget) header") + HEADERS += ../common/gl_legacy/yacreader_flow_gl.h + } else { + HEADERS += ../common/gl/yacreader_flow_gl.h + } +} SOURCES += comic_flow.cpp \ create_library_dialog.cpp \ @@ -166,7 +180,6 @@ SOURCES += comic_flow.cpp \ ../common/pictureflow.cpp \ ../common/custom_widgets.cpp \ ../common/qnaturalsorting.cpp \ - ../common/yacreader_flow_gl.cpp \ ../common/onstart_flow_selection_dialog.cpp \ no_libraries_widget.cpp \ import_widget.cpp \ @@ -195,6 +208,15 @@ SOURCES += comic_flow.cpp \ empty_reading_list_widget.cpp \ ../common/scroll_management.cpp +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("using legacy YACReaderFlowGL (QGLWidget) source code") + SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp + } else { + SOURCES += ../common/gl/yacreader_flow_gl.cpp + } +} + include(./server/server.pri) include(../custom_widgets/custom_widgets_yacreaderlibrary.pri) @@ -223,9 +245,9 @@ TRANSLATIONS = yacreaderlibrary_es.ts \ yacreaderlibrary_de.ts \ yacreaderlibrary_source.ts -isEqual(QT_MAJOR_VERSION, 5) { - Release:DESTDIR = ../release5 - Debug:DESTDIR = ../debug5 + +Release:DESTDIR = ../release +Debug:DESTDIR = ../debug #QML/GridView QT += quick qml @@ -241,11 +263,6 @@ win32:RESOURCES += qml_win.qrc unix:!macx:RESOURCES += qml_win.qrc macx:RESOURCES += qml_osx.qrc -} else { - Release:DESTDIR = ../release - Debug:DESTDIR = ../debug -} - win32 { !exists(../compressed_archive/lib7zip){ error(You\'ll need 7zip source code to compile YACReader. \ diff --git a/YACReaderLibrary/classic_comics_view.cpp b/YACReaderLibrary/classic_comics_view.cpp index 0677bc73..a94f67f9 100644 --- a/YACReaderLibrary/classic_comics_view.cpp +++ b/YACReaderLibrary/classic_comics_view.cpp @@ -16,12 +16,14 @@ ClassicComicsView::ClassicComicsView(QWidget *parent) settings->beginGroup("libraryConfig"); //FLOW----------------------------------------------------------------------- //--------------------------------------------------------------------------- - +#ifndef NO_OPENGL if((settings->value(USE_OPEN_GL).toBool() == true)) comicFlow = new ComicFlowWidgetGL(0); else comicFlow = new ComicFlowWidgetSW(0); - +#else + comicFlow = new ComicFlowWidgetSW(0); +#endif comicFlow->updateConfig(settings); comicFlow->setFocusPolicy(Qt::StrongFocus); comicFlow->setShowMarks(true); diff --git a/YACReaderLibrary/comic_flow.cpp b/YACReaderLibrary/comic_flow.cpp index 06e2af58..730687b4 100644 --- a/YACReaderLibrary/comic_flow.cpp +++ b/YACReaderLibrary/comic_flow.cpp @@ -24,6 +24,7 @@ ComicFlow::ComicFlow(QWidget* parent,FlowType flowType) ComicFlow::~ComicFlow() { + worker->terminate(); delete worker; delete updateTimer; } diff --git a/YACReaderLibrary/comic_flow_widget.cpp b/YACReaderLibrary/comic_flow_widget.cpp index 2fce350c..e4326abc 100644 --- a/YACReaderLibrary/comic_flow_widget.cpp +++ b/YACReaderLibrary/comic_flow_widget.cpp @@ -1,5 +1,5 @@ #include "comic_flow_widget.h" - +#include ComicFlowWidget::ComicFlowWidget(QWidget * parent) :QWidget(parent) { @@ -145,7 +145,7 @@ void ComicFlowWidgetSW::resortCovers(QList newOrder) flow->resortCovers(newOrder); } - +#ifndef NO_OPENGL ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ///OpenGL ComicFlow @@ -341,7 +341,7 @@ void ComicFlowWidgetGL::resortCovers(QList newOrder) { flow->resortCovers(newOrder); } - +#endif //void ComicFlowWidgetGL::setCF_RX(int value){ flow->setCF_RX(value);} //void ComicFlowWidgetGL::setCF_RY(int value){ flow->setCF_RY(value);} //void ComicFlowWidgetGL::setCF_RZ(int value){ flow->setCF_RZ(value);} diff --git a/YACReaderLibrary/comic_flow_widget.h b/YACReaderLibrary/comic_flow_widget.h index 90eaccba..10f68486 100644 --- a/YACReaderLibrary/comic_flow_widget.h +++ b/YACReaderLibrary/comic_flow_widget.h @@ -6,8 +6,9 @@ #include "pictureflow.h" #include "comic_flow.h" +#ifndef NO_OPENGL #include "yacreader_flow_gl.h" - +#endif class ComicFlowWidget : public QWidget { Q_OBJECT @@ -75,6 +76,7 @@ protected: QSize slideSizeF; }; +#ifndef NO_OPENGL class ComicFlowWidgetGL : public ComicFlowWidget { Q_OBJECT @@ -127,5 +129,5 @@ protected: QSize minimumSizeHint() const; QSize sizeHint() const; }; - +#endif #endif diff --git a/YACReaderLibrary/db/reading_list_model.cpp b/YACReaderLibrary/db/reading_list_model.cpp index 406f8e5a..7eb76f6d 100644 --- a/YACReaderLibrary/db/reading_list_model.cpp +++ b/YACReaderLibrary/db/reading_list_model.cpp @@ -8,6 +8,8 @@ #include "QsLog.h" +#include + ReadingListModel::ReadingListModel(QObject *parent) : QAbstractItemModel(parent),rootItem(0) { diff --git a/YACReaderLibrary/import_widget.cpp b/YACReaderLibrary/import_widget.cpp index 9abd74f2..0e325e26 100644 --- a/YACReaderLibrary/import_widget.cpp +++ b/YACReaderLibrary/import_widget.cpp @@ -10,7 +10,8 @@ #include #include #include -#include +//TODO: is QGLWidget needed here??? +//#include #include #include #include diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 57853e5b..2b620a09 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -15,7 +15,9 @@ #include #include #include +#ifndef NO_OPENGL #include +#endif #include #include @@ -182,14 +184,14 @@ void LibraryWindow::doLayout() libraryToolBar = new YACReaderMainToolBar(this); #endif - +#ifndef NO_OPENGL //FLOW----------------------------------------------------------------------- //--------------------------------------------------------------------------- if(QGLFormat::hasOpenGL() && !settings->contains(USE_OPEN_GL)) { settings->setValue(USE_OPEN_GL,2); } - +#endif //FOLDERS FILTER------------------------------------------------------------- //--------------------------------------------------------------------------- #ifndef Q_OS_MAC @@ -2083,58 +2085,39 @@ void LibraryWindow::toggleFullScreen() fullscreen = !fullscreen; } -//QTBUG-41883 void LibraryWindow::toFullScreen() { - _size = size(); - _pos = pos(); - hide(); - - fromMaximized = this->isMaximized(); + fromMaximized = this->isMaximized(); sideBar->hide(); - libraryToolBar->hide(); + libraryToolBar->hide(); comicsView->toFullScreen(); - setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); - setWindowState(windowState() | Qt::WindowFullScreen); - resize(windowHandle()->screen()->size()-QSize(0,1)); - - show(); + showFullScreen(); } -//QTBUG-41883 void LibraryWindow::toNormal() { - hide(); + sideBar->show(); - sideBar->show(); - comicsView->toNormal(); - setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint); - setWindowState(windowState() & ~Qt::WindowFullScreen); - resize(_size); - move(_pos); - - if(fromMaximized) - showMaximized(); - else - showNormal(); + if(fromMaximized) + showMaximized(); + else + showNormal(); #ifdef Q_OS_MAC - QTimer * timer = new QTimer(); - timer->setSingleShot(true); - timer->start(); - connect(timer,SIGNAL(timeout()),libraryToolBar,SLOT(show())); - connect(timer,SIGNAL(timeout()),timer,SLOT(deleteLater())); + QTimer * timer = new QTimer(); + timer->setSingleShot(true); + timer->start(); + connect(timer,SIGNAL(timeout()),libraryToolBar,SLOT(show())); + connect(timer,SIGNAL(timeout()),timer,SLOT(deleteLater())); #else - libraryToolBar->show(); + libraryToolBar->show(); #endif - show(); - } void LibraryWindow::setSearchFilter(const YACReader::SearchModifiers modifier, QString filter) diff --git a/YACReaderLibrary/main.cpp b/YACReaderLibrary/main.cpp index 5f12d0f0..a883151f 100644 --- a/YACReaderLibrary/main.cpp +++ b/YACReaderLibrary/main.cpp @@ -95,7 +95,7 @@ void logSystemAndConfig() #ifdef Q_OS_WIN if(QLibrary::isLibrary(QApplication::applicationDirPath()+"/utils/7z.dll")) #elif defined Q_OS_UNIX && !defined Q_OS_MAC - if(QLibrary::isLibrary(QString(LIBDIR)+"/p7zip/7z.so")) + if(QLibrary::isLibrary(QString(LIBDIR)+"/yacreader/7z.so") | QLibrary::isLibrary(QString(LIBDIR)+"/p7zip/7z.so")) #else if(QLibrary::isLibrary(QApplication::applicationDirPath()+"/utils/7z.so")) #endif diff --git a/YACReaderLibrary/options_dialog.cpp b/YACReaderLibrary/options_dialog.cpp index f0165e31..6073347f 100644 --- a/YACReaderLibrary/options_dialog.cpp +++ b/YACReaderLibrary/options_dialog.cpp @@ -1,8 +1,10 @@ #include "options_dialog.h" +#ifndef NO_OPENGL #include "yacreader_flow_gl.h" -#include "yacreader_flow_config_widget.h" #include "yacreader_gl_flow_config_widget.h" +#endif +#include "yacreader_flow_config_widget.h" #include "api_key_dialog.h" #include @@ -15,6 +17,8 @@ #include #include #include +#include + FlowType flowType = Strip; @@ -28,20 +32,25 @@ OptionsDialog::OptionsDialog(QWidget * parent) QVBoxLayout * flowLayout = new QVBoxLayout; QVBoxLayout * generalLayout = new QVBoxLayout(); - QHBoxLayout * switchFlowType = new QHBoxLayout; + QHBoxLayout * switchFlowType = new QHBoxLayout(); switchFlowType->addStretch(); +#ifndef NO_OPENGL switchFlowType->addWidget(useGL); - +#endif QHBoxLayout * buttons = new QHBoxLayout(); buttons->addStretch(); buttons->addWidget(accept); buttons->addWidget(cancel); flowLayout->addWidget(sw); +#ifndef NO_OPENGL flowLayout->addWidget(gl); +#endif flowLayout->addLayout(switchFlowType); +#ifndef NO_OPENGL sw->hide(); +#endif QVBoxLayout * apiKeyLayout = new QVBoxLayout(); QPushButton * apiKeyButton = new QPushButton(tr("Edit Comic Vine API key")); diff --git a/YACReaderLibrary/server_config_dialog.cpp b/YACReaderLibrary/server_config_dialog.cpp index 73761624..a44a5271 100644 --- a/YACReaderLibrary/server_config_dialog.cpp +++ b/YACReaderLibrary/server_config_dialog.cpp @@ -13,6 +13,22 @@ #include "startup.h" #include "yacreader_global.h" +#include + +bool ipComparator(const QString & ip1, const QString & ip2) +{ + if(ip1.startsWith("192.168") && ip2.startsWith("192.168")) + return ip1 < ip2; + + if(ip1.startsWith("192.168")) + return true; + + if(ip2.startsWith("192.168")) + return false; + + return ip1 < ip2; +} + #ifndef Q_OS_WIN32 #include @@ -166,7 +182,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent) settings->endGroup(); - connect(check,SIGNAL(stateChanged(int)),this,SLOT(enableServer(int))); + connect(check,SIGNAL(stateChanged(int)),this,SLOT(enableServer(int))); } void ServerConfigDialog::enableServer(int status) @@ -205,6 +221,7 @@ void ServerConfigDialog::generateQR() //} ip->clear(); QString dir; + #ifdef Q_OS_WIN32 QList list = QHostInfo::fromName( QHostInfo::localHostName() ).addresses(); @@ -214,11 +231,7 @@ void ServerConfigDialog::generateQR() QString tmp = add.toString(); if(tmp.contains(".") && !tmp.startsWith("127")) { - if(dir.isEmpty() && tmp.startsWith("192.168.2.")) - dir = tmp; - else - otherAddresses.push_back(tmp); - + otherAddresses.push_back(tmp); } } @@ -231,14 +244,19 @@ void ServerConfigDialog::generateQR() QString tmp = add; if(tmp.contains(".") && !tmp.startsWith("127")) { - if(dir.isEmpty() && tmp.startsWith("192.168.2.")) - dir = tmp; - else - otherAddresses.push_back(tmp); - + otherAddresses.push_back(tmp); } } #endif + + std::sort(otherAddresses.begin(),otherAddresses.end(),ipComparator); + + if(!otherAddresses.isEmpty()) + { + dir = otherAddresses.first(); + otherAddresses.pop_front(); + } + if(otherAddresses.length()>0 || !dir.isEmpty()) { if(!dir.isEmpty()) diff --git a/YACReaderLibrary/server_config_dialog.h b/YACReaderLibrary/server_config_dialog.h index b21c96ee..dfe441b5 100644 --- a/YACReaderLibrary/server_config_dialog.h +++ b/YACReaderLibrary/server_config_dialog.h @@ -28,6 +28,7 @@ Q_OBJECT QPixmap * qrCodeImage; QProcess * qrGenerator; + public slots: void generateQR(); void generateQR(const QString & serverAddress); @@ -41,4 +42,4 @@ signals: }; -#endif \ No newline at end of file +#endif diff --git a/common/comic.cpp b/common/comic.cpp index d4c81305..7939e468 100644 --- a/common/comic.cpp +++ b/common/comic.cpp @@ -730,11 +730,13 @@ void PDFComic::process() _index = _firstPage; emit(openAt(_index)); - for(int i=_index;ithread()); diff --git a/common/yacreader_flow_gl.cpp b/common/gl/yacreader_flow_gl.cpp similarity index 100% rename from common/yacreader_flow_gl.cpp rename to common/gl/yacreader_flow_gl.cpp diff --git a/common/yacreader_flow_gl.h b/common/gl/yacreader_flow_gl.h similarity index 100% rename from common/yacreader_flow_gl.h rename to common/gl/yacreader_flow_gl.h diff --git a/common/gl_legacy/yacreader_flow_gl.cpp b/common/gl_legacy/yacreader_flow_gl.cpp new file mode 100644 index 00000000..c585189b --- /dev/null +++ b/common/gl_legacy/yacreader_flow_gl.cpp @@ -0,0 +1,1593 @@ +#include "yacreader_flow_gl.h" + +#include +#include +//#include + +#ifdef Q_OS_MAC + #include +#else + #include +#endif + +#include +#include +#include + +/*** Animation Settings ***/ + +/*** Position Configuration ***/ + +int YACReaderFlowGL::updateInterval = 16; + +struct Preset defaultYACReaderFlowConfig = { + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 3.f, //Animation_Fade_out_dis sets the distance of view + + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.01f, //View_rotate_add sets the speed of the rotation + 0.02f, //View_rotate_sub sets the speed of reversing the rotation + 20.f, //View_angle sets the maximum view angle + + 0.f, //CF_X the X Position of the Coverflow + 0.f, //CF_Y the Y Position of the Coverflow + -8.f, //CF_Z the Z Position of the Coverflow + + 15.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow + + -50.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + 0.0f, //Y_Distance sets the elevation amount + + 30.f //zoom level + +}; + +struct Preset presetYACReaderFlowClassicConfig = { + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 2.f, //Animation_Fade_out_dis sets the distance of view + + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 30.f, //View_angle sets the maximum view angle + + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow + + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow + + -40.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + 0.0f, //Y_Distance sets the elevation amount + + 22.f //zoom level + +}; + +struct Preset presetYACReaderFlowStripeConfig = { + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 6.f, //Animation_Fade_out_dis sets the distance of view + + 1.5f, //pre_rotation sets the rotation increasion + 4.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 30.f, //View_angle sets the maximum view angle + + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow + + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow + + 0.f, //Rotation sets the rotation of each cover + 1.1f, //X_Distance sets the distance between the covers + 0.2f, //Center_Distance sets the distance between the centered and the non centered covers + 0.01f, //Z_Distance sets the pushback amount + 0.0f, //Y_Distance sets the elevation amount + + 22.f //zoom level + +}; + +struct Preset presetYACReaderFlowOverlappedStripeConfig = { + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 2.f, //Animation_Fade_out_dis sets the distance of view + + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 30.f, //View_angle sets the maximum view angle + + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow + + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow + + 0.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + 0.0f, //Y_Distance sets the elevation amount + + 22.f //zoom level + +}; + +struct Preset pressetYACReaderFlowUpConfig = { + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 2.5f, //Animation_Fade_out_dis sets the distance of view + + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 5.f, //View_angle sets the maximum view angle + + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow + + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow + + -50.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + -0.1f, //Y_Distance sets the elevation amount + + 22.f //zoom level + +}; + +struct Preset pressetYACReaderFlowDownConfig = { + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 2.5f, //Animation_Fade_out_dis sets the distance of view + + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 5.f, //View_angle sets the maximum view angle + + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow + + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow + + -50.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + 0.1f, //Y_Distance sets the elevation amount + + 22.f //zoom level +}; +/*Constructor*/ +YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p) + :QGLWidget(QGLFormat(QGL::SampleBuffers), parent),numObjects(0),lazyPopulateObjects(-1),bUseVSync(false),hasBeenInitialized(false) +{ + updateCount = 0; + config = p; + + currentSelected = 0; + + centerPos.x = 0.f; + centerPos.y = 0.f; + centerPos.z = 1.f; + centerPos.rot = 0.f; + + /*** Style ***/ + shadingTop = 0.8f; + shadingBottom = 0.02f; + reflectionUp = 0.f; + reflectionBottom = 0.6f; + + /*** System variables ***/ + numObjects = 0; + //CFImage Dummy; + viewRotate = 0.f; + viewRotateActive = 0; + stepBackup = config.animationStep/config.animationSpeedUp; + + /*QTimer * timer = new QTimer(); + connect(timer, SIGNAL(timeout()), this, SLOT(updateImageData())); + timer->start(70); + */ + + /*loader = new WidgetLoader(0,this); + loader->flow = this; + QThread * loaderThread = new QThread(parent); + + loader->moveToThread(loaderThread); + + loaderThread->start();*/ + + QGLFormat f = format(); + f.setVersion(2, 1); + f.setSwapInterval(0); + setFormat(f); + + timerId = startTimer(updateInterval); + +} + +void YACReaderFlowGL::timerEvent(QTimerEvent * event) +{ + if(timerId == event->timerId()) + updateGL(); + + //if(!worker->isRunning()) + //worker->start(); +} + +void YACReaderFlowGL::startAnimationTimer() +{ + if(timerId == -1) + timerId = startTimer(updateInterval); +} + +void YACReaderFlowGL::stopAnimationTimer() +{ + if(timerId != -1) + { + killTimer(timerId); + timerId = -1; + } +} + +YACReaderFlowGL::~YACReaderFlowGL() +{ + +} + +QSize YACReaderFlowGL::minimumSizeHint() const +{ + return QSize(320, 200); +} + +/*QSize YACReaderFlowGL::sizeHint() const +{ + return QSize(320, 200); +}*/ + +void YACReaderFlowGL::initializeGL() +{ + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + glEnable(GL_COLOR_MATERIAL); + glShadeModel(GL_SMOOTH); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + defaultTexture = bindTexture(QImage(":/images/defaultCover.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption); + markTexture = bindTexture(QImage(":/images/readRibbon.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption); + readingTexture = bindTexture(QImage(":/images/readingRibbon.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption); + if(lazyPopulateObjects!=-1) + populate(lazyPopulateObjects); + + hasBeenInitialized = true; +} + +void YACReaderFlowGL::paintGL() +{ + /*glClearDepth(1.0); + glClearColor(1,1,1,1);*/ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + /*glLoadIdentity(); + glTranslatef(0.0, 0.0, -10.0); + glPopMatrix();*/ + if(numObjects>0) + { + updatePositions(); + udpatePerspective(width(),height()); + draw(); + } +} + +void YACReaderFlowGL::resizeGL(int width, int height) +{ + + fontSize = (width + height) * 0.010; + if(fontSize < 10) + fontSize = 10; + + //int side = qMin(width, height); + udpatePerspective(width,height); + + if(numObjects>0) + updatePositions(); +} + +void YACReaderFlowGL::udpatePerspective(int width, int height) +{ + glViewport(0, 0, width, height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + gluPerspective(20.0, GLdouble(width) / (float)height, 1.0, 200.0); + + glMatrixMode(GL_MODELVIEW); +} + +//----------------------------------------------------------------------------- +/*Private*/ +void YACReaderFlowGL::calcPos(YACReader3DImage & image, int pos) +{ + if(pos == 0){ + image.current = centerPos; + }else{ + if(pos > 0){ + image.current.x = (config.centerDistance)+(config.xDistance*pos); + image.current.y = config.yDistance*pos*-1; + image.current.z = config.zDistance*pos*-1; + image.current.rot = config.rotation; + }else{ + image.current.x = (config.centerDistance)*-1+(config.xDistance*pos); + image.current.y = config.yDistance*pos; + image.current.z = config.zDistance*pos; + image.current.rot = config.rotation*-1; + } + } + +} +void YACReaderFlowGL::calcVector(YACReader3DVector & vector, int pos) +{ + calcPos(dummy,pos); + + vector.x = dummy.current.x; + vector.y = dummy.current.y; + vector.z = dummy.current.z; + vector.rot = dummy.current.rot; +} + +bool YACReaderFlowGL::animate(YACReader3DVector & currentVector,YACReader3DVector & toVector) +{ + float rotDiff = toVector.rot-currentVector.rot; + float xDiff = toVector.x-currentVector.x; + float yDiff = toVector.y-currentVector.y; + float zDiff = toVector.z-currentVector.z; + + if(fabs(rotDiff) < 0.01 + && fabs(xDiff) < 0.001 + && fabs(yDiff) < 0.001 + && fabs(zDiff) < 0.001) + return true; + + //calculate and apply positions + currentVector.x = currentVector.x+(xDiff)*config.animationStep; + currentVector.y = currentVector.y+(yDiff)*config.animationStep; + currentVector.z = currentVector.z+(zDiff)*config.animationStep; + + if(fabs(rotDiff) > 0.01){ + currentVector.rot = currentVector.rot+(rotDiff)*(config.animationStep*config.preRotation); + } + else + { + viewRotateActive = 0; + } + + return false; +} +void YACReaderFlowGL::drawCover(const YACReader3DImage & image) +{ + float w = image.width; + float h = image.height; + + //fadeout + float opacity = 1-1/(config.animationFadeOutDist+config.viewRotateLightStrenght*fabs(viewRotate))*fabs(0-image.current.x); + + glLoadIdentity(); + glTranslatef(config.cfX,config.cfY,config.cfZ); + glRotatef(config.cfRX,1,0,0); + glRotatef(viewRotate*config.viewAngle+config.cfRY,0,1,0); + glRotatef(config.cfRZ,0,0,1); + + glTranslatef( image.current.x, image.current.y, image.current.z ); + + glPushMatrix(); + glRotatef(image.current.rot,0,1,0); + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, image.texture); + + //calculate shading + float LShading = ((config.rotation != 0 )?((image.current.rot < 0)?1-1/config.rotation*image.current.rot:1):1); + float RShading = ((config.rotation != 0 )?((image.current.rot > 0)?1-1/(config.rotation*-1)*image.current.rot:1):1); + float LUP = shadingTop+(1-shadingTop)*LShading; + float LDOWN = shadingBottom+(1-shadingBottom)*LShading; + float RUP = shadingTop+(1-shadingTop)*RShading; + float RDOWN = shadingBottom+(1-shadingBottom)*RShading;; + + + //DrawCover + glBegin(GL_QUADS); + + //esquina inferior izquierda + glColor4f(LDOWN*opacity,LDOWN*opacity,LDOWN*opacity,1); + glTexCoord2f(0.0f, 1.0f); + glVertex3f(w/2.f*-1.f, -0.5f, 0.f); + + //esquina inferior derecha + glColor4f(RDOWN*opacity,RDOWN*opacity,RDOWN*opacity,1); + glTexCoord2f(1.0f, 1.0f); + glVertex3f(w/2.f, -0.5f, 0.f); + + //esquina superior derecha + glColor4f(RUP*opacity,RUP*opacity,RUP*opacity,1); + glTexCoord2f(1.0f, 0.0f); + glVertex3f(w/2.f, -0.5f+h, 0.f); + + //esquina superior izquierda + glColor4f(LUP*opacity,LUP*opacity,LUP*opacity,1); + glTexCoord2f(0.0f, 0.0f); + glVertex3f(w/2.f*-1.f, -0.5f+h, 0.f); + + glEnd(); + + + + //Draw reflection + glBegin(GL_QUADS); + + //esquina inferior izquierda + glColor4f(LUP*opacity*reflectionUp/2,LUP*opacity*reflectionUp/2,LUP*opacity*reflectionUp/2,1); + glTexCoord2f(0.0f, 0.0f); + glVertex3f(w/2.f*-1.f, -0.5f-h, 0.f); + + //esquina inferior derecha + glColor4f(RUP*opacity*reflectionUp/2,RUP*opacity*reflectionUp/2,RUP*opacity*reflectionUp/2,1); + glTexCoord2f(1.0f, 0.0f); + glVertex3f(w/2.f, -0.5f-h, 0.f); + + //esquina superior derecha + glColor4f(RDOWN*opacity/3,RDOWN*opacity/3,RDOWN*opacity/3,1); + glTexCoord2f(1.0f, 1.0f); + glVertex3f(w/2.f, -0.5f, 0.f); + + //esquina superior izquierda + glColor4f(LDOWN*opacity/3,LDOWN*opacity/3,LDOWN*opacity/3,1); + glTexCoord2f(0.0f, 1.0f); + glVertex3f(w/2.f*-1.f, -0.5f, 0.f); + + glEnd(); + glDisable(GL_TEXTURE_2D); + + if(showMarks && loaded[image.index] && marks[image.index] != Unread) + { + glEnable(GL_TEXTURE_2D); + if(marks[image.index] == Read) + glBindTexture(GL_TEXTURE_2D, markTexture); + else + glBindTexture(GL_TEXTURE_2D, readingTexture); + glBegin(GL_QUADS); + + //esquina inferior izquierda + glColor4f(RUP*opacity,RUP*opacity,RUP*opacity,1); + glTexCoord2f(0.0f, 1.0f); + glVertex3f(w/2.f-0.2, -0.685f+h, 0.001f); + + //esquina inferior derecha + glColor4f(RUP*opacity,RUP*opacity,RUP*opacity,1); + glTexCoord2f(1.0f, 1.0f); + glVertex3f(w/2.f-0.05, -0.685f+h, 0.001f); + + //esquina superior derecha + glColor4f(RUP*opacity,RUP*opacity,RUP*opacity,1); + glTexCoord2f(1.0f, 0.0f); + glVertex3f(w/2.f-0.05, -0.485f+h, 0.001f); + + //esquina superior izquierda + glColor4f(RUP*opacity,RUP*opacity,RUP*opacity,1); + glTexCoord2f(0.0f, 0.0f); + glVertex3f(w/2.f-0.2, -0.485f+h, 0.001f); + + glEnd(); + glDisable(GL_TEXTURE_2D); + } + + + glPopMatrix(); +} + +/*Public*/ +void YACReaderFlowGL::cleanupAnimation() +{ + config.animationStep = stepBackup; + viewRotateActive = 0; +} + +void YACReaderFlowGL::draw() +{ + int CS = currentSelected; + int count; + + + //Draw right Covers + for(count = numObjects-1;count > -1;count--){ + if(count > CS){ + drawCover(images[count]); + } + } + + //Draw left Covers + for(count = 0;count < numObjects-1;count++){ + if(count < CS){ + drawCover(images[count]); + } + } + + //Draw Center Cover + drawCover(images[CS]); + + //glDisable(GL_DEPTH_TEST); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(-(float(width())/height())/2.0,(float(width())/height())/2.0, 0, 1, -10, 10); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor4f( 0.3f, 0.3f, 0.3f, 1.0f ); + + renderText(10, fontSize + 10,QString("%1/%2").arg(currentSelected+1).arg(numObjects),QFont("Arial", fontSize)); + + glEnable(GL_DEPTH_TEST); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); +} + +void YACReaderFlowGL::showPrevious() +{ + startAnimationTimer(); + + if(currentSelected > 0){ + + currentSelected--; + emit centerIndexChanged(currentSelected); + config.animationStep *= config.animationSpeedUp; + + if(config.animationStep > config.animationStepMax){ + config.animationStep = config.animationStepMax; + } + + if(viewRotateActive && viewRotate > -1){ + viewRotate -= config.viewRotateAdd; + } + + viewRotateActive = 1; + + } +} + +void YACReaderFlowGL::showNext() +{ + startAnimationTimer(); + + if(currentSelected < numObjects-1){ + + currentSelected++; + emit centerIndexChanged(currentSelected); + config.animationStep *= config.animationSpeedUp; + + if(config.animationStep > config.animationStepMax){ + config.animationStep = config.animationStepMax; + } + + if(viewRotateActive && viewRotate < 1){ + viewRotate += config.viewRotateAdd; + } + + viewRotateActive = 1; + } +} + +void YACReaderFlowGL::setCurrentIndex(int pos) +{ + if(!(pos>=0 && pos < images.length() && images.length()>0)) + return; + if(pos >= images.length() && images.length() > 0) + pos = images.length()-1; + + startAnimationTimer(); + + currentSelected = pos; + + config.animationStep *= config.animationSpeedUp; + + if(config.animationStep > config.animationStepMax){ + config.animationStep = config.animationStepMax; + } + + if(viewRotateActive && viewRotate < 1){ + viewRotate += config.viewRotateAdd; + } + + viewRotateActive = 1; + +} + +void YACReaderFlowGL::updatePositions() +{ + int count; + + bool stopAnimation = true; + for(count = numObjects-1;count > -1;count--){ + calcVector(images[count].animEnd,count-currentSelected); + if(!animate(images[count].current,images[count].animEnd)) + stopAnimation = false; + } + + //slowly reset view angle + if(!viewRotateActive){ + viewRotate += (0-viewRotate)*config.viewRotateSub; + } + + if(fabs (images[currentSelected].current.x - images[currentSelected].animEnd.x) < 1)//viewRotate < 0.2) + { + cleanupAnimation(); + if(updateCount >= 0) //TODO parametrizar + { + + updateCount = 0; + updateImageData(); + } + else + updateCount++; + } + else + updateCount++; + + if(stopAnimation) + stopAnimationTimer(); + +} + +void YACReaderFlowGL::insert(const char *name, GLuint texture, float x, float y,int item) +{ + startAnimationTimer(); + + Q_UNUSED(name) + //set a new entry + if(item == -1){ + images.push_back(YACReader3DImage()); + + item = numObjects; + numObjects++; + + calcVector(images[item].current,item); + images[item].current.z = images[item].current.z-1; + } + + images[item].texture = texture; + images[item].width = x; + images[item].height = y; + images[item].index = item; + //strcpy(cfImages[item].name,name); +} + +void YACReaderFlowGL::remove(int item) +{ + if(item < 0 || item >= images.size()) + return; + + startAnimationTimer(); + + loaded.remove(item); + marks.remove(item); + + //reposition current selection + if(item <= currentSelected && currentSelected != 0){ + currentSelected--; + } + + int count = item; + while(count <= numObjects-2){ + images[count].index--; + count++; + } + images.removeAt(item); + + + numObjects--; +} + +/*Info*/ +YACReader3DImage YACReaderFlowGL::getCurrentSelected() +{ + return images[currentSelected]; +} + +void YACReaderFlowGL::replace(const char *name, GLuint texture, float x, float y,int item) +{ + startAnimationTimer(); + + Q_UNUSED(name) + if(images[item].index == item) + { + images[item].texture = texture; + images[item].width = x; + images[item].height = y; + loaded[item]=true; + } + else + loaded[item]=false; +} + +void YACReaderFlowGL::populate(int n) +{ + emit centerIndexChanged(0); + float x = 1; + float y = 1 * (700.f/480.0f); + int i; + + for(i = 0;i(n,false); + //marks = QVector(n,false); + + + + //worker->start(); +} + +void YACReaderFlowGL::reset() +{ + startAnimationTimer(); + + currentSelected = 0; + loaded.clear(); + + for(int i = 0;iwidth(); + int height = this->height(); + glViewport(0, 0, width, height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + //float sideX = ((float(width)/height)/2)*1.5; + //float sideY = 0.5*1.5; + gluPerspective(zoom, (float)width / (float)height, 1.0, 200.0); + //glOrtho(-sideX, sideX, -sideY+0.2, +sideY+0.2, 4, 11.0); + + glMatrixMode(GL_MODELVIEW); + +} + +void YACReaderFlowGL::setRotation(int angle) +{ + startAnimationTimer(); + + config.rotation = -angle; +} +//sets the distance between the covers +void YACReaderFlowGL::setX_Distance(int distance) +{ + startAnimationTimer(); + + config.xDistance = distance/100.0; +} +//sets the distance between the centered and the non centered covers +void YACReaderFlowGL::setCenter_Distance(int distance) +{ + startAnimationTimer(); + + config.centerDistance = distance/100.0; +} +//sets the pushback amount +void YACReaderFlowGL::setZ_Distance(int distance) +{ + startAnimationTimer(); + + config.zDistance = distance/100.0; +} + +void YACReaderFlowGL::setCF_Y(int value) +{ + startAnimationTimer(); + + config.cfY = value/100.0; +} + +void YACReaderFlowGL::setCF_Z(int value) +{ + startAnimationTimer(); + + config.cfZ = value; +} + +void YACReaderFlowGL::setY_Distance(int value) +{ + startAnimationTimer(); + + config.yDistance = value / 100.0; +} + +void YACReaderFlowGL::setFadeOutDist(int value) +{ + startAnimationTimer(); + + config.animationFadeOutDist = value; +} + +void YACReaderFlowGL::setLightStrenght(int value) +{ + startAnimationTimer(); + + config.viewRotateLightStrenght = value; +} + +void YACReaderFlowGL::setMaxAngle(int value) +{ + startAnimationTimer(); + + config.viewAngle = value; +} + +void YACReaderFlowGL::setPreset(const Preset & p) +{ + startAnimationTimer(); + + config = p; +} + +void YACReaderFlowGL::setPerformance(Performance performance) +{ + if(this->performance != performance) + { + startAnimationTimer(); + + this->performance = performance; + reload(); + } +} + +void YACReaderFlowGL::useVSync(bool b) +{ + if(bUseVSync != b) + { + bUseVSync = b; + if(b) + { + QGLFormat f = format(); + f.setVersion(2, 1); + f.setSwapInterval(1); + setFormat(f); + } + else + { + QGLFormat f = format(); + f.setVersion(2, 1); + f.setSwapInterval(0); + setFormat(f); + } + reset(); + } +} +void YACReaderFlowGL::setShowMarks(bool value) +{ + startAnimationTimer(); + + showMarks = value; +} +void YACReaderFlowGL::setMarks(QVector marks) +{ + startAnimationTimer(); + + this->marks = marks; +} +void YACReaderFlowGL::setMarkImage(QImage & image) +{ + Q_UNUSED(image); + //qué pasa la primera vez?? + //deleteTexture(markTexture); + //markTexture = bindTexture(image,GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption); +} +void YACReaderFlowGL::markSlide(int index, YACReaderComicReadStatus status) +{ + startAnimationTimer(); + + marks[index] = status; +} +void YACReaderFlowGL::unmarkSlide(int index) +{ + startAnimationTimer(); + + marks[index] = YACReader::Unread; +} +void YACReaderFlowGL::setSlideSize(QSize size) +{ + Q_UNUSED(size); + //TODO calcular el tamaño del widget +} +void YACReaderFlowGL::clear() +{ + reset(); +} + +void YACReaderFlowGL::setCenterIndex(unsigned int index) +{ + setCurrentIndex(index); +} +void YACReaderFlowGL::showSlide(int index) +{ + setCurrentIndex(index); +} +int YACReaderFlowGL::centerIndex() +{ + return currentSelected; +} +void YACReaderFlowGL::updateMarks() +{ + //do nothing +} +/*void YACReaderFlowGL::setFlowType(FlowType flowType) +{ + //TODO esperar a que se reimplemente flowtype +}*/ +void YACReaderFlowGL::render() +{ + //do nothing +} + +//EVENTOS +void YACReaderFlowGL::wheelEvent(QWheelEvent * event) +{ + Movement m = getMovement(event); + switch (m) { + case None: + return; + case Forward: + showNext(); + break; + case Backward: + showPrevious(); + break; + default: + break; + } +} + +void YACReaderFlowGL::keyPressEvent(QKeyEvent *event) +{ + if(event->key() == Qt::Key_Left) + { + if(event->modifiers() == Qt::ControlModifier) + setCurrentIndex((currentSelected-10<0)?0:currentSelected-10); + else + showPrevious(); + event->accept(); + return; + } + + if(event->key() == Qt::Key_Right) + { + if(event->modifiers() == Qt::ControlModifier) + setCurrentIndex((currentSelected+10>=numObjects)?numObjects-1:currentSelected+10); + else + showNext(); + event->accept(); + return; + } + + if(event->key() == Qt::Key_Up) + { + //emit selected(centerIndex()); + return; + } + + event->ignore(); +} + +void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) +{ + if(event->button() == Qt::LeftButton) + { + float x,y; + x = event->x(); + y = event->y(); + GLint viewport[4]; + GLdouble modelview[16]; + GLdouble projection[16]; + GLfloat winX, winY, winZ; + GLdouble posX, posY, posZ; + + glGetDoublev( GL_MODELVIEW_MATRIX, modelview ); + glGetDoublev( GL_PROJECTION_MATRIX, projection ); + glGetIntegerv( GL_VIEWPORT, viewport ); + + winX = (float)x; + winY = (float)viewport[3] - (float)y; + glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); + + gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); + + if(posX >= 0.5) + { + //int index = currentSelected+1; + //while((cfImages[index].current.x-cfImages[index].width/(2.0*config.rotation)) < posX) + // index++; + //setCurrentIndex(index-1); + showNext(); + } + else if(posX <=-0.5) + showPrevious(); + } else + QGLWidget::mousePressEvent(event); +} + +void YACReaderFlowGL::mouseDoubleClickEvent(QMouseEvent* event) +{ + float x,y; + x = event->x(); + y = event->y(); + GLint viewport[4]; + GLdouble modelview[16]; + GLdouble projection[16]; + GLfloat winX, winY, winZ; + GLdouble posX, posY, posZ; + + glGetDoublev( GL_MODELVIEW_MATRIX, modelview ); + glGetDoublev( GL_PROJECTION_MATRIX, projection ); + glGetIntegerv( GL_VIEWPORT, viewport ); + + winX = (float)x; + winY = (float)viewport[3] - (float)y; + glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); + + gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); + + if(posX <= 0.5 && posX >= -0.5) + { + emit selected(centerIndex()); + event->accept(); + } + +} + +YACReaderComicFlowGL::YACReaderComicFlowGL(QWidget *parent,struct Preset p ) + :YACReaderFlowGL(parent,p) +{ + worker = new ImageLoaderGL(this); + worker->flow = this; +} + +void YACReaderComicFlowGL::setImagePaths(QStringList paths) +{ + worker->reset(); + reset(); + numObjects = 0; + if(lazyPopulateObjects!=-1 || hasBeenInitialized) + YACReaderFlowGL::populate(paths.size()); + lazyPopulateObjects = paths.size(); + this->paths = paths; + //numObjects = paths.size(); +} + + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +void YACReaderComicFlowGL::updateImageData() +{ + // can't do anything, wait for the next possibility + if(worker->busy()) + return; + + // set image of last one + int idx = worker->index(); + if( idx >= 0 && !worker->result().isNull()) + { + if(!loaded[idx]) + { + float x = 1; + QImage img = worker->result(); + GLuint cover; + if(performance == high || performance == ultraHigh) + cover = bindTexture(img, GL_TEXTURE_2D,GL_RGB,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption); + else + cover = bindTexture(img, GL_TEXTURE_2D,GL_RGB,QGLContext::LinearFilteringBindOption); + float y = 1 * (float(img.height())/img.width()); + QString s = "cover"; + replace(s.toLocal8Bit().data(), cover, x, y,idx); + /*CFImages[idx].width = x; + CFImages[idx].height = y; + CFImages[idx].img = worker->resultTexture; + strcpy(CFImages[idx].name,"cover");*/ + //loaded[idx] = true; + //numImagesLoaded++; + } + } + + // try to load only few images on the left and right side + // i.e. all visible ones plus some extra + int count=8; + switch(performance) + { + case low: + count = 8; + break; + case medium: + count = 10; + break; + case high: + count = 12; + break; + case ultraHigh: + count = 14; + break; + } + int * indexes = new int[2*count+1]; + int center = currentSelected; + indexes[0] = center; + for(int j = 0; j < count; j++) + { + indexes[j*2+1] = center+j+1; + indexes[j*2+2] = center-j-1; + } + for(int c = 0; c < 2*count+1; c++) + { + int i = indexes[c]; + if((i >= 0) && (i < numObjects)) + if(!loaded[i])//slide(i).isNull()) + { + //loader->loadTexture(i); + //loaded[i]=true; + // schedule thumbnail generation + if(paths.size()>0) + { + QString fname = paths.at(i); + //loaded[i]=true; + + worker->generate(i, fname); + } + delete[] indexes; + return; + } + } +} + +void YACReaderComicFlowGL::remove(int item) +{ + worker->lock(); + worker->reset(); + YACReaderFlowGL::remove(item); + if(item >= 0 && item < paths.size()) + paths.removeAt(item); + worker->unlock(); +} + +void YACReaderComicFlowGL::resortCovers(QList newOrder) +{ + worker->lock(); + worker->reset();//is this necesary? + startAnimationTimer(); + QList pathsNew; + QVector loadedNew; + QVector marksNew; + QVector imagesNew; + + int index = 0; + foreach (int i, newOrder) { + pathsNew << paths.at(i); + loadedNew << loaded.at(i); + marksNew << marks.at(i); + imagesNew << images.at(i); + imagesNew.last().index = index++; + } + + paths = pathsNew; + loaded = loadedNew; + marks = marksNew; + images = imagesNew; + + worker->unlock(); +} + +YACReaderPageFlowGL::YACReaderPageFlowGL(QWidget *parent,struct Preset p ) + :YACReaderFlowGL(parent,p) +{ + worker = new ImageLoaderByteArrayGL(this); + worker->flow = this; +} + +YACReaderPageFlowGL::~YACReaderPageFlowGL() +{ + this->killTimer(timerId); + //worker->deleteLater(); + rawImages.clear(); +} + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +void YACReaderPageFlowGL::updateImageData() +{ + // can't do anything, wait for the next possibility + if(worker->busy()) + return; + + // set image of last one + int idx = worker->index(); + if( idx >= 0 && !worker->result().isNull()) + { + if(!loaded[idx]) + { + float x = 1; + QImage img = worker->result(); + GLuint cover; + if(performance == high || performance == ultraHigh) + cover = bindTexture(img, GL_TEXTURE_2D,GL_RGB,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption); + else + cover = bindTexture(img, GL_TEXTURE_2D,GL_RGB,QGLContext::LinearFilteringBindOption); + float y = 1 * (float(img.height())/img.width()); + QString s = "cover"; + replace(s.toLocal8Bit().data(), cover, x, y,idx); + loaded[idx] = true; + + } + } + + // try to load only few images on the left and right side + // i.e. all visible ones plus some extra + int count=8; + switch(performance) + { + case low: + count = 8; + break; + case medium: + count = 10; + break; + case high: + count = 12; + break; + case ultraHigh: + count = 14; + break; + } + int * indexes = new int[2*count+1]; + int center = currentSelected; + indexes[0] = center; + for(int j = 0; j < count; j++) + { + indexes[j*2+1] = center+j+1; + indexes[j*2+2] = center-j-1; + } + for(int c = 0; c < 2*count+1; c++) + { + int i = indexes[c]; + if((i >= 0) && (i < numObjects)) + if(rawImages.size()>0) + + if(!loaded[i]&&imagesReady[i])//slide(i).isNull()) + { + worker->generate(i, rawImages.at(i)); + + delete[] indexes; + return; + } + } +} + +void YACReaderPageFlowGL::populate(int n) +{ + worker->reset(); + if(lazyPopulateObjects!=-1 || hasBeenInitialized) + YACReaderFlowGL::populate(n); + lazyPopulateObjects = n; + imagesReady = QVector (n,false); + rawImages = QVector (n); + imagesSetted = QVector (n,false); //puede sobrar +} + + +//----------------------------------------------------------------------------- +//ImageLoader +//----------------------------------------------------------------------------- +QImage ImageLoaderGL::loadImage(const QString& fileName) +{ + QImage image; + bool result = image.load(fileName); + + switch(flow->performance) + { + case low: + image = image.scaledToWidth(200,Qt::SmoothTransformation); + break; + case medium: + image = image.scaledToWidth(256,Qt::SmoothTransformation); + break; + case high: + image = image.scaledToWidth(320,Qt::SmoothTransformation); + break; + + } + + if(!result) + return QImage(); + + return image; +} + +ImageLoaderGL::ImageLoaderGL(YACReaderFlowGL * flow): +QThread(),flow(flow),restart(false), working(false), idx(-1) +{ + +} + +ImageLoaderGL::~ImageLoaderGL() +{ + mutex.lock(); + condition.wakeOne(); + mutex.unlock(); + wait(); +} + +bool ImageLoaderGL::busy() const +{ + return isRunning() ? working : false; +} + +void ImageLoaderGL::generate(int index, const QString& fileName) +{ + mutex.lock(); + this->idx = index; + this->fileName = fileName; + this->size = size; + this->img = QImage(); + mutex.unlock(); + + if (!isRunning()) + start(); + else + { + // already running, wake up whenever ready + restart = true; + condition.wakeOne(); + } +} + +void ImageLoaderGL::lock() +{ + mutex.lock(); +} + +void ImageLoaderGL::unlock() +{ + mutex.unlock(); +} + +void ImageLoaderGL::run() +{ + for(;;) + { + // copy necessary data + mutex.lock(); + this->working = true; + QString fileName = this->fileName; + mutex.unlock(); + + QImage image = loadImage(fileName); + + // let everyone knows it is ready + mutex.lock(); + this->working = false; + this->img = image; + mutex.unlock(); + + // put to sleep + mutex.lock(); + if (!this->restart) + condition.wait(&mutex); + restart = false; + mutex.unlock(); + } +} + +QImage ImageLoaderGL::result() +{ + return img; +} + +//----------------------------------------------------------------------------- +//ImageLoader +//----------------------------------------------------------------------------- +QImage ImageLoaderByteArrayGL::loadImage(const QByteArray& raw) +{ + QImage image; + bool result = image.loadFromData(raw); + + switch(flow->performance) + { + case low: + image = image.scaledToWidth(128,Qt::SmoothTransformation); + break; + case medium: + image = image.scaledToWidth(196,Qt::SmoothTransformation); + break; + case high: + image = image.scaledToWidth(256,Qt::SmoothTransformation); + break; + case ultraHigh: + image = image.scaledToWidth(320,Qt::SmoothTransformation); + break; + } + + if(!result) + return QImage(); + + return image; +} + +ImageLoaderByteArrayGL::ImageLoaderByteArrayGL(YACReaderFlowGL * flow): +QThread(),flow(flow),restart(false), working(false), idx(-1) +{ + +} + +ImageLoaderByteArrayGL::~ImageLoaderByteArrayGL() +{ + mutex.lock(); + condition.wakeOne(); + mutex.unlock(); + wait(); +} + +bool ImageLoaderByteArrayGL::busy() const +{ + return isRunning() ? working : false; +} + +void ImageLoaderByteArrayGL::generate(int index, const QByteArray& raw) +{ + mutex.lock(); + this->idx = index; + this->rawData = raw; + this->size = size; + this->img = QImage(); + mutex.unlock(); + + if (!isRunning()) + start(); + else + { + // already running, wake up whenever ready + restart = true; + condition.wakeOne(); + } +} + +void ImageLoaderByteArrayGL::run() +{ + for(;;) + { + // copy necessary data + mutex.lock(); + this->working = true; + QByteArray raw = this->rawData; + mutex.unlock(); + + QImage image = loadImage(raw); + + // let everyone knows it is ready + mutex.lock(); + this->working = false; + this->img = image; + mutex.unlock(); + + // put to sleep + mutex.lock(); + if (!this->restart) + condition.wait(&mutex); + restart = false; + mutex.unlock(); + } +} + +QImage ImageLoaderByteArrayGL::result() +{ + return img; +} + diff --git a/common/gl_legacy/yacreader_flow_gl.h b/common/gl_legacy/yacreader_flow_gl.h new file mode 100644 index 00000000..ba025253 --- /dev/null +++ b/common/gl_legacy/yacreader_flow_gl.h @@ -0,0 +1,380 @@ +//OpenGL Coverflow API by J.Roth +#ifndef __YACREADER_FLOW_GL_H +#define __YACREADER_FLOW_GL_H + +#include +#include +#include +#include + +#include +#include +#include + +#include "pictureflow.h" //TODO mover los tipos de flow de sitio +#include "scroll_management.h" + +class ImageLoaderGL; +class QGLContext; +class WidgetLoader; +class ImageLoaderByteArrayGL; + +enum Performance +{ + low=0, + medium, + high, + ultraHigh +}; + +//Cover Vector +struct YACReader3DVector{ + float x; + float y; + float z; + float rot; +}; + +//the image/texture info struct +struct YACReader3DImage{ + GLuint texture; + //char name[256]; + + float width; + float height; + + int index; + + YACReader3DVector current; + YACReader3DVector animEnd; +}; + +struct Preset{ + /*** Animation Settings ***/ + //sets the speed of the animation + float animationStep; + //sets the acceleration of the animation + float animationSpeedUp; + //sets the maximum speed of the animation + float animationStepMax; + //sets the distance of view + float animationFadeOutDist; + //sets the rotation increasion + float preRotation; + //sets the light strenght on rotation + float viewRotateLightStrenght; + //sets the speed of the rotation + float viewRotateAdd; + //sets the speed of reversing the rotation + float viewRotateSub; + //sets the maximum view angle + float viewAngle; + + /*** Position Configuration ***/ + //the X Position of the Coverflow + float cfX; + //the Y Position of the Coverflow + float cfY; + //the Z Position of the Coverflow + float cfZ; + //the X Rotation of the Coverflow + float cfRX; + //the Y Rotation of the Coverflow + float cfRY; + //the Z Rotation of the Coverflow + float cfRZ; + //sets the rotation of each cover + float rotation; + //sets the distance between the covers + float xDistance; + //sets the distance between the centered and the non centered covers + float centerDistance; + //sets the pushback amount + float zDistance; + //sets the elevation amount + float yDistance; + + float zoom; +}; + +extern struct Preset defaultYACReaderFlowConfig; +extern struct Preset presetYACReaderFlowClassicConfig; +extern struct Preset presetYACReaderFlowStripeConfig; +extern struct Preset presetYACReaderFlowOverlappedStripeConfig; +extern struct Preset pressetYACReaderFlowUpConfig; +extern struct Preset pressetYACReaderFlowDownConfig; + +class YACReaderFlowGL : public QGLWidget, public ScrollManagement +{ + Q_OBJECT +protected: + int timerId; + /*** System variables ***/ + YACReader3DImage dummy; + int viewRotateActive; + float stepBackup; + + /*functions*/ + void calcPos(YACReader3DImage & image, int pos); + void calcVector(YACReader3DVector & vector, int pos); + //returns true if the animation is finished for Current + bool animate(YACReader3DVector ¤tVector, YACReader3DVector &toVector); + void drawCover(const YACReader3DImage & image); + + void udpatePerspective(int width, int height); + + int updateCount; + WidgetLoader * loader; + int fontSize; + + GLuint defaultTexture; + GLuint markTexture; + GLuint readingTexture; + void initializeGL(); + void paintGL(); + void timerEvent(QTimerEvent *); + + //number of Covers + int numObjects; + int lazyPopulateObjects; + bool showMarks; + QVector loaded; + QVector marks; + QVector images; + bool hasBeenInitialized; + + Performance performance; + bool bUseVSync; + + /*** Animation Settings ***/ + Preset config; + + //sets/returns the curent selected cover + int currentSelected; + + //defines the position of the centered cover + YACReader3DVector centerPos; + + /*** Style ***/ + //sets the amount of shading of the covers in the back (0-1) + float shadingTop; + float shadingBottom; + + //sets the reflection strenght (0-1) + float reflectionUp; + float reflectionBottom; + + /*** System info ***/ + float viewRotate; + + //sets the updateInterval in ms + static int updateInterval; + + void startAnimationTimer(); + void stopAnimationTimer(); + +public: + + + /*Constructor*/ + YACReaderFlowGL(QWidget *parent = 0,struct Preset p = pressetYACReaderFlowDownConfig); + virtual ~YACReaderFlowGL(); + + //size; + QSize minimumSizeHint() const; + //QSize sizeHint() const; + + /*functions*/ + + //if called it moves the coverflow to the left + void showPrevious(); + //if called it moves the coverflow to the right + void showNext(); + //go to + void setCurrentIndex(int pos); + //must be called whenever the coverflow animation is stopped + void cleanupAnimation(); + //Draws the coverflow + void draw(); + //updates the coverflow + void updatePositions(); + //inserts a new item to the coverflow + //if item is set to a value > -1 it updates a already set value + //otherwise a new entry is set + void insert(const char *name, GLuint Tex, float x, float y,int item = -1); + //removes a item + virtual void remove(int item); + //replaces the texture of the item 'item' with Tex + void replace(const char *name, GLuint Tex, float x, float y,int item); + //create n covers with the default nu + void populate(int n); + /*Info*/ + //retuns the YACReader3DImage Struct of the current selected item + //to read title or textures + YACReader3DImage getCurrentSelected(); + + public slots: + void setCF_RX(int value); + //the Y Rotation of the Coverflow + void setCF_RY(int value); + //the Z Rotation of the Coverflow + void setCF_RZ(int value); + + //perspective + void setZoom(int zoom); + + void setRotation(int angle); + //sets the distance between the covers + void setX_Distance(int distance); + //sets the distance between the centered and the non centered covers + void setCenter_Distance(int distance); + //sets the pushback amount + void setZ_Distance(int distance); + + void setCF_Y(int value); + void setCF_Z(int value); + + void setY_Distance(int value); + + void setFadeOutDist(int value); + + void setLightStrenght(int value); + + void setMaxAngle(int value); + + void setPreset(const Preset & p); + + void setPerformance(Performance performance); + + void useVSync(bool b); + + virtual void updateImageData() = 0; + + void reset(); + void reload(); + + //interface with yacreaderlibrary, compatibility + void setShowMarks(bool value); + void setMarks(QVector marks); + void setMarkImage(QImage & image); + void markSlide(int index, YACReaderComicReadStatus status); + void unmarkSlide(int index); + void setSlideSize(QSize size); + void clear(); + void setCenterIndex(unsigned int index); + void showSlide(int index); + int centerIndex(); + void updateMarks(); + //void setFlowType(PictureFlow::FlowType flowType); + void render(); + + //void paintEvent(QPaintEvent *event); + void mouseDoubleClickEvent(QMouseEvent* event); + void mousePressEvent(QMouseEvent *event); + void wheelEvent(QWheelEvent * event); + void keyPressEvent(QKeyEvent *event); + void resizeGL(int width, int height); + friend class ImageLoaderGL; + friend class ImageLoaderByteArrayGL; + +signals: + void centerIndexChanged(int); + void selected(unsigned int); +}; + +class YACReaderComicFlowGL : public YACReaderFlowGL +{ +public: + YACReaderComicFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig); + void setImagePaths(QStringList paths); + void updateImageData(); + void remove(int item); + void resortCovers(QList newOrder); + friend class ImageLoaderGL; +private: + ImageLoaderGL * worker; +protected: + QList paths; + +}; + +class YACReaderPageFlowGL : public YACReaderFlowGL +{ +public: + YACReaderPageFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig); + ~YACReaderPageFlowGL(); + void updateImageData(); + void populate(int n); + QVector imagesReady; + QVector rawImages; + QVector imagesSetted; + friend class ImageLoaderByteArrayGL; +private: + ImageLoaderByteArrayGL * worker; +}; + +class ImageLoaderGL : public QThread +{ +public: + ImageLoaderGL(YACReaderFlowGL * flow); + ~ImageLoaderGL(); + // returns FALSE if worker is still busy and can't take the task + bool busy() const; + void generate(int index, const QString& fileName); + void reset(){idx = -1;fileName="";} + int index() const { return idx; } + void lock(); + void unlock(); + QImage result(); + YACReaderFlowGL * flow; + GLuint resultTexture; + QImage loadImage(const QString& fileName); + +protected: + void run(); + +private: + QMutex mutex; + QWaitCondition condition; + + + bool restart; + bool working; + int idx; + QString fileName; + QSize size; + QImage img; +}; + +class ImageLoaderByteArrayGL : public QThread +{ +public: + ImageLoaderByteArrayGL(YACReaderFlowGL * flow); + ~ImageLoaderByteArrayGL(); + // returns FALSE if worker is still busy and can't take the task + bool busy() const; + void generate(int index, const QByteArray& raw); + void reset(){idx = -1; rawData.clear();} + int index() const { return idx; } + QImage result(); + YACReaderFlowGL * flow; + GLuint resultTexture; + QImage loadImage(const QByteArray& rawData); + +protected: + void run(); + +private: + QMutex mutex; + QWaitCondition condition; + + + bool restart; + bool working; + int idx; + QByteArray rawData; + QSize size; + QImage img; +}; + +#endif diff --git a/compressed_archive/compressed_archive.cpp b/compressed_archive/compressed_archive.cpp index 77fc9b1e..25bcc2ee 100644 --- a/compressed_archive/compressed_archive.cpp +++ b/compressed_archive/compressed_archive.cpp @@ -2,6 +2,7 @@ #include "extract_delegate.h" #include +#include #include #include @@ -201,7 +202,16 @@ bool CompressedArchive::loadFunctions() #if defined Q_OS_MAC rarLib = new QLibrary(QApplication::applicationDirPath()+"/utils/Codecs/Rar29"); #else - rarLib = new QLibrary(QString(LIBDIR)+"/p7zip/Codecs/Rar29.so"); + //check if a yacreader specific version of p7zip exists on the system + QFileInfo rarCodec(QString(LIBDIR)+"/yacreader/Codecs/Rar29.so"); + if (rarCodec.exists()) + { + rarLib = new QLibrary(rarCodec.absoluteFilePath()); + } + else + { + rarLib = new QLibrary(QString(LIBDIR)+"/p7zip/Codecs/Rar29.so"); + } #endif if(!rarLib->load()) { @@ -211,7 +221,15 @@ bool CompressedArchive::loadFunctions() } #endif #if defined Q_OS_UNIX && !defined Q_OS_MAC - sevenzLib = new QLibrary(QString(LIBDIR)+"/p7zip/7z.so"); + QFileInfo sevenzlibrary(QString(LIBDIR)+"/yacreader/7z.so"); + if (sevenzlibrary.exists()) + { + sevenzLib = new QLibrary(sevenzlibrary.absoluteFilePath()); + } + else + { + sevenzLib = new QLibrary(QString(LIBDIR)+"/p7zip/7z.so"); + } #else sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z"); #endif diff --git a/custom_widgets/custom_widgets_yacreader.pri b/custom_widgets/custom_widgets_yacreader.pri index 8878e64f..fcadc933 100644 --- a/custom_widgets/custom_widgets_yacreader.pri +++ b/custom_widgets/custom_widgets_yacreader.pri @@ -6,11 +6,13 @@ HEADERS += $$PWD/help_about_dialog.h \ $$PWD/yacreader_field_plain_text_edit.h \ $$PWD/yacreader_flow.h \ $$PWD/yacreader_flow_config_widget.h \ - $$PWD/yacreader_gl_flow_config_widget.h \ $$PWD/yacreader_options_dialog.h \ $$PWD/yacreader_spin_slider_widget.h \ $$PWD/yacreader_tool_bar_stretch.h \ $$PWD/yacreader_busy_widget.h +!CONFIG(no_opengl) { + HEADERS += $$PWD/yacreader_gl_flow_config_widget.h +} macx{ HEADERS += $$PWD/yacreader_macosx_toolbar.h @@ -23,11 +25,13 @@ SOURCES += $$PWD/help_about_dialog.cpp \ $$PWD/yacreader_field_plain_text_edit.cpp \ $$PWD/yacreader_flow.cpp \ $$PWD/yacreader_flow_config_widget.cpp \ - $$PWD/yacreader_gl_flow_config_widget.cpp \ $$PWD/yacreader_options_dialog.cpp \ $$PWD/yacreader_spin_slider_widget.cpp \ $$PWD/yacreader_tool_bar_stretch.cpp \ $$PWD/yacreader_busy_widget.cpp +!CONFIG(no_opengl) { + SOURCES += $$PWD/yacreader_gl_flow_config_widget.cpp +} macx{ OBJECTIVE_SOURCES += $$PWD/yacreader_macosx_toolbar.mm } diff --git a/custom_widgets/custom_widgets_yacreaderlibrary.pri b/custom_widgets/custom_widgets_yacreaderlibrary.pri index 40308ef6..ccb13afe 100644 --- a/custom_widgets/custom_widgets_yacreaderlibrary.pri +++ b/custom_widgets/custom_widgets_yacreaderlibrary.pri @@ -6,7 +6,6 @@ HEADERS += $$PWD/help_about_dialog.h \ $$PWD/yacreader_field_plain_text_edit.h \ $$PWD/yacreader_flow.h \ $$PWD/yacreader_flow_config_widget.h \ - $$PWD/yacreader_gl_flow_config_widget.h \ $$PWD/yacreader_options_dialog.h \ $$PWD/yacreader_search_line_edit.h \ $$PWD/yacreader_spin_slider_widget.h \ @@ -19,6 +18,9 @@ HEADERS += $$PWD/help_about_dialog.h \ $$PWD/yacreader_library_item_widget.h \ $$PWD/yacreader_treeview.h \ $$PWD/yacreader_busy_widget.h +!CONFIG(no_opengl){ + HEADERS += $$PWD/yacreader_gl_flow_config_widget.h +} macx{ HEADERS += $$PWD/yacreader_macosx_toolbar.h @@ -29,7 +31,6 @@ SOURCES += $$PWD/help_about_dialog.cpp \ $$PWD/yacreader_field_plain_text_edit.cpp \ $$PWD/yacreader_flow.cpp \ $$PWD/yacreader_flow_config_widget.cpp \ - $$PWD/yacreader_gl_flow_config_widget.cpp \ $$PWD/yacreader_options_dialog.cpp \ $$PWD/yacreader_search_line_edit.cpp \ $$PWD/yacreader_spin_slider_widget.cpp \ @@ -43,6 +44,10 @@ SOURCES += $$PWD/help_about_dialog.cpp \ $$PWD/yacreader_treeview.cpp \ $$PWD/yacreader_busy_widget.cpp +!CONFIG(no_opengl){ + SOURCES += $$PWD/yacreader_gl_flow_config_widget.cpp +} + macx{ OBJECTIVE_SOURCES += $$PWD/yacreader_macosx_toolbar.mm } diff --git a/custom_widgets/yacreader_options_dialog.cpp b/custom_widgets/yacreader_options_dialog.cpp index c89b44dc..4047acea 100644 --- a/custom_widgets/yacreader_options_dialog.cpp +++ b/custom_widgets/yacreader_options_dialog.cpp @@ -1,7 +1,11 @@ #include "yacreader_options_dialog.h" #include "yacreader_flow_config_widget.h" +#ifndef NO_OPENGL #include "yacreader_gl_flow_config_widget.h" +#else +#include "pictureflow.h" +#endif #include "yacreader_spin_slider_widget.h" #include "yacreader_global.h" @@ -11,14 +15,16 @@ #include #include #include +#include YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) :QDialog(parent) { sw = new YACReaderFlowConfigWidget(this); +#ifndef NO_OPENGL gl = new YACReaderGLFlowConfigWidget(this); - +#endif accept = new QPushButton(tr("Save")); cancel = new QPushButton(tr("Cancel")); @@ -37,15 +43,15 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions())); connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions())); //TODO fix this connect(cancel,SIGNAL(clicked()),this,SLOT(close())); - +#ifndef NO_OPENGL useGL = new QCheckBox(tr("Use hardware acceleration (restart needed)")); connect(useGL,SIGNAL(stateChanged(int)),this,SLOT(saveUseGL(int))); - +#endif //sw CONNECTIONS connect(sw->radio1,SIGNAL(toggled(bool)),this,SLOT(setClassicConfigSW())); connect(sw->radio2,SIGNAL(toggled(bool)),this,SLOT(setStripeConfigSW())); connect(sw->radio3,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfigSW())); - +#ifndef NO_OPENGL //gl CONNECTIONS connect(gl->radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig())); connect(gl->radioStripe,SIGNAL(toggled(bool)),this,SLOT(setStripeConfig())); @@ -96,8 +102,10 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) connect(gl->performanceSlider, SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged())); connect(gl->vSyncCheck,SIGNAL(stateChanged(int)),this,SLOT(saveUseVSync(int))); +#endif } +#ifndef NO_OPENGL void YACReaderOptionsDialog::savePerformance(int value) { settings->setValue(PERFORMANCE,value); @@ -122,6 +130,7 @@ void YACReaderOptionsDialog::saveFlowParameters() settings->setValue(LIGHT_STRENGTH,gl->lightStrength->getValue()); settings->setValue(MAX_ANGLE,gl->maxAngle->getValue()); } +#endif void YACReaderOptionsDialog::saveOptions() { @@ -129,8 +138,10 @@ void YACReaderOptionsDialog::saveOptions() close(); } +#ifndef NO_OPENGL void YACReaderOptionsDialog::saveUseGL(int b) { + if(Qt::Checked == b) { sw->setVisible(false); @@ -144,9 +155,10 @@ void YACReaderOptionsDialog::saveUseGL(int b) resize(0,0); settings->setValue(USE_OPEN_GL,b); - } +#endif +#ifndef NO_OPENGL void YACReaderOptionsDialog::saveXRotation(int value) { settings->setValue(FLOW_TYPE_GL,Custom); @@ -203,13 +215,13 @@ void YACReaderOptionsDialog::saveMaxAngle(int value) settings->setValue(FLOW_TYPE_GL,Custom); settings->setValue(MAX_ANGLE,value); } - +#endif void YACReaderOptionsDialog::restoreOptions(QSettings * settings) { this->settings = settings; //FLOW CONFIG - +#ifndef NO_OPENGL if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toInt() == Qt::Checked) { sw->setVisible(false); @@ -305,8 +317,9 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings) } //END FLOW CONFIG + #endif } - +#ifndef NO_OPENGL void YACReaderOptionsDialog::loadConfig() { gl->xRotation->setValue(settings->value(X_ROTATION).toInt()); @@ -321,7 +334,7 @@ void YACReaderOptionsDialog::loadConfig() gl->lightStrength->setValue(settings->value(LIGHT_STRENGTH).toInt()); gl->maxAngle->setValue(settings->value(MAX_ANGLE).toInt()); } - +#endif void YACReaderOptionsDialog::setClassicConfigSW() { settings->setValue(FLOW_TYPE_SW,CoverFlowLike); @@ -337,6 +350,7 @@ void YACReaderOptionsDialog::setOverlappedStripeConfigSW() settings->setValue(FLOW_TYPE_SW,StripOverlapped); } +#ifndef NO_OPENGL void YACReaderOptionsDialog::setClassicConfig() { settings->setValue(FLOW_TYPE_GL,CoverFlowLike); @@ -381,3 +395,4 @@ void YACReaderOptionsDialog::setRouletteConfig() saveFlowParameters(); } +#endif \ No newline at end of file diff --git a/custom_widgets/yacreader_options_dialog.h b/custom_widgets/yacreader_options_dialog.h index 9b347ae8..8921e661 100644 --- a/custom_widgets/yacreader_options_dialog.h +++ b/custom_widgets/yacreader_options_dialog.h @@ -4,7 +4,9 @@ #include class YACReaderFlowConfigWidget; +#ifndef NO_OPENGL class YACReaderGLFlowConfigWidget; +#endif class QCheckBox; class QPushButton; class QSettings; @@ -15,8 +17,10 @@ class YACReaderOptionsDialog : public QDialog Q_OBJECT protected: YACReaderFlowConfigWidget * sw; + #ifndef NO_OPENGL YACReaderGLFlowConfigWidget * gl; QCheckBox * useGL; + #endif QPushButton * accept; QPushButton * cancel; @@ -32,6 +36,7 @@ public slots: virtual void restoreOptions(QSettings * settings); virtual void saveOptions(); protected slots: +#ifndef NO_OPENGL virtual void savePerformance(int value); virtual void saveUseVSync(int b); virtual void saveUseGL(int b); @@ -52,10 +57,12 @@ protected slots: virtual void setOverlappedStripeConfig(); virtual void setModernConfig(); virtual void setRouletteConfig(); + virtual void saveFlowParameters(); +#endif virtual void setClassicConfigSW(); virtual void setStripeConfigSW(); virtual void setOverlappedStripeConfigSW(); - virtual void saveFlowParameters(); + signals: void optionsChanged(); diff --git a/dependencies/poppler/bin/poppler-qt4.dll b/dependencies/poppler/bin/poppler-qt4.dll deleted file mode 100644 index f5b21d16..00000000 Binary files a/dependencies/poppler/bin/poppler-qt4.dll and /dev/null differ diff --git a/dependencies/poppler/bin/poppler-qt4.dll.manifest b/dependencies/poppler/bin/poppler-qt4.dll.manifest deleted file mode 100644 index e693382a..00000000 --- a/dependencies/poppler/bin/poppler-qt4.dll.manifest +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/dependencies/poppler/include/qt4/poppler-annotation-helper.h b/dependencies/poppler/include/qt4/poppler-annotation-helper.h deleted file mode 100644 index 5f335c04..00000000 --- a/dependencies/poppler/include/qt4/poppler-annotation-helper.h +++ /dev/null @@ -1,198 +0,0 @@ -/* poppler-annotation-helper.h: qt interface to poppler - * Copyright (C) 2006, 2008, Albert Astals Cid - * Copyright (C) 2008, Pino Toscano - * Copyright (C) 2012, Fabio D'Urso - * Adapting code from - * Copyright (C) 2004 by Enrico Ros - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include - -#include - -class QColor; - -class AnnotColor; - -namespace Poppler { - -class XPDFReader -{ - public: - // find named symbol and parse it - static inline void lookupName( Dict *, char *, QString & dest ); - static inline void lookupString( Dict *, char *, QString & dest ); - static inline void lookupBool( Dict *, char *, bool & dest ); - static inline void lookupInt( Dict *, char *, int & dest ); - static inline void lookupNum( Dict *, char *, double & dest ); - static inline int lookupNumArray( Dict *, char *, double * dest, int len ); - static inline void lookupColor( Dict *, char *, QColor & color ); - static inline void lookupIntRef( Dict *, char *, int & dest ); - static inline void lookupDate( Dict *, char *, QDateTime & dest ); - // transform from user coords to normalized ones using the matrix M - static inline void transform( double * M, double x, double y, QPointF &res ); - static inline void invTransform( double * M, const QPointF &p, double &x, double &y ); -}; - -void XPDFReader::lookupName( Dict * dict, char * type, QString & dest ) -{ - Object nameObj; - dict->lookup( type, &nameObj ); - if ( nameObj.isNull() ) - return; - if ( nameObj.isName() ) - dest = nameObj.getName(); - else - qDebug() << type << " is not Name." << endl; - nameObj.free(); -} - -void XPDFReader::lookupString( Dict * dict, char * type, QString & dest ) -{ - Object stringObj; - dict->lookup( type, &stringObj ); - if ( stringObj.isNull() ) - return; - if ( stringObj.isString() ) - dest = stringObj.getString()->getCString(); - else - qDebug() << type << " is not String." << endl; - stringObj.free(); -} - -void XPDFReader::lookupBool( Dict * dict, char * type, bool & dest ) -{ - Object boolObj; - dict->lookup( type, &boolObj ); - if ( boolObj.isNull() ) - return; - if ( boolObj.isBool() ) - dest = boolObj.getBool() == gTrue; - else - qDebug() << type << " is not Bool." << endl; - boolObj.free(); -} - -void XPDFReader::lookupInt( Dict * dict, char * type, int & dest ) -{ - Object intObj; - dict->lookup( type, &intObj ); - if ( intObj.isNull() ) - return; - if ( intObj.isInt() ) - dest = intObj.getInt(); - else - qDebug() << type << " is not Int." << endl; - intObj.free(); -} - -void XPDFReader::lookupNum( Dict * dict, char * type, double & dest ) -{ - Object numObj; - dict->lookup( type, &numObj ); - if ( numObj.isNull() ) - return; - if ( numObj.isNum() ) - dest = numObj.getNum(); - else - qDebug() << type << " is not Num." << endl; - numObj.free(); -} - -int XPDFReader::lookupNumArray( Dict * dict, char * type, double * dest, int len ) -{ - Object arrObj; - dict->lookup( type, &arrObj ); - if ( arrObj.isNull() ) - return 0; - Object numObj; - if ( arrObj.isArray() ) - { - len = qMin( len, arrObj.arrayGetLength() ); - for ( int i = 0; i < len; i++ ) - { - dest[i] = arrObj.arrayGet( i, &numObj )->getNum(); - numObj.free(); - } - } - else - { - len = 0; - qDebug() << type << "is not Array." << endl; - } - arrObj.free(); - return len; -} - -void XPDFReader::lookupColor( Dict * dict, char * type, QColor & dest ) -{ - double c[3]; - if ( XPDFReader::lookupNumArray( dict, type, c, 3 ) == 3 ) - dest = QColor( (int)(c[0]*255.0), (int)(c[1]*255.0), (int)(c[2]*255.0)); -} - -void XPDFReader::lookupIntRef( Dict * dict, char * type, int & dest ) -{ - Object refObj; - dict->lookupNF( type, &refObj ); - if ( refObj.isNull() ) - return; - if ( refObj.isRef() ) - dest = refObj.getRefNum(); - else - qDebug() << type << " is not Ref." << endl; - refObj.free(); -} - -void XPDFReader::lookupDate( Dict * dict, char * type, QDateTime & dest ) -{ - Object dateObj; - dict->lookup( type, &dateObj ); - if ( dateObj.isNull() ) - return; - if ( dateObj.isString() ) - { - dest = convertDate( dateObj.getString()->getCString() ); - } - else - qDebug() << type << " is not Date" << endl; - dateObj.free(); -} - -void XPDFReader::transform( double * M, double x, double y, QPointF &res ) -{ - res.setX( M[0] * x + M[2] * y + M[4] ); - res.setY( M[1] * x + M[3] * y + M[5] ); -} - -void XPDFReader::invTransform( double * M, const QPointF &p, double &x, double &y ) -{ - const double det = M[0]*M[3] - M[1]*M[2]; - Q_ASSERT(det != 0); - - const double invM[4] = { M[3]/det, -M[1]/det, -M[2]/det, M[0]/det }; - const double xt = p.x() - M[4]; - const double yt = p.y() - M[5]; - - x = invM[0] * xt + invM[2] * yt; - y = invM[1] * xt + invM[3] * yt; -} - -QColor convertAnnotColor( AnnotColor *color ); -AnnotColor* convertQColor( const QColor &color ); - -} diff --git a/dependencies/poppler/include/qt4/poppler-annotation-private.h b/dependencies/poppler/include/qt4/poppler-annotation-private.h deleted file mode 100644 index 3bfb5daf..00000000 --- a/dependencies/poppler/include/qt4/poppler-annotation-private.h +++ /dev/null @@ -1,111 +0,0 @@ -/* poppler-annotation-private.h: qt interface to poppler - * Copyright (C) 2007, Pino Toscano - * Copyright (C) 2012, Tobias Koenig - * Copyright (C) 2012, Fabio D'Urso - * Copyright (C) 2012, Albert Astals Cid - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _POPPLER_ANNOTATION_PRIVATE_H_ -#define _POPPLER_ANNOTATION_PRIVATE_H_ - -#include -#include -#include - -#include "poppler-annotation.h" - -#include - -class Annot; -class AnnotPath; -class Link; -class Page; -class PDFRectangle; - -namespace Poppler -{ -class DocumentData; - -class AnnotationPrivate : public QSharedData -{ - public: - AnnotationPrivate(); - virtual ~AnnotationPrivate(); - - void addRevision(Annotation *ann, Annotation::RevScope scope, Annotation::RevType type); - - /* Returns an Annotation of the right subclass whose d_ptr points to - * this AnnotationPrivate */ - virtual Annotation * makeAlias() = 0; - - /* properties: contents related */ - QString author; - QString contents; - QString uniqueName; - QDateTime modDate; // before or equal to currentDateTime() - QDateTime creationDate; // before or equal to modifyDate - - /* properties: look/interaction related */ - int flags; - QRectF boundary; - - /* style and popup */ - Annotation::Style style; - Annotation::Popup popup; - - /* revisions */ - Annotation::RevScope revisionScope; - Annotation::RevType revisionType; - QList revisions; - - /* After this call, the Annotation object will behave like a wrapper for - * the specified Annot object. All cached values are discarded */ - void tieToNativeAnnot(Annot *ann, ::Page *page, DocumentData *doc); - - /* Creates a new Annot object on the specified page, flushes current - * values to that object and ties this Annotation to that object */ - virtual Annot* createNativeAnnot(::Page *destPage, DocumentData *doc) = 0; - - /* Inited to 0 (i.e. untied annotation) */ - Annot *pdfAnnot; - ::Page *pdfPage; - DocumentData * parentDoc; - - /* The following helpers only work if pdfPage is set */ - void flushBaseAnnotationProperties(); - void fillMTX(double MTX[6]) const; - QRectF fromPdfRectangle(const PDFRectangle &r) const; - PDFRectangle toPdfRectangle(const QRectF &r) const; - AnnotPath * toAnnotPath(const QLinkedList &l) const; - - /* Scan page for annotations, parentId=0 searches for root annotations */ - static QList findAnnotations(::Page *pdfPage, DocumentData *doc, int parentId = 0); - - /* Add given annotation to given page */ - static void addAnnotationToPage(::Page *pdfPage, DocumentData *doc, const Annotation * ann); - - /* Remove annotation from page and destroy ann */ - static void removeAnnotationFromPage(::Page *pdfPage, const Annotation * ann); - - Ref pdfObjectReference() const; - - Link* additionalAction( Annotation::AdditionalActionType type ) const; -}; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-annotation.h b/dependencies/poppler/include/qt4/poppler-annotation.h deleted file mode 100644 index 9208ca7a..00000000 --- a/dependencies/poppler/include/qt4/poppler-annotation.h +++ /dev/null @@ -1,920 +0,0 @@ -/* poppler-annotation.h: qt interface to poppler - * Copyright (C) 2006-2008, 2012 Albert Astals Cid - * Copyright (C) 2006, 2008 Pino Toscano - * Copyright (C) 2007, Brad Hards - * Copyright (C) 2010, Philip Lorenz - * Copyright (C) 2012, Tobias Koenig - * Copyright (C) 2012, Guillermo A. Amaral B. - * Copyright (C) 2012, Fabio D'Urso - * Adapting code from - * Copyright (C) 2004 by Enrico Ros - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _POPPLER_ANNOTATION_H_ -#define _POPPLER_ANNOTATION_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "poppler-export.h" - -namespace Poppler { - -class Annotation; -class AnnotationPrivate; -class TextAnnotationPrivate; -class LineAnnotationPrivate; -class GeomAnnotationPrivate; -class HighlightAnnotationPrivate; -class StampAnnotationPrivate; -class InkAnnotationPrivate; -class LinkAnnotationPrivate; -class CaretAnnotationPrivate; -class FileAttachmentAnnotationPrivate; -class SoundAnnotationPrivate; -class MovieAnnotationPrivate; -class ScreenAnnotationPrivate; -class WidgetAnnotationPrivate; -class EmbeddedFile; -class Link; -class SoundObject; -class MovieObject; -class LinkRendition; -class Page; - -/** - * \short Helper class for (recursive) Annotation retrieval/storage. - * - */ -class POPPLER_QT4_EXPORT AnnotationUtils -{ - public: - /** - * Restore an Annotation (with revisions if needed) from the DOM - * element \p annElement. - * \returns a pointer to the complete Annotation or 0 if element is - * invalid. - */ - static Annotation * createAnnotation( const QDomElement & annElement ); - - /** - * Save the Annotation \p ann as a child of \p annElement taking - * care of saving all revisions if \p ann has any. - */ - static void storeAnnotation( const Annotation * ann, - QDomElement & annElement, QDomDocument & document ); - - /** - * Returns an element called \p name from the direct children of - * \p parentNode or a null element if not found. - */ - static QDomElement findChildElement( const QDomNode & parentNode, - const QString & name ); -}; - - -/** - * \short Annotation class holding properties shared by all annotations. - * - * An Annotation is an object (text note, highlight, sound, popup window, ..) - * contained by a Page in the document. - * - * \warning Different Annotation objects might point to the same annotation. - * Use uniqueName to test for Annotation equality - */ -class POPPLER_QT4_EXPORT Annotation -{ - friend class AnnotationUtils; - friend class LinkMovie; - friend class LinkRendition; - - public: - // enum definitions - // WARNING!!! oKular uses that very same values so if you change them notify the author! - enum SubType { AText = 1, ALine = 2, AGeom = 3, AHighlight = 4, AStamp = 5, - AInk = 6, ALink = 7, ACaret = 8, AFileAttachment = 9, ASound = 10, - AMovie = 11, AScreen = 12 /** \since 0.20 */, AWidget = 13 /** \since 0.22 */, A_BASE = 0 }; - enum Flag { Hidden = 1, FixedSize = 2, FixedRotation = 4, DenyPrint = 8, - DenyWrite = 16, DenyDelete = 32, ToggleHidingOnMouse = 64, External = 128 }; - enum LineStyle { Solid = 1, Dashed = 2, Beveled = 4, Inset = 8, Underline = 16 }; - enum LineEffect { NoEffect = 1, Cloudy = 2}; - enum RevScope { Root = 0 /** \since 0.20 */, Reply = 1, Group = 2, Delete = 4 }; - enum RevType { None = 1, Marked = 2, Unmarked = 4, Accepted = 8, Rejected = 16, Cancelled = 32, Completed = 64 }; - - /** - * Returns the author of the annotation. - */ - QString author() const; - /** - * Sets a new author for the annotation. - */ - void setAuthor( const QString &author ); - - QString contents() const; - void setContents( const QString &contents ); - - /** - * Returns the unique name (ID) of the annotation. - */ - QString uniqueName() const; - /** - * Sets a new unique name for the annotation. - * - * \note no check of the new uniqueName is done - */ - void setUniqueName( const QString &uniqueName ); - - QDateTime modificationDate() const; - void setModificationDate( const QDateTime &date ); - - QDateTime creationDate() const; - void setCreationDate( const QDateTime &date ); - - int flags() const; - void setFlags( int flags ); - - QRectF boundary() const; - void setBoundary( const QRectF &boundary ); - - /** - * \short Container class for Annotation style information - * - * \since 0.20 - */ - class POPPLER_QT4_EXPORT Style - { - public: - Style(); - Style( const Style &other ); - Style& operator=( const Style &other ); - ~Style(); - - // appearance properties - QColor color() const; // black - void setColor(const QColor &color); - double opacity() const; // 1.0 - void setOpacity(double opacity); - - // pen properties - double width() const; // 1.0 - void setWidth(double width); - LineStyle lineStyle() const; // LineStyle::Solid - void setLineStyle(LineStyle style); - double xCorners() const; // 0.0 - void setXCorners(double radius); - double yCorners() const; // 0.0 - void setYCorners(double radius); - const QVector& dashArray() const; // [ 3 ] - void setDashArray(const QVector &array); - - // pen effects - LineEffect lineEffect() const; // LineEffect::NoEffect - void setLineEffect(LineEffect effect); - double effectIntensity() const; // 1.0 - void setEffectIntensity(double intens); - - private: - class Private; - QSharedDataPointer d; - }; - - /// \since 0.20 - Style style() const; - /// \since 0.20 - void setStyle( const Style& style ); - - /** - * \short Container class for Annotation pop-up window information - * - * \since 0.20 - */ - class POPPLER_QT4_EXPORT Popup - { - public: - Popup(); - Popup( const Popup &other ); - Popup& operator=( const Popup &other ); - ~Popup(); - - // window state (Hidden, FixedRotation, Deny* flags allowed) - int flags() const; // -1 (never initialized) -> 0 (if inited and shown) - void setFlags( int flags ); - - // geometric properties - QRectF geometry() const; // no default - void setGeometry( const QRectF &geom ); - - // window contens/override properties - QString title() const; // '' text in the titlebar (overrides author) - void setTitle( const QString &title ); - QString summary() const; // '' short description (displayed if not empty) - void setSummary( const QString &summary ); - QString text() const; // '' text for the window (overrides annot->contents) - void setText( const QString &text ); - - private: - class Private; - QSharedDataPointer d; - }; - - /// \since 0.20 - Popup popup() const; - /// \since 0.20 - void setPopup( const Popup& popup ); - - /// \cond PRIVATE - // This field is deprecated and not used any more. Use popup - Q_DECL_DEPRECATED struct { int width, height; } window; // Always set to zero - /// \endcond - - /// \since 0.20 - RevScope revisionScope() const; // Root - - /// \since 0.20 - RevType revisionType() const; // None - - /** - * Returns the revisions of this annotation - * - * \note The caller owns the returned annotations and they should - * be deleted when no longer required. - * - * \since 0.20 - */ - QList revisions() const; - - /** - * The type of the annotation. - */ - virtual SubType subType() const = 0; - - /** - * Destructor. - */ - virtual ~Annotation(); - - /** - * Describes the flags from an annotations 'AA' dictionary. - * - * This flag is used by the additionalAction() method for ScreenAnnotation - * and WidgetAnnotation. - * - * \since 0.22 - */ - enum AdditionalActionType - { - CursorEnteringAction, ///< Performed when the cursor enters the annotation's active area - CursorLeavingAction, ///< Performed when the cursor exists the annotation's active area - MousePressedAction, ///< Performed when the mouse button is pressed inside the annotation's active area - MouseReleasedAction, ///< Performed when the mouse button is released inside the annotation's active area - FocusInAction, ///< Performed when the annotation receives the input focus - FocusOutAction, ///< Performed when the annotation loses the input focus - PageOpeningAction, ///< Performed when the page containing the annotation is opened - PageClosingAction, ///< Performed when the page containing the annotation is closed - PageVisibleAction, ///< Performed when the page containing the annotation becomes visible - PageInvisibleAction ///< Performed when the page containing the annotation becomes invisible - }; - - protected: - /// \cond PRIVATE - Annotation( AnnotationPrivate &dd ); - Annotation( AnnotationPrivate &dd, const QDomNode &description ); - void storeBaseAnnotationProperties( QDomNode & parentNode, QDomDocument & document ) const; - Q_DECLARE_PRIVATE( Annotation ) - QExplicitlySharedDataPointer d_ptr; - /// \endcond - - private: - virtual void store( QDomNode & parentNode, QDomDocument & document ) const = 0; - Q_DISABLE_COPY( Annotation ) -}; - -/** - * \short Annotation containing text. - * - * A text annotation is an object showing some text directly on the page, or - * linked to the contents using an icon shown on a page. - */ -class POPPLER_QT4_EXPORT TextAnnotation : public Annotation -{ - friend class AnnotationUtils; - friend class AnnotationPrivate; - - public: - // local enums - enum TextType { Linked, InPlace }; - enum InplaceIntent { Unknown, Callout, TypeWriter }; - - TextAnnotation( TextType type ); - virtual ~TextAnnotation(); - virtual SubType subType() const; - - /** - The type of text annotation represented by this object - */ - TextType textType() const; - - /** - The name of the icon for this text annotation. - - Standard names for text annotation icons are: - - Comment - - Help - - Insert - - Key - - NewParagraph - - Note (this is the default icon to use) - - Paragraph - */ - QString textIcon() const; - - /** - Set the name of the icon to use for this text annotation. - - \sa textIcon for the list of standard names - */ - void setTextIcon( const QString &icon ); - - QFont textFont() const; - void setTextFont( const QFont &font ); - - int inplaceAlign() const; - void setInplaceAlign( int align ); - - /** - Synonym for contents() - - \deprecated Use contents() instead - */ - QString inplaceText() const; - /** - Synonym for setContents() - - \deprecated Use setContents() instead - */ - void setInplaceText( const QString &text ); - - QPointF calloutPoint( int id ) const; - /// \since 0.20 - QVector calloutPoints() const; - /// \since 0.20 - void setCalloutPoints( const QVector &points ); - - InplaceIntent inplaceIntent() const; - void setInplaceIntent( InplaceIntent intent ); - - private: - TextAnnotation( const QDomNode &node ); - TextAnnotation( TextAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - void setTextType( TextType type ); - Q_DECLARE_PRIVATE( TextAnnotation ) - Q_DISABLE_COPY( TextAnnotation ) -}; - -/** - * \short Polygon/polyline annotation. - * - * This annotation represents a polygon (or polyline) to be drawn on a page. - */ -class POPPLER_QT4_EXPORT LineAnnotation : public Annotation -{ - friend class AnnotationUtils; - friend class AnnotationPrivate; - - public: - // local enums - /// \since 0.20 - enum LineType { StraightLine, Polyline }; - enum TermStyle { Square, Circle, Diamond, OpenArrow, ClosedArrow, None, - Butt, ROpenArrow, RClosedArrow, Slash }; - enum LineIntent { Unknown, Arrow, Dimension, PolygonCloud }; - - /// \since 0.20 - LineAnnotation( LineType type ); - virtual ~LineAnnotation(); - virtual SubType subType() const; - - /// \since 0.20 - LineType lineType() const; - - QLinkedList linePoints() const; - void setLinePoints( const QLinkedList &points ); - - TermStyle lineStartStyle() const; - void setLineStartStyle( TermStyle style ); - - TermStyle lineEndStyle() const; - void setLineEndStyle( TermStyle style ); - - bool isLineClosed() const; - void setLineClosed( bool closed ); - - QColor lineInnerColor() const; - void setLineInnerColor( const QColor &color ); - - double lineLeadingForwardPoint() const; - void setLineLeadingForwardPoint( double point ); - - double lineLeadingBackPoint() const; - void setLineLeadingBackPoint( double point ); - - bool lineShowCaption() const; - void setLineShowCaption( bool show ); - - LineIntent lineIntent() const; - void setLineIntent( LineIntent intent ); - - private: - LineAnnotation( const QDomNode &node ); - LineAnnotation( LineAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - void setLineType( LineType type ); - Q_DECLARE_PRIVATE( LineAnnotation ) - Q_DISABLE_COPY( LineAnnotation ) -}; - -/** - * \short Geometric annotation. - * - * The geometric annotation represents a geometric figure, like a rectangle or - * an ellipse. - */ -class POPPLER_QT4_EXPORT GeomAnnotation : public Annotation -{ - friend class AnnotationUtils; - friend class AnnotationPrivate; - - public: - GeomAnnotation(); - virtual ~GeomAnnotation(); - virtual SubType subType() const; - - // common enums - enum GeomType { InscribedSquare, InscribedCircle }; - - GeomType geomType() const; - void setGeomType( GeomType style ); - - QColor geomInnerColor() const; - void setGeomInnerColor( const QColor &color ); - - private: - GeomAnnotation( const QDomNode &node ); - GeomAnnotation( GeomAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - Q_DECLARE_PRIVATE( GeomAnnotation ) - Q_DISABLE_COPY( GeomAnnotation ) -}; - -/** - * \short Text highlight annotation. - * - * The higlight annotation represents some areas of text being "highlighted". - */ -class POPPLER_QT4_EXPORT HighlightAnnotation : public Annotation -{ - friend class AnnotationUtils; - friend class AnnotationPrivate; - - public: - HighlightAnnotation(); - virtual ~HighlightAnnotation(); - virtual SubType subType() const; - - /** - The type of highlight - */ - enum HighlightType { Highlight, ///< highlighter pen style annotation - Squiggly, ///< jagged or squiggly underline - Underline, ///< straight line underline - StrikeOut ///< straight line through-line - }; - - /** - Structure corresponding to a QuadPoints array. This matches a - quadrilateral that describes the area around a word (or set of - words) that are to be highlighted. - */ - struct Quad - { - QPointF points[4]; // 8 valid coords - bool capStart; // false (vtx 1-4) [K] - bool capEnd; // false (vtx 2-3) [K] - double feather; // 0.1 (in range 0..1) [K] - }; - - /** - The type (style) of highlighting to use for this area - or these areas. - */ - HighlightType highlightType() const; - - /** - Set the type of highlighting to use for the given area - or areas. - */ - void setHighlightType( HighlightType type ); - - /** - The list of areas to highlight. - */ - QList< Quad > highlightQuads() const; - - /** - Set the areas to highlight. - */ - void setHighlightQuads( const QList< Quad > &quads ); - - private: - HighlightAnnotation( const QDomNode &node ); - HighlightAnnotation( HighlightAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - Q_DECLARE_PRIVATE( HighlightAnnotation ) - Q_DISABLE_COPY( HighlightAnnotation ) -}; - -/** - * \short Stamp annotation. - * - * A simple annotation drawing a stamp on a page. - */ -class POPPLER_QT4_EXPORT StampAnnotation : public Annotation -{ - friend class AnnotationUtils; - friend class AnnotationPrivate; - - public: - StampAnnotation(); - virtual ~StampAnnotation(); - virtual SubType subType() const; - - /** - The name of the icon for this stamp annotation. - - Standard names for stamp annotation icons are: - - Approved - - AsIs - - Confidential - - Departmental - - Draft (this is the default icon type) - - Experimental - - Expired - - Final - - ForComment - - ForPublicRelease - - NotApproved - - NotForPublicRelease - - Sold - - TopSecret - */ - QString stampIconName() const; - - /** - Set the icon type for this stamp annotation. - - \sa stampIconName for the list of standard icon names - */ - void setStampIconName( const QString &name ); - - private: - StampAnnotation( const QDomNode &node ); - StampAnnotation( StampAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - Q_DECLARE_PRIVATE( StampAnnotation ) - Q_DISABLE_COPY( StampAnnotation ) -}; - -/** - * \short Ink Annotation. - * - * Annotation representing an ink path on a page. - */ -class POPPLER_QT4_EXPORT InkAnnotation : public Annotation -{ - friend class AnnotationUtils; - friend class AnnotationPrivate; - - public: - InkAnnotation(); - virtual ~InkAnnotation(); - virtual SubType subType() const; - - QList< QLinkedList > inkPaths() const; - void setInkPaths( const QList< QLinkedList > &paths ); - - private: - InkAnnotation( const QDomNode &node ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - InkAnnotation(InkAnnotationPrivate &dd); - Q_DECLARE_PRIVATE( InkAnnotation ) - Q_DISABLE_COPY( InkAnnotation ) -}; - -class POPPLER_QT4_EXPORT LinkAnnotation : public Annotation -{ - friend class AnnotationUtils; - friend class AnnotationPrivate; - - public: - virtual ~LinkAnnotation(); - virtual SubType subType() const; - - // local enums - enum HighlightMode { None, Invert, Outline, Push }; - - /** \since 0.20 */ - Link* linkDestination() const; - void setLinkDestination( Link *link ); - - HighlightMode linkHighlightMode() const; - void setLinkHighlightMode( HighlightMode mode ); - - QPointF linkRegionPoint( int id ) const; - void setLinkRegionPoint( int id, const QPointF &point ); - - private: - LinkAnnotation(); - LinkAnnotation( const QDomNode &node ); - LinkAnnotation( LinkAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - Q_DECLARE_PRIVATE( LinkAnnotation ) - Q_DISABLE_COPY( LinkAnnotation ) -}; - -/** - * \short Caret annotation. - * - * The caret annotation represents a symbol to indicate the presence of text. - */ -class POPPLER_QT4_EXPORT CaretAnnotation : public Annotation -{ - friend class AnnotationUtils; - friend class AnnotationPrivate; - - public: - CaretAnnotation(); - virtual ~CaretAnnotation(); - virtual SubType subType() const; - - /** - * The symbols for the caret annotation. - */ - enum CaretSymbol { None, P }; - - CaretSymbol caretSymbol() const; - void setCaretSymbol( CaretSymbol symbol ); - - private: - CaretAnnotation( const QDomNode &node ); - CaretAnnotation( CaretAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - Q_DECLARE_PRIVATE( CaretAnnotation ) - Q_DISABLE_COPY( CaretAnnotation ) -}; - -/** - * \short File attachment annotation. - * - * The file attachment annotation represents a file embedded in the document. - * - * \since 0.10 - */ -class POPPLER_QT4_EXPORT FileAttachmentAnnotation : public Annotation -{ - friend class AnnotationPrivate; - - public: - virtual ~FileAttachmentAnnotation(); - virtual SubType subType() const; - - /** - * Returns the name of the icon of this annotation. - */ - QString fileIconName() const; - /** - * Sets a new name for the icon of this annotation. - */ - void setFileIconName( const QString &icon ); - - /** - * Returns the EmbeddedFile of this annotation. - */ - EmbeddedFile* embeddedFile() const; - /** - * Sets a new EmbeddedFile for this annotation. - * - * \note FileAttachmentAnnotation takes ownership of the object - */ - void setEmbeddedFile( EmbeddedFile *ef ); - - private: - FileAttachmentAnnotation(); - FileAttachmentAnnotation( const QDomNode &node ); - FileAttachmentAnnotation( FileAttachmentAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - Q_DECLARE_PRIVATE( FileAttachmentAnnotation ) - Q_DISABLE_COPY( FileAttachmentAnnotation ) -}; - -/** - * \short Sound annotation. - * - * The sound annotation represents a sound to be played when activated. - * - * \since 0.10 - */ -class POPPLER_QT4_EXPORT SoundAnnotation : public Annotation -{ - friend class AnnotationPrivate; - - public: - virtual ~SoundAnnotation(); - virtual SubType subType() const; - - /** - * Returns the name of the icon of this annotation. - */ - QString soundIconName() const; - /** - * Sets a new name for the icon of this annotation. - */ - void setSoundIconName( const QString &icon ); - - /** - * Returns the SoundObject of this annotation. - */ - SoundObject* sound() const; - /** - * Sets a new SoundObject for this annotation. - * - * \note SoundAnnotation takes ownership of the object - */ - void setSound( SoundObject *ef ); - - private: - SoundAnnotation(); - SoundAnnotation( const QDomNode &node ); - SoundAnnotation( SoundAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - Q_DECLARE_PRIVATE( SoundAnnotation ) - Q_DISABLE_COPY( SoundAnnotation ) -}; - -/** - * \short Movie annotation. - * - * The movie annotation represents a movie to be played when activated. - * - * \since 0.10 - */ -class POPPLER_QT4_EXPORT MovieAnnotation : public Annotation -{ - friend class AnnotationPrivate; - - public: - virtual ~MovieAnnotation(); - virtual SubType subType() const; - - /** - * Returns the MovieObject of this annotation. - */ - MovieObject* movie() const; - /** - * Sets a new MovieObject for this annotation. - * - * \note MovieAnnotation takes ownership of the object - */ - void setMovie( MovieObject *movie ); - - /** - * Returns the title of the movie of this annotation. - */ - QString movieTitle() const; - /** - * Sets a new title for the movie of this annotation. - */ - void setMovieTitle( const QString &title ); - - private: - MovieAnnotation(); - MovieAnnotation( const QDomNode &node ); - MovieAnnotation( MovieAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; - Q_DECLARE_PRIVATE( MovieAnnotation ) - Q_DISABLE_COPY( MovieAnnotation ) -}; - -/** - * \short Screen annotation. - * - * The screen annotation represents a screen to be played when activated. - * - * \since 0.20 - */ -class POPPLER_QT4_EXPORT ScreenAnnotation : public Annotation -{ - friend class AnnotationPrivate; - - public: - virtual ~ScreenAnnotation(); - - virtual SubType subType() const; - - /** - * Returns the LinkRendition of this annotation. - */ - LinkRendition* action() const; - - /** - * Sets a new LinkRendition for this annotation. - * - * \note ScreenAnnotation takes ownership of the object - */ - void setAction( LinkRendition *action ); - - /** - * Returns the title of the screen of this annotation. - */ - QString screenTitle() const; - - /** - * Sets a new title for the screen of this annotation. - */ - void setScreenTitle( const QString &title ); - - /** - * Returns the additional action of the given @p type fo the annotation or - * @c 0 if no action has been defined. - * - * \since 0.22 - */ - Link* additionalAction( AdditionalActionType type ) const; - - private: - ScreenAnnotation(); - ScreenAnnotation( ScreenAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; // stub - Q_DECLARE_PRIVATE( ScreenAnnotation ) - Q_DISABLE_COPY( ScreenAnnotation ) -}; - -/** - * \short Widget annotation. - * - * The widget annotation represents a widget (form field) on a page. - * - * \note This class is just provided for consistency of the annotation API, - * use the FormField classes to get all the form-related information. - * - * \since 0.22 - */ -class POPPLER_QT4_EXPORT WidgetAnnotation : public Annotation -{ - friend class AnnotationPrivate; - - public: - virtual ~WidgetAnnotation(); - - virtual SubType subType() const; - - /** - * Returns the additional action of the given @p type fo the annotation or - * @c 0 if no action has been defined. - * - * \since 0.22 - */ - Link* additionalAction( AdditionalActionType type ) const; - - private: - WidgetAnnotation(); - WidgetAnnotation( WidgetAnnotationPrivate &dd ); - virtual void store( QDomNode &parentNode, QDomDocument &document ) const; // stub - Q_DECLARE_PRIVATE( WidgetAnnotation ) - Q_DISABLE_COPY( WidgetAnnotation ) -}; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-converter-private.h b/dependencies/poppler/include/qt4/poppler-converter-private.h deleted file mode 100644 index dc3e9437..00000000 --- a/dependencies/poppler/include/qt4/poppler-converter-private.h +++ /dev/null @@ -1,49 +0,0 @@ -/* poppler-converter-private.h: Qt4 interface to poppler - * Copyright (C) 2007, 2009, Albert Astals Cid - * Copyright (C) 2008, Pino Toscano - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef POPPLER_QT4_CONVERTER_PRIVATE_H -#define POPPLER_QT4_CONVERTER_PRIVATE_H - -#include - -class QIODevice; - -namespace Poppler { - -class DocumentData; - -class BaseConverterPrivate -{ - public: - BaseConverterPrivate(); - virtual ~BaseConverterPrivate(); - - QIODevice* openDevice(); - void closeDevice(); - - DocumentData *document; - QString outputFileName; - QIODevice *iodev; - bool ownIodev : 1; - BaseConverter::Error lastError; -}; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-embeddedfile-private.h b/dependencies/poppler/include/qt4/poppler-embeddedfile-private.h deleted file mode 100644 index 83549dad..00000000 --- a/dependencies/poppler/include/qt4/poppler-embeddedfile-private.h +++ /dev/null @@ -1,42 +0,0 @@ -/* poppler-embeddedfile-private.h: Qt4 interface to poppler - * Copyright (C) 2005, 2008, 2009, 2012, Albert Astals Cid - * Copyright (C) 2005, Brad Hards - * Copyright (C) 2008, 2011, Pino Toscano - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef POPPLER_EMBEDDEDFILE_PRIVATE_H -#define POPPLER_EMBEDDEDFILE_PRIVATE_H - -class FileSpec; - -namespace Poppler -{ - -class EmbeddedFileData -{ -public: - EmbeddedFileData(FileSpec *fs); - ~EmbeddedFileData(); - - EmbFile *embFile() const; - - FileSpec *filespec; -}; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-export.h b/dependencies/poppler/include/qt4/poppler-export.h deleted file mode 100644 index 7661fe9e..00000000 --- a/dependencies/poppler/include/qt4/poppler-export.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -* This file is used to set the poppler_qt4_EXPORT macros right. -* This is needed for setting the visibility on windows, it will have no effect on other platforms. -*/ -#if defined(_WIN32) -# define LIB_EXPORT __declspec(dllexport) -# define LIB_IMPORT __declspec(dllimport) -#else -# define LIB_EXPORT -# define LIB_IMPORT -#endif - -#ifdef poppler_qt4_EXPORTS -# define POPPLER_QT4_EXPORT LIB_EXPORT -#else -# define POPPLER_QT4_EXPORT LIB_IMPORT -#endif diff --git a/dependencies/poppler/include/qt4/poppler-form.h b/dependencies/poppler/include/qt4/poppler-form.h deleted file mode 100644 index 79ed3932..00000000 --- a/dependencies/poppler/include/qt4/poppler-form.h +++ /dev/null @@ -1,343 +0,0 @@ -/* poppler-form.h: qt4 interface to poppler - * Copyright (C) 2007-2008, Pino Toscano - * Copyright (C) 2008, 2011, Albert Astals Cid - * Copyright (C) 2012, Adam Reichold - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _POPPLER_QT4_FORM_H_ -#define _POPPLER_QT4_FORM_H_ - -#include -#include -#include "poppler-export.h" - -class Page; -class FormWidget; -class FormWidgetButton; -class FormWidgetText; -class FormWidgetChoice; - -namespace Poppler { - - class DocumentData; - class Link; - - class FormFieldData; - /** - The base class representing a form field. - - \since 0.6 - */ - class POPPLER_QT4_EXPORT FormField { - public: - - /** - The different types of form field. - */ - enum FormType { - FormButton, ///< A button field. See \ref Poppler::FormFieldButton::ButtonType "ButtonType" - FormText, ///< A text field. See \ref Poppler::FormFieldText::TextType "TextType" - FormChoice, ///< A single choice field. See \ref Poppler::FormFieldChoice::ChoiceType "ChoiceType" - FormSignature ///< A signature field. - }; - - virtual ~FormField(); - - /** - The type of the field. - */ - virtual FormType type() const = 0; - - /** - \return The size of the field, in normalized coordinates, i.e. - [0..1] with regard to the dimensions (cropbox) of the page - */ - QRectF rect() const; - - /** - The ID of the field. - */ - int id() const; - - /** - The internal name of the field. - */ - QString name() const; - - /** - The internal fully qualified name of the field. - \since 0.18 - */ - QString fullyQualifiedName() const; - - /** - The name of the field to be used in user interface (eg messages to - the user). - */ - QString uiName() const; - - /** - Whether this form field is read-only. - */ - bool isReadOnly() const; - - /** - Whether this form field is visible. - */ - bool isVisible() const; - - /** - The activation action of this form field. - - \note It may be null. - */ - Link* activationAction() const; - - protected: - /// \cond PRIVATE - FormField(FormFieldData &dd); - - FormFieldData *m_formData; - /// \endcond - - private: - Q_DISABLE_COPY(FormField) - }; - - /** - A form field that represents a "button". - - \since 0.8 - */ - class POPPLER_QT4_EXPORT FormFieldButton : public FormField { - public: - - /** - * The types of button field. - */ - enum ButtonType - { - Push, ///< A simple push button. - CheckBox, ///< A check box. - Radio ///< A radio button. - }; - - /// \cond PRIVATE - FormFieldButton(DocumentData *doc, ::Page *p, ::FormWidgetButton *w); - /// \endcond - virtual ~FormFieldButton(); - - virtual FormType type() const; - - /** - The particular type of the button field. - */ - ButtonType buttonType() const; - - /** - * The caption to be used for the button. - */ - QString caption() const; - - /** - The state of the button. - */ - bool state() const; - - /** - Sets the state of the button to the new \p state . - */ - void setState( bool state ); - - /** - The list with the IDs of siblings (ie, buttons belonging to the same - group as the current one. - - Valid only for \ref Radio buttons, an empty list otherwise. - */ - QList siblings() const; - - private: - Q_DISABLE_COPY(FormFieldButton) - }; - - /** - A form field that represents a text input. - - \since 0.6 - */ - class POPPLER_QT4_EXPORT FormFieldText : public FormField { - public: - - /** - The particular type of this text field. - */ - enum TextType { - Normal, ///< A simple singleline text field. - Multiline, ///< A multiline text field. - FileSelect ///< An input field to select the path of a file on disk. - }; - - /// \cond PRIVATE - FormFieldText(DocumentData *doc, ::Page *p, ::FormWidgetText *w); - /// \endcond - virtual ~FormFieldText(); - - virtual FormType type() const; - - /** - The text type of the text field. - */ - TextType textType() const; - - /** - The text associated with the text field. - */ - QString text() const; - - /** - Sets the text associated with the text field to the specified - \p text. - */ - void setText( const QString& text ); - - /** - Whether this text field is a password input, eg its text \b must be - replaced with asterisks. - - Always false for \ref FileSelect text fields. - */ - bool isPassword() const; - - /** - Whether this text field should allow rich text. - */ - bool isRichText() const; - - /** - The maximum length for the text of this field, or -1 if not set. - */ - int maximumLength() const; - - /** - The horizontal alignment for the text of this text field. - */ - Qt::Alignment textAlignment() const; - - /** - Whether the text inserted manually in the field (where possible) - can be spell-checked. - */ - bool canBeSpellChecked() const; - - private: - Q_DISABLE_COPY(FormFieldText) - }; - - /** - A form field that represents a choice field. - - \since 0.6 - */ - class POPPLER_QT4_EXPORT FormFieldChoice : public FormField { - public: - - /** - The particular type of this choice field. - */ - enum ChoiceType { - ComboBox, ///< A simple singleline text field. - ListBox ///< A multiline text field. - }; - - /// \cond PRIVATE - FormFieldChoice(DocumentData *doc, ::Page *p, ::FormWidgetChoice *w); - /// \endcond - virtual ~FormFieldChoice(); - - virtual FormType type() const; - - /** - The choice type of the choice field. - */ - ChoiceType choiceType() const; - - /** - The possible choices of the choice field. - */ - QStringList choices() const; - - /** - Whether this FormFieldChoice::ComboBox is editable, i.e. the user - can type in a custom value. - - Always false for the other types of choices. - */ - bool isEditable() const; - - /** - Whether more than one choice of this FormFieldChoice::ListBox - can be selected at the same time. - - Always false for the other types of choices. - */ - bool multiSelect() const; - - /** - The currently selected choices. - */ - QList currentChoices() const; - - /** - Sets the selected choices to \p choice. - */ - void setCurrentChoices( const QList &choice ); - - /** - The text entered into an editable combo box choice field. Otherwise a null string. - - \since 0.22 - */ - QString editChoice() const; - - /** - Sets the text entered into an editable combo box choice field. Otherwise does nothing. - - \since 0.22 - */ - void setEditChoice(const QString& text); - - /** - The horizontal alignment for the text of this text field. - */ - Qt::Alignment textAlignment() const; - - /** - Whether the text inserted manually in the field (where possible) - can be spell-checked. - - Returns false if the field is not an editable text field. - */ - bool canBeSpellChecked() const; - - private: - Q_DISABLE_COPY(FormFieldChoice) - }; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-link-extractor-private.h b/dependencies/poppler/include/qt4/poppler-link-extractor-private.h deleted file mode 100644 index 32ddd038..00000000 --- a/dependencies/poppler/include/qt4/poppler-link-extractor-private.h +++ /dev/null @@ -1,57 +0,0 @@ -/* poppler-link-extractor_p.h: qt interface to poppler - * Copyright (C) 2007, 2008, 2011, Pino Toscano - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _POPPLER_LINK_EXTRACTOR_H_ -#define _POPPLER_LINK_EXTRACTOR_H_ - -#include -#include - -#include - -namespace Poppler -{ - -class Link; -class PageData; - -class LinkExtractorOutputDev : public OutputDev -{ - public: - LinkExtractorOutputDev(PageData *data); - virtual ~LinkExtractorOutputDev(); - - // inherited from OutputDev - virtual GBool upsideDown() { return gFalse; } - virtual GBool useDrawChar() { return gFalse; } - virtual GBool interpretType3Chars() { return gFalse; } - virtual void processLink(::AnnotLink *link); - - // our stuff - QList< Link* > links(); - - private: - PageData *m_data; - double m_pageCropWidth; - double m_pageCropHeight; - QList< Link* > m_links; -}; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-link.h b/dependencies/poppler/include/qt4/poppler-link.h deleted file mode 100644 index ef93bf09..00000000 --- a/dependencies/poppler/include/qt4/poppler-link.h +++ /dev/null @@ -1,611 +0,0 @@ -/* poppler-link.h: qt interface to poppler - * Copyright (C) 2006, Albert Astals Cid - * Copyright (C) 2007-2008, 2010, Pino Toscano - * Copyright (C) 2010, 2012, Guillermo Amaral - * Copyright (C) 2012, Tobias Koenig - * Adapting code from - * Copyright (C) 2004 by Enrico Ros - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _POPPLER_LINK_H_ -#define _POPPLER_LINK_H_ - -#include -#include -#include -#include "poppler-export.h" - -struct Ref; -class MediaRendition; - -namespace Poppler { - -class LinkPrivate; -class LinkGotoPrivate; -class LinkExecutePrivate; -class LinkBrowsePrivate; -class LinkActionPrivate; -class LinkSoundPrivate; -class LinkJavaScriptPrivate; -class LinkMoviePrivate; -class LinkDestinationData; -class LinkDestinationPrivate; -class LinkRenditionPrivate; -class MediaRendition; -class SoundObject; - -/** - * \short A destination. - * - * The LinkDestination class represent a "destination" (in terms of visual - * viewport to be displayed) for \link Poppler::LinkGoto GoTo\endlink links, - * and items in the table of contents (TOC) of a document. - * - * Coordinates are in 0..1 range - */ -class POPPLER_QT4_EXPORT LinkDestination -{ - public: - /** - * The possible kind of "viewport destination". - */ - enum Kind - { - /** - * The new viewport is specified in terms of: - * - possibile new left coordinate (see isChangeLeft() ) - * - possibile new top coordinate (see isChangeTop() ) - * - possibile new zoom level (see isChangeZoom() ) - */ - destXYZ = 1, - destFit = 2, - destFitH = 3, - destFitV = 4, - destFitR = 5, - destFitB = 6, - destFitBH = 7, - destFitBV = 8 - }; - - /// \cond PRIVATE - LinkDestination(const LinkDestinationData &data); - LinkDestination(const QString &description); - /// \endcond - /** - * Copy constructor. - */ - LinkDestination(const LinkDestination &other); - /** - * Destructor. - */ - ~LinkDestination(); - - // Accessors. - /** - * The kind of destination. - */ - Kind kind() const; - /** - * Which page is the target of this destination. - * - * \note this number is 1-based, so for a 5 pages document the - * valid page numbers go from 1 to 5 (both included). - */ - int pageNumber() const; - /** - * The new left for the viewport of the target page, in case - * it is specified to be changed (see isChangeLeft() ) - */ - double left() const; - double bottom() const; - double right() const; - /** - * The new top for the viewport of the target page, in case - * it is specified to be changed (see isChangeTop() ) - */ - double top() const; - double zoom() const; - /** - * Whether the left of the viewport on the target page should - * be changed. - * - * \see left() - */ - bool isChangeLeft() const; - /** - * Whether the top of the viewport on the target page should - * be changed. - * - * \see top() - */ - bool isChangeTop() const; - /** - * Whether the zoom level should be changed. - * - * \see zoom() - */ - bool isChangeZoom() const; - - /** - * Return a string repesentation of this destination. - */ - QString toString() const; - - /** - * Return the name of this destination. - * - * \since 0.12 - */ - QString destinationName() const; - - /** - * Assignment operator. - */ - LinkDestination& operator=(const LinkDestination &other); - - private: - QSharedDataPointer< LinkDestinationPrivate > d; -}; - -/** - * \short Encapsulates data that describes a link. - * - * This is the base class for links. It makes mandatory for inherited - * kind of links to reimplement the linkType() method and return the type of - * the link described by the reimplemented class. - */ -class POPPLER_QT4_EXPORT Link -{ - public: - /// \cond PRIVATE - Link( const QRectF &linkArea ); - /// \endcond - - /** - * The possible kinds of link. - * - * Inherited classes must return an unique identifier - */ - enum LinkType - { - None, ///< Unknown link - Goto, ///< A "Go To" link - Execute, ///< A command to be executed - Browse, ///< An URL to be browsed (eg "http://poppler.freedesktop.org") - Action, ///< A "standard" action to be executed in the viewer - Sound, ///< A link representing a sound to be played - Movie, ///< An action to be executed on a movie - Rendition, ///< A rendition link \since 0.20 - JavaScript ///< A JavaScript code to be interpreted \since 0.10 - }; - - /** - * The type of this link. - */ - virtual LinkType linkType() const; - - /** - * Destructor. - */ - virtual ~Link(); - - /** - * The area of a Page where the link should be active. - * - * \note this can be a null rect, in this case the link represents - * a general action. The area is given in 0..1 range - */ - QRectF linkArea() const; - - protected: - /// \cond PRIVATE - Link( LinkPrivate &dd ); - Q_DECLARE_PRIVATE( Link ) - LinkPrivate *d_ptr; - /// \endcond - - private: - Q_DISABLE_COPY( Link ) -}; - - -/** - * \brief Viewport reaching request. - * - * With a LinkGoto link, the document requests the specified viewport to be - * reached (aka, displayed in a viewer). Furthermore, if a file name is specified, - * then the destination refers to that document (and not to the document the - * current LinkGoto belongs to). - */ -class POPPLER_QT4_EXPORT LinkGoto : public Link -{ - public: - /** - * Create a new Goto link. - * - * \param linkArea the active area of the link - * \param extFileName if not empty, the file name to be open - * \param destination the destination to be reached - */ - LinkGoto( const QRectF &linkArea, QString extFileName, const LinkDestination & destination ); - /** - * Destructor. - */ - ~LinkGoto(); - - /** - * Whether the destination is in an external document - * (i.e. not the current document) - */ - bool isExternal() const; - // query for goto parameters - /** - * The file name of the document the destination() refers to, - * or an empty string in case it refers to the current document. - */ - QString fileName() const; - /** - * The destination to reach. - */ - LinkDestination destination() const; - LinkType linkType() const; - - private: - Q_DECLARE_PRIVATE( LinkGoto ) - Q_DISABLE_COPY( LinkGoto ) -}; - -/** - * \brief Generic execution request. - * - * The LinkExecute link represent a "file name" execution request. The result - * depends on the \link fileName() file name\endlink: - * - if it is a document, then it is requested to be open - * - otherwise, it represents an executable to be run with the specified parameters - */ -class POPPLER_QT4_EXPORT LinkExecute : public Link -{ - public: - /** - * The file name to be executed - */ - QString fileName() const; - /** - * The parameters for the command. - */ - QString parameters() const; - - /** - * Create a new Execute link. - * - * \param linkArea the active area of the link - * \param file the file name to be open, or the program to be execute - * \param params the parameters for the program to execute - */ - LinkExecute( const QRectF &linkArea, const QString & file, const QString & params ); - /** - * Destructor. - */ - ~LinkExecute(); - LinkType linkType() const; - - private: - Q_DECLARE_PRIVATE( LinkExecute ) - Q_DISABLE_COPY( LinkExecute ) -}; - -/** - * \brief An URL to browse. - * - * The LinkBrowse link holds a URL (eg 'http://poppler.freedesktop.org', - * 'mailto:john@some.org', etc) to be open. - * - * The format of the URL is specified by RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt) - */ -class POPPLER_QT4_EXPORT LinkBrowse : public Link -{ - public: - /** - * The URL to open - */ - QString url() const; - - /** - * Create a new browse link. - * - * \param linkArea the active area of the link - * \param url the URL to be open - */ - LinkBrowse( const QRectF &linkArea, const QString &url ); - /** - * Destructor. - */ - ~LinkBrowse(); - LinkType linkType() const; - - private: - Q_DECLARE_PRIVATE( LinkBrowse ) - Q_DISABLE_COPY( LinkBrowse ) -}; - -/** - * \brief "Standard" action request. - * - * The LinkAction class represents a link that request a "standard" action - * to be performed by the viewer on the displayed document. - */ -class POPPLER_QT4_EXPORT LinkAction : public Link -{ - public: - /** - * The possible types of actions - */ - enum ActionType { PageFirst = 1, - PagePrev = 2, - PageNext = 3, - PageLast = 4, - HistoryBack = 5, - HistoryForward = 6, - Quit = 7, - Presentation = 8, - EndPresentation = 9, - Find = 10, - GoToPage = 11, - Close = 12, - Print = 13 ///< \since 0.16 - }; - - /** - * The action of the current LinkAction - */ - ActionType actionType() const; - - /** - * Create a new Action link, that executes a specified action - * on the document. - * - * \param linkArea the active area of the link - * \param actionType which action should be executed - */ - LinkAction( const QRectF &linkArea, ActionType actionType ); - /** - * Destructor. - */ - ~LinkAction(); - LinkType linkType() const; - - private: - Q_DECLARE_PRIVATE( LinkAction ) - Q_DISABLE_COPY( LinkAction ) -}; - -/** - * Sound: a sound to be played. - * - * \since 0.6 - */ -class POPPLER_QT4_EXPORT LinkSound : public Link -{ - public: - // create a Link_Sound - LinkSound( const QRectF &linkArea, double volume, bool sync, bool repeat, bool mix, SoundObject *sound ); - /** - * Destructor. - */ - virtual ~LinkSound(); - - LinkType linkType() const; - - /** - * The volume to be used when playing the sound. - * - * The volume is in the range [ -1, 1 ], where: - * - a negative number: no volume (mute) - * - 1: full volume - */ - double volume() const; - /** - * Whether the playback of the sound should be synchronous - * (thus blocking, waiting for the end of the sound playback). - */ - bool synchronous() const; - /** - * Whether the sound should be played continuously (that is, - * started again when it ends) - */ - bool repeat() const; - /** - * Whether the playback of this sound can be mixed with - * playbacks with other sounds of the same document. - * - * \note When false, any other playback must be stopped before - * playing the sound. - */ - bool mix() const; - /** - * The sound object to be played - */ - SoundObject *sound() const; - - private: - Q_DECLARE_PRIVATE( LinkSound ) - Q_DISABLE_COPY( LinkSound ) -}; - -/** - * Rendition: Rendition link. - * - * \since 0.20 - */ -class POPPLER_QT4_EXPORT LinkRendition : public Link -{ - public: - /** - * Describes the possible rendition actions. - * - * \since 0.22 - */ - enum RenditionAction { - NoRendition, - PlayRendition, - StopRendition, - PauseRendition, - ResumeRendition - }; - - /** - * Create a new rendition link. - * - * \param linkArea the active area of the link - * \param rendition the media rendition object - * - * \deprecated Use the constructor that takes all parameter instead - */ - Q_DECL_DEPRECATED LinkRendition( const QRectF &linkArea, ::MediaRendition *rendition ); - - /** - * Create a new rendition link. - * - * \param linkArea the active area of the link - * \param rendition the media rendition object - * \param operation the numeric operation (action) (@see ::LinkRendition::RenditionOperation) - * \param script the java script code - * \param annotationReference the object reference of the screen annotation associated with this rendition action - * \since 0.22 - */ - LinkRendition( const QRectF &linkArea, ::MediaRendition *rendition, int operation, const QString &script, const Ref &annotationReference ); - - /** - * Destructor. - */ - virtual ~LinkRendition(); - - LinkType linkType() const; - - /** - * Returns the media rendition object if the redition provides one, @c 0 otherwise - */ - MediaRendition *rendition() const; - - /** - * Returns the action that should be executed if a rendition object is provided. - * - * \since 0.22 - */ - RenditionAction action() const; - - /** - * The JS code that shall be executed or an empty string. - * - * \since 0.22 - */ - QString script() const; - - /** - * Returns whether the given @p annotation is the referenced screen annotation for this rendition @p link. - * - * \since 0.22 - */ - bool isReferencedAnnotation( const ScreenAnnotation *annotation ) const; - - private: - Q_DECLARE_PRIVATE( LinkRendition ) - Q_DISABLE_COPY( LinkRendition ) -}; - -/** - * JavaScript: a JavaScript code to be interpreted. - * - * \since 0.10 - */ -class POPPLER_QT4_EXPORT LinkJavaScript : public Link -{ - public: - /** - * Create a new JavaScript link. - * - * \param linkArea the active area of the link - * \param js the JS code to be interpreted - */ - LinkJavaScript( const QRectF &linkArea, const QString &js ); - /** - * Destructor. - */ - virtual ~LinkJavaScript(); - - LinkType linkType() const; - - /** - * The JS code - */ - QString script() const; - - private: - Q_DECLARE_PRIVATE( LinkJavaScript ) - Q_DISABLE_COPY( LinkJavaScript ) -}; - -/** - * Movie: a movie to be played. - * - * \since 0.20 - */ -class POPPLER_QT4_EXPORT LinkMovie : public Link -{ - public: - /** - * Describes the operation to be performed on the movie. - */ - enum Operation { Play, - Stop, - Pause, - Resume - }; - - /** - * Create a new Movie link. - * - * \param linkArea the active area of the link - * \param operation the operation to be performed on the movie - * \param annotationTitle the title of the movie annotation identifying the movie to be played - * \param annotationReference the object reference of the movie annotation identifying the movie to be played - * - * Note: This constructor is supposed to be used by Poppler::Page only. - */ - LinkMovie( const QRectF &linkArea, Operation operation, const QString &annotationTitle, const Ref &annotationReference ); - /** - * Destructor. - */ - ~LinkMovie(); - LinkType linkType() const; - /** - * Returns the operation to be performed on the movie. - */ - Operation operation() const; - /** - * Returns whether the given @p annotation is the referenced movie annotation for this movie @p link. - */ - bool isReferencedAnnotation( const MovieAnnotation *annotation ) const; - - private: - Q_DECLARE_PRIVATE( LinkMovie ) - Q_DISABLE_COPY( LinkMovie ) -}; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-media.h b/dependencies/poppler/include/qt4/poppler-media.h deleted file mode 100644 index 64ec83c2..00000000 --- a/dependencies/poppler/include/qt4/poppler-media.h +++ /dev/null @@ -1,97 +0,0 @@ -/* poppler-media.h: qt interface to poppler - * Copyright (C) 2012 Guillermo A. Amaral B. - * Copyright (C) 2012 Albert Astals Cid - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __POPPLER_MEDIARENDITION_H__ -#define __POPPLER_MEDIARENDITION_H__ - -#include "poppler-export.h" - -#include -#include - -class MediaRendition; -class QIODevice; - -namespace Poppler -{ - class MediaRenditionPrivate; - - /** - Qt wrapper for MediaRendition. - - \since 0.20 - */ - class POPPLER_QT4_EXPORT MediaRendition { - public: - MediaRendition(::MediaRendition *rendition); - ~MediaRendition(); - - /** - Check if wrapper is holding a valid rendition object. - */ - bool isValid() const; - - /** - Returns content type. - */ - QString contentType() const; - - /** - Returns file name. - */ - QString fileName() const; - - /** - Returns true if media is embedded. - */ - bool isEmbedded() const; - - /** - Returns data buffer. - */ - QByteArray data() const; - - /** - Convenience accessor for auto-play parameter. - */ - bool autoPlay() const; - - /** - Convenience accessor for show controls parameter. - */ - bool showControls() const; - - /** - Convenience accessor for repeat count parameter. - */ - float repeatCount() const; - - /** - Convenience accessor for size parameter. - */ - QSize size() const; - - private: - Q_DECLARE_PRIVATE( MediaRendition ) - MediaRenditionPrivate *d_ptr; - Q_DISABLE_COPY( MediaRendition ) - }; -} - -#endif /* __POPPLER_MEDIARENDITION_H__ */ diff --git a/dependencies/poppler/include/qt4/poppler-optcontent-private.h b/dependencies/poppler/include/qt4/poppler-optcontent-private.h deleted file mode 100644 index 98eda073..00000000 --- a/dependencies/poppler/include/qt4/poppler-optcontent-private.h +++ /dev/null @@ -1,121 +0,0 @@ -/* poppler-optcontent-private.h: qt interface to poppler - * - * Copyright (C) 2007, Brad Hards - * Copyright (C) 2008, Pino Toscano - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef POPPLER_OPTCONTENT_PRIVATE_H -#define POPPLER_OPTCONTENT_PRIVATE_H - -#include -#include -#include - -class Array; -class OCGs; -class OptionalContentGroup; - -class QModelIndex; - -namespace Poppler -{ - class OptContentItem; - class OptContentModel; - class OptContentModelPrivate; - - class RadioButtonGroup - { - public: - RadioButtonGroup( OptContentModelPrivate *ocModel, Array *rbarray); - ~RadioButtonGroup(); - QSet setItemOn( OptContentItem *itemToSetOn ); - - private: - QList itemsInGroup; - }; - - class OptContentItem - { - public: - enum ItemState { On, Off, HeadingOnly }; - - OptContentItem( OptionalContentGroup *group ); - OptContentItem( const QString &label ); - OptContentItem(); - ~OptContentItem(); - - QString name() const { return m_name; } - ItemState state() const { return m_stateBackup; } - bool setState(ItemState state, QSet &changedItems); - - QList childList() { return m_children; } - - void setParent( OptContentItem* parent) { m_parent = parent; } - OptContentItem* parent() { return m_parent; } - - void addChild( OptContentItem *child ); - - void appendRBGroup( RadioButtonGroup *rbgroup ); - - bool isEnabled() const { return m_enabled; } - - QSet recurseListChildren(bool includeMe = false) const; - - private: - OptionalContentGroup *m_group; - QString m_name; - ItemState m_state; // true for ON, false for OFF - ItemState m_stateBackup; - QList m_children; - OptContentItem *m_parent; - QList m_rbGroups; - bool m_enabled; - }; - - class OptContentModelPrivate - { - public: - OptContentModelPrivate( OptContentModel *qq, OCGs *optContent ); - ~OptContentModelPrivate(); - - void parseRBGroupsArray( Array *rBGroupArray ); - OptContentItem *nodeFromIndex(const QModelIndex &index, bool canBeNull = false) const; - QModelIndex indexFromItem(OptContentItem *node, int column) const; - - /** - Get the OptContentItem corresponding to a given reference value. - - \param ref the reference number (e.g. from Object.getRefNum()) to look up - - \return the matching optional content item, or null if the reference wasn't found - */ - OptContentItem *itemFromRef( const QString &ref ) const; - void setRootNode(OptContentItem *node); - - OptContentModel *q; - - QMap m_optContentItems; - QList m_rbgroups; - OptContentItem *m_rootNode; - - private: - void addChild( OptContentItem *parent, OptContentItem *child); - void parseOrderArray( OptContentItem *parentNode, Array *orderArray ); - }; -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-optcontent.h b/dependencies/poppler/include/qt4/poppler-optcontent.h deleted file mode 100644 index 3f478539..00000000 --- a/dependencies/poppler/include/qt4/poppler-optcontent.h +++ /dev/null @@ -1,76 +0,0 @@ -/* poppler-optcontent.h: qt interface to poppler - * - * Copyright (C) 2007, Brad Hards - * Copyright (C) 2008, Pino Toscano - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef POPPLER_OPTCONTENT_H -#define POPPLER_OPTCONTENT_H - -#include - -#include "poppler-export.h" - -class OCGs; - -namespace Poppler -{ - class Document; - class OptContentModelPrivate; - - /** - * \brief Model for optional content - * - * OptContentModel is an item model representing the optional content items - * that can be found in PDF documents. - * - * The model offers a mostly read-only display of the data, allowing to - * enable/disable some contents setting the Qt::CheckStateRole data role. - * - * \since 0.8 - */ - class POPPLER_QT4_EXPORT OptContentModel : public QAbstractItemModel - { - friend class Document; - - Q_OBJECT - - public: - virtual ~OptContentModel(); - - QModelIndex index(int row, int column, const QModelIndex &parent) const; - QModelIndex parent(const QModelIndex &child) const; - - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent) const; - - QVariant data(const QModelIndex &index, int role) const; - virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); - - Qt::ItemFlags flags ( const QModelIndex & index ) const; - - virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - - private: - OptContentModel( OCGs *optContent, QObject *parent = 0); - - friend class OptContentModelPrivate; - OptContentModelPrivate *d; - }; -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-page-private.h b/dependencies/poppler/include/qt4/poppler-page-private.h deleted file mode 100644 index 91955e09..00000000 --- a/dependencies/poppler/include/qt4/poppler-page-private.h +++ /dev/null @@ -1,54 +0,0 @@ -/* poppler-page.cc: qt interface to poppler - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2007, 2012, Albert Astals Cid - * Copyright (C) 2008, Pino Toscano - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _POPPLER_PAGE_PRIVATE_H_ -#define _POPPLER_PAGE_PRIVATE_H_ - -#include "CharTypes.h" - -class QRectF; - -class LinkAction; -class Page; -class TextPage; - -namespace Poppler -{ - -class DocumentData; -class PageTransition; - -class PageData { -public: - Link* convertLinkActionToLink(::LinkAction * a, const QRectF &linkArea); - - DocumentData *parentDoc; - ::Page *page; - int index; - PageTransition *transition; - - static Link* convertLinkActionToLink(::LinkAction * a, DocumentData *parentDoc, const QRectF &linkArea); - - TextPage *prepareTextSearch(const QString &text, Page::SearchMode caseSensitive, Page::Rotation rotate, GBool *sCase, QVector *u); -}; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-page-transition-private.h b/dependencies/poppler/include/qt4/poppler-page-transition-private.h deleted file mode 100644 index 63febb09..00000000 --- a/dependencies/poppler/include/qt4/poppler-page-transition-private.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2005, Albert Astals Cid - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -class Object; - -namespace Poppler { - -class PageTransitionParams { - public: - Object *dictObj; -}; - -} diff --git a/dependencies/poppler/include/qt4/poppler-page-transition.h b/dependencies/poppler/include/qt4/poppler-page-transition.h deleted file mode 100644 index e7f39e27..00000000 --- a/dependencies/poppler/include/qt4/poppler-page-transition.h +++ /dev/null @@ -1,148 +0,0 @@ -/* PageTransition.h - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005, Brad Hards - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __PAGETRANSITION_X_H__ -#define __PAGETRANSITION_X_H__ - -#include "poppler-export.h" - -namespace Poppler { - -class PageTransitionParams; -class PageTransitionData; - -/** - \brief Describes how a PDF file viewer shall perform the transition - from one page to another - - In PDF files there is a way to specify if the viewer shall use - certain effects to perform the transition from one page to - another. This feature can be used, e.g., in a PDF-based beamer - presentation. - - This utility class represents the transition effect, and can be - used to extract the information from a PDF object. -*/ - - -class POPPLER_QT4_EXPORT PageTransition { - public: - - /** \brief transition effect that shall be used - */ - // if changed remember to keep in sync with PageTransition.h enum - enum Type { - Replace = 0, - Split, - Blinds, - Box, - Wipe, - Dissolve, - Glitter, - Fly, - Push, - Cover, - Uncover, - Fade - }; - - /** \brief alignment of the transition effect that shall be used - */ - // if changed remember to keep in sync with PageTransition.h enum - enum Alignment { - Horizontal = 0, - Vertical - }; - - /** \brief direction of the transition effect that shall be used - */ - // if changed remember to keep in sync with PageTransition.h enum - enum Direction { - Inward = 0, - Outward - }; - - /** \brief Construct a new PageTransition object from a page dictionary. - - Users of the library will rarely need to construct a - PageTransition object themselves. Instead, the method - Poppler::Page::transition() can be used to find out if a certain - transition effect is specified. - - @warning In case or error, this method will print an error message to stderr, - and construct a default object. - - @param params an object whose dictionary will be read and - parsed. This must be a valid object, whose dictionaries are - accessed by the constructor. The object is only accessed by this - constructor, and may be deleted after the constructor returns. - */ - PageTransition(const PageTransitionParams ¶ms); - - /** \brief copy constructor */ - PageTransition(const PageTransition &pt); - - /** - Destructor - */ - ~PageTransition(); - - /** - \brief Get type of the transition. - */ - Type type() const; - - /** - \brief Get duration of the transition in seconds. - */ - int duration() const; - - /** - \brief Get dimension in which the transition effect occurs. - */ - Alignment alignment() const; - - /** - \brief Get direction of motion of the transition effect. - */ - Direction direction() const; - - /** - \brief Get direction in which the transition effect moves. - */ - int angle() const; - - /** - \brief Get starting or ending scale. - */ - double scale() const; - - /** - \brief Returns true if the area to be flown is rectangular and - opaque. - */ - bool isRectangular() const; - - private: - PageTransitionData *data; -}; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-private.h b/dependencies/poppler/include/qt4/poppler-private.h deleted file mode 100644 index 5a9e1b85..00000000 --- a/dependencies/poppler/include/qt4/poppler-private.h +++ /dev/null @@ -1,311 +0,0 @@ -/* poppler-private.h: qt interface to poppler - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005, 2008, Brad Hards - * Copyright (C) 2006-2009, 2011, 2012 by Albert Astals Cid - * Copyright (C) 2007-2009, 2011 by Pino Toscano - * Copyright (C) 2011 Andreas Hartmetz - * Copyright (C) 2011 Hib Eris - * Copyright (C) 2012 Thomas Freitag - * Inspired on code by - * Copyright (C) 2004 by Albert Astals Cid - * Copyright (C) 2004 by Enrico Ros - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _POPPLER_PRIVATE_H_ -#define _POPPLER_PRIVATE_H_ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#if defined(HAVE_SPLASH) -#include -#endif - -#include "poppler-qt4.h" -#include "poppler-embeddedfile-private.h" - -class LinkDest; -class FormWidget; - -namespace Poppler { - - /* borrowed from kpdf */ - QString unicodeToQString(Unicode* u, int len); - - QString UnicodeParsedString(GooString *s1); - - GooString *QStringToUnicodeGooString(const QString &s); - - GooString *QStringToGooString(const QString &s); - - void qt4ErrorFunction(int pos, char *msg, va_list args); - - class LinkDestinationData - { - public: - LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc, bool external ) - : ld(l), namedDest(nd), doc(pdfdoc), externalDest(external) - { - } - - LinkDest *ld; - GooString *namedDest; - Poppler::DocumentData *doc; - bool externalDest; - }; - - class DocumentData { - public: - DocumentData(const QString &filePath, GooString *ownerPassword, GooString *userPassword) - { - init(); - m_filePath = filePath; - -#if defined(_WIN32) - wchar_t *fileName = new WCHAR[filePath.length()]; - int length = filePath.toWCharArray(fileName); - doc = new PDFDoc(fileName, length, ownerPassword, userPassword); - delete fileName; -#else - GooString *fileName = new GooString(QFile::encodeName(filePath)); - doc = new PDFDoc(fileName, ownerPassword, userPassword); -#endif - - delete ownerPassword; - delete userPassword; - } - - DocumentData(const QByteArray &data, GooString *ownerPassword, GooString *userPassword) - { - Object obj; - fileContents = data; - obj.initNull(); - MemStream *str = new MemStream((char*)fileContents.data(), 0, fileContents.length(), &obj); - init(); - doc = new PDFDoc(str, ownerPassword, userPassword); - delete ownerPassword; - delete userPassword; - } - - void init(); - - ~DocumentData(); - - OutputDev *getOutputDev() - { - if (!m_outputDev) - { - switch (m_backend) - { - case Document::ArthurBackend: - // create a splash backend even in case of the Arthur Backend - case Document::SplashBackend: - { -#if defined(HAVE_SPLASH) - SplashColor bgColor; - GBool overprint = m_hints & Document::OverprintPreview ? gTrue : gFalse; - globalParams->setOverprintPreview(overprint); -#if defined(SPLASH_CMYK) - if (overprint) - { - Guchar c, m, y, k; - - c = 255 - paperColor.blue(); - m = 255 - paperColor.red(); - y = 255 - paperColor.green(); - k = c; - if (m < k) { - k = m; - } - if (y < k) { - k = y; - } - bgColor[0] = c - k; - bgColor[1] = m - k; - bgColor[2] = y - k; - bgColor[3] = k; - for (int i = 4; i < SPOT_NCOMPS + 4; i++) { - bgColor[i] = 0; - } - } - else -#endif - { - bgColor[0] = paperColor.blue(); - bgColor[1] = paperColor.green(); - bgColor[2] = paperColor.red(); - } - GBool AA = m_hints & Document::TextAntialiasing ? gTrue : gFalse; - SplashOutputDev * splashOutputDev = new SplashOutputDev( -#if defined(SPLASH_CMYK) - (overprint) ? splashModeDeviceN8 : splashModeXBGR8, -#else - splashModeXBGR8, -#endif - 4, gFalse, bgColor, gTrue, AA); - splashOutputDev->setVectorAntialias(m_hints & Document::Antialiasing ? gTrue : gFalse); - splashOutputDev->setFreeTypeHinting(m_hints & Document::TextHinting ? gTrue : gFalse, m_hints & Document::TextSlightHinting ? gTrue : gFalse); - splashOutputDev->startDoc(doc); - m_outputDev = splashOutputDev; -#endif - break; - } - } - } - return m_outputDev; - } - - void addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items ); - - void setPaperColor(const QColor &color) - { - if (color == paperColor) - return; - - paperColor = color; - - // Make sure the new paper color will be picked up for the next rendering - delete m_outputDev; - m_outputDev = NULL; - } - - void fillMembers() - { - m_fontInfoIterator = new FontIterator(0, this); - int numEmb = doc->getCatalog()->numEmbeddedFiles(); - if (!(0 == numEmb)) { - // we have some embedded documents, build the list - for (int yalv = 0; yalv < numEmb; ++yalv) { - FileSpec *fs = doc->getCatalog()->embeddedFile(yalv); - m_embeddedFiles.append(new EmbeddedFile(*new EmbeddedFileData(fs))); - } - } - } - - static Document *checkDocument(DocumentData *doc); - - PDFDoc *doc; - QString m_filePath; - QByteArray fileContents; - bool locked; - FontIterator *m_fontInfoIterator; - Document::RenderBackend m_backend; - OutputDev *m_outputDev; - QList m_embeddedFiles; - QPointer m_optContentModel; - QColor paperColor; - int m_hints; - static int count; - }; - - class FontInfoData - { - public: - FontInfoData() - { - isEmbedded = false; - isSubset = false; - type = FontInfo::unknown; - } - - FontInfoData( const FontInfoData &fid ) - { - fontName = fid.fontName; - fontFile = fid.fontFile; - isEmbedded = fid.isEmbedded; - isSubset = fid.isSubset; - type = fid.type; - embRef = fid.embRef; - } - - FontInfoData( ::FontInfo* fi ) - { - if (fi->getName()) fontName = fi->getName()->getCString(); - if (fi->getFile()) fontFile = fi->getFile()->getCString(); - isEmbedded = fi->getEmbedded(); - isSubset = fi->getSubset(); - type = (Poppler::FontInfo::Type)fi->getType(); - embRef = fi->getEmbRef(); - } - - QString fontName; - QString fontFile; - bool isEmbedded : 1; - bool isSubset : 1; - FontInfo::Type type; - Ref embRef; - }; - - class FontIteratorData - { - public: - FontIteratorData( int startPage, DocumentData *dd ) - : fontInfoScanner( dd->doc, startPage ) - , totalPages( dd->doc->getNumPages() ) - , currentPage( qMax( startPage, 0 ) - 1 ) - { - } - - ~FontIteratorData() - { - } - - FontInfoScanner fontInfoScanner; - int totalPages; - int currentPage; - }; - - class TextBoxData - { - public: - TextBoxData() - : nextWord(0), hasSpaceAfter(false) - { - } - - QString text; - QRectF bBox; - TextBox *nextWord; - QVector charBBoxes; // the boundingRect of each character - bool hasSpaceAfter; - }; - - class FormFieldData - { - public: - FormFieldData(DocumentData *_doc, ::Page *p, ::FormWidget *w) : - doc(_doc), page(p), fm(w) - { - } - - DocumentData *doc; - ::Page *page; - ::FormWidget *fm; - QRectF box; - }; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-qiodeviceoutstream-private.h b/dependencies/poppler/include/qt4/poppler-qiodeviceoutstream-private.h deleted file mode 100644 index e7faa294..00000000 --- a/dependencies/poppler/include/qt4/poppler-qiodeviceoutstream-private.h +++ /dev/null @@ -1,46 +0,0 @@ -/* poppler-qiodevicestream-private.h: Qt4 interface to poppler - * Copyright (C) 2008, Pino Toscano - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef POPPLER_QIODEVICESTREAM_PRIVATE_H -#define POPPLER_QIODEVICESTREAM_PRIVATE_H - -#include "Object.h" -#include "Stream.h" - -class QIODevice; - -namespace Poppler { - -class QIODeviceOutStream : public OutStream -{ - public: - QIODeviceOutStream(QIODevice* device); - virtual ~QIODeviceOutStream(); - - virtual void close(); - virtual int getPos(); - virtual void put(char c); - virtual void printf(const char *format, ...); - - private: - QIODevice *m_device; -}; - -} - -#endif diff --git a/dependencies/poppler/include/qt4/poppler-qt4.h b/dependencies/poppler/include/qt4/poppler-qt4.h deleted file mode 100644 index f4f6fc65..00000000 --- a/dependencies/poppler/include/qt4/poppler-qt4.h +++ /dev/null @@ -1,1809 +0,0 @@ -/* poppler-qt.h: qt interface to poppler - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005, 2007, Brad Hards - * Copyright (C) 2005-2012, Albert Astals Cid - * Copyright (C) 2005, Stefan Kebekus - * Copyright (C) 2006-2011, Pino Toscano - * Copyright (C) 2009 Shawn Rutledge - * Copyright (C) 2010 Suzuki Toshiya - * Copyright (C) 2010 Matthias Fauconneau - * Copyright (C) 2011 Andreas Hartmetz - * Copyright (C) 2011 Glad Deschrijver - * Copyright (C) 2012, Guillermo A. Amaral B. - * Copyright (C) 2012, Fabio D'Urso - * Copyright (C) 2012, Tobias Koenig - * Copyright (C) 2012 Adam Reichold - * Copyright (C) 2012 Thomas Freitag - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __POPPLER_QT_H__ -#define __POPPLER_QT_H__ - -#include "poppler-annotation.h" -#include "poppler-link.h" -#include "poppler-optcontent.h" -#include "poppler-page-transition.h" - -#include -#include -#include -#include -#include "poppler-export.h" - -class EmbFile; -class Sound; -class AnnotMovie; - -/** - The %Poppler Qt4 binding. -*/ -namespace Poppler { - - class Document; - class DocumentData; - - class PageData; - - class FormField; - - class TextBoxData; - - class PDFConverter; - class PSConverter; - - /** - Debug/error function. - - This function type is used for debugging & error output; - the first parameter is the actual message, the second is the unaltered - closure argument which was passed to the setDebugErrorFunction call. - - \since 0.16 - */ - typedef void (*PopplerDebugFunc)(const QString & /*message*/, const QVariant & /*closure*/); - - /** - Set a new debug/error output function. - - If not set, by default error and debug messages will be sent to the - Qt \p qDebug() function. - - \param debugFunction the new debug function - \param closure user data which will be passes as-is to the debug function - - \since 0.16 - */ - POPPLER_QT4_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure); - - /** - Describes the physical location of text on a document page - - This very simple class describes the physical location of text - on the page. It consists of - - a QString that contains the text - - a QRectF that gives a box that describes where on the page - the text is found. - */ - class POPPLER_QT4_EXPORT TextBox { - friend class Page; - public: - /** - The default constructor sets the \p text and the rectangle that - contains the text. Coordinated for the \p bBox are in points = - 1/72 of an inch. - */ - TextBox(const QString& text, const QRectF &bBox); - /** - Destructor. - */ - ~TextBox(); - - /** - Returns the text of this text box - */ - QString text() const; - - /** - Returns the position of the text, in point, i.e., 1/72 of - an inch - - \since 0.8 - */ - QRectF boundingBox() const; - - /** - Returns the pointer to the next text box, if there is one. - - Otherwise, it returns a null pointer. - */ - TextBox *nextWord() const; - - /** - Returns the bounding box of the \p i -th characted of the word. - */ - QRectF charBoundingBox(int i) const; - - /** - Returns whether there is a space character after this text box - */ - bool hasSpaceAfter() const; - - private: - Q_DISABLE_COPY(TextBox) - - TextBoxData *m_data; - }; - - - class FontInfoData; - /** - Container class for information about a font within a PDF - document - */ - class POPPLER_QT4_EXPORT FontInfo { - friend class Document; - public: - /** - The type of font. - */ - enum Type { - unknown, - Type1, - Type1C, - Type1COT, - Type3, - TrueType, - TrueTypeOT, - CIDType0, - CIDType0C, - CIDType0COT, - CIDTrueType, - CIDTrueTypeOT - }; - - /// \cond PRIVATE - /** - Create a new font information container. - */ - FontInfo(); - - /** - Create a new font information container. - */ - FontInfo( const FontInfoData &fid ); - /// \endcond - - /** - Copy constructor. - */ - FontInfo( const FontInfo &fi ); - - /** - Destructor. - */ - ~FontInfo(); - - /** - The name of the font. Can be QString::null if the font has no name - */ - QString name() const; - - /** - The path of the font file used to represent this font on this system, - or a null string is the font is embedded - */ - QString file() const; - - /** - Whether the font is embedded in the file, or not - - \return true if the font is embedded - */ - bool isEmbedded() const; - - /** - Whether the font provided is only a subset of the full - font or not. This only has meaning if the font is embedded. - - \return true if the font is only a subset - */ - bool isSubset() const; - - /** - The type of font encoding - - \return a enumerated value corresponding to the font encoding used - - \sa typeName for a string equivalent - */ - Type type() const; - - /** - The name of the font encoding used - - \note if you are looking for the name of the font (as opposed to the - encoding format used), you probably want name(). - - \sa type for a enumeration version - */ - QString typeName() const; - - /** - Standard assignment operator - */ - FontInfo& operator=( const FontInfo &fi ); - - private: - FontInfoData *m_data; - }; - - - class FontIteratorData; - /** - Iterator for reading the fonts in a document. - - FontIterator provides a Java-style iterator for reading the fonts in a - document. - - You can use it in the following way: - \code -Poppler::FontIterator* it = doc->newFontIterator(); -while (it->hasNext()) { - QList fonts = it->next(); - // do something with the fonts -} -// after doing the job, the iterator must be freed -delete it; - \endcode - - \since 0.12 - */ - class POPPLER_QT4_EXPORT FontIterator { - friend class Document; - friend class DocumentData; - public: - /** - Destructor. - */ - ~FontIterator(); - - /** - Returns the fonts of the current page and then advances the iterator - to the next page. - */ - QList next(); - - /** - Checks whether there is at least one more page to iterate, ie returns - false when the iterator is beyond the last page. - */ - bool hasNext() const; - - /** - Returns the current page where the iterator is. - */ - int currentPage() const; - - private: - Q_DISABLE_COPY( FontIterator ) - FontIterator( int, DocumentData *dd ); - - FontIteratorData *d; - }; - - - class EmbeddedFileData; - /** - Container class for an embedded file with a PDF document - */ - class POPPLER_QT4_EXPORT EmbeddedFile { - friend class DocumentData; - friend class AnnotationPrivate; - public: - /// \cond PRIVATE - EmbeddedFile(EmbFile *embfile); - /// \endcond - - /** - Destructor. - */ - ~EmbeddedFile(); - - /** - The name associated with the file - */ - QString name() const; - - /** - The description associated with the file, if any. - - This will return an empty QString if there is no description element - */ - QString description() const; - - /** - The size of the file. - - This will return < 0 if there is no size element - */ - int size() const; - - /** - The modification date for the embedded file, if known. - */ - QDateTime modDate() const; - - /** - The creation date for the embedded file, if known. - */ - QDateTime createDate() const; - - /** - The MD5 checksum of the file. - - This will return an empty QByteArray if there is no checksum element. - */ - QByteArray checksum() const; - - /** - The MIME type of the file, if known. - - \since 0.8 - */ - QString mimeType() const; - - /** - The data as a byte array - */ - QByteArray data(); - - /** - Is the embedded file valid? - - \since 0.12 - */ - bool isValid() const; - - /** - A QDataStream for the actual data? - */ - //QDataStream dataStream() const; - - private: - Q_DISABLE_COPY(EmbeddedFile) - EmbeddedFile(EmbeddedFileData &dd); - - EmbeddedFileData *m_embeddedFile; - }; - - - /** - \brief A page in a document. - - The Page class represents a single page within a PDF document. - - You cannot construct a Page directly, but you have to use the Document - functions that return a new Page out of an index or a label. - */ - class POPPLER_QT4_EXPORT Page { - friend class Document; - public: - /** - Destructor. - */ - ~Page(); - - /** - The type of rotation to apply for an operation - */ - enum Rotation { Rotate0 = 0, ///< Do not rotate - Rotate90 = 1, ///< Rotate 90 degrees clockwise - Rotate180 = 2, ///< Rotate 180 degrees - Rotate270 = 3 ///< Rotate 270 degrees clockwise (90 degrees counterclockwise) - }; - - /** - The kinds of page actions - */ - enum PageAction { - Opening, ///< The action when a page is "opened" - Closing ///< The action when a page is "closed" - }; - - /** - How the text is going to be returned - \since 0.16 - */ - enum TextLayout { - PhysicalLayout, ///< The text is layouted to resemble the real page layout - RawOrderLayout ///< The text is returned without any type of processing - }; - - /** - Additional flags for the renderToPainter method - \since 0.16 - */ - enum PainterFlag { - /** - Do not save/restore the caller-owned painter. - - renderToPainter() by default preserves, using save() + restore(), - the state of the painter specified; if this is not needed, this - flag can avoid this job - */ - DontSaveAndRestore = 0x00000001 - }; - Q_DECLARE_FLAGS( PainterFlags, PainterFlag ) - - /** - Render the page to a QImage using the current - \link Document::renderBackend() Document renderer\endlink. - - If \p x = \p y = \p w = \p h = -1, the method will automatically - compute the size of the image from the horizontal and vertical - resolutions specified in \p xres and \p yres. Otherwise, the - method renders only a part of the page, specified by the - parameters (\p x, \p y, \p w, \p h) in pixel coordinates. The returned - QImage then has size (\p w, \p h), independent of the page - size. - - \param x specifies the left x-coordinate of the box, in - pixels. - - \param y specifies the top y-coordinate of the box, in - pixels. - - \param w specifies the width of the box, in pixels. - - \param h specifies the height of the box, in pixels. - - \param xres horizontal resolution of the graphics device, - in dots per inch - - \param yres vertical resolution of the graphics device, in - dots per inch - - \param rotate how to rotate the page - - \warning The parameter (\p x, \p y, \p w, \p h) are not - well-tested. Unusual or meaningless parameters may lead to - rather unexpected results. - - \returns a QImage of the page, or a null image on failure. - - \since 0.6 - */ - QImage renderToImage(double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, Rotation rotate = Rotate0) const; - - /** - Render the page to the specified QPainter using the current - \link Document::renderBackend() Document renderer\endlink. - - If \p x = \p y = \p w = \p h = -1, the method will automatically - compute the size of the page area from the horizontal and vertical - resolutions specified in \p xres and \p yres. Otherwise, the - method renders only a part of the page, specified by the - parameters (\p x, \p y, \p w, \p h) in pixel coordinates. - - \param painter the painter to paint on - - \param x specifies the left x-coordinate of the box, in - pixels. - - \param y specifies the top y-coordinate of the box, in - pixels. - - \param w specifies the width of the box, in pixels. - - \param h specifies the height of the box, in pixels. - - \param xres horizontal resolution of the graphics device, - in dots per inch - - \param yres vertical resolution of the graphics device, in - dots per inch - - \param rotate how to rotate the page - - \param flags additional painter flags - - \warning The parameter (\p x, \p y, \p w, \p h) are not - well-tested. Unusual or meaningless parameters may lead to - rather unexpected results. - - \returns whether the painting succeeded - - \note This method is only supported for Arthur - - \since 0.16 - */ - bool renderToPainter(QPainter* painter, double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, - Rotation rotate = Rotate0, PainterFlags flags = 0) const; - - /** - Get the page thumbnail if it exists. - - \return a QImage of the thumbnail, or a null image - if the PDF does not contain one for this page - - \since 0.12 - */ - QImage thumbnail() const; - - /** - Returns the text that is inside a specified rectangle - - \param rect the rectangle specifying the area of interest, - with coordinates given in points, i.e., 1/72th of an inch. - If rect is null, all text on the page is given - - \since 0.16 - **/ - QString text(const QRectF &rect, TextLayout textLayout) const; - - /** - Returns the text that is inside a specified rectangle. - The text is returned using the physical layout of the page - - \param rect the rectangle specifying the area of interest, - with coordinates given in points, i.e., 1/72th of an inch. - If rect is null, all text on the page is given - **/ - QString text(const QRectF &rect) const; - - /** - The starting point for a search - */ - enum SearchDirection { FromTop, ///< Start sorting at the top of the document - NextResult, ///< Find the next result, moving "down the page" - PreviousResult ///< Find the previous result, moving "up the page" - }; - - /** - The type of search to perform - */ - enum SearchMode { CaseSensitive, ///< Case differences cause no match in searching - CaseInsensitive ///< Case differences are ignored in matching - }; - - /** - Returns true if the specified text was found. - - \param text the text the search - \param rect in all directions is used to return where the text was found, for NextResult and PreviousResult - indicates where to continue searching for - \param direction in which direction do the search - \param caseSensitive be case sensitive? - \param rotate the rotation to apply for the search order - **/ - Q_DECL_DEPRECATED bool search(const QString &text, QRectF &rect, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const; - - /** - Returns true if the specified text was found. - - \param text the text the search - \param rectXXX in all directions is used to return where the text was found, for NextResult and PreviousResult - indicates where to continue searching for - \param direction in which direction do the search - \param caseSensitive be case sensitive? - \param rotate the rotation to apply for the search order - \since 0.14 - **/ - bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const; - - /** - Returns a list of all occurrences of the specified text on the page. - - \param text the text to search - \param caseSensitive whether to be case sensitive - \param rotate the rotation to apply for the search order - - \warning Do not use the returned QRectF as arguments of another search call because of truncation issues if qreal is defined as float. - - \since 0.22 - **/ - QList search(const QString &text, SearchMode caseSensitive, Rotation rotate = Rotate0) const; - - /** - Returns a list of text of the page - - This method returns a QList of TextBoxes that contain all - the text of the page, with roughly one text word of text - per TextBox item. - - For text written in western languages (left-to-right and - up-to-down), the QList contains the text in the proper - order. - - \note The caller owns the text boxes and they should - be deleted when no longer required. - - \warning This method is not tested with Asian scripts - */ - QList textList(Rotation rotate = Rotate0) const; - - /** - \return The dimensions (cropbox) of the page, in points (i.e. 1/72th of an inch) - */ - QSizeF pageSizeF() const; - - /** - \return The dimensions (cropbox) of the page, in points (i.e. 1/72th of an inch) - */ - QSize pageSize() const; - - /** - Returns the transition of this page - - \returns a pointer to a PageTransition structure that - defines how transition to this page shall be performed. - - \note The PageTransition structure is owned by this page, and will - automatically be destroyed when this page class is - destroyed. - **/ - PageTransition *transition() const; - - /** - Gets the page action specified, or NULL if there is no action. - - \since 0.6 - **/ - Link *action( PageAction act ) const; - - /** - Types of orientations that are possible - */ - enum Orientation { - Landscape, ///< Landscape orientation (portrait, with 90 degrees clockwise rotation ) - Portrait, ///< Normal portrait orientation - Seascape, ///< Seascape orientation (portrait, with 270 degrees clockwise rotation) - UpsideDown ///< Upside down orientation (portrait, with 180 degrees rotation) - }; - - /** - The orientation of the page - */ - Orientation orientation() const; - - /** - The default CTM - */ - void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown); - - /** - Gets the links of the page - */ - QList links() const; - - /** - Returns the annotations of the page - - \note If you call this method twice, you get different objects - pointing to the same annotations (see Annotation). - The caller owns the returned objects and they should be deleted - when no longer required. - */ - QList annotations() const; - - /** - Adds an annotation to the page - - \note Ownership of the annotation object stays with the caller, who can - delete it at any time. - \since 0.20 - */ - void addAnnotation( const Annotation *ann ); - - /** - Removes an annotation from the page and destroys the annotation object - - \note There mustn't be other Annotation objects pointing this annotation - \since 0.20 - */ - void removeAnnotation( const Annotation *ann ); - - /** - Returns the form fields on the page - The caller gets the ownership of the returned objects. - - \since 0.6 - */ - QList formFields() const; - - /** - Returns the page duration. That is the time, in seconds, that the page - should be displayed before the presentation automatically advances to the next page. - Returns < 0 if duration is not set. - - \since 0.6 - */ - double duration() const; - - /** - Returns the label of the page, or a null string is the page has no label. - - \since 0.6 - **/ - QString label() const; - - private: - Q_DISABLE_COPY(Page) - - Page(DocumentData *doc, int index); - PageData *m_page; - }; - -/** - \brief PDF document. - - The Document class represents a PDF document: its pages, and all the global - properties, metadata, etc. - - \section ownership Ownership of the returned objects - - All the functions that returns class pointers create new object, and the - responsability of those is given to the callee. - - The only exception is \link Poppler::Page::transition() Page::transition()\endlink. - - \section document-loading Loading - - To get a Document, you have to load it via the load() & loadFromData() - functions. - - In all the functions that have passwords as arguments, they \b must be Latin1 - encoded. If you have a password that is a UTF-8 string, you need to use - QString::toLatin1() (or similar) to convert the password first. - If you have a UTF-8 character array, consider converting it to a QString first - (QString::fromUtf8(), or similar) before converting to Latin1 encoding. - - \section document-rendering Rendering - - To render pages of a document, you have different Document functions to set - various options. - - \subsection document-rendering-backend Backends - - %Poppler offers a different backends for rendering the pages. Currently - there are two backends (see #RenderBackend), but only the Splash engine works - well and has been tested. - - The available rendering backends can be discovered via availableRenderBackends(). - The current rendering backend can be changed using setRenderBackend(). - Please note that setting a backend not listed in the available ones - will always result in null QImage's. - - \section document-cms Color management support - - %Poppler, if compiled with this support, provides functions to handle color - profiles. - - To know whether the %Poppler version you are using has support for color - management, you can query Poppler::isCmsAvailable(). In case it is not - avilable, all the color management-related functions will either do nothing - or return null. -*/ - class POPPLER_QT4_EXPORT Document { - friend class Page; - friend class DocumentData; - - public: - /** - The page mode - */ - enum PageMode { - UseNone, ///< No mode - neither document outline nor thumbnail images are visible - UseOutlines, ///< Document outline visible - UseThumbs, ///< Thumbnail images visible - FullScreen, ///< Fullscreen mode (no menubar, windows controls etc) - UseOC, ///< Optional content group panel visible - UseAttach ///< Attachments panel visible - }; - - /** - The page layout - */ - enum PageLayout { - NoLayout, ///< Layout not specified - SinglePage, ///< Display a single page - OneColumn, ///< Display a single column of pages - TwoColumnLeft, ///< Display the pages in two columns, with odd-numbered pages on the left - TwoColumnRight, ///< Display the pages in two columns, with odd-numbered pages on the right - TwoPageLeft, ///< Display the pages two at a time, with odd-numbered pages on the left - TwoPageRight ///< Display the pages two at a time, with odd-numbered pages on the right - }; - - /** - The render backends available - - \since 0.6 - */ - enum RenderBackend { - SplashBackend, ///< Splash backend - ArthurBackend ///< Arthur (Qt4) backend - }; - - /** - The render hints available - - \since 0.6 - */ - enum RenderHint { - Antialiasing = 0x00000001, ///< Antialiasing for graphics - TextAntialiasing = 0x00000002, ///< Antialiasing for text - TextHinting = 0x00000004, ///< Hinting for text \since 0.12.1 - TextSlightHinting = 0x00000008, ///< Lighter hinting for text when combined with TextHinting \since 0.18 - OverprintPreview = 0x00000010 ///< Overprint preview \since 0.22 - }; - Q_DECLARE_FLAGS( RenderHints, RenderHint ) - - /** - Form types - - \since 0.22 - */ - enum FormType { - NoForm, ///< Document doesn't contain forms - AcroForm, ///< AcroForm - XfaForm ///< Adobe XML Forms Architecture (XFA), currently unsupported - }; - - /** - Set a color display profile for the current document. - - \param outputProfileA is a \c cmsHPROFILE of the LCMS library. - - \since 0.12 - */ - void setColorDisplayProfile(void *outputProfileA); - /** - Set a color display profile for the current document. - - \param name is the name of the display profile to set. - - \since 0.12 - */ - void setColorDisplayProfileName(const QString &name); - /** - Return the current RGB profile. - - \return a \c cmsHPROFILE of the LCMS library. - - \since 0.12 - */ - void* colorRgbProfile() const; - /** - Return the current display profile. - - \return a \c cmsHPROFILE of the LCMS library. - - \since 0.12 - */ - void *colorDisplayProfile() const; - - /** - Load the document from a file on disk - - \param filePath the name (and path, if required) of the file to load - \param ownerPassword the Latin1-encoded owner password to use in - loading the file - \param userPassword the Latin1-encoded user ("open") password - to use in loading the file - - \return the loaded document, or NULL on error - - \note The caller owns the pointer to Document, and this should - be deleted when no longer required. - - \warning The returning document may be locked if a password is required - to open the file, and one is not provided (as the userPassword). - */ - static Document *load(const QString & filePath, - const QByteArray &ownerPassword=QByteArray(), - const QByteArray &userPassword=QByteArray()); - - /** - Load the document from memory - - \param fileContents the file contents. They are copied so there is no need - to keep the byte array around for the full life time of - the document. - \param ownerPassword the Latin1-encoded owner password to use in - loading the file - \param userPassword the Latin1-encoded user ("open") password - to use in loading the file - - \return the loaded document, or NULL on error - - \note The caller owns the pointer to Document, and this should - be deleted when no longer required. - - \warning The returning document may be locked if a password is required - to open the file, and one is not provided (as the userPassword). - - \since 0.6 - */ - static Document *loadFromData(const QByteArray &fileContents, - const QByteArray &ownerPassword=QByteArray(), - const QByteArray &userPassword=QByteArray()); - - /** - Get a specified Page - - Note that this follows the PDF standard of being zero based - if you - want the first page, then you need an index of zero. - - The caller gets the ownership of the returned object. - - \param index the page number index - */ - Page *page(int index) const; - - /** - \overload - - - The intent is that you can pass in a label like \c "ix" and - get the page with that label (which might be in the table of - contents), or pass in \c "1" and get the page that the user - expects (which might not be the first page, if there is a - title page and a table of contents). - - \param label the page label - */ - Page *page(const QString &label) const; - - /** - The number of pages in the document - */ - int numPages() const; - - /** - The type of mode that should be used by the application - when the document is opened. Note that while this is - called page mode, it is really viewer application mode. - */ - PageMode pageMode() const; - - /** - The layout that pages should be shown in when the document - is first opened. This basically describes how pages are - shown relative to each other. - */ - PageLayout pageLayout() const; - - /** - Provide the passwords required to unlock the document - - \param ownerPassword the Latin1-encoded owner password to use in - loading the file - \param userPassword the Latin1-encoded user ("open") password - to use in loading the file - */ - bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword); - - /** - Determine if the document is locked - */ - bool isLocked() const; - - /** - The date associated with the document - - You would use this method with something like: - \code -QDateTime created = m_doc->date("CreationDate"); -QDateTime modified = m_doc->date("ModDate"); - \endcode - - The available dates are: - - CreationDate: the date of creation of the document - - ModDate: the date of the last change in the document - - \param data the type of date that is required - */ - QDateTime date( const QString & data ) const; - - /** - Get specified information associated with the document - - You would use this method with something like: - \code -QString title = m_doc->info("Title"); -QString subject = m_doc->info("Subject"); - \endcode - - In addition to \c Title and \c Subject, other information that may - be available include \c Author, \c Keywords, \c Creator and \c Producer. - - \param data the information that is required - - \sa infoKeys() to get a list of the available keys - */ - QString info( const QString & data ) const; - - /** - Obtain a list of the available string information keys. - */ - QStringList infoKeys() const; - - /** - Test if the document is encrypted - */ - bool isEncrypted() const; - - /** - Test if the document is linearised - - In some cases, this is called "fast web view", since it - is mostly an optimisation for viewing over the Web. - */ - bool isLinearized() const; - - /** - Test if the permissions on the document allow it to be - printed - */ - bool okToPrint() const; - - /** - Test if the permissions on the document allow it to be - printed at high resolution - */ - bool okToPrintHighRes() const; - - /** - Test if the permissions on the document allow it to be - changed. - - \note depending on the type of change, it may be more - appropriate to check other properties as well. - */ - bool okToChange() const; - - /** - Test if the permissions on the document allow the - contents to be copied / extracted - */ - bool okToCopy() const; - - /** - Test if the permissions on the document allow annotations - to be added or modified, and interactive form fields (including - signature fields) to be completed. - */ - bool okToAddNotes() const; - - /** - Test if the permissions on the document allow interactive - form fields (including signature fields) to be completed. - - \note this can be true even if okToAddNotes() is false - this - means that only form completion is permitted. - */ - bool okToFillForm() const; - - /** - Test if the permissions on the document allow interactive - form fields (including signature fields) to be set, created and - modified - */ - bool okToCreateFormFields() const; - - /** - Test if the permissions on the document allow content extraction - (text and perhaps other content) for accessibility usage (eg for - a screen reader) - */ - bool okToExtractForAccessibility() const; - - /** - Test if the permissions on the document allow it to be - "assembled" - insertion, rotation and deletion of pages; - or creation of bookmarks and thumbnail images. - - \note this can be true even if okToChange() is false - */ - bool okToAssemble() const; - - /** - The version of the PDF specification that the document - conforms to - - \deprecated use getPdfVersion and avoid float point - comparisons/handling - */ - Q_DECL_DEPRECATED double pdfVersion() const; - - /** - The version of the PDF specification that the document - conforms to - - \param major an optional pointer to a variable where store the - "major" number of the version - \param minor an optional pointer to a variable where store the - "minor" number of the version - - \since 0.12 - */ - void getPdfVersion(int *major, int *minor) const; - - /** - The fonts within the PDF document. - - This is a shorthand for getting all the fonts at once. - - \note this can take a very long time to run with a large - document. You may wish to use a FontIterator if you have more - than say 20 pages - - \see newFontIterator() - */ - QList fonts() const; - - /** - Scans for fonts within the PDF document. - - \param numPages the number of pages to scan - \param fontList pointer to the list where the font information - should be placed - - \note with this method you can scan for fonts only \em once for each - document; once the end is reached, no more scanning with this method - can be done - - \return false if the end of the document has been reached - - \deprecated this function is quite limited in its job (see note), - better use fonts() or newFontIterator() - - \see fonts(), newFontIterator() - */ - Q_DECL_DEPRECATED bool scanForFonts( int numPages, QList *fontList ) const; - - /** - Creates a new FontIterator object for font scanning. - - The new iterator can be used for reading the font information of the - document, reading page by page. - - The caller is responsible for the returned object, ie it should freed - it when no more useful. - - \param startPage the initial page from which start reading fonts - - \see fonts() - - \since 0.12 - */ - FontIterator* newFontIterator( int startPage = 0 ) const; - - /** - The font data if the font is an embedded one. - - \since 0.10 - */ - QByteArray fontData(const FontInfo &font) const; - - /** - The documents embedded within the PDF document. - - \note there are two types of embedded document - this call - only accesses documents that are embedded at the document level. - */ - QList embeddedFiles() const; - - /** - Whether there are any documents embedded in this PDF document. - */ - bool hasEmbeddedFiles() const; - - /** - Gets the table of contents (TOC) of the Document. - - The caller is responsable for the returned object. - - In the tree the tag name is the 'screen' name of the entry. A tag can have - attributes. Here follows the list of tag attributes with meaning: - - Destination: A string description of the referred destination - - DestinationName: A 'named reference' to the viewport - - ExternalFileName: A link to a external filename - - Open: A bool value that tells whether the subbranch of the item is open or not - - Resolving the final destination for each item can be done in the following way: - - first, checking for 'Destination': if not empty, then a LinkDestination - can be constructed straight with it - - as second step, if the 'DestinationName' is not empty, then the destination - can be resolved using linkDestination() - - Note also that if 'ExternalFileName' is not emtpy, then the destination refers - to that document (and not to the current one). - - \returns the TOC, or NULL if the Document does not have one - */ - QDomDocument *toc() const; - - /** - Tries to resolve the named destination \p name. - - \note this operation starts a search through the whole document - - \returns a new LinkDestination object if the named destination was - actually found, or NULL otherwise - */ - LinkDestination *linkDestination( const QString &name ); - - /** - Sets the paper color - - \param color the new paper color - */ - void setPaperColor(const QColor &color); - /** - The paper color - - The default color is white. - */ - QColor paperColor() const; - - /** - Sets the backend used to render the pages. - - \param backend the new rendering backend - - \since 0.6 - */ - void setRenderBackend( RenderBackend backend ); - /** - The currently set render backend - - The default backend is \ref SplashBackend - - \since 0.6 - */ - RenderBackend renderBackend() const; - - /** - The available rendering backends. - - \since 0.6 - */ - static QSet availableRenderBackends(); - - /** - Sets the render \p hint . - - \note some hints may not be supported by some rendering backends. - - \param on whether the flag should be added or removed. - - \since 0.6 - */ - void setRenderHint( RenderHint hint, bool on = true ); - /** - The currently set render hints. - - \since 0.6 - */ - RenderHints renderHints() const; - - /** - Gets a new PS converter for this document. - - The caller gets the ownership of the returned converter. - - \since 0.6 - */ - PSConverter *psConverter() const; - - /** - Gets a new PDF converter for this document. - - The caller gets the ownership of the returned converter. - - \since 0.8 - */ - PDFConverter *pdfConverter() const; - - /** - Gets the metadata stream contents - - \since 0.6 - */ - QString metadata() const; - - /** - Test whether this document has "optional content". - - Optional content is used to optionally turn on (display) - and turn off (not display) some elements of the document. - The most common use of this is for layers in design - applications, but it can be used for a range of things, - such as not including some content in printing, and - displaying content in the appropriate language. - - \since 0.8 - */ - bool hasOptionalContent() const; - - /** - Itemviews model for optional content. - - The model is owned by the document. - - \since 0.8 - */ - OptContentModel *optionalContentModel(); - - /** - Document-level JavaScript scripts. - - Returns the list of document level JavaScript scripts to be always - executed before any other script. - - \since 0.10 - */ - QStringList scripts() const; - - /** - The PDF identifiers. - - \param permanentId an optional pointer to a variable where store the - permanent ID of the document - \param updateId an optional pointer to a variable where store the - update ID of the document - - \return whether the document has the IDs - - \since 0.16 - */ - bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const; - - /** - Returns the type of forms contained in the document - - \since 0.22 - */ - FormType formType() const; - - /** - Destructor. - */ - ~Document(); - - private: - Q_DISABLE_COPY(Document) - - DocumentData *m_doc; - - Document(DocumentData *dataA); - }; - - class BaseConverterPrivate; - class PSConverterPrivate; - class PDFConverterPrivate; - /** - \brief Base converter. - - This is the base class for the converters. - - \since 0.8 - */ - class POPPLER_QT4_EXPORT BaseConverter - { - friend class Document; - public: - /** - Destructor. - */ - virtual ~BaseConverter(); - - /** Sets the output file name. You must set this or the output device. */ - void setOutputFileName(const QString &outputFileName); - - /** - * Sets the output device. You must set this or the output file name. - * - * \since 0.8 - */ - void setOutputDevice(QIODevice *device); - - /** - Does the conversion. - - \return whether the conversion succeeded - */ - virtual bool convert() = 0; - - enum Error - { - NoError, - FileLockedError, - OpenOutputError, - NotSupportedInputFileError - }; - - /** - Returns the last error - \since 0.12.1 - */ - Error lastError() const; - - protected: - /// \cond PRIVATE - BaseConverter(BaseConverterPrivate &dd); - Q_DECLARE_PRIVATE(BaseConverter) - BaseConverterPrivate *d_ptr; - /// \endcond - - private: - Q_DISABLE_COPY(BaseConverter) - }; - - /** - Converts a PDF to PS - - Sizes have to be in Points (1/72 inch) - - If you are using QPrinter you can get paper size by doing: - \code -QPrinter dummy(QPrinter::PrinterResolution); -dummy.setFullPage(true); -dummy.setPageSize(myPageSize); -width = dummy.width(); -height = dummy.height(); - \endcode - - \since 0.6 - */ - class POPPLER_QT4_EXPORT PSConverter : public BaseConverter - { - friend class Document; - public: - /** - Options for the PS export. - - \since 0.10 - */ - enum PSOption { - Printing = 0x00000001, ///< The PS is generated for printing purposes - StrictMargins = 0x00000002, - ForceRasterization = 0x00000004, - PrintToEPS = 0x00000008, ///< Output EPS instead of PS \since 0.20 - HideAnnotations = 0x00000010 ///< Don't print annotations \since 0.20 - }; - Q_DECLARE_FLAGS( PSOptions, PSOption ) - - /** - Destructor. - */ - ~PSConverter(); - - /** Sets the list of pages to print. Mandatory. */ - void setPageList(const QList &pageList); - - /** - Sets the title of the PS Document. Optional - */ - void setTitle(const QString &title); - - /** - Sets the horizontal DPI. Defaults to 72.0 - */ - void setHDPI(double hDPI); - - /** - Sets the vertical DPI. Defaults to 72.0 - */ - void setVDPI(double vDPI); - - /** - Sets the rotate. Defaults to not rotated - */ - void setRotate(int rotate); - - /** - Sets the output paper width. Has to be set. - */ - void setPaperWidth(int paperWidth); - - /** - Sets the output paper height. Has to be set. - */ - void setPaperHeight(int paperHeight); - - /** - Sets the output right margin. Defaults to 0 - */ - void setRightMargin(int marginRight); - - /** - Sets the output bottom margin. Defaults to 0 - */ - void setBottomMargin(int marginBottom); - - /** - Sets the output left margin. Defaults to 0 - */ - void setLeftMargin(int marginLeft); - - /** - Sets the output top margin. Defaults to 0 - */ - void setTopMargin(int marginTop); - - /** - Defines if margins have to be strictly followed (even if that - means changing aspect ratio), or if the margins can be adapted - to keep aspect ratio. - - Defaults to false. - */ - void setStrictMargins(bool strictMargins); - - /** Defines if the page will be rasterized to an image before printing. Defaults to false */ - void setForceRasterize(bool forceRasterize); - - /** - Sets the options for the PS export. - - \since 0.10 - */ - void setPSOptions(PSOptions options); - - /** - The currently set options for the PS export. - - The default flags are: Printing. - - \since 0.10 - */ - PSOptions psOptions() const; - - /** - Sets a function that will be called each time a page is converted. - - The payload belongs to the caller. - - \since 0.16 - */ - void setPageConvertedCallback(void (* callback)(int page, void *payload), void *payload); - - bool convert(); - - private: - Q_DECLARE_PRIVATE(PSConverter) - Q_DISABLE_COPY(PSConverter) - - PSConverter(DocumentData *document); - }; - - /** - Converts a PDF to PDF (thus saves a copy of the document). - - \since 0.8 - */ - class POPPLER_QT4_EXPORT PDFConverter : public BaseConverter - { - friend class Document; - public: - /** - Options for the PDF export. - */ - enum PDFOption { - WithChanges = 0x00000001 ///< The changes done to the document are saved as well - }; - Q_DECLARE_FLAGS( PDFOptions, PDFOption ) - - /** - Destructor. - */ - virtual ~PDFConverter(); - - /** - Sets the options for the PDF export. - */ - void setPDFOptions(PDFOptions options); - /** - The currently set options for the PDF export. - */ - PDFOptions pdfOptions() const; - - bool convert(); - - private: - Q_DECLARE_PRIVATE(PDFConverter) - Q_DISABLE_COPY(PDFConverter) - - PDFConverter(DocumentData *document); - }; - - /** - Conversion from PDF date string format to QDateTime - */ - POPPLER_QT4_EXPORT QDateTime convertDate( char *dateString ); - - /** - Whether the color management functions are available. - - \since 0.12 - */ - POPPLER_QT4_EXPORT bool isCmsAvailable(); - - /** - Whether the overprint preview functionality is available. - - \since 0.22 - */ - POPPLER_QT4_EXPORT bool isOverprintPreviewAvailable(); - - class SoundData; - /** - Container class for a sound file in a PDF document. - - A sound can be either External (in that case should be loaded the file - whose url is represented by url() ), or Embedded, and the player has to - play the data contained in data(). - - \since 0.6 - */ - class POPPLER_QT4_EXPORT SoundObject { - public: - /** - The type of sound - */ - enum SoundType { - External, ///< The real sound file is external - Embedded ///< The sound is contained in the data - }; - - /** - The encoding format used for the sound - */ - enum SoundEncoding { - Raw, ///< Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ] - Signed, ///< Twos-complement values - muLaw, ///< mu-law-encoded samples - ALaw ///< A-law-encoded samples - }; - - /// \cond PRIVATE - SoundObject(Sound *popplersound); - /// \endcond - - ~SoundObject(); - - /** - Is the sound embedded (SoundObject::Embedded) or external (SoundObject::External)? - */ - SoundType soundType() const; - - /** - The URL of the sound file to be played, in case of SoundObject::External - */ - QString url() const; - - /** - The data of the sound, in case of SoundObject::Embedded - */ - QByteArray data() const; - - /** - The sampling rate of the sound - */ - double samplingRate() const; - - /** - The number of sound channels to use to play the sound - */ - int channels() const; - - /** - The number of bits per sample value per channel - */ - int bitsPerSample() const; - - /** - The encoding used for the sound - */ - SoundEncoding soundEncoding() const; - - private: - Q_DISABLE_COPY(SoundObject) - - SoundData *m_soundData; - }; - - class MovieData; - /** - Container class for a movie object in a PDF document. - - \since 0.10 - */ - class POPPLER_QT4_EXPORT MovieObject { - friend class AnnotationPrivate; - public: - /** - The play mode for playing the movie - */ - enum PlayMode { - PlayOnce, ///< Play the movie once, closing the movie controls at the end - PlayOpen, ///< Like PlayOnce, but leaving the controls open - PlayRepeat, ///< Play continuously until stopped - PlayPalindrome ///< Play forward, then backward, then again foward and so on until stopped - }; - - ~MovieObject(); - - /** - The URL of the movie to be played - */ - QString url() const; - - /** - The size of the movie - */ - QSize size() const; - - /** - The rotation (either 0, 90, 180, or 270 degrees clockwise) for the movie, - */ - int rotation() const; - - /** - Whether show a bar with movie controls - */ - bool showControls() const; - - /** - How to play the movie - */ - PlayMode playMode() const; - - /** - Returns whether a poster image should be shown if the movie is not playing. - \since 0.22 - */ - bool showPosterImage() const; - - /** - Returns the poster image that should be shown if the movie is not playing. - If the image is null but showImagePoster() returns @c true, the first frame of the movie - should be used as poster image. - \since 0.22 - */ - QImage posterImage() const; - - private: - /// \cond PRIVATE - MovieObject( AnnotMovie *ann ); - /// \endcond - - Q_DISABLE_COPY(MovieObject) - - MovieData *m_movieData; - }; - -} - -Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags) -Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints) -Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions) -Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PSConverter::PSOptions) - -#endif diff --git a/dependencies/poppler/lib/poppler-qt4.lib b/dependencies/poppler/lib/poppler-qt4.lib deleted file mode 100644 index 4e91866b..00000000 Binary files a/dependencies/poppler/lib/poppler-qt4.lib and /dev/null differ