Add Qt<5.10 support

parent 54034333
Pipeline #63616116 passed with stages
in 2 minutes and 24 seconds
......@@ -13,7 +13,14 @@
#include <tuple>
#include <QByteArray>
#include <QRandomGenerator>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QRandomGenerator>
#else
#ifndef QT_NO_QT_INCLUDE_WARN
#pragma message "WARNING: You're using Qt<5.10. Using fallback options instead of QRandomGenerator."
#pragma message "WARNING: It's highly recommended to update your Qt package!"
#endif // QT_NO_QT_INCLUDE_WARN
#endif // Qt 5.10
#include <QString>
#include "errors.h"
......@@ -23,7 +30,11 @@ static OlmUtility* utility = olm_utility(new uint8_t[olm_utility_size()]);
static QByteArray getRandomData(int buffer_size) {
QByteArray buffer(buffer_size, '0');
std::generate(buffer.begin(), buffer.end(), *QRandomGenerator::system());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
std::generate(buffer.begin(), buffer.end(), *QRandomGenerator::system());
#else
std::generate(buffer.begin(), buffer.end(), std::rand);
#endif // Qt 5.10
return buffer;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment