aboutsummaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/MoreApps/moreapps.cpp14
-rw-r--r--src/widgets/scrolltext/scrolltext.cpp2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/widgets/MoreApps/moreapps.cpp b/src/widgets/MoreApps/moreapps.cpp
index b8e8c17..c333751 100644
--- a/src/widgets/MoreApps/moreapps.cpp
+++ b/src/widgets/MoreApps/moreapps.cpp
@@ -11,6 +11,7 @@
#include <algorithm>
#include <cstdlib>
#include <ctime>
+#include <random>
MoreApps::MoreApps(QWidget *parent, QNetworkAccessManager *nam,
const QString &publisherName, const QUrl &remoteFilterUrl,
@@ -217,7 +218,7 @@ void MoreApps::setRemoteIcon(const QUrl &iconUrl, QLabel *lb) {
auto replyBytes = reply->readAll();
QPixmap pixmap;
pixmap.loadFromData(replyBytes);
- //qDebug() << "after load" << lb->size();
+ // qDebug() << "after load" << lb->size();
lb->setPixmap(pixmap.scaled(lb->size(), Qt::KeepAspectRatio,
Qt::SmoothTransformation));
}
@@ -239,11 +240,10 @@ void MoreApps::showApps() {
qDebug() << "showing apps...";
- std::srand(unsigned(std::time(0)));
- // rand generator
- auto rand = [](auto i) { return std::rand() % i; };
- // shuffle appList before adding
- std::random_shuffle(mAppList.begin(), mAppList.end(), rand);
+ std::random_device rd;
+ std::mt19937 rng(rd());
+
+ std::shuffle(mAppList.begin(), mAppList.end(), rng);
auto fallbackIconUrl =
QUrl("https://dashboard.snapcraft.io/site_media/appmedia/"
@@ -254,7 +254,7 @@ void MoreApps::showApps() {
setRemoteIcon(fallbackIconUrl, nullptr);
foreach (auto a, mAppList) {
auto iconUrl = a.getIconUrl();
- //qDebug() << "pre-caching icon for" << a.getName();
+ // qDebug() << "pre-caching icon for" << a.getName();
setRemoteIcon(iconUrl, nullptr);
}
}
diff --git a/src/widgets/scrolltext/scrolltext.cpp b/src/widgets/scrolltext/scrolltext.cpp
index b03b761..cac212f 100644
--- a/src/widgets/scrolltext/scrolltext.cpp
+++ b/src/widgets/scrolltext/scrolltext.cpp
@@ -15,7 +15,7 @@ ScrollText::ScrollText(QWidget *parent) : QWidget(parent), scrollPos(0) {
setSeparator(" ");
- connect(&timer, SIGNAL(timeout()), this, SLOT(timer_timeout()));
+ connect(&timer, &QTimer::timeout, this, &ScrollText::timer_timeout);
timer.setInterval(50);
}