diff options
author | Ken Moore <ken@ixsystems.com> | 2018-02-27 10:24:37 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-02-27 10:24:37 -0500 |
commit | 6f7bfe5269912021229e570675ac0fbd9ad4f082 (patch) | |
tree | 83e4f30b9ec64c71ec89c723cca5a59fa4dbc2a4 /src-qt5/desktop-utils/lumina-pdf/propDialog.cpp | |
parent | Added highlighting for search results (diff) | |
download | lumina-6f7bfe5269912021229e570675ac0fbd9ad4f082.tar.gz lumina-6f7bfe5269912021229e570675ac0fbd9ad4f082.tar.bz2 lumina-6f7bfe5269912021229e570675ac0fbd9ad4f082.zip |
Get lumina-pdf all up and running again.
1. Abstract out the backend renderer into a new class
2. The Renderer can be selected at build time by setting the "USE_MUPDF" build flag to use mupdf instead of poppler (default).
Diffstat (limited to 'src-qt5/desktop-utils/lumina-pdf/propDialog.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/propDialog.cpp | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/propDialog.cpp b/src-qt5/desktop-utils/lumina-pdf/propDialog.cpp index d1ef0c49..c40f537e 100644 --- a/src-qt5/desktop-utils/lumina-pdf/propDialog.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/propDialog.cpp @@ -10,18 +10,10 @@ #include <LuminaXDG.h> -void PropDialog::setInfo(fz_context *CTX, pdf_obj *info, QTextEdit *widget, QString str) { - pdf_obj *obj = pdf_dict_gets(CTX, info, str.toLatin1().data()); - if(obj) - widget->setText(pdf_to_utf8(CTX, obj)); -} - -PropDialog::PropDialog(fz_context *CTX, pdf_document *DOC) : QDialog(), ui(new Ui::PropDialog()){ +PropDialog::PropDialog(Renderer *Backend) : QDialog(), ui(new Ui::PropDialog()){ + ui->setupUi(this); this->setWindowTitle(tr("PDF Information")); this->setWindowIcon( LXDG::findIcon("dialog-information","unknown")); - pdf_obj *info = pdf_dict_gets(CTX, pdf_trailer(CTX, DOC), "Info"); - - ui->setupUi(this); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close())); @@ -39,29 +31,21 @@ PropDialog::PropDialog(fz_context *CTX, pdf_document *DOC) : QDialog(), ui(new U ui->saveButton->setText(tr("Save")); ui->closeButton->setText(tr("Close")); + QJsonObject info = Backend->properties(); //Fill the text boxes with information from the document - if(info) { - setInfo(CTX, info, ui->titleE, "Title"); - setInfo(CTX, info, ui->subjectE, "Subject"); - setInfo(CTX, info, ui->authorE, "Author"); - setInfo(CTX, info, ui->creatorE, "Creator"); - setInfo(CTX, info, ui->producerE, "Producer"); - setInfo(CTX, info, ui->keywordE, "Keywords"); - pdf_obj *obj = pdf_dict_gets(CTX, info, (char *)"CreationDate"); - char *str = pdf_to_utf8(CTX, obj); - if(obj) - ui->createdEntry->setText(QDateTime::fromString(QString(str).left(16), "'D:'yyyyMMddHHmmss").toString()); - //ModDate not displaying when should, possibly broken - obj = pdf_dict_gets(CTX, info, (char *)"ModDate"); - str = pdf_to_utf8(CTX, obj); - if(obj) - ui->modifiedEntry->setText(QDateTime::fromString(QString(str).left(16), "'D:'yyyyMMddHHmmss").toString()); - ui->numberL->setText(ui->numberL->text()+QString::number(pdf_count_pages(CTX, DOC))); - free(str); - } + ui->titleE->setText( info.value("title").toString() ); + ui->subjectE->setText( info.value("subject").toString() ); + ui->authorE->setText( info.value("author").toString() ); + ui->creatorE->setText( info.value("creator").toString() ); + ui->producerE->setText( info.value("producer").toString() ); + ui->keywordE->setText( info.value("keywords").toString() ); + ui->createdEntry->setText( info.value("dt_created").toString() ); + ui->modifiedEntry->setText( info.value("dt_modified").toString() ); + ui->numberL->setText( QString::number(Backend->numPages()) ); + } //Load size from mainUI after pages have loaded -void PropDialog::setSize(QSizeF pageSize) { +void PropDialog::setSize(QSizeF pageSize) { ui->sizeL->setText(ui->sizeL->text()+QString::number(pageSize.width())+", "+QString::number(pageSize.height())); } |