!36 use QRandomGenerator to generate random numbers
From: @hou-hongxun Reviewed-by: @peijiankang Signed-off-by: @peijiankang
This commit is contained in:
commit
3216dde97c
42
0001-use-QRandomGenerator-to-generate-random-numbers.patch
Normal file
42
0001-use-QRandomGenerator-to-generate-random-numbers.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
From 64e868be8ff42979c955a38b34678b9e24a18dcf Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= <houhongxun@kylinos.cn>
|
||||||
|
Date: Mon, 6 May 2024 10:00:18 +0800
|
||||||
|
Subject: [PATCH] use QRandomGenerator to generate random numbers
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: 侯红勋 <houhongxun@kylinos.cn>
|
||||||
|
---
|
||||||
|
UIControl/player/coreplayer/mmediaplaylist.cpp | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/UIControl/player/coreplayer/mmediaplaylist.cpp b/UIControl/player/coreplayer/mmediaplaylist.cpp
|
||||||
|
index 9aa1c03..38f93a5 100644
|
||||||
|
--- a/UIControl/player/coreplayer/mmediaplaylist.cpp
|
||||||
|
+++ b/UIControl/player/coreplayer/mmediaplaylist.cpp
|
||||||
|
@@ -16,6 +16,7 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mmediaplaylist.h"
|
||||||
|
+#include <QRandomGenerator>
|
||||||
|
|
||||||
|
MMediaPlaylist::MMediaPlaylist(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
@@ -223,11 +224,10 @@ MMediaPlaylist::PlaybackMode MMediaPlaylist::playbackMode() const
|
||||||
|
|
||||||
|
int MMediaPlaylist::randomIndex()
|
||||||
|
{
|
||||||
|
- qsrand(QDateTime::currentDateTime().toMSecsSinceEpoch());
|
||||||
|
- return qrand()%(m_playerList.length());
|
||||||
|
+ QRandomGenerator rnd(QDateTime::currentDateTime().toMSecsSinceEpoch());
|
||||||
|
+ return rnd.generate()%(m_playerList.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
MMediaContent::MMediaContent(QUrl url)
|
||||||
|
{
|
||||||
|
m_url = url;
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: kylin-music
|
Name: kylin-music
|
||||||
Version: 1.1.3
|
Version: 1.1.3
|
||||||
Release: 5
|
Release: 6
|
||||||
Summary: kylin-music
|
Summary: kylin-music
|
||||||
License: GPL-3.0-or-later and MIT
|
License: GPL-3.0-or-later and MIT
|
||||||
URL: https://github.com/UbuntuKylin/kylin-music
|
URL: https://github.com/UbuntuKylin/kylin-music
|
||||||
@ -11,6 +11,7 @@ patch1: 0002-modify-version-is-error.patch
|
|||||||
Patch2: kylin-music-1.1.3_kylin_fix_install_the_repair_file_in_the_bin_directory.patch
|
Patch2: kylin-music-1.1.3_kylin_fix_install_the_repair_file_in_the_bin_directory.patch
|
||||||
Patch3: 0001-kylin-music-fix-wrong-mouse-style-of-some-title-bar-.patch
|
Patch3: 0001-kylin-music-fix-wrong-mouse-style-of-some-title-bar-.patch
|
||||||
Patch4: 0001-kylin-music-fix-null-pointer-widget-error.patch
|
Patch4: 0001-kylin-music-fix-null-pointer-widget-error.patch
|
||||||
|
Patch5: 0001-use-QRandomGenerator-to-generate-random-numbers.patch
|
||||||
|
|
||||||
BuildRequires: qt5-qtbase-devel
|
BuildRequires: qt5-qtbase-devel
|
||||||
BuildRequires: qtchooser
|
BuildRequires: qtchooser
|
||||||
@ -38,6 +39,7 @@ kylin-music
|
|||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export PATH=%{_qt5_bindir}:$PATH
|
export PATH=%{_qt5_bindir}:$PATH
|
||||||
@ -82,6 +84,9 @@ cp -r %{_builddir}/%{name}-%{version}/data/kylin-music %{buildroot}/usr/share/ky
|
|||||||
%{_datadir}/kylin-user-guide/data/guide/*
|
%{_datadir}/kylin-user-guide/data/guide/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon May 06 2024 houhongxun <houhongxun@kylinos.cn> - 1.1.3-6
|
||||||
|
- add Patch5: 0001-use-QRandomGenerator-to-generate-random-numbers.patch
|
||||||
|
|
||||||
* Tue Apr 16 2024 houhongxun <houhongxun@kylinos.cn> - 1.1.3-5
|
* Tue Apr 16 2024 houhongxun <houhongxun@kylinos.cn> - 1.1.3-5
|
||||||
- add Patch4: 0001-kylin-music-fix-null-pointer-widget-error.patch
|
- add Patch4: 0001-kylin-music-fix-null-pointer-widget-error.patch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user