gui: PreviewGeneratorMapFunctor: Use PreviewGenerator::get()
This commit is contained in:
bovenliggende
57bb5c48c8
commit
1536781bda
@ -3,26 +3,6 @@
|
|||||||
|
|
||||||
PreviewGeneratorMapFunctor::PreviewGeneratorMapFunctor()
|
PreviewGeneratorMapFunctor::PreviewGeneratorMapFunctor()
|
||||||
{
|
{
|
||||||
generator[GeneratorIndex::PDF] = new PreviewGeneratorPdf();
|
|
||||||
}
|
|
||||||
|
|
||||||
PreviewGenerator *PreviewGeneratorMapFunctor::getGenerator(QString filePath)
|
|
||||||
{
|
|
||||||
/* Dirty, but that's all we have at this point */
|
|
||||||
if(filePath.endsWith(".pdf"))
|
|
||||||
{
|
|
||||||
return generator[GeneratorIndex::PDF];
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
PreviewGeneratorMapFunctor::~PreviewGeneratorMapFunctor()
|
|
||||||
{
|
|
||||||
for(int i = GeneratorIndex::PDF; i < GeneratorIndex::LAST_DUMMY; i++)
|
|
||||||
{
|
|
||||||
// delete generator[i];
|
|
||||||
generator[i] = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewGeneratorMapFunctor::setRenderConfig(RenderConfig config)
|
void PreviewGeneratorMapFunctor::setRenderConfig(RenderConfig config)
|
||||||
@ -32,7 +12,8 @@ void PreviewGeneratorMapFunctor::setRenderConfig(RenderConfig config)
|
|||||||
|
|
||||||
QSharedPointer<PreviewResult> PreviewGeneratorMapFunctor::operator()(const QSharedPointer<PreviewResult> &renderResult)
|
QSharedPointer<PreviewResult> PreviewGeneratorMapFunctor::operator()(const QSharedPointer<PreviewResult> &renderResult)
|
||||||
{
|
{
|
||||||
PreviewGenerator *previewGenerator = getGenerator(renderResult->getDocumentPath());
|
QFileInfo info{renderResult->getDocumentPath()};
|
||||||
|
PreviewGenerator *previewGenerator = PreviewGenerator::get(info);
|
||||||
if(previewGenerator == nullptr)
|
if(previewGenerator == nullptr)
|
||||||
{
|
{
|
||||||
return QSharedPointer<PreviewResult>();
|
return QSharedPointer<PreviewResult>();
|
||||||
|
@ -14,16 +14,12 @@ class PreviewGeneratorMapFunctor
|
|||||||
LAST_DUMMY
|
LAST_DUMMY
|
||||||
};
|
};
|
||||||
RenderConfig renderConfig;
|
RenderConfig renderConfig;
|
||||||
PreviewGenerator *generator[LAST_DUMMY];
|
|
||||||
PreviewGenerator *getGenerator(QString filePath);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef QSharedPointer<PreviewResult> result_type;
|
typedef QSharedPointer<PreviewResult> result_type;
|
||||||
|
|
||||||
PreviewGeneratorMapFunctor();
|
PreviewGeneratorMapFunctor();
|
||||||
|
|
||||||
~PreviewGeneratorMapFunctor();
|
|
||||||
|
|
||||||
void setRenderConfig(RenderConfig config);
|
void setRenderConfig(RenderConfig config);
|
||||||
|
|
||||||
QSharedPointer<PreviewResult> operator()(const QSharedPointer<PreviewResult> &renderResult);
|
QSharedPointer<PreviewResult> operator()(const QSharedPointer<PreviewResult> &renderResult);
|
||||||
|
Laden…
Verwijs in nieuw issue
Block a user