-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmyplaylist.cpp
More file actions
87 lines (85 loc) · 1.62 KB
/
Copy pathmyplaylist.cpp
File metadata and controls
87 lines (85 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "myplaylist.h"
#include<QTime>
myplayList::myplayList()
{
}
QUrl myplayList::myCurrentMedia()
{
return media(nowindex).canonicalUrl();
}
void myplayList::mysetCurrentMedia(int nowsong)
{
nowindex=nowsong;
}
void myplayList::mysetPlaybackMode(int mode)//0是列表1是单曲2是随机
{
nowmode=mode;
}
void myplayList::mysetnext()
{
if(nowmode==0)
{
if(nowindex==mediaCount()-1)//顺序列表播放到尾巴上 从头再来
{
nowindex=0;
return;
}
nowindex+=1;
}
if(nowmode==1)
{
return;
}
if(nowmode==2)
{
QTime time;
time= QTime::currentTime();
qsrand(time.msec()+time.second()*1000);
int xxx=qrand()%mediaCount();
nowindex=xxx;
}
}
void myplayList::mysetprevious()
{
if(nowmode==0)
{
if(nowindex==0)//顺序列表播放头上再按上一曲, 从头播放第一首
{
nowindex=0;
return;
}
nowindex-=1;
}
if(nowmode==1)
{
return;
}
if(nowmode==2)
{
QTime time;
time= QTime::currentTime();
qsrand(time.msec()+time.second()*1000);
int xxx=qrand()%mediaCount();
nowindex=xxx;
}
}
void myplayList::mydelitem(int index)
{
if(index<nowindex)
{
this->removeMedia(index);
nowindex--;//当前播放的歌曲变成null
return;
}
if(index==nowindex)
{
this->removeMedia(index);
nowindex++;
return;
}
if(index>nowindex)
{
this->removeMedia(index);
return;
}
}