Commit 4699c749 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some deprecated methods

parent f372ca18
......@@ -24,6 +24,7 @@
#include <NetworkManagerQt/Utils>
#include <KLocalizedString>
#include <QRandomGenerator>
#include "uiutils.h"
......@@ -31,8 +32,6 @@ WifiConnectionWidget::WifiConnectionWidget(const NetworkManager::Setting::Ptr &s
SettingWidget(setting, parent, f),
m_ui(new Ui::WifiConnectionWidget)
{
qsrand(QTime::currentTime().msec());
m_ui->setupUi(this);
connect(m_ui->btnRandomMacAddr, &QPushButton::clicked, this, &WifiConnectionWidget::generateRandomClonedMac);
......@@ -125,9 +124,10 @@ QVariantMap WifiConnectionWidget::setting() const
void WifiConnectionWidget::generateRandomClonedMac()
{
QByteArray mac;
auto *generator = QRandomGenerator::global();
mac.resize(6);
for (int i = 0; i < 6; i++) {
int random = qrand() % 255;
const int random = generator->bounded(255);
mac[i] = random;
}
......
......@@ -25,12 +25,12 @@
#include <NetworkManagerQt/Utils>
#include <NetworkManagerQt/WiredSetting>
#include <QRandomGenerator>
WiredConnectionWidget::WiredConnectionWidget(const NetworkManager::Setting::Ptr &setting, QWidget* parent, Qt::WindowFlags f):
SettingWidget(setting, parent, f),
m_widget(new Ui::WiredConnectionWidget)
{
qsrand(QTime::currentTime().msec());
m_widget->setupUi(this);
connect(m_widget->btnRandomMacAddr, &QPushButton::clicked, this, &WiredConnectionWidget::generateRandomClonedMac);
......@@ -150,10 +150,11 @@ QVariantMap WiredConnectionWidget::setting() const
void WiredConnectionWidget::generateRandomClonedMac()
{
auto *generator = QRandomGenerator::global();
QByteArray mac;
mac.resize(6);
for (int i = 0; i < 6; i++) {
int random = qrand() % 255;
const int random = generator->bounded(255);
mac[i] = random;
}
......
......@@ -229,7 +229,6 @@ void OpenconnectAuthWorkerThread::writeProgress(int level, const char *fmt, va_l
if (*m_userDecidedToQuit) {
return;
}
QString msg;
msg.vsprintf(fmt, argPtr);
const QString msg = QString::vasprintf(fmt, argPtr);
Q_EMIT updateLog(msg, level);
}
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