[Add] Added page margins.
This commit is contained in:
parent
0cbe75daac
commit
c5dd6943ef
@ -10,6 +10,8 @@
|
||||
#define CHILD_AREA_WIDTH 150
|
||||
#define CHILD_AREA_HEIGHT 150
|
||||
|
||||
#define CHILD_AREA_SIDE_MARGIN 6
|
||||
|
||||
PagesContainerWidget::PagesContainerWidget(QWidget* parent) {
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
setAcceptDrops(true);
|
||||
@ -23,7 +25,7 @@ int PagesContainerWidget::getPagesCount() const {
|
||||
}
|
||||
|
||||
QSize PagesContainerWidget::sizeHint() const {
|
||||
return QSize(CHILD_AREA_WIDTH*getPagesCount(), CHILD_AREA_HEIGHT + 20);
|
||||
return QSize((CHILD_AREA_SIDE_MARGIN + CHILD_AREA_WIDTH)*getPagesCount(), CHILD_AREA_HEIGHT + 22);
|
||||
}
|
||||
|
||||
void PagesContainerWidget::addPageWidget(PDFPageWidget* pageWidget) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
PDFJam::PDFJam(void) {
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Ensure the folder exists. */
|
||||
void PDFJam::makeFolder(QString path) {
|
||||
QString tmp = "mkdir -p %1";
|
||||
@ -61,4 +61,11 @@ void PDFJam::run(void) {
|
||||
|
||||
/*system("echo 'tata' > /tmp/test.txt");*/
|
||||
}
|
||||
#endif
|
||||
|
||||
void PDFJam::run(void) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,28 +1,14 @@
|
||||
#pragma once
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <poppler-qt5.h>
|
||||
#include <QImage>
|
||||
|
||||
class PDFPageWidget;
|
||||
class QImage;
|
||||
|
||||
class PDFJam : public QThread {
|
||||
Q_OBJECT
|
||||
class PDFJam {/*: public QThread {*/
|
||||
/*Q_OBJECT*/
|
||||
public:
|
||||
PDFJam(void);
|
||||
|
||||
void pushCommand(QString);
|
||||
void loadFile(QString fileName, int, int);
|
||||
void makeFolder(QString);
|
||||
|
||||
protected:
|
||||
void run(void);
|
||||
|
||||
private:
|
||||
QVector<QString> cmdQueue;
|
||||
QString nextCommand();
|
||||
bool isQueueEmpty();
|
||||
QMutex mutex;
|
||||
volatile bool stopped;
|
||||
};
|
||||
|
||||
|
@ -35,8 +35,8 @@ PDFPageWidget::PDFPageWidget(QWidget* parent) :
|
||||
QVBoxLayout* vbox = new QVBoxLayout();
|
||||
vbox->addStretch(1);
|
||||
vbox->addLayout(hbox);
|
||||
vbox->setContentsMargins(0, 3, 0, 3);
|
||||
this->setLayout(vbox);
|
||||
vbox->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void PDFPageWidget::setButton(QPushButton* btn) {
|
||||
|
@ -12,6 +12,7 @@ void PDFPreviewWidget::setImage(QImage image) {
|
||||
}
|
||||
|
||||
void PDFPreviewWidget::regenImage(void) {
|
||||
if(pPage != NULL) {
|
||||
double dpi;
|
||||
double dpi2;
|
||||
QSize targetSize = this->size();
|
||||
@ -22,10 +23,10 @@ void PDFPreviewWidget::regenImage(void) {
|
||||
dpi = dpi<dpi2?dpi:dpi2;
|
||||
previewImage = pPage->renderToImage(dpi, dpi);
|
||||
}
|
||||
}
|
||||
|
||||
void PDFPreviewWidget::previewUpdate(Poppler::Page* pp) {
|
||||
pPage = pp;
|
||||
qDebug() << "Set new popler page" << pp;
|
||||
regenImage();
|
||||
update();
|
||||
}
|
||||
@ -35,7 +36,6 @@ void PDFPreviewWidget::pageClicked(QMouseEvent* mouseEvent, QImage image) {
|
||||
}
|
||||
|
||||
void PDFPreviewWidget::resizeEvent(QResizeEvent* event) {
|
||||
if(pPage != NULL)
|
||||
regenImage();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@ void PDFTableWidget::loadFile(QString fileName) {
|
||||
PDFFileWidget* fileWidget = new PDFFileWidget();
|
||||
fileWidget->setAncestor(this);
|
||||
fileWidget->setDocument(doc, fileName);
|
||||
pdfJam.loadFile(fileName, files.size()-1, doc->numPages());
|
||||
connect(fileWidget, SIGNAL(pageClicked(QMouseEvent*,QImage)), this,
|
||||
SIGNAL(pageClicked(QMouseEvent*,QImage)));
|
||||
connect(fileWidget, SIGNAL(previewUpdate(Poppler::Page*)), this,
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include <QFrame>
|
||||
#include <poppler-qt5.h>
|
||||
#include "pdf_jam.h"
|
||||
|
||||
class QImage;
|
||||
class QVBoxLayout;
|
||||
@ -17,7 +16,6 @@ public:
|
||||
void loadFile(QString fileName);
|
||||
|
||||
protected:
|
||||
PDFJam pdfJam;
|
||||
|
||||
private:
|
||||
QVBoxLayout* outerLayout;
|
||||
|
Loading…
Reference in New Issue
Block a user