gui: PreviewGenerator: Make previews for all text files

This commit is contained in:
Albert S. 2022-05-30 20:05:02 +02:00
parent 26c7cdbc5f
commit 145cd150b1

View File

@ -1,3 +1,4 @@
#include "../shared/common.h"
#include "previewgenerator.h" #include "previewgenerator.h"
#include "previewgeneratorpdf.h" #include "previewgeneratorpdf.h"
#include "previewgeneratorplaintext.h" #include "previewgeneratorplaintext.h"
@ -11,5 +12,13 @@ static QMap<QString, PreviewGenerator *> generators{
PreviewGenerator *PreviewGenerator::get(QFileInfo &info) PreviewGenerator *PreviewGenerator::get(QFileInfo &info)
{ {
return generators.value(info.suffix(), nullptr); PreviewGenerator *result = generators.value(info.suffix(), nullptr);
if(result == nullptr)
{
if(Common::isTextFile(info))
{
return plainTextGenerator;
}
}
return result;
} }