forked from loafle/openapi-generator-original
[cpp-qt5-client] Fix qt5.15 check (#8711)
* Fix qt5.15 check * Fix check fix
This commit is contained in:
@@ -57,13 +57,13 @@ QJsonValue {{prefix}}HttpFileElement::asJsonValue() const {
|
||||
if (!result) {
|
||||
qDebug() << "Error opening file " << local_filename;
|
||||
}
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
return QJsonDocument::fromJson(bArray.data()).object();
|
||||
#else
|
||||
return QJsonDocument::fromBinaryData(bArray.data()).object();
|
||||
return QJsonDocument::fromBinaryData(bArray.data()).object();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool {{prefix}}HttpFileElement::fromStringValue(const QString &instr) {
|
||||
QFile file(local_filename);
|
||||
bool result = false;
|
||||
@@ -86,7 +86,7 @@ bool {{prefix}}HttpFileElement::fromJsonValue(const QJsonValue &jval) {
|
||||
file.remove();
|
||||
}
|
||||
result = file.open(QIODevice::WriteOnly);
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
file.write(QJsonDocument(jval.toObject()).toJson());
|
||||
#else
|
||||
file.write(QJsonDocument(jval.toObject()).toBinaryData());
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <QUrl>
|
||||
#include <QUuid>
|
||||
#include <QtGlobal>
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
#define SKIP_EMPTY_PARTS Qt::SkipEmptyParts
|
||||
#else
|
||||
#define SKIP_EMPTY_PARTS QString::SkipEmptyParts
|
||||
@@ -52,7 +52,7 @@ void {{prefix}}HttpRequestInput::add_file(QString variable_name, QString local_f
|
||||
{{prefix}}HttpRequestWorker::{{prefix}}HttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager)
|
||||
: QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) {
|
||||
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||
#else
|
||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
||||
@@ -216,7 +216,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) {
|
||||
// variable layout is MULTIPART
|
||||
|
||||
boundary = QString("__-----------------------%1%2")
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
.arg(QDateTime::currentDateTime().toSecsSinceEpoch())
|
||||
.arg(randomGenerator.generate());
|
||||
#else
|
||||
@@ -546,7 +546,7 @@ QByteArray {{prefix}}HttpRequestWorker::compress(const QByteArray& input, int le
|
||||
return output;{{/contentCompression}}{{^contentCompression}}
|
||||
Q_UNUSED(input);
|
||||
Q_UNUSED(level);
|
||||
Q_UNUSED(compressType);
|
||||
Q_UNUSED(compressType);
|
||||
return QByteArray();{{/contentCompression}}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
bool isResponseCompressionEnabled;
|
||||
bool isRequestCompressionEnabled;
|
||||
int httpResponseCode;
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
QRandomGenerator randomGenerator;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -65,13 +65,13 @@ QJsonValue PFXHttpFileElement::asJsonValue() const {
|
||||
if (!result) {
|
||||
qDebug() << "Error opening file " << local_filename;
|
||||
}
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
return QJsonDocument::fromJson(bArray.data()).object();
|
||||
#else
|
||||
return QJsonDocument::fromBinaryData(bArray.data()).object();
|
||||
return QJsonDocument::fromBinaryData(bArray.data()).object();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool PFXHttpFileElement::fromStringValue(const QString &instr) {
|
||||
QFile file(local_filename);
|
||||
bool result = false;
|
||||
@@ -94,7 +94,7 @@ bool PFXHttpFileElement::fromJsonValue(const QJsonValue &jval) {
|
||||
file.remove();
|
||||
}
|
||||
result = file.open(QIODevice::WriteOnly);
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
file.write(QJsonDocument(jval.toObject()).toJson());
|
||||
#else
|
||||
file.write(QJsonDocument(jval.toObject()).toBinaryData());
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <QUrl>
|
||||
#include <QUuid>
|
||||
#include <QtGlobal>
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
#define SKIP_EMPTY_PARTS Qt::SkipEmptyParts
|
||||
#else
|
||||
#define SKIP_EMPTY_PARTS QString::SkipEmptyParts
|
||||
@@ -59,7 +59,7 @@ void PFXHttpRequestInput::add_file(QString variable_name, QString local_filename
|
||||
PFXHttpRequestWorker::PFXHttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager)
|
||||
: QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) {
|
||||
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||
#else
|
||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
||||
@@ -223,7 +223,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) {
|
||||
// variable layout is MULTIPART
|
||||
|
||||
boundary = QString("__-----------------------%1%2")
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
.arg(QDateTime::currentDateTime().toSecsSinceEpoch())
|
||||
.arg(randomGenerator.generate());
|
||||
#else
|
||||
@@ -480,7 +480,7 @@ QByteArray PFXHttpRequestWorker::compress(const QByteArray& input, int level, PF
|
||||
|
||||
Q_UNUSED(input);
|
||||
Q_UNUSED(level);
|
||||
Q_UNUSED(compressType);
|
||||
Q_UNUSED(compressType);
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
@@ -97,7 +97,7 @@ private:
|
||||
bool isResponseCompressionEnabled;
|
||||
bool isRequestCompressionEnabled;
|
||||
int httpResponseCode;
|
||||
#if QT_VERSION >= 0x051500
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
QRandomGenerator randomGenerator;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user