aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/experimental/lumina-pdf
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/experimental/lumina-pdf')
-rw-r--r--src-qt5/experimental/lumina-pdf/lumina-pdf.desktop10
-rw-r--r--src-qt5/experimental/lumina-pdf/lumina-pdf.pro101
-rw-r--r--src-qt5/experimental/lumina-pdf/main.cpp31
-rw-r--r--src-qt5/experimental/lumina-pdf/mainUI.cpp178
-rw-r--r--src-qt5/experimental/lumina-pdf/mainUI.h52
-rw-r--r--src-qt5/experimental/lumina-pdf/mainUI.ui129
6 files changed, 0 insertions, 501 deletions
diff --git a/src-qt5/experimental/lumina-pdf/lumina-pdf.desktop b/src-qt5/experimental/lumina-pdf/lumina-pdf.desktop
deleted file mode 100644
index c9632c9f..00000000
--- a/src-qt5/experimental/lumina-pdf/lumina-pdf.desktop
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Exec=lumina-pdf %f
-Icon=application-pdf
-Terminal=false
-Type=Application
-StartupNotify=true
-Categories=Utility;
-MimeType=application/pdf;
-Name=Lumina PDF Viewer
-Comment=View PDF Files
diff --git a/src-qt5/experimental/lumina-pdf/lumina-pdf.pro b/src-qt5/experimental/lumina-pdf/lumina-pdf.pro
deleted file mode 100644
index 7d5562ed..00000000
--- a/src-qt5/experimental/lumina-pdf/lumina-pdf.pro
+++ /dev/null
@@ -1,101 +0,0 @@
-include("$${PWD}/../../OS-detect.pri")
-
-QT += core gui
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets concurrent
-
-
-TARGET = lumina-pdf
-TEMPLATE = app
-
-QT += printsupport
-
-target.path = $${L_BINDIR}
-
-#include all the special classes from the Lumina tree
-include(../../core/libLumina/LUtils.pri) #includes LUtils
-include(../../core/libLumina/LuminaXDG.pri)
-
-SOURCES += main.cpp\
- mainUI.cpp
-
-HEADERS += mainUI.h
-
-FORMS += mainUI.ui
-
-LIBS += -lpoppler-qt5
-INCLUDEPATH+= $${L_INCLUDEDIR}/poppler/qt5
-
-TRANSLATIONS = i18n/l-pdf_af.ts \
- i18n/l-pdf_ar.ts \
- i18n/l-pdf_az.ts \
- i18n/l-pdf_bg.ts \
- i18n/l-pdf_bn.ts \
- i18n/l-pdf_bs.ts \
- i18n/l-pdf_ca.ts \
- i18n/l-pdf_cs.ts \
- i18n/l-pdf_cy.ts \
- i18n/l-pdf_da.ts \
- i18n/l-pdf_de.ts \
- i18n/l-pdf_el.ts \
- i18n/l-pdf_en_GB.ts \
- i18n/l-pdf_en_ZA.ts \
- i18n/l-pdf_es.ts \
- i18n/l-pdf_et.ts \
- i18n/l-pdf_eu.ts \
- i18n/l-pdf_fa.ts \
- i18n/l-pdf_fi.ts \
- i18n/l-pdf_fr.ts \
- i18n/l-pdf_fr_CA.ts \
- i18n/l-pdf_gl.ts \
- i18n/l-pdf_he.ts \
- i18n/l-pdf_hi.ts \
- i18n/l-pdf_hr.ts \
- i18n/l-pdf_hu.ts \
- i18n/l-pdf_id.ts \
- i18n/l-pdf_is.ts \
- i18n/l-pdf_it.ts \
- i18n/l-pdf_ja.ts \
- i18n/l-pdf_ka.ts \
- i18n/l-pdf_ko.ts \
- i18n/l-pdf_lt.ts \
- i18n/l-pdf_lv.ts \
- i18n/l-pdf_mk.ts \
- i18n/l-pdf_mn.ts \
- i18n/l-pdf_ms.ts \
- i18n/l-pdf_mt.ts \
- i18n/l-pdf_nb.ts \
- i18n/l-pdf_nl.ts \
- i18n/l-pdf_pa.ts \
- i18n/l-pdf_pl.ts \
- i18n/l-pdf_pt.ts \
- i18n/l-pdf_pt_BR.ts \
- i18n/l-pdf_ro.ts \
- i18n/l-pdf_ru.ts \
- i18n/l-pdf_sk.ts \
- i18n/l-pdf_sl.ts \
- i18n/l-pdf_sr.ts \
- i18n/l-pdf_sv.ts \
- i18n/l-pdf_sw.ts \
- i18n/l-pdf_ta.ts \
- i18n/l-pdf_tg.ts \
- i18n/l-pdf_th.ts \
- i18n/l-pdf_tr.ts \
- i18n/l-pdf_uk.ts \
- i18n/l-pdf_uz.ts \
- i18n/l-pdf_vi.ts \
- i18n/l-pdf_zh_CN.ts \
- i18n/l-pdf_zh_HK.ts \
- i18n/l-pdf_zh_TW.ts \
- i18n/l-pdf_zu.ts
-
-dotrans.path=$${L_SHAREDIR}/lumina-desktop/i18n/
-dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/i18n/
-
-desktop.files=lumina-pdf.desktop
-desktop.path=$${L_SHAREDIR}/applications/
-
-INSTALLS += target desktop
-
-WITH_I18N{
- INSTALLS += dotrans
-}
diff --git a/src-qt5/experimental/lumina-pdf/main.cpp b/src-qt5/experimental/lumina-pdf/main.cpp
deleted file mode 100644
index f6bb9839..00000000
--- a/src-qt5/experimental/lumina-pdf/main.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <QTranslator>
-#include <QApplication>
-#include <QDebug>
-#include <QFile>
-
-#include "mainUI.h"
-#include <LUtils.h>
-//#include <LuminaThemes.h>
-
-int main(int argc, char ** argv)
-{
- //LTHEME::LoadCustomEnvSettings();
- QApplication a(argc, argv);
- LUtils::LoadTranslation(&a, "l-pdf");
- //LuminaThemeEngine theme(&a);
-
-
- //Read the input variables
- QString path = "";
- for(int i=1; i<argc; i++){
- path = LUtils::PathToAbsolute( argv[i] );
- if(QFile::exists(path)){ break; } //already found a valid file
- }
-
- MainUI w;
- //QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) );
- if(!path.isEmpty()){ w.loadFile(path); }
- w.show();
- int retCode = a.exec();
- return retCode;
-}
diff --git a/src-qt5/experimental/lumina-pdf/mainUI.cpp b/src-qt5/experimental/lumina-pdf/mainUI.cpp
deleted file mode 100644
index 620b4623..00000000
--- a/src-qt5/experimental/lumina-pdf/mainUI.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-//===========================================
-// Lumina Desktop source code
-// Copyright (c) 2017, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-#include "mainUI.h"
-#include "ui_mainUI.h"
-
-#include <QPainter>
-#include <QImage>
-#include <QSize>
-#include <QFileDialog>
-#include <QInputDialog>
-#include <QDebug>
-#include <QApplication>
-#include <QScreen>
-
-#include <LuminaXDG.h>
-
-MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){
- ui->setupUi(this);
-
- this->setWindowTitle(tr("Lumina PDF Viewer"));
- this->setWindowIcon( LXDG::findIcon("application-pdf","unknown"));
-
- lastdir = QDir::homePath();
- Printer = new QPrinter();
- WIDGET = new QPrintPreviewWidget(Printer,this);
- this->setCentralWidget(WIDGET);
- connect(WIDGET, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paintOnWidget(QPrinter*)) );
- DOC = 0;
-
- PrintDLG = new QPrintDialog(this);
- connect(PrintDLG, SIGNAL(accepted(QPrinter*)), this, SLOT(paintOnWidget(QPrinter*)) ); //Can change to PaintToPrinter() later
-
- //Create the other interface widgets
- progress = new QProgressBar(this);
- progress->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- progress->setFormat("%v/%m (%p%)"); // [current]/[total]
- progAct = ui->toolBar->addWidget(progress);
- progAct->setVisible(false);
- //Put the various actions into logical groups
- QActionGroup *tmp = new QActionGroup(this);
- tmp->setExclusive(true);
- tmp->addAction(ui->actionFit_Width);
- tmp->addAction(ui->actionFit_Page);
- ui->actionFit_Page->setChecked(true);
-
- tmp = new QActionGroup(this);
- tmp->setExclusive(true);
- tmp->addAction(ui->actionSingle_Page);
- tmp->addAction(ui->actionDual_Pages);
- tmp->addAction(ui->actionAll_Pages);
- ui->actionSingle_Page->setChecked(true);
-
- //Connect up the buttons
- connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close()) );
- connect(ui->actionPrint, SIGNAL(triggered()), PrintDLG, SLOT(open()) );
- connect(ui->actionFit_Width, SIGNAL(triggered()), WIDGET, SLOT(fitToWidth()) );
- connect(ui->actionFit_Page, SIGNAL(triggered()), WIDGET, SLOT(fitInView()) );
- connect(ui->actionOpen_PDF, SIGNAL(triggered()), this, SLOT(OpenNewFile()) );
- connect(ui->actionSingle_Page, SIGNAL(triggered()), WIDGET, SLOT(setSinglePageViewMode()) );
- connect(ui->actionDual_Pages, SIGNAL(triggered()), WIDGET, SLOT(setFacingPagesViewMode()) );
- connect(ui->actionAll_Pages, SIGNAL(triggered()), WIDGET, SLOT(setAllPagesViewMode()) );
-
- //Setup all the icons
- ui->actionPrint->setIcon( LXDG::findIcon("document-print",""));
- ui->actionClose->setIcon( LXDG::findIcon("window-close",""));
- ui->actionFit_Width->setIcon(LXDG::findIcon("arrow-expand-all",""));
- ui->actionFit_Page->setIcon(LXDG::findIcon("zoom-fit-best",""));
- ui->actionOpen_PDF->setIcon(LXDG::findIcon("document-open",""));
- ui->actionSingle_Page->setIcon(LXDG::findIcon("view-preview",""));
- ui->actionDual_Pages->setIcon(LXDG::findIcon("format-view-agenda",""));
- ui->actionAll_Pages->setIcon(LXDG::findIcon("format-view-grid-small",""));
-}
-
-MainUI::~MainUI(){
-
-}
-
-void MainUI::loadFile(QString path){
-
- if(!QFile::exists(path) || path.isEmpty() ){ return; }
- Poppler::Document *TDOC = Poppler::Document::load(path);
- if(TDOC==0){
- qDebug() << "Could not open file:" << path;
- return;
- }else if(TDOC->isLocked()){
- //Prompt for password to unlock the document
- QString pass = "";
- bool ok = true; //flag this to go into the loop the first time (if password prompt is cancelled - this becomes false)
- while( (ok ? true : !TDOC->unlock(QByteArray(), pass.toLocal8Bit())) ){ //make sure the unlock function is only called when ok is true
- pass = QInputDialog::getText(this, tr("Unlock PDF"), tr("Password:"), QLineEdit::Password, "", &ok);
- }
- if(TDOC->isLocked()){ return; } //Cancelled - still locked
- }
-
- if(DOC!=0){
- //Clear out the old document first
- delete DOC;
- DOC=0;
- }
- DOC = TDOC; //Save this for later
- qDebug() << "Opening File:" << path;
- this->setWindowTitle(DOC->title());
- if(this->windowTitle().isEmpty()){ this->setWindowTitle(path.section("/",-1)); }
-
- //Setup the Document
- Poppler::Page *PAGE = DOC->page(0);
- if(PAGE!=0){
- lastdir = path.section("/",0,-2); //save this for later
- Printer->setPageSize( QPageSize(PAGE->pageSize(), QPageSize::Point) );
- Printer->setPageMargins(QMarginsF(0,0,0,0), QPageLayout::Point);
- switch(PAGE->orientation()){
- case Poppler::Page::Landscape:
- Printer->setOrientation(QPrinter::Landscape); break;
- default:
- Printer->setOrientation(QPrinter::Portrait);
- }
- delete PAGE;
- WIDGET->updatePreview(); //start loading the file preview
- }
-
-}
-
-void MainUI::paintOnWidget(QPrinter *PRINTER){
- if(DOC==0){ return; }
- //this->show();
- //QApplication::processEvents();
- int pages = DOC->numPages();
- int firstpage = 0;
- //qDebug() << "Start Rendering PDF:" << PRINTER->fromPage() << PRINTER->toPage();
- if(PRINTER->fromPage() != PRINTER->toPage() || PRINTER->fromPage()!=0){
- firstpage = PRINTER->fromPage() - 1;
- pages = PRINTER->toPage();
- }
- qDebug() << " - Generating Pages:" << firstpage << pages;
- //Now start painting all the pages onto the widget
- QRectF size = PRINTER->pageRect(QPrinter::DevicePixel);
- QSize DPI(PRINTER->resolution(),PRINTER->resolution());
- //QScreen *scrn = QApplication::screens().first();
- //QSize SDPI(scrn->logicalDotsPerInchX(), scrn->logicalDotsPerInchY());
- QPainter painter(PRINTER);
- //qDebug() << "Set progress bar range:" << firstpage+1 << pages;
- progress->setRange(firstpage+1,pages+1);
- //progress->setValue(firstpage);
- progAct->setVisible(true);
- qDebug() << "Printer DPI:" << DPI;
- //qDebug() << "Screen DPI:" << SDPI;
- for(int i=firstpage; i<pages; i++){
- //qDebug() << "Loading Page:" << i;
- progress->setValue(i+1);
- //qDebug() << " - ProcessEvents";
- QApplication::processEvents();
- //Now paint this page on the printer
- //qDebug() << " - Load Poppler Page";
- if(i != firstpage){ PRINTER->newPage(); } //this is the start of the next page (not needed for first)
- Poppler::Page *PAGE = DOC->page(i);
- if(PAGE!=0){
- painter.drawImage(0,0,PAGE->renderToImage(2*DPI.width(), 2*DPI.height()).scaled(size.width(), size.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation) );
- }else{
- painter.drawImage(0,0,QImage());
- }
- if(PAGE!=0){ delete PAGE; }
- //QApplication::processEvents();
- }
- //qDebug() << "Done Loading Pages";
- progAct->setVisible(false);
-}
-
-void MainUI::OpenNewFile(){
- //Prompt for a file
- QString path = QFileDialog::getOpenFileName(this, tr("Open PDF"), lastdir, tr("PDF Documents (*.pdf)"));
- //Now Open it
- if(!path.isEmpty()){ loadFile(path); }
-
-}
diff --git a/src-qt5/experimental/lumina-pdf/mainUI.h b/src-qt5/experimental/lumina-pdf/mainUI.h
deleted file mode 100644
index 1bd1699b..00000000
--- a/src-qt5/experimental/lumina-pdf/mainUI.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===========================================
-// Lumina Desktop source code
-// Copyright (c) 2017, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-#ifndef _LUMINA_PDF_VIEWER_MAIN_WINDOW_H
-#define _LUMINA_PDF_VIEWER_MAIN_WINDOW_H
-
-#include <QPrintPreviewWidget>
-#include <QPrintDialog>
-#include <QPrinter>
-#include <QMainWindow>
-#include <QProgressBar>
-
-#include <poppler-qt5.h>
-
-namespace Ui{
- class MainUI;
-};
-
-class MainUI : public QMainWindow{
- Q_OBJECT
-public:
- MainUI();
- ~MainUI();
-
- void loadFile(QString path);
-
-
-private:
- Poppler::Document *DOC;
- QPrintPreviewWidget *WIDGET;
- Ui::MainUI *ui;
- QPrinter* Printer;
- QPrintDialog *PrintDLG;
-
- QString lastdir;
-
- //Other Interface elements
- QProgressBar *progress;
- QAction *progAct; //action associated with the progressbar
-
-
-private slots:
- void paintOnWidget(QPrinter *PRINTER);
-
- //Button Slots
- void OpenNewFile();
-
-};
-#endif
diff --git a/src-qt5/experimental/lumina-pdf/mainUI.ui b/src-qt5/experimental/lumina-pdf/mainUI.ui
deleted file mode 100644
index e12cd6fd..00000000
--- a/src-qt5/experimental/lumina-pdf/mainUI.ui
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainUI</class>
- <widget class="QMainWindow" name="MainUI">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>659</width>
- <height>588</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>MainWindow</string>
- </property>
- <widget class="QWidget" name="centralwidget"/>
- <widget class="QMenuBar" name="menubar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>659</width>
- <height>20</height>
- </rect>
- </property>
- <widget class="QMenu" name="menuFile">
- <property name="title">
- <string>File</string>
- </property>
- <addaction name="actionPrint"/>
- <addaction name="separator"/>
- <addaction name="actionOpen_PDF"/>
- <addaction name="separator"/>
- <addaction name="actionClose"/>
- </widget>
- <addaction name="menuFile"/>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- <widget class="QToolBar" name="toolBar">
- <property name="windowTitle">
- <string>toolBar</string>
- </property>
- <property name="movable">
- <bool>false</bool>
- </property>
- <property name="floatable">
- <bool>false</bool>
- </property>
- <attribute name="toolBarArea">
- <enum>TopToolBarArea</enum>
- </attribute>
- <attribute name="toolBarBreak">
- <bool>false</bool>
- </attribute>
- <addaction name="actionFit_Page"/>
- <addaction name="actionFit_Width"/>
- <addaction name="separator"/>
- <addaction name="actionSingle_Page"/>
- <addaction name="actionDual_Pages"/>
- <addaction name="actionAll_Pages"/>
- </widget>
- <action name="actionOpen_PDF">
- <property name="text">
- <string>Open PDF</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+O</string>
- </property>
- </action>
- <action name="actionClose">
- <property name="text">
- <string>Close</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+Q</string>
- </property>
- </action>
- <action name="actionFit_Page">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Fit Page</string>
- </property>
- </action>
- <action name="actionFit_Width">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Fit Width</string>
- </property>
- </action>
- <action name="actionPrint">
- <property name="text">
- <string>Print</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+P</string>
- </property>
- </action>
- <action name="actionSingle_Page">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Single Page</string>
- </property>
- </action>
- <action name="actionDual_Pages">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Dual Pages</string>
- </property>
- </action>
- <action name="actionAll_Pages">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>All Pages</string>
- </property>
- </action>
- </widget>
- <resources/>
- <connections/>
-</ui>
bgstack15