Generalize previews: Add PreviewResult,PreviewResultPdf, remove PdfPreview
Cette révision appartient à :
Parent
32286cae4b
révision
95b3d1fce2
@ -1,5 +0,0 @@
|
||||
#include "pdfpreview.h"
|
||||
|
||||
PdfPreview::PdfPreview()
|
||||
{
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#ifndef PDFPREVIEW_H
|
||||
#define PDFPREVIEW_H
|
||||
#include <QImage>
|
||||
|
||||
class PdfPreview
|
||||
{
|
||||
public:
|
||||
PdfPreview();
|
||||
QImage previewImage;
|
||||
QString documentPath;
|
||||
unsigned int page;
|
||||
|
||||
bool hasPreviewImage()
|
||||
{
|
||||
return !previewImage.isNull();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // PDFPREVIEW_H
|
35
gui/previewresult.cpp
Fichier normal
35
gui/previewresult.cpp
Fichier normal
@ -0,0 +1,35 @@
|
||||
#include "previewresult.h"
|
||||
|
||||
PreviewResult::PreviewResult()
|
||||
{
|
||||
}
|
||||
|
||||
PreviewResult::~PreviewResult()
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *PreviewResult::createPreviewWidget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool PreviewResult::hasPreview()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PreviewResult::PreviewResult(QString documentPath, unsigned int page)
|
||||
{
|
||||
this->documentPath = documentPath;
|
||||
this->page = page;
|
||||
}
|
||||
|
||||
QString PreviewResult::getDocumentPath() const
|
||||
{
|
||||
return this->documentPath;
|
||||
}
|
||||
|
||||
unsigned int PreviewResult::getPage() const
|
||||
{
|
||||
return this->page;
|
||||
}
|
22
gui/previewresult.h
Fichier normal
22
gui/previewresult.h
Fichier normal
@ -0,0 +1,22 @@
|
||||
#ifndef PREVIEWRESULT_H
|
||||
#define PREVIEWRESULT_H
|
||||
#include "clicklabel.h"
|
||||
|
||||
class PreviewResult
|
||||
{
|
||||
protected:
|
||||
QString documentPath;
|
||||
unsigned int page;
|
||||
|
||||
public:
|
||||
PreviewResult();
|
||||
PreviewResult(QString documentPath, unsigned int page);
|
||||
PreviewResult(const PreviewResult &o) = default;
|
||||
virtual ~PreviewResult();
|
||||
virtual QWidget *createPreviewWidget();
|
||||
virtual bool hasPreview();
|
||||
QString getDocumentPath() const;
|
||||
unsigned int getPage() const;
|
||||
};
|
||||
|
||||
#endif // PREVIEWRESULT_H
|
21
gui/previewresultpdf.cpp
Fichier normal
21
gui/previewresultpdf.cpp
Fichier normal
@ -0,0 +1,21 @@
|
||||
#include "previewresultpdf.h"
|
||||
|
||||
PreviewResultPdf::PreviewResultPdf(const PreviewResult &o)
|
||||
{
|
||||
this->documentPath = o.getDocumentPath();
|
||||
this->page = o.getPage();
|
||||
}
|
||||
|
||||
QWidget *PreviewResultPdf::createPreviewWidget()
|
||||
{
|
||||
ClickLabel *label = new ClickLabel();
|
||||
label->setPixmap(QPixmap::fromImage(previewImage));
|
||||
label->setToolTip(getDocumentPath());
|
||||
return label;
|
||||
}
|
||||
|
||||
bool PreviewResultPdf::hasPreview()
|
||||
{
|
||||
bool result = !this->previewImage.isNull();
|
||||
return result;
|
||||
}
|
17
gui/previewresultpdf.h
Fichier normal
17
gui/previewresultpdf.h
Fichier normal
@ -0,0 +1,17 @@
|
||||
#ifndef PREVIEWRESULTPDF_H
|
||||
#define PREVIEWRESULTPDF_H
|
||||
#include <QImage>
|
||||
#include "previewresult.h"
|
||||
|
||||
class PreviewResultPdf : public PreviewResult
|
||||
{
|
||||
public:
|
||||
using PreviewResult::PreviewResult;
|
||||
PreviewResultPdf(const PreviewResult &o);
|
||||
QImage previewImage;
|
||||
|
||||
QWidget *createPreviewWidget() override;
|
||||
bool hasPreview() override;
|
||||
};
|
||||
|
||||
#endif // PREVIEWRESULTPDF_H
|
Chargement…
Référencer dans un nouveau ticket
Block a user