-
Notifications
You must be signed in to change notification settings - Fork 0
/
songsfile.cpp
45 lines (33 loc) · 937 Bytes
/
songsfile.cpp
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
#include "songsfile.h"
QString SongsFile::m_songPath= "";
SongsFile::SongsFile(QObject *parent) : QObject(parent)
{
// m_songPath.clear();
m_songsNameList.clear();
m_songsPathList.clear();
}
SongsFile::~SongsFile()
{
}
void SongsFile::setSongsPath(const QString songPath)//做哪一类操作时,要注意加上const呢?
{
m_songPath = songPath;
}
void SongsFile::gainSongsSource(){
// m_songPath = "C:/UnigressMusic/songs";
QDir dir(m_songPath);
QFileInfoList infos = dir.entryInfoList(QStringList() << "*.mp3",QDir::Files, QDir::Name);
foreach(const QFileInfo &info, infos)
{
m_songsNameList.append(info.baseName());
m_songsPathList.append(info.absoluteFilePath());
}
}
QStringList &SongsFile::getSongNameList()
{
return m_songsNameList;
}
QStringList &SongsFile::getSongPathList()
{
return m_songsPathList;
}