mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
Update QtWebApp to 1.8.3
nullptr redefinition for old __cplusplus versions has been removed, the rest is vanilla
This commit is contained in:
@ -7,7 +7,6 @@
|
||||
#define TEMPLATE_H
|
||||
|
||||
#include <QString>
|
||||
#include <QRegExp>
|
||||
#include <QIODevice>
|
||||
#include <QTextCodec>
|
||||
#include <QFile>
|
||||
|
@ -10,7 +10,8 @@ TemplateCache::TemplateCache(const QSettings* settings, QObject* parent)
|
||||
{
|
||||
cache.setMaxCost(settings->value("cacheSize","1000000").toInt());
|
||||
cacheTimeout=settings->value("cacheTime","60000").toInt();
|
||||
qDebug("TemplateCache: timeout=%i, size=%i",cacheTimeout,cache.maxCost());
|
||||
long int cacheMaxCost=(long int)cache.maxCost();
|
||||
qDebug("TemplateCache: timeout=%i, size=%li",cacheTimeout,cacheMaxCost);
|
||||
}
|
||||
|
||||
QString TemplateCache::tryFile(const QString localizedName)
|
||||
|
@ -1,6 +1,10 @@
|
||||
INCLUDEPATH += $$PWD
|
||||
DEPENDPATH += $$PWD
|
||||
|
||||
greaterThan(QT_VERSION,6) {
|
||||
QT += core5compat
|
||||
}
|
||||
|
||||
HEADERS += $$PWD/templateglobal.h
|
||||
HEADERS += $$PWD/template.h
|
||||
HEADERS += $$PWD/templateloader.h
|
||||
|
@ -9,6 +9,12 @@
|
||||
#include <QStringList>
|
||||
#include <QDir>
|
||||
#include <QSet>
|
||||
#include <QTextStream>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QRegularExpression>
|
||||
#else
|
||||
#include <QRegExp>
|
||||
#endif
|
||||
|
||||
using namespace stefanfrings;
|
||||
|
||||
@ -35,8 +41,8 @@ TemplateLoader::TemplateLoader(const QSettings *settings, QObject *parent)
|
||||
else
|
||||
{
|
||||
textCodec=QTextCodec::codecForName(encoding.toLocal8Bit());
|
||||
}
|
||||
qDebug("TemplateLoader: path=%s, codec=%s",qPrintable(templatePath),textCodec->name().data());
|
||||
}
|
||||
qDebug("TemplateLoader: path=%s, codec=%s",qPrintable(templatePath),qPrintable(encoding));
|
||||
}
|
||||
|
||||
TemplateLoader::~TemplateLoader()
|
||||
@ -67,13 +73,23 @@ QString TemplateLoader::tryFile(QString localizedName)
|
||||
Template TemplateLoader::getTemplate(QString templateName, QString locales)
|
||||
{
|
||||
QSet<QString> tried; // used to suppress duplicate attempts
|
||||
QStringList locs=locales.split(',',QString::SkipEmptyParts);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
QStringList locs=locales.split(',',Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList locs=locales.split(',',QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
// Search for exact match
|
||||
foreach (QString loc,locs)
|
||||
{
|
||||
loc.replace(QRegExp(";.*"),"");
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
loc.replace(QRegularExpression(";.*"),"");
|
||||
#else
|
||||
loc.replace(QRegExp(";.*"),"");
|
||||
#endif
|
||||
loc.replace('-','_');
|
||||
|
||||
QString localizedName=templateName+"-"+loc.trimmed();
|
||||
if (!tried.contains(localizedName))
|
||||
{
|
||||
@ -88,7 +104,11 @@ Template TemplateLoader::getTemplate(QString templateName, QString locales)
|
||||
// Search for correct language but any country
|
||||
foreach (QString loc,locs)
|
||||
{
|
||||
loc.replace(QRegExp("[;_-].*"),"");
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
loc.replace(QRegularExpression("[;_-].*"),"");
|
||||
#else
|
||||
loc.replace(QRegExp("[;_-].*"),"");
|
||||
#endif
|
||||
QString localizedName=templateName+"-"+loc.trimmed();
|
||||
if (!tried.contains(localizedName))
|
||||
{
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
#include <QMutex>
|
||||
#include <QTextCodec>
|
||||
#include "templateglobal.h"
|
||||
#include "template.h"
|
||||
|
||||
|
Reference in New Issue
Block a user