gui: PreviewGeneratorMapFunctor: Use PreviewGenerator::get()

This commit is contained in:
Albert S. 2022-04-24 12:27:06 +02:00
부모 57bb5c48c8
커밋 1536781bda
2개의 변경된 파일2개의 추가작업 그리고 25개의 파일을 삭제

파일 보기

@ -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);