TTKMusicPlayer  4.1.3.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicmvradiocategoryrequest.cpp
Go to the documentation of this file.
2 
5 {
6 
7 }
8 
10 {
11  TTK_INFO_STREAM(className() << __FUNCTION__);
12 
14  if(m_reply && m_reply->error() == QNetworkReply::NoError)
15  {
16  QJson::Parser json;
17  bool ok = false;
18  const QVariant &data = json.parse(m_reply->readAll(), &ok);
19  if(ok)
20  {
21  QVariantMap value = data.toMap();
22  if(value.contains("data"))
23  {
24  const QVariantList &datas = value["data"].toList();
25  for(const QVariant &var : qAsConst(datas))
26  {
27  if(var.isNull())
28  {
29  continue;
30  }
31 
32  QVariantMap value = var.toMap();
34 
35  if(value["classId"].toString() == m_queryValue)
36  {
37  const QVariantList &fms = value["fm_list"].toList();
38  for(const QVariant &var : qAsConst(fms))
39  {
40  if(var.isNull())
41  {
42  continue;
43  }
44 
45  value = var.toMap();
47 
49  item.m_name = value["fmName"].toString();
50  item.m_id = value["fmId"].toString();
51  item.m_coverUrl = value["imgUrlMv"].toString();
52  Q_EMIT createMVRadioItem(item);
53  }
54  }
55  }
56  }
57  }
58  }
59 
60  Q_EMIT downLoadDataChanged({});
61  deleteAll();
62 }
#define TTK_NETWORK_QUERY_CHECK(VALUE)
MusicMVRadioCategoryRequest(QObject *parent=nullptr)
The class of the search result data item.
virtual void deleteAll()
void downLoadDataChanged(const QString &bytes)
QNetworkReply * m_reply
The class of the music mv radio request abstract.
#define qAsConst
Definition: ttkqtglobal.h:51
#define TTK_INFO_STREAM(msg)
Definition: ttklogger.h:68
QVariant parse(QIODevice *io, bool *ok=0)
Read JSON string from the I/O Device and converts it to a QVariant object.
Definition: parser.cpp:69
virtual void downLoadFinished() override
void createMVRadioItem(const MusicResultDataItem &item)
TTK_MODULE_EXPORT QString toString(Record type)
virtual void downLoadFinished() overridefinal
Main class used to convert JSON data to QVariant objects.
Definition: parser.h:40