TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicdownloadthunderskinrequest.cpp
Go to the documentation of this file.
3 
4 static constexpr int MAX_SIZE = 30;
5 static constexpr const char *QUERY_URL = "eC9KOTYxbVhvVDJNcGEwckhyMVZRdVRhOHhFRHQ2eFVNdWJxaURFSzA1ZWVmZm5HOFlzS1VCY2ZKOFRlYStBL2Y3SjNEK2gzY2QwPQ==";
6 
9 {
10 
11 }
12 
13 bool MusicThunderSkinConfigManager::readBuffer(MusicSkinRemoteGroupList &items)
14 {
15  const QDomNodeList &nodes = m_document->elementsByTagName("group");
16  for(int i = 0; i < nodes.count(); ++i)
17  {
19  QDomNode node = nodes.item(i);
20  group.m_group = QString("%1%2").arg(SKIN_THUNDER_DIR, node.toElement().attribute("name"));
21  group.m_id = TTK_DEFAULT_STR;
22 
23  const QDomNodeList &groupNodes = node.childNodes();
24  for(int j = 0; j < groupNodes.count(); ++j)
25  {
26  if(j > MAX_SIZE)
27  {
28  break;
29  }
30 
32  item.m_index = j;
33 
34  node = groupNodes.item(j);
35  const QDomNodeList &packageNodes = node.childNodes();
36 
37  for(int k = 0; k < packageNodes.count(); ++k)
38  {
39  const QDomElement &element = packageNodes.item(k).toElement();
40  if(element.nodeName() == "name")
41  {
42  item.m_name = element.text();
43  }
44  else if(element.nodeName() == "popularity")
45  {
46  item.m_useCount = element.text().toInt();
47  }
48  else if(element.nodeName() == "file")
49  {
50  item.m_url = element.text();
51  }
52  }
53 
54  if(item.isValid())
55  {
56  group.m_items << item;
57  }
58  }
59 
60  if(group.isValid())
61  {
62  items << group;
63  }
64  }
65 
66  return true;
67 }
68 
69 
72 {
73 
74 }
75 
77 {
79  connect(d, SIGNAL(downLoadRawDataChanged(QByteArray)), SLOT(downLoadFinished(QByteArray)));
81 }
82 
84 {
85  MusicSkinRemoteGroupList items;
87  if(manager.fromByteArray(bytes))
88  {
89  manager.readBuffer(items);
90  }
91 
92  Q_EMIT downLoadDataChanged(items);
93 }
static constexpr int MAX_SIZE
The class of the remote skin item.
The class of the ttk xml interface.
QDomDocument * m_document
#define TTK_DEFAULT_STR
Definition: ttkglobal.h:200
void downLoadDataChanged(const MusicSkinRemoteGroupList &bytes)
The class of the download skin remote background.
static constexpr const char * SKIN_THUNDER_DIR
virtual bool readBuffer(MusicSkinRemoteGroupList &items) overridefinal
virtual void downLoadFinished(const QByteArray &bytes) overridefinal
The class of the data source download request.
bool fromByteArray(const QByteArray &data)
MusicDownloadThunderSkinRequest(QObject *parent=nullptr)
void startToRequest(const QString &url)
The class of the remote skin item group.
static constexpr const char * QUERY_URL
TTK_MODULE_EXPORT QString mdII(const QString &data, bool encode)
The class of the thunder skin XML config manager.