forked from Greedysky/TTKMusicPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add playlist category found widget[912001]
- Loading branch information
Showing
9 changed files
with
300 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "musiccategoryconfigmanager.h" | ||
|
||
MusicCategoryConfigManager::MusicCategoryConfigManager(QObject *parent) | ||
: MusicAbstractXml(parent) | ||
{ | ||
|
||
} | ||
|
||
QString MusicCategoryConfigManager::getClassName() | ||
{ | ||
return staticMetaObject.className(); | ||
} | ||
|
||
void MusicCategoryConfigManager::readCategoryConfig(PlaylistCategorys &records, const QString &key) | ||
{ | ||
QDomNodeList nodes = m_ddom->elementsByTagName(key); | ||
for(int i=0; i<nodes.count(); ++i) | ||
{ | ||
QDomNode node = nodes.at(i); | ||
QDomNodeList tagNodes = node.childNodes(); | ||
for(int j=0; j<tagNodes.count(); ++j) | ||
{ | ||
PlaylistCategory category; | ||
QDomNode tagNode = tagNodes.at(j); | ||
category.m_category = tagNode.toElement().attribute("value"); | ||
QDomNodeList typeNodes = tagNode.childNodes(); | ||
for(int k=0; k<typeNodes.count(); ++k) | ||
{ | ||
PlaylistCategoryItem item; | ||
QDomNode typeNode = typeNodes.at(k); | ||
item.m_name = typeNode.toElement().attribute("value"); | ||
item.m_id = typeNode.toElement().attribute("key"); | ||
category.m_items.append(item); | ||
} | ||
records.append(category); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#ifndef MUSICCATEGORYCONFIGMANAGER_H | ||
#define MUSICCATEGORYCONFIGMANAGER_H | ||
|
||
/* ================================================= | ||
* This file is part of the TTK Music Player project | ||
* Copyright (c) 2015 - 2017 Greedysky Studio | ||
* All rights reserved! | ||
* Redistribution and use of the source code or any derivative | ||
* works are strictly forbiden. | ||
=================================================*/ | ||
|
||
#include "musicabstractxml.h" | ||
|
||
typedef struct MUSIC_CORE_EXPORT PlaylistCategoryItem | ||
{ | ||
QString m_id; | ||
QString m_name; | ||
|
||
PlaylistCategoryItem() | ||
{ | ||
|
||
} | ||
|
||
PlaylistCategoryItem(const QString &id, const QString &name) | ||
{ | ||
m_id = id; | ||
m_name = name; | ||
} | ||
}PlaylistCategoryItem; | ||
TTK_DECLARE_LISTS(PlaylistCategoryItem) | ||
|
||
typedef struct MUSIC_CORE_EXPORT PlaylistCategory | ||
{ | ||
QString m_category; | ||
PlaylistCategoryItems m_items; | ||
}PlaylistCategory; | ||
TTK_DECLARE_LISTS(PlaylistCategory) | ||
|
||
/*! @brief The class of the category Config Manager. | ||
* @author Greedysky <[email protected]> | ||
*/ | ||
class MUSIC_CORE_EXPORT MusicCategoryConfigManager : public MusicAbstractXml | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit MusicCategoryConfigManager(QObject *parent = 0); | ||
/*! | ||
* Object contsructor. | ||
*/ | ||
|
||
static QString getClassName(); | ||
/*! | ||
* Get class object name. | ||
*/ | ||
inline bool readCategoryConfig(){ return readConfig(":/data/playlist"); } | ||
/*! | ||
* Read user datas from xml file by given name. | ||
*/ | ||
void readCategoryConfig(PlaylistCategorys &records, const QString &key); | ||
/*! | ||
* Read user datas into xml file. | ||
*/ | ||
|
||
}; | ||
|
||
#endif // MUSICCATEGORYCONFIGMANAGER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,48 @@ | |
=================================================*/ | ||
|
||
#include "musictoolmenuwidget.h" | ||
#include "musiccategoryconfigmanager.h" | ||
|
||
/*! @brief The class of the playlist music found category item. | ||
* @author Greedysky <[email protected]> | ||
*/ | ||
class MUSIC_WIDGET_EXPORT MusicPlaylistFoundCategoryItem : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit MusicPlaylistFoundCategoryItem(QWidget *parent = 0); | ||
/*! | ||
* Object contsructor. | ||
*/ | ||
|
||
static QString getClassName(); | ||
/*! | ||
* Get class object name. | ||
*/ | ||
|
||
void setCategory(const PlaylistCategory &category); | ||
/*! | ||
* Set current category. | ||
*/ | ||
|
||
Q_SIGNALS: | ||
void categoryChanged(const PlaylistCategoryItem &category); | ||
/*! | ||
* Current category changed. | ||
*/ | ||
|
||
public Q_SLOTS: | ||
void buttonClicked(int index); | ||
/*! | ||
* Current category item clicked. | ||
*/ | ||
|
||
protected: | ||
PlaylistCategory m_category; | ||
|
||
}; | ||
|
||
|
||
|
||
/*! @brief The class of the playlist music found category widget. | ||
* @author Greedysky <[email protected]> | ||
|
@@ -28,6 +70,14 @@ class MUSIC_WIDGET_EXPORT MusicPlaylistFoundCategoryWidget : public MusicToolMen | |
/*! | ||
* Get class object name. | ||
*/ | ||
void setCategory(const QString &server, QObject *obj); | ||
/*! | ||
* Set current category by input server. | ||
*/ | ||
void closeMenu(); | ||
/*! | ||
* Close the menu dialog. | ||
*/ | ||
|
||
public Q_SLOTS: | ||
void popupMenu(); | ||
|
Oops, something went wrong.