diff options
author | 2023-05-17 21:59:43 +0530 | |
---|---|---|
committer | 2023-05-17 21:59:43 +0530 | |
commit | 5f10a0f9657358fcd86c55ec065f3855bad0c160 (patch) | |
tree | 340f949dbe076db57bf62879ad150fabc884905a /src/widgets/MoreApps/moreapps.cpp | |
parent | b4b5dc3397966bea899bbb5ec0f756bb745dbff1 (diff) | |
download | whatsie-5f10a0f9657358fcd86c55ec065f3855bad0c160.tar.gz whatsie-5f10a0f9657358fcd86c55ec065f3855bad0c160.zip |
feat: minor fixes + code cleanup
Diffstat (limited to 'src/widgets/MoreApps/moreapps.cpp')
-rw-r--r-- | src/widgets/MoreApps/moreapps.cpp | 14 |
1 files changed, 7 insertions, 7 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); } } |