TTKMusicPlayer  4.1.3.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  if(category.m_category.isEmpty())
39  {
40  continue;
41  }
42 
43  const QDomNodeList &typeNodes = tagNode.childNodes();
44  for(int k = 0; k < typeNodes.count(); ++k)
45  {
46  const QDomElement &element = typeNodes.item(k).toElement();
47 
49  item.m_key = element.attribute("key");
50  item.m_value = element.attribute("value");
51  category.m_items.append(item);
52  }
53 
54  items.append(category);
55  }
56  }
57 
58  return true;
59 }
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:133
The class of the results category item.
MusicResultsCategoryItemList m_items