TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musiccategoryconfigmanager.cpp
Go to the documentation of this file.
2 #include "musicobject.h"
3 
5  : TTKAbstractXml(),
6  m_type(key)
7 {
8 
9 }
10 
12 {
13  QString v;
14  switch(type)
15  {
16  case Category::PlayList: v = RESOURCE_DIR_FULL + "playlist"; break;
17  case Category::TopList: v = RESOURCE_DIR_FULL + "toplist"; break;
18  case Category::ArtistList: v = RESOURCE_DIR_FULL + "artistlist"; break;
19  case Category::MovieList: v = RESOURCE_DIR_FULL + "movielist"; break;
20  default: break;
21  }
22 
23  return TTKAbstractXml::fromFile(v);
24 }
25 
26 bool MusicCategoryConfigManager::readBuffer(MusicResultsCategoryList &items)
27 {
28  const QDomNodeList &nodes = m_document->elementsByTagName(m_type);
29  for(int i = 0; i < nodes.count(); ++i)
30  {
31  const QDomNodeList &tagNodes = nodes.item(i).childNodes();
32  for(int j = 0; j < tagNodes.count(); ++j)
33  {
34  MusicResultsCategory category;
35  const QDomNode &tagNode = tagNodes.item(j);
36  category.m_category = tagNode.toElement().attribute("value");
37 
38  const QDomNodeList &typeNodes = tagNode.childNodes();
39  for(int k = 0; k < typeNodes.count(); ++k)
40  {
41  const QDomElement &element = typeNodes.item(k).toElement();
42 
44  item.m_key = element.attribute("key");
45  item.m_value = element.attribute("value");
46  category.m_items.append(item);
47  }
48  items.append(category);
49  }
50  }
51 
52  return true;
53 }
The class of the ttk xml interface.
QDomDocument * m_document
bool fromFile(const QString &name)
static constexpr wchar_t key[]
virtual bool readBuffer(MusicResultsCategoryList &items) overridefinal
MusicCategoryConfigManager(const QString &key)
The class of the results category core.
#define RESOURCE_DIR_FULL
Definition: musicobject.h:131
The class of the results category item.
MusicResultsCategoryItemList m_items