gui: PreviewGeneratorMapFunctor: Use PreviewGenerator::get()
This commit is contained in:
szülő
57bb5c48c8
commit
1536781bda
@ -3,26 +3,6 @@
|
||||
|
||||
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)
|
||||
@ -32,7 +12,8 @@ void PreviewGeneratorMapFunctor::setRenderConfig(RenderConfig config)
|
||||
|
||||
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)
|
||||
{
|
||||
return QSharedPointer<PreviewResult>();
|
||||
|
@ -14,16 +14,12 @@ class PreviewGeneratorMapFunctor
|
||||
LAST_DUMMY
|
||||
};
|
||||
RenderConfig renderConfig;
|
||||
PreviewGenerator *generator[LAST_DUMMY];
|
||||
PreviewGenerator *getGenerator(QString filePath);
|
||||
|
||||
public:
|
||||
typedef QSharedPointer<PreviewResult> result_type;
|
||||
|
||||
PreviewGeneratorMapFunctor();
|
||||
|
||||
~PreviewGeneratorMapFunctor();
|
||||
|
||||
void setRenderConfig(RenderConfig config);
|
||||
|
||||
QSharedPointer<PreviewResult> operator()(const QSharedPointer<PreviewResult> &renderResult);
|
||||
|
Betöltés…
Reference in New Issue
Block a user