|
|
@ -23,6 +23,9 @@ |
|
|
|
#include <QDebug> |
|
|
|
#include <QDebug> |
|
|
|
#include <QFile> |
|
|
|
#include <QFile> |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMessageBox> |
|
|
|
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) |
|
|
|
|
|
|
|
#include <QRandomGenerator> |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#include "src/core/core.h" |
|
|
|
#include "src/core/core.h" |
|
|
|
#include "src/nexus.h" |
|
|
|
#include "src/nexus.h" |
|
|
@ -98,11 +101,19 @@ void PrivacyForm::showEvent(QShowEvent*) |
|
|
|
void PrivacyForm::on_randomNosapamButton_clicked() |
|
|
|
void PrivacyForm::on_randomNosapamButton_clicked() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QTime time = QTime::currentTime(); |
|
|
|
QTime time = QTime::currentTime(); |
|
|
|
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) |
|
|
|
|
|
|
|
QRandomGenerator((uint)time.msec()); |
|
|
|
|
|
|
|
#else |
|
|
|
qsrand((uint)time.msec()); |
|
|
|
qsrand((uint)time.msec()); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
uint32_t newNospam{0}; |
|
|
|
uint32_t newNospam{0}; |
|
|
|
for (int i = 0; i < 4; ++i) |
|
|
|
for (int i = 0; i < 4; ++i) |
|
|
|
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) |
|
|
|
|
|
|
|
newNospam = (newNospam << 8) + (QRandomGenerator::global()->generate() % 256); // Generate byte by byte. For some reason.
|
|
|
|
|
|
|
|
#else |
|
|
|
newNospam = (newNospam << 8) + (qrand() % 256); // Generate byte by byte. For some reason.
|
|
|
|
newNospam = (newNospam << 8) + (qrand() % 256); // Generate byte by byte. For some reason.
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
Core::getInstance()->setNospam(newNospam); |
|
|
|
Core::getInstance()->setNospam(newNospam); |
|
|
|
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().getNoSpamString()); |
|
|
|
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().getNoSpamString()); |
|
|
|