Add function to strip html tags

This commit is contained in:
Richard Ramos 2020-07-31 17:26:58 -04:00 committed by Michał
parent 7a286e548e
commit 895e94d5e1
2 changed files with 8 additions and 0 deletions

View File

@ -103,6 +103,8 @@ DOS_API void DOS_CALL dos_signal(DosQObject *vptr, const char *signal, const cha
DOS_API DosQNetworkConfigurationManager *DOS_CALL dos_qncm_create(); DOS_API DosQNetworkConfigurationManager *DOS_CALL dos_qncm_create();
DOS_API char * DOS_CALL dos_plain_text(char* htmlString);
DOS_API void DOS_CALL dos_qncm_delete(DosQNetworkConfigurationManager *vptr); DOS_API void DOS_CALL dos_qncm_delete(DosQNetworkConfigurationManager *vptr);
DOS_API char * DOS_CALL dos_image_resizer(char* imagePath, int maxSize, char* tmpDirPath); DOS_API char * DOS_CALL dos_image_resizer(char* imagePath, int maxSize, char* tmpDirPath);

View File

@ -35,6 +35,7 @@
#include <QtGui/QPixmap> #include <QtGui/QPixmap>
#include <QtGui/QImage> #include <QtGui/QImage>
#include <QtGui/QColorSpace> #include <QtGui/QColorSpace>
#include <QtGui/QTextDocumentFragment>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QUuid> #include <QtCore/QUuid>
#include <QtQml/QQmlApplicationEngine> #include <QtQml/QQmlApplicationEngine>
@ -1118,6 +1119,11 @@ void dos_qncm_delete(::DosQNetworkConfigurationManager *vptr)
delete ncm; delete ncm;
} }
char *dos_plain_text(char* htmlString)
{
return convert_to_cstring(QTextDocumentFragment::fromHtml( htmlString ).toPlainText().toUtf8());
}
char *dos_image_resizer(char* imagePath, int maxSize, char* tmpDirPath) char *dos_image_resizer(char* imagePath, int maxSize, char* tmpDirPath)
{ {
QImage img(imagePath); QImage img(imagePath);