├── DuDuPlayer
├── Controls
│ ├── HeaderItem.qml
│ ├── Themes.qrc
│ ├── controls.pro
│ ├── controls.pro.user
│ ├── controls_plugin.cpp
│ ├── controls_plugin.h
│ ├── fnamespace.h
│ ├── fusswindow.cpp
│ ├── fusswindow.h
│ ├── qmldir
│ ├── theme
│ │ ├── BusyIndicatorStyle.qml
│ │ ├── ButtonStyle.qml
│ │ ├── CalendarStyle.qml
│ │ ├── CheckBoxStyle.qml
│ │ ├── ComboBoxStyle.qml
│ │ ├── GroupBoxStyle.qml
│ │ ├── HeaderItem.qml
│ │ ├── MenuStyle.qml
│ │ ├── MyWindow.qml
│ │ ├── ProgressBarStyle.qml
│ │ ├── RadioButtonStyle.qml
│ │ ├── ScrollViewStyle.qml
│ │ ├── SliderStyle.qml
│ │ ├── SpinBoxStyle.qml
│ │ ├── StatusBarStyle.qml
│ │ ├── SwitchStyle.qml
│ │ ├── TabViewStyle.qml
│ │ ├── TableViewStyle.qml
│ │ ├── TextAreaStyle.qml
│ │ ├── TextFieldStyle.qml
│ │ ├── ToolBarStyle.qml
│ │ └── ToolButtonStyle.qml
│ └── win.ico
├── DuDuPlayer.pro
├── DuDuPlayer.pro.user
├── MainForm.ui.qml
├── README.md
├── code
│ ├── app
│ │ ├── localmusic
│ │ │ ├── localmusic.cpp
│ │ │ ├── localmusic.h
│ │ │ ├── localmusicmodel.cpp
│ │ │ └── localmusicmodel.h
│ │ ├── onlinemusic
│ │ │ ├── CAppOnlineMusic.cpp
│ │ │ ├── CAppOnlineMusic.h
│ │ │ ├── CModelOnlineMusicCollect.cpp
│ │ │ ├── CModelOnlineMusicCollect.h
│ │ │ ├── CModelOnlineMusicEmotion.cpp
│ │ │ ├── CModelOnlineMusicEmotion.h
│ │ │ ├── CModelOnlineMusicHistory.cpp
│ │ │ ├── CModelOnlineMusicHistory.h
│ │ │ ├── CModelOnlineMusicLanguage.cpp
│ │ │ ├── CModelOnlineMusicLanguage.h
│ │ │ ├── CModelOnlineMusicSearched.cpp
│ │ │ ├── CModelOnlineMusicSearched.h
│ │ │ ├── CModelOnlineMusicSence.cpp
│ │ │ ├── CModelOnlineMusicSence.h
│ │ │ ├── CModelOnlineMusicStyle.cpp
│ │ │ ├── CModelOnlineMusicStyle.h
│ │ │ ├── CModelOnlineMusicTopName.cpp
│ │ │ ├── CModelOnlineMusicTopName.h
│ │ │ ├── CModelOnlineMusicType.cpp
│ │ │ ├── CModelOnlineMusicType.h
│ │ │ ├── CModelOnlineMusicYears.cpp
│ │ │ ├── CModelOnlineMusicYears.h
│ │ │ ├── JConNetRspData.h
│ │ │ ├── cnetworkmanager.cpp
│ │ │ ├── cnetworkmanager.h
│ │ │ ├── cnetworkonlineserver.cpp
│ │ │ └── cnetworkonlineserver.h
│ │ └── video
│ │ │ ├── dudumediaplayer.cpp
│ │ │ ├── dudumediaplayer.h
│ │ │ └── 新建文本文档.txt
│ ├── clogic.cpp
│ ├── clogic.h
│ ├── framework
│ │ ├── CAppDataBase.cpp
│ │ ├── CAppDataBase.h
│ │ ├── JsonLite.h
│ │ ├── TypeDefine.h
│ │ ├── commondata.h
│ │ ├── dudu.h
│ │ ├── jsoncpp
│ │ │ ├── CJSONUtils.cpp
│ │ │ ├── CJSONUtils.h
│ │ │ ├── json
│ │ │ │ ├── assertions.h
│ │ │ │ ├── autolink.h
│ │ │ │ ├── config.h
│ │ │ │ ├── features.h
│ │ │ │ ├── forwards.h
│ │ │ │ ├── json.h
│ │ │ │ ├── reader.h
│ │ │ │ ├── value.h
│ │ │ │ ├── version.h
│ │ │ │ └── writer.h
│ │ │ └── src
│ │ │ │ ├── json_batchallocator.h
│ │ │ │ ├── json_internalarray.inl
│ │ │ │ ├── json_internalmap.inl
│ │ │ │ ├── json_reader.cpp
│ │ │ │ ├── json_tool.h
│ │ │ │ ├── json_value.cpp
│ │ │ │ ├── json_valueiterator.inl
│ │ │ │ └── json_writer.cpp
│ │ ├── metadata.cpp
│ │ ├── metadata.h
│ │ └── qtdudu.h
│ ├── logic
│ │ ├── clogic.cpp
│ │ └── clogic.h
│ └── playlist
│ │ ├── TreeItem.cpp
│ │ ├── TreeItem.h
│ │ ├── TreeModel.cpp
│ │ └── TreeModel.h
├── images
│ ├── 128cloud.png
│ ├── 128download.png
│ ├── 128gadget.png
│ ├── 128music.png
│ ├── 128radiotower.png
│ ├── 128smartphone.png
│ ├── 64last.png
│ ├── 64next.png
│ ├── 64pause.png
│ ├── 64play.png
│ ├── anchor-left.png
│ ├── anchor-right.png
│ ├── btn-delete.png
│ ├── cancel.png
│ ├── close.png
│ ├── collect24.png
│ ├── comment.png
│ ├── default.png
│ ├── download16.png
│ ├── dudu-default.jpg
│ ├── dudu.jpg
│ ├── film16.png
│ ├── game.png
│ ├── icon-col-click.png
│ ├── icon-col.png
│ ├── icon-delete.png
│ ├── icon-history-click.png
│ ├── icon-history.png
│ ├── icon-music.png
│ ├── icon-net.png
│ ├── icon-person-center-click.png
│ ├── icon-person-center.png
│ ├── icon-search.png
│ ├── icon-singer22.png
│ ├── icon-titlebar-person-default.png
│ ├── icon-up.png
│ ├── iconSearch.png
│ ├── last-click.png
│ ├── last.png
│ ├── loop24.png
│ ├── maximize.png
│ ├── more16.png
│ ├── music.png
│ ├── music24.png
│ ├── next--click.png
│ ├── next.png
│ ├── null.png
│ ├── options.png
│ ├── play-click.png
│ ├── play.png
│ ├── refresh.png
│ ├── search-press.png
│ ├── search.png
│ ├── skin.png
│ ├── sound-off.png
│ ├── sound-on.png
│ ├── stop-click.png
│ └── stop.png
├── main.cpp
├── main.qml
├── qml.qrc
├── qml
│ ├── Home.qml
│ ├── LeftMain.qml
│ ├── MusicMediaPlayerBar.qml
│ ├── RightMain.qml
│ ├── TitleBar.qml
│ ├── common
│ │ ├── ColorButton.qml
│ │ ├── DuDuTabViewStyle.qml
│ │ ├── FlatButton.qml
│ │ ├── Function.js
│ │ ├── KeyboardQWERTY.qml
│ │ ├── KeyboardSymbol.qml
│ │ ├── PicButton.qml
│ │ ├── PlayProgressBar.qml
│ │ └── TextButton.qml
│ └── sub
│ │ ├── LeftMainTitleBar.qml
│ │ ├── LocalMusicList.qml
│ │ ├── MusicMediaPlayerBar.qml
│ │ ├── PageKTV.qml
│ │ ├── PageList.qml
│ │ ├── PageLive.qml
│ │ ├── PageLyric.qml
│ │ ├── PageMV.qml
│ │ ├── PageOnlineMusic.qml
│ │ ├── PageRadio.qml
│ │ ├── PageSongList.qml
│ │ ├── PlayProgressBar.qml
│ │ ├── PopupSkin.qml
│ │ ├── ProgressBar.qml
│ │ ├── RightMainTitlebar.qml
│ │ ├── TreeViewTest.qml
│ │ ├── onlinemusic
│ │ ├── BottomMusicControl.qml
│ │ ├── OnlineMusic.qml
│ │ ├── PageItem.qml
│ │ ├── PagePersonalCenter.qml
│ │ ├── PagePlay.qml
│ │ ├── PageSearch.qml
│ │ ├── PageSearchedList.qml
│ │ ├── PageSingerList.qml
│ │ ├── pageEmotion.qml
│ │ ├── pageHot.qml
│ │ ├── pageLanguage.qml
│ │ ├── pageSence.qml
│ │ ├── pageStyle.qml
│ │ └── pageYears.qml
│ │ └── video
│ │ └── DuDuVideo.qml
└── 设计图
│ ├── 主页.png
│ └── 规格.txt
└── README.md
/DuDuPlayer/Controls/HeaderItem.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.2
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Private 1.0
4 | import QtQuick.Layouts 1.1
5 |
6 | Rectangle{
7 | property color backGround: "transparent"
8 | property color borderColor: "#a0a0a0"
9 | property int borderWidth: 1
10 | property string title: ""
11 |
12 | anchors.fill: parent
13 | color: backGround
14 | border.color: borderColor
15 | border.width: borderWidth
16 | ColumnLayout{
17 | anchors.fill: parent
18 | Rectangle{
19 | Layout.fillWidth: true
20 | Layout.preferredHeight: 24
21 | height: 24
22 | color: "transparent"
23 | Text {
24 | anchors.verticalCenter: parent.verticalCenter
25 | anchors.left: parent.left
26 | anchors.leftMargin: 4
27 | verticalAlignment: Text.AlignVCenter
28 | text: title
29 | }
30 | }
31 | Rectangle{
32 | Layout.fillWidth: true
33 | Layout.preferredHeight: 1
34 | height: 1
35 | color: borderColor
36 | }
37 | Rectangle{
38 | Layout.fillHeight: true
39 | Layout.fillWidth: true
40 | color: "transparent"
41 | ContentItem{}
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/Themes.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | theme/MyWindow.qml
4 | theme/ButtonStyle.qml
5 | theme/MenuStyle.qml
6 | theme/TextAreaStyle.qml
7 | theme/TextFieldStyle.qml
8 | theme/ComboBoxStyle.qml
9 | theme/GroupBoxStyle.qml
10 | theme/HeaderItem.qml
11 | theme/CheckBoxStyle.qml
12 | theme/RadioButtonStyle.qml
13 | theme/BusyIndicatorStyle.qml
14 | theme/CalendarStyle.qml
15 | theme/ProgressBarStyle.qml
16 | theme/ScrollViewStyle.qml
17 | theme/SliderStyle.qml
18 | theme/SpinBoxStyle.qml
19 | theme/StatusBarStyle.qml
20 | theme/SwitchStyle.qml
21 | theme/TableViewStyle.qml
22 | theme/TabViewStyle.qml
23 | theme/ToolBarStyle.qml
24 | theme/ToolButtonStyle.qml
25 |
26 |
27 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/controls.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = lib
2 | TARGET = Controls
3 | QT += qml quick widgets
4 | CONFIG += qt plugin
5 |
6 | TARGET = $$qtLibraryTarget($$TARGET)
7 | uri = XA.Controls
8 |
9 | # Input
10 | SOURCES += \
11 | controls_plugin.cpp \
12 | fusswindow.cpp
13 |
14 | HEADERS += \
15 | controls_plugin.h \
16 | fusswindow.h \
17 | fnamespace.h
18 |
19 | OTHER_FILES = qmldir \
20 |
21 | !equals(_PRO_FILE_PWD_, $$OUT_PWD) {
22 | copy_qmldir.target = $$OUT_PWD/qmldir
23 | copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
24 | copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
25 | QMAKE_EXTRA_TARGETS += copy_qmldir
26 | PRE_TARGETDEPS += $$copy_qmldir.target
27 | }
28 |
29 | qmldir.files = qmldir
30 | unix {
31 | installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
32 | qmldir.path = $$installPath
33 | target.path = $$installPath
34 | INSTALLS += target qmldir
35 | }
36 |
37 | RESOURCES += \
38 | Themes.qrc
39 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/controls_plugin.cpp:
--------------------------------------------------------------------------------
1 | #include "controls_plugin.h"
2 | #include "fusswindow.h"
3 |
4 | #include
5 |
6 | void ControlsPlugin::registerTypes(const char *uri)
7 | {
8 | // @uri XA.Controls
9 | qmlRegisterType(uri, 1, 0, "FussWindow");
10 | }
11 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/controls_plugin.h:
--------------------------------------------------------------------------------
1 | #ifndef CONTROLS_PLUGIN_H
2 | #define CONTROLS_PLUGIN_H
3 |
4 | #include
5 |
6 | class ControlsPlugin : public QQmlExtensionPlugin
7 | {
8 | Q_OBJECT
9 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
10 |
11 | public:
12 | void registerTypes(const char *uri);
13 | };
14 |
15 | #endif // CONTROLS_PLUGIN_H
16 |
17 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/fnamespace.h:
--------------------------------------------------------------------------------
1 | #ifndef FNAMESPACE_H
2 | #define FNAMESPACE_H
3 |
4 | #endif // FNAMESPACE_H
5 |
6 | namespace Fuss {
7 | //窗口区域,客户区、左上、上、右上、右、右下、下、左下、左、标题栏、按钮区域
8 | enum FussWindowArea
9 | {
10 | CustomerArea = 0,
11 | LeftTopResizeArea = 1,
12 | TopResizeArea = 2,
13 | RightTopResizeArea = 3,
14 | RightResizeArea = 4,
15 | RightBottomResizeArea = 5,
16 | BottomResizeArea = 6,
17 | LeftBottomResizeArea = 7,
18 | LeftResizeArea = 8,
19 | TitleBarArea = 9,
20 | ButtonArea = 10
21 | };
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/fusswindow.h:
--------------------------------------------------------------------------------
1 | #ifndef FUSSWINDOW_H
2 | #define FUSSWINDOW_H
3 |
4 | #include "fnamespace.h"
5 | #include
6 | #include
7 |
8 | class FussWindow : public QQuickView
9 | {
10 | Q_OBJECT
11 | Q_PROPERTY(int shadowThick READ shadowThick WRITE setShadowThick NOTIFY shadowThickChanged)
12 | Q_PROPERTY(QObject* layoutComponent READ layoutComponent WRITE setLayoutComponent NOTIFY layoutComponentChanged)
13 | Q_PROPERTY(bool showTitleMenu READ showTitleMenu WRITE setShowTitleMenu NOTIFY showTitleMenuChanged)
14 | Q_PROPERTY(bool showMaxButton READ showMaxButton WRITE setShowMaxButton NOTIFY showMaxButtonChanged)
15 | Q_PROPERTY(QObject* titleMenu READ titleMenu WRITE setTitleMenu NOTIFY titleMenuChanged)
16 |
17 | public:
18 | FussWindow(QQuickView *parent = 0);
19 | ~FussWindow();
20 |
21 | protected:
22 | void mousePressEvent(QMouseEvent * event);
23 | void mouseMoveEvent(QMouseEvent * event);
24 | void mouseReleaseEvent(QMouseEvent * event);
25 | void mouseDoubleClickEvent(QMouseEvent * event);
26 |
27 | signals:
28 | void shadowThickChanged();
29 | void layoutComponentChanged();
30 | void showTitleMenuChanged();
31 | void showMaxButtonChanged();
32 | void titleMenuChanged();
33 |
34 | public slots:
35 | int shadowThick();
36 | void setShadowThick(int thick);
37 |
38 | QObject* layoutComponent();
39 | void setLayoutComponent(QObject* layoutComponent);
40 |
41 | QObject* titleMenu();
42 | void setTitleMenu(QObject* titleMenu);
43 |
44 | bool showTitleMenu();
45 | void setShowTitleMenu(bool showTitleMenu);
46 |
47 | bool showMaxButton();
48 | void setShowMaxButton(bool showMaxButton);
49 |
50 | private:
51 | QQuickItem * clientContent;
52 | QQuickItem * menuButton;
53 | QQuickItem * m_layoutComponent;
54 | QQuickItem * m_titleMenu;
55 | bool m_showTitleMenu = false;
56 | bool m_showMaxButton = true;
57 |
58 | int m_shadowThick = 5;
59 | int oldCursorScreenX;
60 | int oldCursorScreenY;
61 | bool beginMove;
62 | Qt::CursorShape getCursorType(int x,int y);
63 | bool beginResize;
64 | Fuss::FussWindowArea cursorInArea;
65 |
66 | };
67 |
68 | #endif // FUSSWINDOW_H
69 |
70 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/qmldir:
--------------------------------------------------------------------------------
1 | module XA.Controls
2 | plugin Controls
3 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/BusyIndicatorStyle.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 | import QtQuick 2.2
41 | import QtQuick.Controls 1.2
42 | import QtQuick.Controls.Private 1.0
43 | import QtQuick.Controls.Styles 1.2
44 |
45 | BusyIndicatorStyle {
46 | // indicator: Image {
47 | // visible: control.running
48 | // source: "spinner.png"
49 | // RotationAnimator on rotation {
50 | // running: control.running
51 | // loops: Animation.Infinite
52 | // duration: 2000
53 | // from: 0 ; to: 360
54 | // }
55 | // }
56 | }
57 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/ButtonStyle.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.2
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Private 1.0
4 |
5 | Style {
6 | id: buttonstyle
7 |
8 | /*! The \l {QtQuick.Controls::}{Button} attached to this style. */
9 | readonly property Button control: __control
10 |
11 | /*! The padding between the background and the label components. */
12 | padding {
13 | top: 4
14 | left: 8
15 | right: control.menu !== null ? Math.round(TextSingleton.implicitHeight * 0.5) : 8
16 | bottom: 4
17 | }
18 |
19 | /*! This defines the background of the button. */
20 | property Component background: Item {
21 | property bool down: control.pressed || (control.checkable && control.checked)
22 | implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
23 | implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
24 | Rectangle {
25 | anchors.fill: parent
26 | border.width: control.activeFocus ? 2 : 1
27 | border.color: "#888"
28 | radius: TextSingleton.implicitHeight * 0.16
29 | gradient: Gradient {
30 | GradientStop {
31 | position: 0 ;
32 | color: {
33 | if(control.pressed)
34 | return "#f0f0f0";
35 | return control.hovered ? "#fff" : "#f0f0f0";
36 | }
37 | }
38 | GradientStop {
39 | position: 1 ;
40 | color: {
41 | if(control.pressed)
42 | return "#c0c0c0";
43 | return control.hovered ? "#eee" : "#e0e0e0"
44 | }
45 | }
46 | }
47 | }
48 | Text {
49 | id: imageItem
50 | visible: control.menu !== null
51 | text:"▼"
52 | anchors.verticalCenter: parent.verticalCenter
53 | anchors.right: parent.right
54 | anchors.rightMargin: padding.right
55 | opacity: control.enabled ? 0.6 : 0.5
56 | color: (control.hovered||control.pressed) ? "#AAA" : "#BBB";
57 | }
58 | }
59 |
60 | /*! This defines the label of the button. */
61 | property Component label: Item {
62 | implicitWidth: row.implicitWidth
63 | implicitHeight: row.implicitHeight
64 | baselineOffset: row.y + text.y + text.baselineOffset
65 | Row {
66 | id: row
67 | anchors.centerIn: parent
68 | spacing: 2
69 | Image {
70 | source: control.iconSource
71 | anchors.verticalCenter: parent.verticalCenter
72 | }
73 | Text {
74 | id: text
75 | renderType: Text.NativeRendering
76 | anchors.verticalCenter: parent.verticalCenter
77 | text: control.text
78 | color: SystemPaletteSingleton.buttonText(control.enabled)
79 | }
80 | }
81 | }
82 |
83 | /*! \internal */
84 | property Component panel: Item {
85 | anchors.fill: parent
86 | implicitWidth: Math.max(labelLoader.implicitWidth + padding.left + padding.right, backgroundLoader.implicitWidth)
87 | implicitHeight: Math.max(labelLoader.implicitHeight + padding.top + padding.bottom, backgroundLoader.implicitHeight)
88 | baselineOffset: labelLoader.item ? padding.top + labelLoader.item.baselineOffset : 0
89 |
90 | Loader {
91 | id: backgroundLoader
92 | anchors.fill: parent
93 | sourceComponent: background
94 | }
95 |
96 | Loader {
97 | id: labelLoader
98 | sourceComponent: label
99 | anchors.fill: parent
100 | anchors.leftMargin: padding.left
101 | anchors.topMargin: padding.top
102 | anchors.rightMargin: padding.right
103 | anchors.bottomMargin: padding.bottom
104 | }
105 | }
106 |
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/GroupBoxStyle.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 | import QtQuick 2.2
41 | import QtQuick.Controls 1.2
42 | import QtQuick.Controls.Private 1.0
43 | import QtQuick.Layouts 1.1
44 |
45 | /*!
46 | \qmltype GroupBoxStyle
47 | \internal
48 | \inqmlmodule QtQuick.Controls.Styles
49 | \ingroup controlsstyling
50 | \since 5.1
51 | */
52 | Style {
53 |
54 | /*! The \l GroupBox attached to this style. */
55 | readonly property GroupBox control: __control
56 |
57 | /*! The margin from the content item to the groupbox. */
58 | padding {
59 | top: 36
60 | left: 6
61 | right: 6
62 | bottom: 6
63 | }
64 |
65 | /*! The title text color. */
66 | property color textColor: SystemPaletteSingleton.text(control.enabled)
67 |
68 | /*! The groupbox frame. */
69 | property Component panel: Item {
70 | anchors.fill: parent
71 |
72 | Rectangle{
73 | anchors.fill: parent
74 | color: "transparent"
75 | border.color: "#a0a0a0"
76 | border.width: 1
77 | ColumnLayout{
78 | anchors.fill: parent
79 | Rectangle{
80 | Layout.fillWidth: true
81 | Layout.preferredHeight: 24
82 | height: 24
83 | color: "transparent"
84 | Text {
85 | anchors.verticalCenter: parent.verticalCenter
86 | anchors.verticalCenterOffset: 4
87 | anchors.left: parent.left
88 | anchors.leftMargin: 10
89 | verticalAlignment: Text.AlignVCenter
90 | text: control.title
91 | color: textColor
92 | }
93 | }
94 | Rectangle{
95 | Layout.fillWidth: true
96 | Layout.preferredHeight: 1
97 | height: 1
98 | color: "#a0a0a0"
99 | }
100 | Rectangle{
101 | Layout.fillHeight: true
102 | Layout.fillWidth: true
103 | color: "transparent"
104 | }
105 | }
106 |
107 | }
108 |
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/HeaderItem.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.2
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Layouts 1.1
4 |
5 | Rectangle{
6 | id:layout
7 | property color backGroundColor: "transparent"
8 | property color borderColor: "#a0a0a0"
9 | property int borderWidth: 1
10 | property string title: ""
11 | property Component content
12 |
13 | color: backGroundColor
14 | border.color: borderColor
15 | border.width: borderWidth
16 |
17 | implicitHeight: 25+contentLoader.height+8+borderWidth*2
18 | implicitWidth: contentLoader.width+8+borderWidth*2
19 | ColumnLayout{
20 | anchors.fill: parent
21 | spacing: 0
22 | Rectangle{
23 | Layout.fillWidth: true
24 | Layout.preferredHeight: 24
25 | height: 24
26 | color: "transparent"
27 | Text {
28 | anchors.verticalCenter: parent.verticalCenter
29 | anchors.left: parent.left
30 | anchors.leftMargin: 4
31 | verticalAlignment: Text.AlignVCenter
32 | text: title
33 | }
34 | }
35 | Rectangle{
36 | Layout.fillWidth: true
37 | Layout.preferredHeight: 1
38 | height: 1
39 | color: borderColor
40 | }
41 | Rectangle{
42 | id:contentRectangle
43 | Layout.fillHeight: true
44 | Layout.fillWidth: true
45 | color: "transparent"
46 | Loader{
47 | id:contentLoader
48 | anchors.margins: 4
49 | anchors.centerIn: parent
50 | sourceComponent: content
51 | }
52 | }
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/ProgressBarStyle.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.2
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Private 1.0
4 | import QtQuick.Controls.Styles 1.2
5 |
6 | ProgressBarStyle {
7 | background: Rectangle {
8 | radius: 2
9 | gradient: Gradient {
10 | GradientStop {color: "#bbb" ; position: 0}
11 | GradientStop {color: "#eee" ; position: 0.1}
12 | GradientStop {color: "#eee" ; position: 1}
13 | }
14 | border.color: "gray"
15 | border.width: 1
16 | implicitWidth: 200
17 | implicitHeight: 24
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/ScrollViewStyle.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.2
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Private 1.0
4 | import QtQuick.Controls.Styles 1.2
5 |
6 | ScrollViewStyle{
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/SpinBoxStyle.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 | import QtQuick 2.2
41 | import QtQuick.Controls 1.2
42 | import QtQuick.Controls.Private 1.0
43 | import QtQuick.Controls.Styles 1.2
44 |
45 | SpinBoxStyle{
46 | // background: Rectangle {
47 | // implicitWidth: 100
48 | // implicitHeight: 20
49 | // border.color: "gray"
50 | // radius: 2
51 | // }
52 | }
53 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/StatusBarStyle.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 | import QtQuick 2.2
41 | import QtQuick.Controls 1.2
42 | import QtQuick.Controls.Private 1.0
43 |
44 | /*!
45 | \qmltype StatusBarStyle
46 | \inqmlmodule QtQuick.Controls.Styles
47 | \ingroup controlsstyling
48 | \since 5.2
49 | \brief Provides custom styling for StatusBar
50 |
51 | The status bar can be defined by overriding the background component and
52 | setting the content padding.
53 |
54 | Example:
55 | \qml
56 | StatusBar {
57 | style: StatusBarStyle {
58 | padding {
59 | left: 8
60 | right: 8
61 | top: 3
62 | bottom: 3
63 | }
64 | background: Rectangle {
65 | implicitHeight: 16
66 | implicitWidth: 200
67 | gradient: Gradient{
68 | GradientStop{color: "#eee" ; position: 0}
69 | GradientStop{color: "#ccc" ; position: 1}
70 | }
71 | Rectangle {
72 | anchors.top: parent.top
73 | width: parent.width
74 | height: 1
75 | color: "#999"
76 | }
77 | }
78 | }
79 | }
80 | \endqml
81 | */
82 |
83 | Style {
84 |
85 | /*! The content padding inside the status bar. */
86 | padding {
87 | left: 3
88 | right: 3
89 | top: 3
90 | bottom: 2
91 | }
92 |
93 | /*! This defines the background of the tool bar. */
94 | property Component background: Rectangle {
95 | implicitHeight: 16
96 | implicitWidth: 200
97 |
98 | gradient: Gradient{
99 | GradientStop{color: "#eee" ; position: 0}
100 | GradientStop{color: "#ccc" ; position: 1}
101 | }
102 |
103 | Rectangle {
104 | anchors.top: parent.top
105 | width: parent.width
106 | height: 1
107 | color: "#999"
108 | }
109 | }
110 |
111 | property Component panel: Loader {
112 | sourceComponent: background
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/TabViewStyle.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 | import QtQuick 2.2
41 | import QtQuick.Controls 1.2
42 | import QtQuick.Controls.Private 1.0
43 | import QtQuick.Controls.Styles 1.2
44 |
45 | TabViewStyle {
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/TableViewStyle.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.2
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Private 1.0
4 |
5 | /*!
6 | \qmltype TableViewStyle
7 | \inqmlmodule QtQuick.Controls.Styles
8 | \since 5.1
9 | \ingroup viewsstyling
10 | \brief Provides custom styling for TableView
11 |
12 | \note This class derives from \l {QtQuick.Controls.Styles::}{ScrollViewStyle}
13 | and supports all of the properties defined there.
14 | */
15 | ScrollViewStyle {
16 | id: root
17 |
18 | /*! The \l TableView attached to this style. */
19 | readonly property TableView control: __control
20 |
21 | /*! The text color. */
22 | property color textColor: SystemPaletteSingleton.text(control.enabled)
23 |
24 | /*! The background color. */
25 | property color backgroundColor: control.backgroundVisible ? SystemPaletteSingleton.base(control.enabled) : "transparent"
26 |
27 | /*! The alternate background color. */
28 | property color alternateBackgroundColor: "#f5f5f5"
29 |
30 | /*! The text highlight color, used within selections. */
31 | property color highlightedTextColor: "white"
32 |
33 | /*! Activates items on single click. */
34 | property bool activateItemOnSingleClick: false
35 |
36 | padding.top: control.headerVisible ? 0 : 1
37 |
38 | /*! \qmlproperty Component TableViewStyle::headerDelegate
39 | Delegate for header. This delegate is described in \l {TableView::headerDelegate}
40 | */
41 | property Component headerDelegate: Rectangle {
42 | height:Math.max(24, textItem.implicitHeight * 1.2)
43 | border.color: "#a0a0a0"
44 | border.width: 1
45 | gradient: Gradient {
46 | GradientStop {
47 | position: 0 ;
48 | color:"#fff"
49 | }
50 | GradientStop {
51 | position: 1 ;
52 | color:"#eee"
53 | }
54 | }
55 | Text {
56 | id: textItem
57 | anchors.fill: parent
58 | verticalAlignment: Text.AlignVCenter
59 | horizontalAlignment: styleData.textAlignment
60 | anchors.leftMargin: 12
61 | text: styleData.value
62 | elide: Text.ElideRight
63 | color: textColor
64 | renderType: Text.NativeRendering
65 | }
66 | Rectangle {
67 | anchors.right: parent.right
68 | anchors.top: parent.top
69 | anchors.bottom: parent.bottom
70 | anchors.bottomMargin: 1
71 | anchors.topMargin: 1
72 | width: 1
73 | color: "#ccc"
74 | }
75 | }
76 |
77 | /*! \qmlproperty Component TableViewStyle::rowDelegate
78 | Delegate for row. This delegate is described in \l {TableView::rowDelegate}
79 | */
80 | property Component rowDelegate: Rectangle {
81 | height: Math.max(24,Math.round(TextSingleton.implicitHeight * 1.2))
82 | property color selectedColor: styleData.hasActiveFocus ? "#ff00a0e9" : "#999"
83 | color: styleData.selected ? selectedColor :
84 | !styleData.alternate ? alternateBackgroundColor : backgroundColor
85 | }
86 |
87 | /*! \qmlproperty Component TableViewStyle::itemDelegate
88 | Delegate for item. This delegate is described in \l {TableView::itemDelegate}
89 | */
90 | property Component itemDelegate: Item {
91 | height: Math.max(24, label.implicitHeight)
92 | property int implicitWidth: label.implicitWidth + 20
93 |
94 | Text {
95 | id: label
96 | objectName: "label"
97 | width: parent.width
98 | anchors.leftMargin: 12
99 | anchors.left: parent.left
100 | anchors.right: parent.right
101 | horizontalAlignment: styleData.textAlignment
102 | anchors.verticalCenter: parent.verticalCenter
103 | anchors.verticalCenterOffset: 1
104 | elide: styleData.elideMode
105 | text: styleData.value !== undefined ? styleData.value : ""
106 | color: styleData.textColor
107 | renderType: Text.NativeRendering
108 | }
109 | }
110 | }
111 |
112 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/TextAreaStyle.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 | import QtQuick 2.2
41 | import QtQuick.Controls 1.2
42 | import QtQuick.Controls.Private 1.0
43 | import QtQuick.Controls.Styles 1.2
44 |
45 | /*!
46 | \qmltype TextAreaStyle
47 | \inqmlmodule QtQuick.Controls.Styles
48 | \since 5.2
49 | \ingroup controlsstyling
50 | \brief Provides custom styling for TextArea.
51 |
52 | Example:
53 | \qml
54 | TextArea {
55 | style: TextAreaStyle {
56 | textColor: "#333"
57 | selectionColor: "steelblue"
58 | selectedTextColor: "#eee"
59 | backgroundColor: "#eee"
60 | }
61 | }
62 | \endqml
63 | */
64 |
65 | ScrollViewStyle {
66 | id: style
67 |
68 | /*! The \l TextArea attached to this style. */
69 | readonly property TextArea control: __control
70 |
71 | /*! The current font. */
72 | property font font
73 |
74 | /*! The text color. */
75 | property color textColor: SystemPaletteSingleton.text(control.enabled)
76 |
77 | /*! The text highlight color, used behind selections. */
78 | property color selectionColor: SystemPaletteSingleton.highlight(control.enabled)
79 |
80 | /*! The highlighted text color, used in selections. */
81 | property color selectedTextColor: SystemPaletteSingleton.highlightedText(control.enabled)
82 |
83 | /*! The background color. */
84 | property color backgroundColor: control.backgroundVisible ? SystemPaletteSingleton.base(control.enabled) : "transparent"
85 |
86 | /*!
87 | \qmlproperty enumeration renderType
88 |
89 | Override the default rendering type for the control.
90 |
91 | Supported render types are:
92 | \list
93 | \li Text.QtRendering
94 | \li Text.NativeRendering - the default
95 | \endlist
96 |
97 | \sa Text::renderType
98 | */
99 | property int renderType: Text.NativeRendering
100 | }
101 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/ToolBarStyle.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 | import QtQuick 2.2
41 | import QtQuick.Controls 1.2
42 | import QtQuick.Controls.Private 1.0
43 |
44 | /*!
45 | \qmltype ToolBarStyle
46 | \inqmlmodule QtQuick.Controls.Styles
47 | \ingroup controlsstyling
48 | \since 5.2
49 | \brief Provides custom styling for ToolBar
50 |
51 | The tool bar can be defined by overriding the background component and
52 | setting the content padding.
53 |
54 | Example:
55 | \qml
56 | ToolBar {
57 | style: ToolBarStyle {
58 | padding {
59 | left: 8
60 | right: 8
61 | top: 3
62 | bottom: 3
63 | }
64 | background: Rectangle {
65 | implicitWidth: 100
66 | implicitHeight: 40
67 | border.color: "#999"
68 | gradient: Gradient {
69 | GradientStop { position: 0 ; color: "#fff" }
70 | GradientStop { position: 1 ; color: "#eee" }
71 | }
72 | }
73 | }
74 | }
75 | \endqml
76 | */
77 |
78 | Style {
79 |
80 | /*! The content padding inside the tool bar. */
81 | padding {
82 | left: 6
83 | right: 6
84 | top: 3
85 | bottom: 3
86 | }
87 |
88 | /*! This defines the background of the tool bar. */
89 | property Component background: Item {
90 | implicitHeight: 40
91 | implicitWidth: 200
92 | Rectangle {
93 | anchors.fill: parent
94 | gradient: Gradient{
95 | GradientStop{color: "#eee" ; position: 0}
96 | GradientStop{color: "#ccc" ; position: 1}
97 | }
98 | Rectangle {
99 | anchors.bottom: parent.bottom
100 | width: parent.width
101 | height: 1
102 | color: "#999"
103 | }
104 | }
105 | }
106 |
107 | property Component panel: Loader {
108 | sourceComponent: background
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/theme/ToolButtonStyle.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 | import QtQuick 2.2
41 | import QtQuick.Controls 1.2
42 | import QtQuick.Controls.Private 1.0
43 |
44 | /*!
45 | \qmltype ToolButtonStyle
46 | \internal
47 | \ingroup controlsstyling
48 | \inqmlmodule QtQuick.Controls.Styles
49 | */
50 | Style {
51 | readonly property ToolButton control: __control
52 | property Component panel: Item {
53 | id: styleitem
54 | implicitWidth: (hasIcon ? icon.width : Math.max(label.implicitWidth + frame.border.left + frame.border.right, 36))
55 | + (arrow.visible ? 10 : 0)
56 | implicitHeight: hasIcon ? icon.height : Math.max(label.implicitHeight, 36)
57 |
58 | readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading
59 |
60 | Rectangle {
61 | anchors.fill: parent
62 | visible: control.pressed || (control.checkable && control.checked)
63 | color: "lightgray"
64 | radius:4
65 | border.color: "#aaa"
66 | }
67 | Item {
68 | anchors.left: parent.left
69 | anchors.right: arrow.left
70 | anchors.top: parent.top
71 | anchors.bottom: parent.bottom
72 | clip: true
73 | Text {
74 | id: label
75 | visible: !hasIcon
76 | anchors.centerIn: parent
77 | text: control.text
78 | }
79 | Image {
80 | id: icon
81 | anchors.centerIn: parent
82 | source: control.iconSource
83 | }
84 | }
85 |
86 | BorderImage {
87 | id: frame
88 | anchors.fill: parent
89 | anchors.margins: -1
90 | anchors.topMargin: -2
91 | anchors.rightMargin: 0
92 | source: "images/focusframe.png"
93 | visible: control.activeFocus
94 | border.left: 4
95 | border.right: 4
96 | border.top: 4
97 | border.bottom: 4
98 | }
99 |
100 | Image {
101 | id: arrow
102 | visible: control.menu !== null
103 | source: visible ? "images/arrow-down.png" : ""
104 | anchors.verticalCenter: parent.verticalCenter
105 | anchors.right: parent.right
106 | anchors.rightMargin: visible ? 3 : 0
107 | opacity: control.enabled ? 0.7 : 0.5
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/DuDuPlayer/Controls/win.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AiLoverer/DuDuPlayer/d997e05d3134057757d4c6d094ae4b65fde17fdf/DuDuPlayer/Controls/win.ico
--------------------------------------------------------------------------------
/DuDuPlayer/DuDuPlayer.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += qml quick
4 | QT += core
5 | QT += sql
6 | QT += multimedia
7 | QT += widgets
8 | QT += 3drender
9 |
10 | CONFIG += c++11
11 |
12 |
13 | SOURCES += main.cpp \
14 | code/playlist/TreeItem.cpp \
15 | code/playlist/TreeModel.cpp \
16 | code/framework/metadata.cpp \
17 | code/logic/clogic.cpp \
18 | code/app/localmusic/localmusic.cpp \
19 | code/app/localmusic/localmusicmodel.cpp \
20 | code/app/onlinemusic/CAppOnlineMusic.cpp \
21 | code/app/onlinemusic/CModelOnlineMusicCollect.cpp \
22 | code/app/onlinemusic/CModelOnlineMusicEmotion.cpp \
23 | code/app/onlinemusic/CModelOnlineMusicHistory.cpp \
24 | code/app/onlinemusic/CModelOnlineMusicLanguage.cpp \
25 | code/app/onlinemusic/CModelOnlineMusicSearched.cpp \
26 | code/app/onlinemusic/CModelOnlineMusicSence.cpp \
27 | code/app/onlinemusic/CModelOnlineMusicStyle.cpp \
28 | code/app/onlinemusic/CModelOnlineMusicTopName.cpp \
29 | code/app/onlinemusic/CModelOnlineMusicType.cpp \
30 | code/app/onlinemusic/CModelOnlineMusicYears.cpp \
31 | code/app/onlinemusic/cnetworkmanager.cpp \
32 | code/app/onlinemusic/cnetworkonlineserver.cpp \
33 | code/framework/CAppDataBase.cpp \
34 | code/framework/jsoncpp/CJSONUtils.cpp \
35 | code/framework/jsoncpp/src/json_reader.cpp \
36 | code/framework/jsoncpp/src/json_value.cpp \
37 | code/framework/jsoncpp/src/json_writer.cpp \
38 | code/app/video/dudumediaplayer.cpp
39 |
40 | RESOURCES += qml.qrc
41 |
42 | win32 {
43 | TARGET_PLATFORM = win32
44 | DEFINES += OS_WIN
45 | }
46 | qnx {
47 | }
48 | # Additional import path used to resolve QML modules in Qt Creator's code model
49 | QML_IMPORT_PATH =
50 |
51 | # Additional import path used to resolve QML modules just for Qt Quick Designer
52 | QML_DESIGNER_IMPORT_PATH =
53 |
54 | # The following define makes your compiler emit warnings if you use
55 | # any feature of Qt which as been marked deprecated (the exact warnings
56 | # depend on your compiler). Please consult the documentation of the
57 | # deprecated API in order to know how to port your code away from it.
58 | DEFINES += QT_DEPRECATED_WARNINGS
59 |
60 | # You can also make your code fail to compile if you use deprecated APIs.
61 | # In order to do so, uncomment the following line.
62 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
63 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
64 |
65 | # Default rules for deployment.
66 | qnx: target.path = /tmp/$${TARGET}/bin
67 | else: unix:!android: target.path = /opt/$${TARGET}/bin
68 | !isEmpty(target.path): INSTALLS += target
69 |
70 | HEADERS += \
71 | code/playlist/TreeItem.h \
72 | code/playlist/TreeModel.h \
73 | code/framework/metadata.h \
74 | code/framework/dudu.h \
75 | code/framework/qtdudu.h \
76 | code/framework/TypeDefine.h \
77 | code/logic/clogic.h \
78 | code/framework/commondata.h \
79 | code/app/localmusic/localmusic.h \
80 | code/app/localmusic/localmusicmodel.h \
81 | code/app/onlinemusic/CAppOnlineMusic.h \
82 | code/app/onlinemusic/CModelOnlineMusicCollect.h \
83 | code/app/onlinemusic/CModelOnlineMusicEmotion.h \
84 | code/app/onlinemusic/CModelOnlineMusicHistory.h \
85 | code/app/onlinemusic/CModelOnlineMusicLanguage.h \
86 | code/app/onlinemusic/CModelOnlineMusicSearched.h \
87 | code/app/onlinemusic/CModelOnlineMusicSence.h \
88 | code/app/onlinemusic/CModelOnlineMusicStyle.h \
89 | code/app/onlinemusic/CModelOnlineMusicTopName.h \
90 | code/app/onlinemusic/CModelOnlineMusicType.h \
91 | code/app/onlinemusic/CModelOnlineMusicYears.h \
92 | code/app/onlinemusic/cnetworkmanager.h \
93 | code/app/onlinemusic/cnetworkonlineserver.h \
94 | code/framework/CAppDataBase.h \
95 | code/app/onlinemusic/JConNetRspData.h \
96 | code/framework/JsonLite.h \
97 | code/framework/jsoncpp/CJSONUtils.h \
98 | code/framework/jsoncpp/src/json_batchallocator.h \
99 | code/framework/jsoncpp/src/json_tool.h \
100 | code/framework/jsoncpp/json/assertions.h \
101 | code/framework/jsoncpp/json/autolink.h \
102 | code/framework/jsoncpp/json/config.h \
103 | code/framework/jsoncpp/json/features.h \
104 | code/framework/jsoncpp/json/forwards.h \
105 | code/framework/jsoncpp/json/json.h \
106 | code/framework/jsoncpp/json/reader.h \
107 | code/framework/jsoncpp/json/value.h \
108 | code/framework/jsoncpp/json/version.h \
109 | code/framework/jsoncpp/json/writer.h \
110 | code/app/video/dudumediaplayer.h
111 |
--------------------------------------------------------------------------------
/DuDuPlayer/MainForm.ui.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.6
2 |
3 | Rectangle {
4 | property alias mouseArea: mouseArea
5 | property alias textEdit: textEdit
6 |
7 | width: 360
8 | height: 360
9 |
10 | MouseArea {
11 | id: mouseArea
12 | anchors.fill: parent
13 | }
14 |
15 | TextEdit {
16 | id: textEdit
17 | text: qsTr("Enter some text...")
18 | verticalAlignment: Text.AlignVCenter
19 | anchors.top: parent.top
20 | anchors.horizontalCenter: parent.horizontalCenter
21 | anchors.topMargin: 20
22 | Rectangle {
23 | anchors.fill: parent
24 | anchors.margins: -10
25 | color: "transparent"
26 | border.width: 1
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/DuDuPlayer/README.md:
--------------------------------------------------------------------------------
1 | # DuDuPlayer
2 | create by qml
3 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/localmusic/localmusic.h:
--------------------------------------------------------------------------------
1 | #ifndef LOCALMUSIC_H
2 | #define LOCALMUSIC_H
3 | /***
4 | * 音乐播放控制 C++ code
5 | */
6 | #include
7 | #include
8 | #include "../../framework/dudu.h"
9 | namespace QTDUDU {
10 | #ifdef OS_WIN
11 | #define MUSIC_PATH "d:/KuGou"
12 | #define MUSIC_LYRIC_PATH "d:/KuGou/Lyric"
13 | #elif
14 | #define MUSIC_PATH "/fs/mmc1/appdata/HMI/"
15 | #endif
16 |
17 | class LocalMusic : public QObject
18 | {
19 | Q_OBJECT
20 | public:
21 | Q_PROPERTY(int nplayIndex MEMBER m_nPlayIndex NOTIFY nplayIndexChanged)
22 | Q_PROPERTY(QStringList lyrics MEMBER m_lstLyric NOTIFY lyricsChanged)
23 | Q_PROPERTY(QStringList times MEMBER m_lstTime NOTIFY timeChanged)
24 | public:
25 | Q_INVOKABLE void getMusicData();
26 | Q_INVOKABLE void playMusic(int nIndex);
27 | Q_INVOKABLE void pauseMusic();
28 | Q_INVOKABLE void nextMusic();
29 | Q_INVOKABLE void lastMusic();
30 | Q_INVOKABLE void setPlayPosition(int nPosition);
31 | Q_INVOKABLE int getIndexByTime(int mmTime); // 传入参数为时间,单位是毫秒
32 | protected:
33 | LocalMusic(QObject *parent = 0);
34 | ~LocalMusic();
35 | private:
36 |
37 | // 读取本地音频文件--所有歌曲路径
38 | bool readMusic(QString strPath, QString strFormat);
39 |
40 | // ***歌词相关***
41 | /* krc codec
42 | const int Keys[16] = {64, 71, 97, 119, 94, 50, 116, 71, 81, 54, 49, 45, 206, 210, 110, 105};
43 |
44 | typedef int CONVERT_CODE;
45 |
46 | #define CONVERT_SUCCESS 0x00
47 | #define CONVERT_FILE_EMPTY 0x01
48 | #define CONVERT_PARA_ERR 0x02
49 | #define CONVERT_FORMAT_ERR 0x03
50 | #define CONVERT_UNKNOWN 0x04
51 | */
52 | // UTF-8编码检测
53 | bool IsUTF8(const void* pBuffer, long size);
54 | // 破解krc文件
55 | //CONVERT_CODE KrcDecode(QFile &KrcFile, QFile &LrcFile);
56 | // 加载歌词文件
57 | void loadLyricFile(QString strFileName);
58 | private:
59 | int m_nPlayIndex;
60 | // ***歌词相关***
61 | // 歌词对应的时间戳
62 | QStringList m_lstTime;
63 | // 歌词
64 | QStringList m_lstLyric;
65 | // 歌词路径
66 | QString m_strlyricPath;
67 | public:
68 | static LocalMusic *getInstance();
69 | void deleteInstance();
70 | void getQMLMediaPlayer();
71 | void play(QString strSongPath);
72 | private:
73 | static LocalMusic* m_pInstance;
74 | private:
75 | QVector m_lstMusicInfo;
76 | QMediaPlayer* m_pAudioPlayer;
77 |
78 | signals:
79 |
80 | void nplayIndexChanged();
81 | void lyricsChanged();
82 | void timeChanged();
83 |
84 | void sigForUpdateLocalMusicData(const QVector& data);
85 | void sigQMLPlay(QString strSongName, QString strSongPath, QString strSingerPic, int nIndex);
86 | void sigQMLPause();
87 | void sigQMLPlayIndexChanged(int nIndex);
88 | void sigQMLPositionChanged(long position);
89 | void sigQMLDurationChanged(long duration);
90 |
91 | public slots:
92 | void positionChanged(qint64 position);
93 | void durationChanged(qint64 duration);
94 | };
95 |
96 | }
97 |
98 | #endif // LOCALMUSIC_H
99 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/localmusic/localmusicmodel.cpp:
--------------------------------------------------------------------------------
1 | #include "localmusicmodel.h"
2 | #include "../../framework/dudu.h"
3 | namespace QTDUDU {
4 | class LocalMusicModelPrivate
5 | {
6 | public:
7 | LocalMusicModelPrivate(LocalMusicModel* model):
8 | m_model(model)
9 | {
10 | m_roleNames.insert(Role_SongName, "songname");
11 | m_roleNames.insert(Role_HasDownload, "hasDownload");
12 | m_roleNames.insert(Role_HasMV, "hasMV");
13 | m_roleNames.insert(Role_HasCollected, "hasCollected");
14 |
15 | }
16 |
17 | enum {
18 | Role_SongName = Qt::UserRole + 1,
19 | Role_HasDownload,
20 | Role_HasMV,
21 | Role_HasCollected
22 | };
23 |
24 | LocalMusicModel* m_model;
25 | QHash m_roleNames;
26 | QVector m_datas;
27 | };
28 |
29 | LocalMusicModel::LocalMusicModel(QObject *parent) :
30 | QAbstractListModel(parent),
31 | m_dPtr(new LocalMusicModelPrivate(this))
32 | {
33 | qRegisterMetaType>("QVector");
34 |
35 | connect(LocalMusic::getInstance(), SIGNAL(sigForUpdateLocalMusicData(QVector)),
36 | this, SLOT(slotForLocalMusic(QVector)));
37 | }
38 |
39 | LocalMusicModel::~LocalMusicModel()
40 | {
41 | if (NULL != m_dPtr) {
42 | delete m_dPtr;
43 | m_dPtr = NULL;
44 | }
45 | }
46 |
47 | int LocalMusicModel::rowCount(const QModelIndex &parent) const
48 | {
49 | Q_UNUSED(parent)
50 | return m_dPtr->m_datas.size();
51 | }
52 |
53 | QVariant LocalMusicModel::data(const QModelIndex &index, int role) const
54 | {
55 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
56 | {
57 | return QVariant();
58 | }
59 |
60 | if (role == m_dPtr->Role_SongName) {
61 | return m_dPtr->m_datas.at(index.row()).strSongName;
62 | }
63 | return QVariant();
64 |
65 | }
66 |
67 | QHash LocalMusicModel::roleNames() const
68 | {
69 | return m_dPtr->m_roleNames;
70 | }
71 |
72 | void LocalMusicModel::slotForLocalMusic(const QVector &data)
73 | {
74 | beginResetModel();
75 | m_dPtr->m_datas = data;
76 | endResetModel();
77 |
78 | qDebug()<<"slotForLocalMusic data size is : "<< data.size() ;
79 | }
80 |
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/localmusic/localmusicmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef LOCALMUSICMODEL_H
2 | #define LOCALMUSICMODEL_H
3 | #include
4 | #include "../../framework/dudu.h"
5 | namespace QTDUDU {
6 |
7 | class LocalMusicModelPrivate;
8 | class LocalMusicModel : public QAbstractListModel
9 | {
10 | Q_OBJECT
11 | public:
12 | LocalMusicModel(QObject *parent = 0);
13 | ~LocalMusicModel();
14 |
15 | int rowCount(const QModelIndex& parent) const;
16 |
17 | QVariant data(const QModelIndex& index, int role) const;
18 |
19 | QHash roleNames() const;
20 | private:
21 | LocalMusicModelPrivate* m_dPtr;
22 |
23 | public slots:
24 | void slotForLocalMusic(const QVector& data);
25 | };
26 | }
27 | #endif // LOCALMUSICMODEL_H
28 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicCollect.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicCollect.h"
2 |
3 | namespace QTDUDU {
4 |
5 | class CModelOnlineMusicCollectPrivate
6 | {
7 | public:
8 | CModelOnlineMusicCollectPrivate(CModelOnlineMusicCollect* model):
9 | m_model(model)
10 | {
11 | m_roleNames.insert(Role_SongName, "songname");
12 | m_roleNames.insert(Role_SingerName, "singername");
13 | m_roleNames.insert(Role_SingerPicUrl, "singerpicurl");
14 | m_roleNames.insert(Role_Score, "score");
15 | m_roleNames.insert(Role_TopNo, "topno");
16 | m_roleNames.insert(Role_ExtraUrl, "extralUrl");
17 | m_roleNames.insert(Role_CacheID, "cacheId");
18 | m_roleNames.insert(Role_LyricUrl, "lyriUrl");
19 | m_roleNames.insert(Role_PlayUrl, "playUrl");
20 | m_roleNames.insert(Role_ExtraUrl, "extralUrl");
21 | m_roleNames.insert(Role_SongId, "songId");
22 | m_roleNames.insert(Role_SingerId, "singerId");
23 |
24 |
25 | }
26 |
27 | enum {
28 | Role_SongName = Qt::UserRole + 1,
29 | Role_SingerName,
30 | Role_SingerPicUrl,
31 | Role_Score,
32 | Role_TopNo,
33 | Role_ExtraUrl,
34 | Role_CacheID,
35 | Role_LyricUrl,
36 | Role_PlayUrl,
37 | Role_SongId,
38 | Role_SingerId
39 | };
40 |
41 | CModelOnlineMusicCollect* m_model;
42 | QHash m_roleNames;
43 | QVector m_datas;
44 | };
45 |
46 | CModelOnlineMusicCollect::CModelOnlineMusicCollect(QObject *parent) :
47 | QAbstractListModel(parent),
48 | m_dPtr(new CModelOnlineMusicCollectPrivate(this))
49 | {
50 | qRegisterMetaType>("QVector");
51 |
52 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicCollectData(QVector)),
53 | this, SLOT(slotForOnlineMusicCollect(QVector)));
54 | }
55 |
56 | CModelOnlineMusicCollect::~CModelOnlineMusicCollect()
57 | {
58 | if (NULL != m_dPtr) {
59 | delete m_dPtr;
60 | m_dPtr = NULL;
61 | }
62 | }
63 |
64 | int CModelOnlineMusicCollect::rowCount(const QModelIndex &parent) const
65 | {
66 | Q_UNUSED(parent)
67 | return m_dPtr->m_datas.size();
68 | }
69 |
70 | QVariant CModelOnlineMusicCollect::data(const QModelIndex &index, int role) const
71 | {
72 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
73 | {
74 | return QVariant();
75 | }
76 |
77 | if (role == m_dPtr->Role_SongName) {
78 | return m_dPtr->m_datas.at(index.row()).strSongName;
79 | }
80 | else if (role == m_dPtr->Role_SingerName) {
81 | return m_dPtr->m_datas.at(index.row()).strSingerName;
82 | }
83 | else if (role == m_dPtr->Role_SingerPicUrl) {
84 | return m_dPtr->m_datas.at(index.row()).strSingerPicUrl;
85 | }
86 | else if (role == m_dPtr->Role_Score) {
87 | return m_dPtr->m_datas.at(index.row()).strScore;
88 | }
89 | else if (role == m_dPtr->Role_TopNo) {
90 | return m_dPtr->m_datas.at(index.row()).strTopNo;
91 | }
92 | else if (role == m_dPtr->Role_ExtraUrl) {
93 | return m_dPtr->m_datas.at(index.row()).strExtraUrl;
94 | }
95 | else if (role == m_dPtr->Role_CacheID) {
96 | return m_dPtr->m_datas.at(index.row()).strCacheID;
97 | }
98 | else if (role == m_dPtr->Role_LyricUrl) {
99 | return m_dPtr->m_datas.at(index.row()).strLyricUrl;
100 | }
101 | else if (role == m_dPtr->Role_PlayUrl) {
102 | return m_dPtr->m_datas.at(index.row()).strPlayUrl;
103 | }
104 | else if (role == m_dPtr->Role_SongId) {
105 | return m_dPtr->m_datas.at(index.row()).strSongID;
106 | }
107 | else if (role == m_dPtr->Role_SingerId) {
108 | return m_dPtr->m_datas.at(index.row()).strSingerID;
109 | }
110 |
111 | return QVariant();
112 |
113 | }
114 |
115 | QHash CModelOnlineMusicCollect::roleNames() const
116 | {
117 | return m_dPtr->m_roleNames;
118 | }
119 |
120 | void CModelOnlineMusicCollect::slotForOnlineMusicCollect(const QVector &data)
121 | {
122 | beginResetModel();
123 | m_dPtr->m_datas = data;
124 | endResetModel();
125 |
126 | //qDebug()<<"slotForOnlineMusicCollect data size is : "<< data.size() ;
127 | }
128 | }
129 |
130 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicCollect.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICCOLLECT_H
2 | #define CMODELONLINEMUSICCOLLECT_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class CModelOnlineMusicCollectPrivate;
10 | class CModelOnlineMusicCollect : public QAbstractListModel
11 | {
12 | Q_OBJECT
13 | public:
14 | CModelOnlineMusicCollect(QObject *parent = 0);
15 | ~CModelOnlineMusicCollect();
16 |
17 | int rowCount(const QModelIndex& parent) const;
18 |
19 | QVariant data(const QModelIndex& index, int role) const;
20 |
21 | QHash roleNames() const;
22 |
23 | private:
24 | CModelOnlineMusicCollectPrivate* m_dPtr;
25 | signals:
26 |
27 | public slots:
28 | void slotForOnlineMusicCollect(const QVector& data);
29 |
30 | };
31 | }
32 |
33 |
34 | #endif // CMODELONLINEMUSICCOLLECT_H
35 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicEmotion.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicEmotion.h"
2 |
3 | namespace QTDUDU {
4 |
5 | class CModelOnlineMusicEmotionPrivate
6 | {
7 | public:
8 | CModelOnlineMusicEmotionPrivate(CModelOnlineMusicEmotion* model):
9 | m_model(model)
10 | {
11 | m_roleNames.insert(Role_Type, "type");
12 | m_roleNames.insert(Role_Url, "picUrl");
13 | }
14 |
15 | enum {
16 | Role_Type = Qt::UserRole + 1,
17 | Role_Url,
18 | };
19 |
20 | CModelOnlineMusicEmotion* m_model;
21 | QHash m_roleNames;
22 | QVector m_datas;
23 | };
24 |
25 | CModelOnlineMusicEmotion::CModelOnlineMusicEmotion(QObject *parent) :
26 | QAbstractListModel(parent),
27 | m_dPtr(new CModelOnlineMusicEmotionPrivate(this))
28 | {
29 | qRegisterMetaType>("QVector");
30 |
31 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicEmotionData(QVector)),
32 | this, SLOT(slotForOnlineMusicEmotion(QVector)));
33 | }
34 |
35 | CModelOnlineMusicEmotion::~CModelOnlineMusicEmotion()
36 | {
37 | if (NULL != m_dPtr) {
38 | delete m_dPtr;
39 | m_dPtr = NULL;
40 | }
41 | }
42 |
43 | int CModelOnlineMusicEmotion::rowCount(const QModelIndex &parent) const
44 | {
45 | Q_UNUSED(parent)
46 | return m_dPtr->m_datas.size();
47 | }
48 |
49 | QVariant CModelOnlineMusicEmotion::data(const QModelIndex &index, int role) const
50 | {
51 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
52 | {
53 | return QVariant();
54 | }
55 |
56 | if (role == m_dPtr->Role_Type) {
57 | return m_dPtr->m_datas.at(index.row()).strType;
58 | }
59 | else if (role == m_dPtr->Role_Url) {
60 | return m_dPtr->m_datas.at(index.row()).strPicUrl;
61 | }
62 |
63 | return QVariant();
64 |
65 | }
66 |
67 | QHash CModelOnlineMusicEmotion::roleNames() const
68 | {
69 | return m_dPtr->m_roleNames;
70 | }
71 |
72 | void CModelOnlineMusicEmotion::slotForOnlineMusicEmotion(const QVector &data)
73 | {
74 | beginResetModel();
75 | m_dPtr->m_datas = data;
76 | endResetModel();
77 |
78 | //qDebug()<<"slot For OnlineMusic Emotion data size is : "<< data.size() ;
79 | }
80 | }
81 |
82 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicEmotion.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICEMOTION_H
2 | #define CMODELONLINEMUSICEMOTION_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class CModelOnlineMusicEmotionPrivate;
10 | class CModelOnlineMusicEmotion : public QAbstractListModel
11 | {
12 | Q_OBJECT
13 | public:
14 | CModelOnlineMusicEmotion(QObject *parent = 0);
15 | ~CModelOnlineMusicEmotion();
16 |
17 | int rowCount(const QModelIndex& parent) const;
18 |
19 | QVariant data(const QModelIndex& index, int role) const;
20 |
21 | QHash roleNames() const;
22 |
23 | private:
24 | CModelOnlineMusicEmotionPrivate* m_dPtr;
25 | signals:
26 |
27 | public slots:
28 | void slotForOnlineMusicEmotion(const QVector& data);
29 |
30 | };
31 | }
32 |
33 |
34 | #endif // CMODELONLINEMUSICEMOTION_H
35 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicHistory.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicHistory.h"
2 |
3 | namespace QTDUDU {
4 |
5 | class CModelOnlineMusicHistoryPrivate
6 | {
7 | public:
8 | CModelOnlineMusicHistoryPrivate(CModelOnlineMusicHistory* model):
9 | m_model(model)
10 | {
11 | m_roleNames.insert(Role_SongName, "songname");
12 | m_roleNames.insert(Role_SingerName, "singername");
13 | m_roleNames.insert(Role_SingerPicUrl, "singerpicurl");
14 | m_roleNames.insert(Role_Score, "score");
15 | m_roleNames.insert(Role_TopNo, "topno");
16 | m_roleNames.insert(Role_ExtraUrl, "extralUrl");
17 | m_roleNames.insert(Role_CacheID, "cacheId");
18 | m_roleNames.insert(Role_LyricUrl, "lyriUrl");
19 | m_roleNames.insert(Role_PlayUrl, "playUrl");
20 | m_roleNames.insert(Role_ExtraUrl, "extralUrl");
21 | m_roleNames.insert(Role_SongId, "songId");
22 | m_roleNames.insert(Role_SingerId, "singerId");
23 |
24 |
25 | }
26 |
27 | enum {
28 | Role_SongName = Qt::UserRole + 1,
29 | Role_SingerName,
30 | Role_SingerPicUrl,
31 | Role_Score,
32 | Role_TopNo,
33 | Role_ExtraUrl,
34 | Role_CacheID,
35 | Role_LyricUrl,
36 | Role_PlayUrl,
37 | Role_SongId,
38 | Role_SingerId
39 | };
40 |
41 | CModelOnlineMusicHistory* m_model;
42 | QHash m_roleNames;
43 | QVector m_datas;
44 | };
45 |
46 | CModelOnlineMusicHistory::CModelOnlineMusicHistory(QObject *parent) :
47 | QAbstractListModel(parent),
48 | m_dPtr(new CModelOnlineMusicHistoryPrivate(this))
49 | {
50 | qRegisterMetaType>("QVector");
51 |
52 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicHistoryData(QVector)),
53 | this, SLOT(slotForOnlineMusicHistory(QVector)));
54 | }
55 |
56 | CModelOnlineMusicHistory::~CModelOnlineMusicHistory()
57 | {
58 | if (NULL != m_dPtr) {
59 | delete m_dPtr;
60 | m_dPtr = NULL;
61 | }
62 | }
63 |
64 | int CModelOnlineMusicHistory::rowCount(const QModelIndex &parent) const
65 | {
66 | Q_UNUSED(parent)
67 | return m_dPtr->m_datas.size();
68 | }
69 |
70 | QVariant CModelOnlineMusicHistory::data(const QModelIndex &index, int role) const
71 | {
72 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
73 | {
74 | return QVariant();
75 | }
76 |
77 | if (role == m_dPtr->Role_SongName) {
78 | return m_dPtr->m_datas.at(index.row()).strSongName;
79 | }
80 | else if (role == m_dPtr->Role_SingerName) {
81 | return m_dPtr->m_datas.at(index.row()).strSingerName;
82 | }
83 | else if (role == m_dPtr->Role_SingerPicUrl) {
84 | return m_dPtr->m_datas.at(index.row()).strSingerPicUrl;
85 | }
86 | else if (role == m_dPtr->Role_Score) {
87 | return m_dPtr->m_datas.at(index.row()).strScore;
88 | }
89 | else if (role == m_dPtr->Role_TopNo) {
90 | return m_dPtr->m_datas.at(index.row()).strTopNo;
91 | }
92 | else if (role == m_dPtr->Role_ExtraUrl) {
93 | return m_dPtr->m_datas.at(index.row()).strExtraUrl;
94 | }
95 | else if (role == m_dPtr->Role_CacheID) {
96 | return m_dPtr->m_datas.at(index.row()).strCacheID;
97 | }
98 | else if (role == m_dPtr->Role_LyricUrl) {
99 | return m_dPtr->m_datas.at(index.row()).strLyricUrl;
100 | }
101 | else if (role == m_dPtr->Role_PlayUrl) {
102 | return m_dPtr->m_datas.at(index.row()).strPlayUrl;
103 | }
104 | else if (role == m_dPtr->Role_SongId) {
105 | return m_dPtr->m_datas.at(index.row()).strSongID;
106 | }
107 | else if (role == m_dPtr->Role_SingerId) {
108 | return m_dPtr->m_datas.at(index.row()).strSingerID;
109 | }
110 |
111 | return QVariant();
112 |
113 | }
114 |
115 | QHash CModelOnlineMusicHistory::roleNames() const
116 | {
117 | return m_dPtr->m_roleNames;
118 | }
119 |
120 | void CModelOnlineMusicHistory::slotForOnlineMusicHistory(const QVector &data)
121 | {
122 | beginResetModel();
123 | m_dPtr->m_datas = data;
124 | endResetModel();
125 |
126 | //qDebug()<<"slot For OnlineMusic TopName data size is : "<< data.size() ;
127 | }
128 | }
129 |
130 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicHistory.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICHISTORY_H
2 | #define CMODELONLINEMUSICHISTORY_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class CModelOnlineMusicHistoryPrivate;
10 | class CModelOnlineMusicHistory : public QAbstractListModel
11 | {
12 | Q_OBJECT
13 | public:
14 | CModelOnlineMusicHistory(QObject *parent = 0);
15 | ~CModelOnlineMusicHistory();
16 |
17 | int rowCount(const QModelIndex& parent) const;
18 |
19 | QVariant data(const QModelIndex& index, int role) const;
20 |
21 | QHash roleNames() const;
22 |
23 | private:
24 | CModelOnlineMusicHistoryPrivate* m_dPtr;
25 | signals:
26 |
27 | public slots:
28 | void slotForOnlineMusicHistory(const QVector& data);
29 |
30 | };
31 | }
32 |
33 |
34 | #endif // CMODELONLINEMUSICHISTORY_H
35 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicLanguage.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicLanguage.h"
2 |
3 | namespace QTDUDU {
4 |
5 | class CModelOnlineMusicLanguagePrivate
6 | {
7 | public:
8 | CModelOnlineMusicLanguagePrivate(CModelOnlineMusicLanguage* model):
9 | m_model(model)
10 | {
11 | m_roleNames.insert(Role_Type, "type");
12 | m_roleNames.insert(Role_Url, "picUrl");
13 | }
14 |
15 | enum {
16 | Role_Type = Qt::UserRole + 1,
17 | Role_Url,
18 | };
19 |
20 | CModelOnlineMusicLanguage* m_model;
21 | QHash m_roleNames;
22 | QVector m_datas;
23 | };
24 |
25 |
26 | CModelOnlineMusicLanguage::CModelOnlineMusicLanguage(QObject *parent) :
27 | QAbstractListModel(parent),
28 | m_dPtr(new CModelOnlineMusicLanguagePrivate(this))
29 | {
30 | qRegisterMetaType>("QVector");
31 |
32 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicLanguageData(QVector)),
33 | this, SLOT(slotForOnlineMusicLanguage(QVector)));
34 | }
35 |
36 | CModelOnlineMusicLanguage::~CModelOnlineMusicLanguage()
37 | {
38 | if (NULL != m_dPtr) {
39 | delete m_dPtr;
40 | m_dPtr = NULL;
41 | }
42 | }
43 |
44 | int CModelOnlineMusicLanguage::rowCount(const QModelIndex &parent) const
45 | {
46 | Q_UNUSED(parent)
47 | return m_dPtr->m_datas.size();
48 | }
49 |
50 | QVariant CModelOnlineMusicLanguage::data(const QModelIndex &index, int role) const
51 | {
52 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
53 | {
54 | return QVariant();
55 | }
56 |
57 | if (role == m_dPtr->Role_Type) {
58 | return m_dPtr->m_datas.at(index.row()).strType;
59 | }
60 | else if (role == m_dPtr->Role_Url) {
61 | return m_dPtr->m_datas.at(index.row()).strPicUrl;
62 | }
63 |
64 | return QVariant();
65 |
66 | }
67 |
68 | QHash CModelOnlineMusicLanguage::roleNames() const
69 | {
70 | return m_dPtr->m_roleNames;
71 | }
72 |
73 | void CModelOnlineMusicLanguage::slotForOnlineMusicLanguage(const QVector &data)
74 | {
75 | beginResetModel();
76 | m_dPtr->m_datas = data;
77 | endResetModel();
78 |
79 | //qDebug()<<"slot For OnlineMusic Language data size is : "<< data.size() ;
80 | }
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicLanguage.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICLANGUAGE_H
2 | #define CMODELONLINEMUSICLANGUAGE_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class CModelOnlineMusicLanguagePrivate;
10 | class CModelOnlineMusicLanguage : public QAbstractListModel
11 | {
12 | Q_OBJECT
13 | public:
14 | CModelOnlineMusicLanguage(QObject *parent = 0);
15 | ~CModelOnlineMusicLanguage();
16 |
17 | int rowCount(const QModelIndex& parent) const;
18 |
19 | QVariant data(const QModelIndex& index, int role) const;
20 |
21 | QHash roleNames() const;
22 |
23 | private:
24 | CModelOnlineMusicLanguagePrivate* m_dPtr;
25 | signals:
26 |
27 | public slots:
28 | void slotForOnlineMusicLanguage(const QVector& data);
29 |
30 | };
31 | }
32 |
33 |
34 | #endif // CMODELONLINEMUSICLANGUAGE_H
35 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicSearched.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicSearched.h"
2 |
3 | namespace QTDUDU {
4 |
5 | class CModelOnlineMusicSearchedPrivate
6 | {
7 | public:
8 | CModelOnlineMusicSearchedPrivate(CModelOnlineMusicSearched* model):
9 | m_model(model)
10 | {
11 | m_roleNames.insert(Role_SongName, "songname");
12 | m_roleNames.insert(Role_SingerName, "singername");
13 | m_roleNames.insert(Role_SingerPicUrl, "singerpicurl");
14 | m_roleNames.insert(Role_Score, "score");
15 | m_roleNames.insert(Role_TopNo, "topno");
16 |
17 | }
18 |
19 | enum {
20 | Role_SongName = Qt::UserRole + 1,
21 | Role_SingerName,
22 | Role_SingerPicUrl,
23 | Role_Score,
24 | Role_TopNo,
25 | };
26 |
27 | CModelOnlineMusicSearched* m_model;
28 | QHash m_roleNames;
29 | QVector m_datas;
30 | };
31 |
32 | CModelOnlineMusicSearched::CModelOnlineMusicSearched(QObject *parent) :
33 | QAbstractListModel(parent),
34 | m_dPtr(new CModelOnlineMusicSearchedPrivate(this))
35 | {
36 | qRegisterMetaType>("QVector");
37 |
38 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicSearchedMusicData(QVector)),
39 | this, SLOT(slotForOnlineMusicSearched(QVector)));
40 | }
41 |
42 | CModelOnlineMusicSearched::~CModelOnlineMusicSearched()
43 | {
44 | if (NULL != m_dPtr) {
45 | delete m_dPtr;
46 | m_dPtr = NULL;
47 | }
48 | }
49 |
50 | int CModelOnlineMusicSearched::rowCount(const QModelIndex &parent) const
51 | {
52 | Q_UNUSED(parent)
53 | return m_dPtr->m_datas.size();
54 | }
55 |
56 | QVariant CModelOnlineMusicSearched::data(const QModelIndex &index, int role) const
57 | {
58 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
59 | {
60 | return QVariant();
61 | }
62 |
63 | if (role == m_dPtr->Role_SongName) {
64 | return m_dPtr->m_datas.at(index.row()).strSongName;
65 | }
66 | else if (role == m_dPtr->Role_SingerName) {
67 | return m_dPtr->m_datas.at(index.row()).strSingerName;
68 | }
69 | else if (role == m_dPtr->Role_SingerPicUrl) {
70 | return m_dPtr->m_datas.at(index.row()).strSingerPicUrl;
71 | }
72 | else if (role == m_dPtr->Role_Score) {
73 | return m_dPtr->m_datas.at(index.row()).strScore;
74 | }
75 | else if (role == m_dPtr->Role_TopNo) {
76 | return m_dPtr->m_datas.at(index.row()).strTopNo;
77 | }
78 |
79 | return QVariant();
80 |
81 | }
82 |
83 | QHash CModelOnlineMusicSearched::roleNames() const
84 | {
85 | return m_dPtr->m_roleNames;
86 | }
87 |
88 | void CModelOnlineMusicSearched::slotForOnlineMusicSearched(const QVector &data)
89 | {
90 | beginResetModel();
91 | m_dPtr->m_datas = data;
92 | endResetModel();
93 |
94 | //qDebug()<<"slot For OnlineMusic Searched data size is : "<< data.size() ;
95 | }
96 | }
97 |
98 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicSearched.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICSEARCHED_H
2 | #define CMODELONLINEMUSICSEARCHED_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class CModelOnlineMusicSearchedPrivate;
10 | class CModelOnlineMusicSearched : public QAbstractListModel
11 | {
12 | Q_OBJECT
13 | public:
14 | CModelOnlineMusicSearched(QObject *parent = 0);
15 | ~CModelOnlineMusicSearched();
16 |
17 | int rowCount(const QModelIndex& parent) const;
18 |
19 | QVariant data(const QModelIndex& index, int role) const;
20 |
21 | QHash roleNames() const;
22 |
23 | private:
24 | CModelOnlineMusicSearchedPrivate* m_dPtr;
25 | signals:
26 |
27 | public slots:
28 | void slotForOnlineMusicSearched(const QVector& data);
29 |
30 | };
31 | }
32 |
33 |
34 | #endif // CMODELONLINEMUSICSEARCHED_H
35 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicSence.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicSence.h"
2 |
3 | namespace QTDUDU {
4 |
5 | class CModelOnlineMusicSencePrivate
6 | {
7 | public:
8 | CModelOnlineMusicSencePrivate(CModelOnlineMusicSence* model):
9 | m_model(model)
10 | {
11 | m_roleNames.insert(Role_Type, "type");
12 | m_roleNames.insert(Role_Url, "picUrl");
13 | }
14 |
15 | enum {
16 | Role_Type = Qt::UserRole + 1,
17 | Role_Url,
18 | };
19 |
20 | CModelOnlineMusicSence* m_model;
21 | QHash m_roleNames;
22 | QVector m_datas;
23 | };
24 |
25 |
26 | CModelOnlineMusicSence::CModelOnlineMusicSence(QObject *parent) :
27 | QAbstractListModel(parent),
28 | m_dPtr(new CModelOnlineMusicSencePrivate(this))
29 | {
30 | qRegisterMetaType>("QVector");
31 |
32 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicSenceData(QVector)),
33 | this, SLOT(slotForOnlineMusicSence(QVector)));
34 | }
35 |
36 | CModelOnlineMusicSence::~CModelOnlineMusicSence()
37 | {
38 | if (NULL != m_dPtr) {
39 | delete m_dPtr;
40 | m_dPtr = NULL;
41 | }
42 | }
43 |
44 | int CModelOnlineMusicSence::rowCount(const QModelIndex &parent) const
45 | {
46 | Q_UNUSED(parent)
47 | return m_dPtr->m_datas.size();
48 | }
49 |
50 | QVariant CModelOnlineMusicSence::data(const QModelIndex &index, int role) const
51 | {
52 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
53 | {
54 | return QVariant();
55 | }
56 |
57 | if (role == m_dPtr->Role_Type) {
58 | return m_dPtr->m_datas.at(index.row()).strType;
59 | }
60 | else if (role == m_dPtr->Role_Url) {
61 | return m_dPtr->m_datas.at(index.row()).strPicUrl;
62 | }
63 |
64 | return QVariant();
65 |
66 | }
67 |
68 | QHash CModelOnlineMusicSence::roleNames() const
69 | {
70 | return m_dPtr->m_roleNames;
71 | }
72 |
73 | void CModelOnlineMusicSence::slotForOnlineMusicSence(const QVector &data)
74 | {
75 | beginResetModel();
76 | m_dPtr->m_datas = data;
77 | endResetModel();
78 |
79 | //qDebug()<<"slot For OnlineMusic Sence data size is : "<< data.size() ;
80 | }
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicSence.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICSENCE_H
2 | #define CMODELONLINEMUSICSENCE_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class CModelOnlineMusicSencePrivate;
10 | class CModelOnlineMusicSence : public QAbstractListModel
11 | {
12 | Q_OBJECT
13 | public:
14 | CModelOnlineMusicSence(QObject *parent = 0);
15 | ~CModelOnlineMusicSence();
16 |
17 | int rowCount(const QModelIndex& parent) const;
18 |
19 | QVariant data(const QModelIndex& index, int role) const;
20 |
21 | QHash roleNames() const;
22 |
23 | private:
24 | CModelOnlineMusicSencePrivate* m_dPtr;
25 | signals:
26 |
27 | public slots:
28 | void slotForOnlineMusicSence(const QVector& data);
29 |
30 | };
31 | }
32 |
33 |
34 | #endif // CMODELONLINEMUSICSENCE_H
35 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicStyle.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicStyle.h"
2 |
3 | namespace QTDUDU {
4 |
5 | class CModelOnlineMusicStylePrivate
6 | {
7 | public:
8 | CModelOnlineMusicStylePrivate(CModelOnlineMusicStyle* model):
9 | m_model(model)
10 | {
11 | m_roleNames.insert(Role_Type, "type");
12 | m_roleNames.insert(Role_Url, "picUrl");
13 | }
14 |
15 | enum {
16 | Role_Type = Qt::UserRole + 1,
17 | Role_Url,
18 | };
19 |
20 | CModelOnlineMusicStyle* m_model;
21 | QHash m_roleNames;
22 | QVector m_datas;
23 | };
24 |
25 |
26 | CModelOnlineMusicStyle::CModelOnlineMusicStyle(QObject *parent) :
27 | QAbstractListModel(parent),
28 | m_dPtr(new CModelOnlineMusicStylePrivate(this))
29 | {
30 | qRegisterMetaType>("QVector");
31 |
32 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicStyleData(QVector)),
33 | this, SLOT(slotForOnlineMusicStyle(QVector)));
34 | }
35 |
36 | CModelOnlineMusicStyle::~CModelOnlineMusicStyle()
37 | {
38 | if (NULL != m_dPtr) {
39 | delete m_dPtr;
40 | m_dPtr = NULL;
41 | }
42 | }
43 |
44 | int CModelOnlineMusicStyle::rowCount(const QModelIndex &parent) const
45 | {
46 | Q_UNUSED(parent)
47 | return m_dPtr->m_datas.size();
48 | }
49 |
50 | QVariant CModelOnlineMusicStyle::data(const QModelIndex &index, int role) const
51 | {
52 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
53 | {
54 | return QVariant();
55 | }
56 |
57 | if (role == m_dPtr->Role_Type) {
58 | return m_dPtr->m_datas.at(index.row()).strType;
59 | }
60 | else if (role == m_dPtr->Role_Url) {
61 | return m_dPtr->m_datas.at(index.row()).strPicUrl;
62 | }
63 |
64 | return QVariant();
65 |
66 | }
67 |
68 | QHash CModelOnlineMusicStyle::roleNames() const
69 | {
70 | return m_dPtr->m_roleNames;
71 | }
72 |
73 | void CModelOnlineMusicStyle::slotForOnlineMusicStyle(const QVector &data)
74 | {
75 | beginResetModel();
76 | m_dPtr->m_datas = data;
77 | endResetModel();
78 |
79 | // qDebug()<<"slot For OnlineMusic Style data size is : "<< data.size() ;
80 | }
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicStyle.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICSTYLE_H
2 | #define CMODELONLINEMUSICSTYLE_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class CModelOnlineMusicStylePrivate;
10 | class CModelOnlineMusicStyle : public QAbstractListModel
11 | {
12 | Q_OBJECT
13 | public:
14 | CModelOnlineMusicStyle(QObject *parent = 0);
15 | ~CModelOnlineMusicStyle();
16 |
17 | int rowCount(const QModelIndex& parent) const;
18 |
19 | QVariant data(const QModelIndex& index, int role) const;
20 |
21 | QHash roleNames() const;
22 |
23 | private:
24 | CModelOnlineMusicStylePrivate* m_dPtr;
25 | signals:
26 |
27 | public slots:
28 | void slotForOnlineMusicStyle(const QVector& data);
29 |
30 | };
31 | }
32 |
33 |
34 | #endif // CMODELONLINEMUSICSTYLE_H
35 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicTopName.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicTopName.h"
2 |
3 | namespace QTDUDU {
4 |
5 | class CModelOnlineMusicTopNamePrivate
6 | {
7 | public:
8 | CModelOnlineMusicTopNamePrivate(CModelOnlineMusicTopName* model):
9 | m_model(model)
10 | {
11 | m_roleNames.insert(Role_SongName, "songname");
12 | m_roleNames.insert(Role_SingerName, "singername");
13 | m_roleNames.insert(Role_SingerPicUrl, "singerpicurl");
14 | m_roleNames.insert(Role_Score, "score");
15 | m_roleNames.insert(Role_TopNo, "topno");
16 | m_roleNames.insert(Role_ExtraUrl, "extralUrl");
17 | m_roleNames.insert(Role_CacheID, "cacheId");
18 | m_roleNames.insert(Role_LyricUrl, "lyriUrl");
19 | m_roleNames.insert(Role_PlayUrl, "playUrl");
20 | m_roleNames.insert(Role_ExtraUrl, "extralUrl");
21 | m_roleNames.insert(Role_SongId, "songId");
22 | m_roleNames.insert(Role_SingerId, "singerId");
23 |
24 |
25 | }
26 |
27 | enum {
28 | Role_SongName = Qt::UserRole + 1,
29 | Role_SingerName,
30 | Role_SingerPicUrl,
31 | Role_Score,
32 | Role_TopNo,
33 | Role_ExtraUrl,
34 | Role_CacheID,
35 | Role_LyricUrl,
36 | Role_PlayUrl,
37 | Role_SongId,
38 | Role_SingerId
39 | };
40 |
41 | CModelOnlineMusicTopName* m_model;
42 | QHash m_roleNames;
43 | QVector m_datas;
44 | };
45 |
46 | CModelOnlineMusicTopName::CModelOnlineMusicTopName(QObject *parent) :
47 | QAbstractListModel(parent),
48 | m_dPtr(new CModelOnlineMusicTopNamePrivate(this))
49 | {
50 | qRegisterMetaType>("QVector");
51 |
52 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicTopnameMusicData(QVector)),
53 | this, SLOT(slotForOnlineMusicTopName(QVector)));
54 | }
55 |
56 | CModelOnlineMusicTopName::~CModelOnlineMusicTopName()
57 | {
58 | if (NULL != m_dPtr) {
59 | delete m_dPtr;
60 | m_dPtr = NULL;
61 | }
62 | }
63 |
64 | int CModelOnlineMusicTopName::rowCount(const QModelIndex &parent) const
65 | {
66 | Q_UNUSED(parent)
67 | return m_dPtr->m_datas.size();
68 | }
69 |
70 | QVariant CModelOnlineMusicTopName::data(const QModelIndex &index, int role) const
71 | {
72 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
73 | {
74 | return QVariant();
75 | }
76 |
77 | if (role == m_dPtr->Role_SongName) {
78 | return m_dPtr->m_datas.at(index.row()).strSongName;
79 | }
80 | else if (role == m_dPtr->Role_SingerName) {
81 | return m_dPtr->m_datas.at(index.row()).strSingerName;
82 | }
83 | else if (role == m_dPtr->Role_SingerPicUrl) {
84 | return m_dPtr->m_datas.at(index.row()).strSingerPicUrl;
85 | }
86 | else if (role == m_dPtr->Role_Score) {
87 | return m_dPtr->m_datas.at(index.row()).strScore;
88 | }
89 | else if (role == m_dPtr->Role_TopNo) {
90 | return m_dPtr->m_datas.at(index.row()).strTopNo;
91 | }
92 | else if (role == m_dPtr->Role_ExtraUrl) {
93 | return m_dPtr->m_datas.at(index.row()).strExtraUrl;
94 | }
95 | else if (role == m_dPtr->Role_CacheID) {
96 | return m_dPtr->m_datas.at(index.row()).strCacheID;
97 | }
98 | else if (role == m_dPtr->Role_LyricUrl) {
99 | return m_dPtr->m_datas.at(index.row()).strLyricUrl;
100 | }
101 | else if (role == m_dPtr->Role_PlayUrl) {
102 | return m_dPtr->m_datas.at(index.row()).strPlayUrl;
103 | }
104 | else if (role == m_dPtr->Role_SongId) {
105 | return m_dPtr->m_datas.at(index.row()).strSongID;
106 | }
107 | else if (role == m_dPtr->Role_SingerId) {
108 | return m_dPtr->m_datas.at(index.row()).strSingerID;
109 | }
110 |
111 | return QVariant();
112 |
113 | }
114 |
115 | QHash CModelOnlineMusicTopName::roleNames() const
116 | {
117 | return m_dPtr->m_roleNames;
118 | }
119 |
120 | void CModelOnlineMusicTopName::slotForOnlineMusicTopName(const QVector &data)
121 | {
122 | beginResetModel();
123 | m_dPtr->m_datas = data;
124 | endResetModel();
125 |
126 | // qDebug()<<"slot For OnlineMusic TopName data size is : "<< data.size() ;
127 | }
128 | }
129 |
130 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicTopName.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICTOPNAME_H
2 | #define CMODELONLINEMUSICTOPNAME_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class CModelOnlineMusicTopNamePrivate;
10 | class CModelOnlineMusicTopName : public QAbstractListModel
11 | {
12 | Q_OBJECT
13 | public:
14 | CModelOnlineMusicTopName(QObject *parent = 0);
15 | ~CModelOnlineMusicTopName();
16 |
17 | int rowCount(const QModelIndex& parent) const;
18 |
19 | QVariant data(const QModelIndex& index, int role) const;
20 |
21 | QHash roleNames() const;
22 |
23 | private:
24 | CModelOnlineMusicTopNamePrivate* m_dPtr;
25 | signals:
26 |
27 | public slots:
28 | void slotForOnlineMusicTopName(const QVector& data);
29 |
30 | };
31 | }
32 |
33 |
34 | #endif // CMODELONLINEMUSICTOPNAME_H
35 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicType.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicType.h"
2 |
3 | namespace QTDUDU {
4 |
5 |
6 | class CModelOnlineMusicTypePrivate
7 | {
8 | public:
9 | CModelOnlineMusicTypePrivate(CModelOnlineMusicType* model):
10 | m_model(model)
11 | {
12 | m_roleNames.insert(Role_Type, "type");
13 | m_roleNames.insert(Role_Name, "name");
14 | m_roleNames.insert(Role_Url, "url");
15 | }
16 |
17 | enum {
18 | Role_Type = Qt::UserRole + 1,
19 | Role_Name,
20 | Role_Url,
21 | };
22 |
23 | CModelOnlineMusicType* m_model;
24 | QHash m_roleNames;
25 | QVector m_datas;
26 | };
27 |
28 | CModelOnlineMusicType::CModelOnlineMusicType(QObject *parent) :
29 | QAbstractListModel(parent),
30 | m_dPtr(new CModelOnlineMusicTypePrivate(this))
31 | {
32 | qRegisterMetaType>("QVector");
33 |
34 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicTopTypeData(QVector)),
35 | this, SLOT(slotForOnlineMusicType(QVector)));
36 | }
37 |
38 | CModelOnlineMusicType::~CModelOnlineMusicType()
39 | {
40 | if (NULL != m_dPtr) {
41 | delete m_dPtr;
42 | m_dPtr = NULL;
43 | }
44 | }
45 |
46 | int CModelOnlineMusicType::rowCount(const QModelIndex &parent) const
47 | {
48 | Q_UNUSED(parent)
49 | return m_dPtr->m_datas.size();
50 | }
51 |
52 | QVariant CModelOnlineMusicType::data(const QModelIndex &index, int role) const
53 | {
54 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
55 | {
56 | return QVariant();
57 | }
58 |
59 | if (role == m_dPtr->Role_Type) {
60 | return m_dPtr->m_datas.at(index.row()).strType;
61 | }
62 | else if (role == m_dPtr->Role_Name) {
63 | return m_dPtr->m_datas.at(index.row()).strName;
64 | }
65 | else if (role == m_dPtr->Role_Url) {
66 | return m_dPtr->m_datas.at(index.row()).strPicUrl;
67 | }
68 |
69 | return QVariant();
70 | }
71 |
72 | QHash CModelOnlineMusicType::roleNames() const
73 | {
74 | return m_dPtr->m_roleNames;
75 | }
76 |
77 | void CModelOnlineMusicType::slotForOnlineMusicType(const QVector &data)
78 | {
79 | //qDebug()<<"in slotForOnlineMusicType";
80 | beginResetModel();
81 | m_dPtr->m_datas = data;
82 | endResetModel();
83 | //qDebug()<<"slot For OnlineMusic Type data size is : "<< data.size() ;
84 | }
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicType.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICTYPE_H
2 | #define CMODELONLINEMUSICTYPE_H
3 | #include
4 | #include "../../framework/dudu.h"
5 |
6 | namespace QTDUDU {
7 | class CModelOnlineMusicTypePrivate;
8 | class CModelOnlineMusicType : public QAbstractListModel
9 | {
10 | Q_OBJECT
11 | public:
12 | CModelOnlineMusicType(QObject *parent = 0);
13 | ~CModelOnlineMusicType();
14 |
15 | int rowCount(const QModelIndex& parent) const;
16 |
17 | QVariant data(const QModelIndex& index, int role) const;
18 |
19 | QHash roleNames() const;
20 |
21 | private:
22 | CModelOnlineMusicTypePrivate* m_dPtr;
23 | signals:
24 |
25 | public slots:
26 | void slotForOnlineMusicType(const QVector& data);
27 |
28 | };
29 |
30 | }
31 |
32 |
33 | #endif // CMODELONLINEMUSICTYPE_H
34 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicYears.cpp:
--------------------------------------------------------------------------------
1 | #include "CModelOnlineMusicYears.h"
2 |
3 | namespace QTDUDU {
4 |
5 | class CModelOnlineMusicYearsPrivate
6 | {
7 | public:
8 | CModelOnlineMusicYearsPrivate(CModelOnlineMusicYears* model):
9 | m_model(model)
10 | {
11 | m_roleNames.insert(Role_Type, "type");
12 | m_roleNames.insert(Role_Url, "picUrl");
13 | }
14 |
15 | enum {
16 | Role_Type = Qt::UserRole + 1,
17 | Role_Url,
18 | };
19 |
20 | CModelOnlineMusicYears* m_model;
21 | QHash m_roleNames;
22 | QVector m_datas;
23 | };
24 |
25 |
26 | CModelOnlineMusicYears::CModelOnlineMusicYears(QObject *parent) :
27 | QAbstractListModel(parent),
28 | m_dPtr(new CModelOnlineMusicYearsPrivate(this))
29 | {
30 | qRegisterMetaType>("QVector");
31 |
32 | connect(CAppOnlineMusic::getInstance(), SIGNAL(sigForUpdateOnlineMusicYearsData(QVector)),
33 | this, SLOT(slotForOnlineMusicYears(QVector)));
34 | }
35 |
36 | CModelOnlineMusicYears::~CModelOnlineMusicYears()
37 | {
38 | if (NULL != m_dPtr) {
39 | delete m_dPtr;
40 | m_dPtr = NULL;
41 | }
42 | }
43 |
44 | int CModelOnlineMusicYears::rowCount(const QModelIndex &parent) const
45 | {
46 | Q_UNUSED(parent)
47 | return m_dPtr->m_datas.size();
48 | }
49 |
50 | QVariant CModelOnlineMusicYears::data(const QModelIndex &index, int role) const
51 | {
52 | if (index.row() < 0 || index.row() >= m_dPtr->m_datas.count())
53 | {
54 | return QVariant();
55 | }
56 |
57 | if (role == m_dPtr->Role_Type) {
58 | return m_dPtr->m_datas.at(index.row()).strType;
59 | }
60 | else if (role == m_dPtr->Role_Url) {
61 | return m_dPtr->m_datas.at(index.row()).strPicUrl;
62 | }
63 |
64 | return QVariant();
65 |
66 | }
67 |
68 | QHash CModelOnlineMusicYears::roleNames() const
69 | {
70 | return m_dPtr->m_roleNames;
71 | }
72 |
73 | void CModelOnlineMusicYears::slotForOnlineMusicYears(const QVector &data)
74 | {
75 | beginResetModel();
76 | m_dPtr->m_datas = data;
77 | endResetModel();
78 |
79 | //qDebug()<<"slot For OnlineMusic Years data size is : "<< data.size() ;
80 | }
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/CModelOnlineMusicYears.h:
--------------------------------------------------------------------------------
1 | #ifndef CMODELONLINEMUSICYEARS_H
2 | #define CMODELONLINEMUSICYEARS_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class CModelOnlineMusicYearsPrivate;
10 | class CModelOnlineMusicYears : public QAbstractListModel
11 | {
12 | Q_OBJECT
13 | public:
14 | CModelOnlineMusicYears(QObject *parent = 0);
15 | ~CModelOnlineMusicYears();
16 |
17 | int rowCount(const QModelIndex& parent) const;
18 |
19 | QVariant data(const QModelIndex& index, int role) const;
20 |
21 | QHash roleNames() const;
22 |
23 | private:
24 | CModelOnlineMusicYearsPrivate* m_dPtr;
25 | signals:
26 |
27 | public slots:
28 | void slotForOnlineMusicYears(const QVector& data);
29 |
30 | };
31 | }
32 |
33 |
34 | #endif // CMODELONLINEMUSICYEARS_H
35 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/onlinemusic/cnetworkmanager.h:
--------------------------------------------------------------------------------
1 | #ifndef CNETWORKMANAGER_H
2 | #define CNETWORKMANAGER_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 | #include
7 | #include
8 | #include
9 | namespace QTDUDU {
10 | class CNetworkManager : public QObject
11 | {
12 | Q_OBJECT
13 | protected:
14 | explicit CNetworkManager(QObject *parent = 0);
15 | public:
16 | static CNetworkManager* getInstance();
17 |
18 | void getData(UINT type);
19 | void addParam(QString key, QString val);
20 | void setOpenId(QString openid) {m_strOpenId = openid;}
21 | void setOpenKey(QString openkey) {m_strOpenKey = openkey;}
22 | void setPrefix(QString prefix) {m_strPrefix = prefix;}
23 | private:
24 | static CNetworkManager* m_pInstance;
25 |
26 | void createSign(bool special=false);
27 | QString sortHash(bool specail=false);
28 | QString createOnlineMusicUrlString(UINT apitype);
29 | QNetworkRequest createRequest(UINT apiType);
30 | void accessNewWork(UINT apitype);
31 | private:
32 | // request参数值
33 | // http://autoapi.openspeech.cn/api/v2/music/songs/?words=刘德华&openid=123456&
34 | // clientType =4&sId=1001&sign=08a376375b1a5d84ce7ff0360a06095232ccbf82
35 | QString m_strOpenId; // 厂商唯一标识,用于标识厂商,后续增加定制需求所用
36 | QString m_strOpenKey;
37 | QString m_strSign; // 请求签名,对除sign外所有参数进行签名
38 | QString m_strPrefix;
39 | QHash m_paramMap;
40 | QHash m_specialMap;
41 | QNetworkAccessManager *m_networkAccess;
42 | UINT m_currentRequest;
43 | UINT m_nameIndex;
44 | UINT m_IDIndex;
45 | bool m_isRequest;
46 | bool m_hasSort;
47 | QVector m_waitList;
48 | QTimer m_tm;
49 |
50 | signals:
51 | void dataReady(UINT type,QString data);
52 | void downloadError();
53 | void requestOccur();
54 | public slots:
55 | void downloadFinished(QNetworkReply *reply);
56 | void previousFinished();
57 | //void slotForUSBDeviceChanged(const DeviceStateChange& state);
58 | //void slotForCarLifeDeviceChanged(QString id, QString type, QString status);
59 | void handleTimeOut();
60 | };
61 | }
62 |
63 |
64 | #endif // CNETWORKMANAGER_H
65 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/video/dudumediaplayer.cpp:
--------------------------------------------------------------------------------
1 | #include "dudumediaplayer.h"
2 | namespace QTDUDU {
3 |
4 | DuDuMediaPlayer* DuDuMediaPlayer::m_pInstance = nullptr;
5 |
6 | void DuDuMediaPlayer::play()
7 | {
8 | qDebug()<<"play :..";
9 | QMediaPlayer ::setMedia(QUrl::fromLocalFile(QStringLiteral("D:/KuGou/MV/mv.mp4")));
10 | QMediaPlayer ::play();
11 |
12 | }
13 |
14 | void DuDuMediaPlayer::pause()
15 | {
16 | qDebug()<<"pause";
17 | QMediaPlayer ::pause();
18 | }
19 |
20 | void DuDuMediaPlayer::setPosition(int position)
21 | {
22 | QMediaPlayer::setPosition(position);
23 | }
24 |
25 | DuDuMediaPlayer::DuDuMediaPlayer(QObject *parent, Flags flags) : QMediaPlayer(parent, flags)
26 | {
27 | //connect(this, SIGNAL(videoAvailableChanged(bool)), this, SLOT(VideoAvailableChanged(bool)));
28 | connect(this, SIGNAL(metaDataAvailableChanged(bool)), this, SLOT(slotMetaDataAvailableChanged(bool)));
29 | connect(this, SIGNAL(positionChanged(qint64)), this, SLOT(slotForPositionChanged(qint64)));
30 | connect(this, SIGNAL(durationChanged(qint64)), this, SLOT(slotForDurationChanged(qint64)));
31 | connect(this, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(slotForState(QMediaPlayer::State)));
32 | }
33 |
34 | DuDuMediaPlayer *DuDuMediaPlayer::getInstance()
35 | {
36 | if(m_pInstance == nullptr)
37 | {
38 | m_pInstance = new DuDuMediaPlayer(0, 0);
39 | }
40 | return m_pInstance;
41 | }
42 |
43 | DuDuMediaPlayer::DuDuMediaPlayer()
44 | {
45 |
46 | }
47 |
48 | DuDuMediaPlayer::~DuDuMediaPlayer()
49 | {
50 |
51 | }
52 |
53 | void DuDuMediaPlayer::VideoAvailableChanged(bool bavaliable)
54 | {
55 | qDebug()<<"bavaliable :"<setCurrentIndex(++count);
91 | }
92 | */
93 | }
94 |
95 | void DuDuMediaPlayer::slotForState(QMediaPlayer::State state)
96 | {
97 | emit sigState(static_cast(state));
98 | }
99 | }
100 |
101 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/video/dudumediaplayer.h:
--------------------------------------------------------------------------------
1 | #ifndef DUDUMEDIAPLAYER_H
2 | #define DUDUMEDIAPLAYER_H
3 |
4 | #include
5 | #include "../../framework/dudu.h"
6 |
7 | namespace QTDUDU {
8 |
9 | class DuDuMediaPlayer : public QMediaPlayer
10 | {
11 | Q_OBJECT
12 | public:
13 | Q_PROPERTY(QAbstractVideoSurface* videoSurface READ getVideoSurface WRITE setVideoSurface )
14 | Q_INVOKABLE void play();
15 | Q_INVOKABLE void pause();
16 | Q_INVOKABLE void setPosition(int position);
17 | public:
18 | explicit DuDuMediaPlayer(QObject *parent = 0, Flags flags = 0);
19 | static DuDuMediaPlayer *getInstance();
20 |
21 | private:
22 | DuDuMediaPlayer();
23 | ~DuDuMediaPlayer();
24 | private:
25 | QAbstractVideoSurface* m_surface;
26 | static DuDuMediaPlayer* m_pInstance;
27 | void VideoAvailableChanged(bool bavaliable);
28 | signals:
29 | void sigPositionChanged(int position);
30 | void sigDurationChanged(int duration);
31 | void sigState(int state);
32 | public slots:
33 | void setVideoSurface(QAbstractVideoSurface* surface);
34 | QAbstractVideoSurface* getVideoSurface();
35 | void slotForPositionChanged(qint64 position);
36 | void slotForDurationChanged(qint64 duration);
37 | void slotMetaDataAvailableChanged(bool available);
38 | void slotForState(QMediaPlayer::State state);
39 |
40 |
41 | };
42 |
43 | }
44 |
45 |
46 | #endif // DUDUMEDIAPLAYER_H
47 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/app/video/新建文本文档.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AiLoverer/DuDuPlayer/d997e05d3134057757d4c6d094ae4b65fde17fdf/DuDuPlayer/code/app/video/新建文本文档.txt
--------------------------------------------------------------------------------
/DuDuPlayer/code/clogic.cpp:
--------------------------------------------------------------------------------
1 | #include "clogic.h"
2 |
3 | CLogic::CLogic(QObject *parent) : QObject(parent)
4 | {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/clogic.h:
--------------------------------------------------------------------------------
1 | #ifndef CLOGIC_H
2 | #define CLOGIC_H
3 |
4 | #include
5 |
6 | class CLogic : public QObject
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit CLogic(QObject *parent = 0);
11 |
12 | signals:
13 |
14 | public slots:
15 | };
16 |
17 | #endif // CLOGIC_H
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/TypeDefine.h:
--------------------------------------------------------------------------------
1 | #ifndef __OPENHMI_TYPEDEFINE_H_INCLUDED__
2 | #define __OPENHMI_TYPEDEFINE_H_INCLUDED__
3 | #include
4 | namespace QTDUDU
5 | {
6 | typedef wchar_t CHAR;
7 |
8 | typedef char INT8;
9 | typedef unsigned char BYTE;
10 | typedef short SHORT;
11 | typedef unsigned short USHORT;
12 | typedef int INT;
13 | typedef unsigned int UINT;
14 | typedef long LONG;
15 | typedef unsigned long ULONG;
16 | typedef long long LLONG;
17 |
18 | typedef float FLOAT;
19 | typedef double DOUBLE;
20 | typedef bool BOOLEAN;
21 |
22 | typedef QString String;
23 |
24 | /////////////////////////////////////////////
25 | typedef CHAR* PCHAR;
26 |
27 | typedef INT8* PINT8;
28 | typedef BYTE* PBYTE;
29 | typedef SHORT* PSHORT;
30 | typedef USHORT* PUSHORT;
31 | typedef INT* PINT;
32 | typedef UINT* PUINT;
33 | typedef LONG* PLONG;
34 | typedef ULONG* PULONG;
35 | typedef LLONG* PLLONG;
36 |
37 | typedef FLOAT* PFLOAT;
38 | typedef DOUBLE* PDOULBE;
39 | typedef BOOLEAN* PBOOLEAN;
40 |
41 | /////////////////////////////////////////////
42 |
43 | /////////////////////////////////////////////
44 | #define TRUE true
45 | #define FALSE false
46 | #ifndef NULL
47 | #define NULL 0
48 | #endif
49 | #define STRING_NULL QString()
50 | /////////////////////////////////////////////
51 |
52 | #define INVALID_THREAD_ID 0
53 |
54 | /////////////////////////////////////////////
55 | #ifdef OS_QNX
56 | typedef INT SOCKET;
57 | #define INVALID_SOCKET 0
58 | #endif
59 |
60 | #ifdef OS_LINUX
61 | typedef INT SOCKET;
62 | #define INVALID_SOCKET 0
63 | #endif
64 |
65 | }
66 |
67 | #endif
68 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/dudu.h:
--------------------------------------------------------------------------------
1 | #ifndef DUDU_H
2 | #define DUDU_H
3 | #pragma once
4 | // qt class
5 | #include "./qtdudu.h"
6 |
7 | // common class
8 | #include "./TypeDefine.h"
9 | #include "./JsonLite.h"
10 | #include "../logic/clogic.h"
11 | #include "./commondata.h"
12 | #include "./CAppDataBase.h"
13 |
14 |
15 | // network class
16 | #include "../app/onlinemusic/cnetworkonlineserver.h"
17 | #include "../app/onlinemusic/cnetworkmanager.h"
18 |
19 | // system class
20 | #ifdef OS_WIN
21 | #include
22 | #endif
23 |
24 | // app class
25 | #include "../playlist/TreeModel.h"
26 | #include "../playlist/TreeItem.h"
27 |
28 | #include "../app/localmusic/localmusic.h"
29 | #include "../app/localmusic/localmusicmodel.h"
30 |
31 | // onlinemusic class
32 | #include "../app/onlinemusic/JConNetRspData.h"
33 | #include "../app/onlinemusic/CAppOnlineMusic.h"
34 | #include "../app/onlinemusic/CModelOnlineMusicCollect.h"
35 | #include "../app/onlinemusic/CModelOnlineMusicEmotion.h"
36 | #include "../app/onlinemusic/CModelOnlineMusicHistory.h"
37 | #include "../app/onlinemusic/CModelOnlineMusicLanguage.h"
38 | #include "../app/onlinemusic/CModelOnlineMusicSearched.h"
39 | #include "../app/onlinemusic/CModelOnlineMusicSence.h"
40 | #include "../app/onlinemusic/CModelOnlineMusicStyle.h"
41 | #include "../app/onlinemusic/CModelOnlineMusicTopName.h"
42 | #include "../app/onlinemusic/CModelOnlineMusicType.h"
43 | #include "../app/onlinemusic/CModelOnlineMusicYears.h"
44 |
45 | // video class
46 | #include "../app/video/dudumediaplayer.h"
47 | #endif // DUDU_H
48 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/CJSONUtils.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "./json/json.h"
4 | #include "./json/config.h"
5 | #include "./json/assertions.h"
6 | #include "./json/autolink.h"
7 | #include "./json/features.h"
8 | #include "./json/forwards.h"
9 | #include "./json/reader.h"
10 | #include "./json/value.h"
11 | #include "./json/version.h"
12 | #include "./json/writer.h"
13 | #include
14 | #include
15 | #include "../dudu.h"
16 |
17 | namespace QTDUDU
18 | {
19 | class JSON_API CJSONUtils
20 | {
21 | public:
22 | static void encode (const Json::Value &json, QString &strJson);
23 | static BOOLEAN decode (const QString &strJson, Json::Value &json);
24 |
25 | static QString getStrValue (const char *pcKey, const Json::Value &json);
26 | static void getStrAryValue (const char *pcKey, const Json::Value &json, QVector& aryOutStrs);
27 | static BOOLEAN getBoolValue (const char *pcKey, const Json::Value &json);
28 | static INT getIntValue (const char *pcKey, const Json::Value &json);
29 | static UINT getUIntValue (const char *pcKey, const Json::Value &json);
30 | static DOUBLE getDoubleValue (const char *pcKey, const Json::Value &json);
31 | static Json::Value getJsonValue (const char *pcKey, const Json::Value &json);
32 | static void getJsonAryValue (const char *pcKey, const Json::Value &json, QVector& aryOutJsons);
33 |
34 | static QString getStrValue (const QString &strKey, const Json::Value &json);
35 | static void getStrAryValue (const QString &strKey, const Json::Value &json, QVector& aryOutStrs);
36 | static BOOLEAN getBoolValue (const QString &strKey, const Json::Value &json);
37 | static INT getIntValue (const QString &strKey, const Json::Value &json);
38 | static UINT getUIntValue (const QString &strKey, const Json::Value &json);
39 | static DOUBLE getDoubleValue (const QString &strKey, const Json::Value &json);
40 | static Json::Value getJsonValue (const QString &strKey, const Json::Value &json);
41 | static void getJsonAryValue (const QString &strKey, const Json::Value &json, QVector& aryOutJsons);
42 |
43 | static void setStrValue (Json::Value &json, const char *pcKey, const QString &strValue);
44 | static void setBoolValue (Json::Value &json, const char *pcKey, BOOLEAN bValue);
45 | static void setIntValue (Json::Value &json, const char *pcKey, INT iValue);
46 | static void setIntAryValue (Json::Value &json, const char *pcKey, QVector &aryInt);
47 | static void setUIntValue (Json::Value &json, const char *pcKey, UINT uiValue);
48 | static void setUintAryValue (Json::Value &json, const char *pcKey, QVector &aryUint);
49 | static void setDoubleValue (Json::Value &json, const char *pcKey, DOUBLE dValue);
50 | static void setStrAryValue (Json::Value &json, const char *pcKey, QVector &aryStr);
51 | static void setJsonValue (Json::Value &json, const char *pcKey, Json::Value &jsonValue);
52 | static void setJsonAryValue (Json::Value &json, const char *pcKey, QVector &aryJson);
53 |
54 | static void setStrValue (Json::Value &json, const QString &strKey, const QString &strValue);
55 | static void setBoolValue (Json::Value &json, const QString &strKey, BOOLEAN bValue);
56 | static void setIntValue (Json::Value &json, const QString &strKey, INT iValue);
57 | static void setIntAryValue (Json::Value &json, const QString &strKey, QVector &aryInt);
58 | static void setUIntValue (Json::Value &json, const QString &strKey, UINT uiValue);
59 | static void setUintAryValue (Json::Value &json, const QString &strKey, QVector &aryUint);
60 | static void setDoubleValue (Json::Value &json, const QString &strKey, DOUBLE dValue);
61 | static void setStrAryValue (Json::Value &json, const QString &strKey, QVector &aryStr);
62 | static void setJsonValue (Json::Value &json, const QString &strKey, Json::Value &jsonValue);
63 | static void setJsonAryValue (Json::Value &json, const QString &strKey, QVector &aryJson);
64 |
65 | static BOOLEAN hasProperty (const char *pcKey, const Json::Value &json);
66 | static BOOLEAN hasProperty (const QString &strKey, const Json::Value &json);
67 |
68 | static QString toString (const Json::Value &json);
69 | static char* QStringToCharPointer(const QString& str);
70 | };
71 | }
72 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/json/assertions.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007-2010 Baptiste Lepilleur
2 | // Distributed under MIT license, or public domain if desired and
3 | // recognized in your jurisdiction.
4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5 |
6 | #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
7 | #define CPPTL_JSON_ASSERTIONS_H_INCLUDED
8 |
9 | #include
10 |
11 | #if !defined(JSON_IS_AMALGAMATION)
12 | #include "../json/config.h"
13 | #endif // if !defined(JSON_IS_AMALGAMATION)
14 |
15 | #if JSON_USE_EXCEPTION
16 | #include
17 | #define JSON_ASSERT(condition) \
18 | assert(condition); // @todo <= change this into an exception throw
19 | #define JSON_FAIL_MESSAGE(message) throw std::runtime_error(message);
20 | #else // JSON_USE_EXCEPTION
21 | #define JSON_ASSERT(condition) assert(condition);
22 |
23 | // The call to assert() will show the failure message in debug builds. In
24 | // release bugs we write to invalid memory in order to crash hard, so that a
25 | // debugger or crash reporter gets the chance to take over. We still call exit()
26 | // afterward in order to tell the compiler that this macro doesn't return.
27 | #define JSON_FAIL_MESSAGE(message) \
28 | { \
29 | assert(false &&message); \
30 | strcpy(reinterpret_cast(666), message); \
31 | exit(123); \
32 | }
33 |
34 | #endif
35 |
36 | #define JSON_ASSERT_MESSAGE(condition, message) \
37 | if (!(condition)) { \
38 | JSON_FAIL_MESSAGE(message) \
39 | }
40 |
41 | #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
42 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/json/autolink.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007-2010 Baptiste Lepilleur
2 | // Distributed under MIT license, or public domain if desired and
3 | // recognized in your jurisdiction.
4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5 |
6 | #ifndef JSON_AUTOLINK_H_INCLUDED
7 | #define JSON_AUTOLINK_H_INCLUDED
8 |
9 | #include "config.h"
10 |
11 | #ifdef JSON_IN_CPPTL
12 | #include
13 | #endif
14 |
15 | #if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \
16 | !defined(JSON_IN_CPPTL)
17 | #define CPPTL_AUTOLINK_NAME "json"
18 | #undef CPPTL_AUTOLINK_DLL
19 | #ifdef JSON_DLL
20 | #define CPPTL_AUTOLINK_DLL
21 | #endif
22 | #include "autolink.h"
23 | #endif
24 |
25 | #endif // JSON_AUTOLINK_H_INCLUDED
26 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/json/config.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007-2010 Baptiste Lepilleur
2 | // Distributed under MIT license, or public domain if desired and
3 | // recognized in your jurisdiction.
4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5 |
6 | #ifndef JSON_CONFIG_H_INCLUDED
7 | #define JSON_CONFIG_H_INCLUDED
8 |
9 | /// If defined, indicates that json library is embedded in CppTL library.
10 | //# define JSON_IN_CPPTL 1
11 |
12 | /// If defined, indicates that json may leverage CppTL library
13 | //# define JSON_USE_CPPTL 1
14 | /// If defined, indicates that cpptl vector based map should be used instead of
15 | /// std::map
16 | /// as Value container.
17 | //# define JSON_USE_CPPTL_SMALLMAP 1
18 | /// If defined, indicates that Json specific container should be used
19 | /// (hash table & simple deque container with customizable allocator).
20 | /// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332
21 | //# define JSON_VALUE_USE_INTERNAL_MAP 1
22 | /// Force usage of standard new/malloc based allocator instead of memory pool
23 | /// based allocator.
24 | /// The memory pools allocator used optimization (initializing Value and
25 | /// ValueInternalLink
26 | /// as if it was a POD) that may cause some validation tool to report errors.
27 | /// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined.
28 | //# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1
29 |
30 | // If non-zero, the library uses exceptions to report bad input instead of C
31 | // assertion macros. The default is to use exceptions.
32 | #ifndef JSON_USE_EXCEPTION
33 | #define JSON_USE_EXCEPTION 1
34 | #endif
35 |
36 | /// If defined, indicates that the source file is amalgated
37 | /// to prevent private header inclusion.
38 | /// Remarks: it is automatically defined in the generated amalgated header.
39 | // #define JSON_IS_AMALGAMATION
40 |
41 | #ifdef JSON_IN_CPPTL
42 | #include
43 | #ifndef JSON_USE_CPPTL
44 | #define JSON_USE_CPPTL 1
45 | #endif
46 | #endif
47 |
48 | #ifdef JSON_IN_CPPTL
49 | #define JSON_API CPPTL_API
50 | #elif defined(JSON_DLL_BUILD)
51 | #if defined(_MSC_VER)
52 | #define JSON_API __declspec(dllexport)
53 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
54 | #endif // if defined(_MSC_VER)
55 | #elif defined(JSON_DLL)
56 | #if defined(_MSC_VER)
57 | #define JSON_API __declspec(dllimport)
58 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
59 | #endif // if defined(_MSC_VER)
60 | #endif // ifdef JSON_IN_CPPTL
61 | #if !defined(JSON_API)
62 | #define JSON_API
63 | #endif
64 |
65 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
66 | // integer
67 | // Storages, and 64 bits integer support is disabled.
68 | // #define JSON_NO_INT64 1
69 |
70 | #if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
71 | // Microsoft Visual Studio 6 only support conversion from __int64 to double
72 | // (no conversion from unsigned __int64).
73 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1
74 | // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
75 | // characters in the debug information)
76 | // All projects I've ever seen with VS6 were using this globally (not bothering
77 | // with pragma push/pop).
78 | #pragma warning(disable : 4786)
79 | #endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
80 |
81 | #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
82 | /// Indicates that the following function is deprecated.
83 | #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
84 | #endif
85 |
86 | #if !defined(JSONCPP_DEPRECATED)
87 | #define JSONCPP_DEPRECATED(message)
88 | #endif // if !defined(JSONCPP_DEPRECATED)
89 |
90 | namespace Json {
91 | typedef int Int;
92 | typedef unsigned int UInt;
93 | #if defined(JSON_NO_INT64)
94 | typedef int LargestInt;
95 | typedef unsigned int LargestUInt;
96 | #undef JSON_HAS_INT64
97 | #else // if defined(JSON_NO_INT64)
98 | // For Microsoft Visual use specific types as long long is not supported
99 | #if defined(_MSC_VER) // Microsoft Visual Studio
100 | typedef __int64 Int64;
101 | typedef unsigned __int64 UInt64;
102 | #else // if defined(_MSC_VER) // Other platforms, use long long
103 | typedef long long int Int64;
104 | typedef unsigned long long int UInt64;
105 | #endif // if defined(_MSC_VER)
106 | typedef Int64 LargestInt;
107 | typedef UInt64 LargestUInt;
108 | #define JSON_HAS_INT64
109 | #endif // if defined(JSON_NO_INT64)
110 | } // end namespace Json
111 |
112 | #endif // JSON_CONFIG_H_INCLUDED
113 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/json/features.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007-2010 Baptiste Lepilleur
2 | // Distributed under MIT license, or public domain if desired and
3 | // recognized in your jurisdiction.
4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5 |
6 | #ifndef CPPTL_JSON_FEATURES_H_INCLUDED
7 | #define CPPTL_JSON_FEATURES_H_INCLUDED
8 |
9 | #if !defined(JSON_IS_AMALGAMATION)
10 | #include "forwards.h"
11 | #endif // if !defined(JSON_IS_AMALGAMATION)
12 |
13 | namespace Json {
14 |
15 | /** \brief Configuration passed to reader and writer.
16 | * This configuration object can be used to force the Reader or Writer
17 | * to behave in a standard conforming way.
18 | */
19 | class JSON_API Features {
20 | public:
21 | /** \brief A configuration that allows all features and assumes all strings
22 | * are UTF-8.
23 | * - C & C++ comments are allowed
24 | * - Root object can be any JSON value
25 | * - Assumes Value strings are encoded in UTF-8
26 | */
27 | static Features all();
28 |
29 | /** \brief A configuration that is strictly compatible with the JSON
30 | * specification.
31 | * - Comments are forbidden.
32 | * - Root object must be either an array or an object value.
33 | * - Assumes Value strings are encoded in UTF-8
34 | */
35 | static Features strictMode();
36 |
37 | /** \brief Initialize the configuration like JsonConfig::allFeatures;
38 | */
39 | Features();
40 |
41 | /// \c true if comments are allowed. Default: \c true.
42 | bool allowComments_;
43 |
44 | /// \c true if root must be either an array or an object value. Default: \c
45 | /// false.
46 | bool strictRoot_;
47 |
48 | /// \c true if dropped null placeholders are allowed. Default: \c false.
49 | bool allowDroppedNullPlaceholders_;
50 |
51 | /// \c true if numeric object key are allowed. Default: \c false.
52 | bool allowNumericKeys_;
53 | };
54 |
55 | } // namespace Json
56 |
57 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED
58 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/json/forwards.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007-2010 Baptiste Lepilleur
2 | // Distributed under MIT license, or public domain if desired and
3 | // recognized in your jurisdiction.
4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5 |
6 | #ifndef JSON_FORWARDS_H_INCLUDED
7 | #define JSON_FORWARDS_H_INCLUDED
8 |
9 | #if !defined(JSON_IS_AMALGAMATION)
10 | #include "config.h"
11 | #endif // if !defined(JSON_IS_AMALGAMATION)
12 |
13 | namespace Json {
14 |
15 | // writer.h
16 | class FastWriter;
17 | class StyledWriter;
18 |
19 | // reader.h
20 | class Reader;
21 |
22 | // features.h
23 | class Features;
24 |
25 | // value.h
26 | typedef unsigned int ArrayIndex;
27 | class StaticString;
28 | class Path;
29 | class PathArgument;
30 | class Value;
31 | class ValueIteratorBase;
32 | class ValueIterator;
33 | class ValueConstIterator;
34 | #ifdef JSON_VALUE_USE_INTERNAL_MAP
35 | class ValueMapAllocator;
36 | class ValueInternalLink;
37 | class ValueInternalArray;
38 | class ValueInternalMap;
39 | #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
40 |
41 | } // namespace Json
42 |
43 | #endif // JSON_FORWARDS_H_INCLUDED
44 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/json/json.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007-2010 Baptiste Lepilleur
2 | // Distributed under MIT license, or public domain if desired and
3 | // recognized in your jurisdiction.
4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5 |
6 | #ifndef JSON_JSON_H_INCLUDED
7 | #define JSON_JSON_H_INCLUDED
8 |
9 | #include "autolink.h"
10 | #include "value.h"
11 | #include "reader.h"
12 | #include "writer.h"
13 | #include "features.h"
14 |
15 | #endif // JSON_JSON_H_INCLUDED
16 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/json/version.h:
--------------------------------------------------------------------------------
1 | // DO NOT EDIT. This file is generated by CMake from "version"
2 | // and "version.h.in" files.
3 | // Run CMake configure step to update it.
4 | #ifndef JSON_VERSION_H_INCLUDED
5 | #define JSON_VERSION_H_INCLUDED
6 |
7 | #define JSONCPP_VERSION_STRING "0.6.0-dev"
8 | #define JSONCPP_VERSION_MAJOR 0
9 | #define JSONCPP_VERSION_MINOR 6
10 | #define JSONCPP_VERSION_PATCH 0
11 | #define JSONCPP_VERSION_QUALIFIER -dev
12 | #define JSONCPP_VERSION_HEXA \
13 | ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
14 | (JSONCPP_VERSION_PATCH << 8))
15 |
16 | #endif // JSON_VERSION_H_INCLUDED
17 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/src/json_batchallocator.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007-2010 Baptiste Lepilleur
2 | // Distributed under MIT license, or public domain if desired and
3 | // recognized in your jurisdiction.
4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5 |
6 | #ifndef JSONCPP_BATCHALLOCATOR_H_INCLUDED
7 | #define JSONCPP_BATCHALLOCATOR_H_INCLUDED
8 |
9 | #include
10 | #include
11 |
12 | #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
13 |
14 | namespace Json {
15 |
16 | /* Fast memory allocator.
17 | *
18 | * This memory allocator allocates memory for a batch of object (specified by
19 | * the page size, the number of object in each page).
20 | *
21 | * It does not allow the destruction of a single object. All the allocated
22 | * objects can be destroyed at once. The memory can be either released or reused
23 | * for future allocation.
24 | *
25 | * The in-place new operator must be used to construct the object using the
26 | * pointer returned by allocate.
27 | */
28 | template
29 | class BatchAllocator {
30 | public:
31 | BatchAllocator(unsigned int objectsPerPage = 255)
32 | : freeHead_(0), objectsPerPage_(objectsPerPage) {
33 | // printf( "Size: %d => %s\n", sizeof(AllocatedType),
34 | // typeid(AllocatedType).name() );
35 | assert(sizeof(AllocatedType) * objectPerAllocation >=
36 | sizeof(AllocatedType *)); // We must be able to store a slist in the
37 | // object free space.
38 | assert(objectsPerPage >= 16);
39 | batches_ = allocateBatch(0); // allocated a dummy page
40 | currentBatch_ = batches_;
41 | }
42 |
43 | ~BatchAllocator() {
44 | for (BatchInfo *batch = batches_; batch;) {
45 | BatchInfo *nextBatch = batch->next_;
46 | free(batch);
47 | batch = nextBatch;
48 | }
49 | }
50 |
51 | /// allocate space for an array of objectPerAllocation object.
52 | /// @warning it is the responsability of the caller to call objects
53 | /// constructors.
54 | AllocatedType *allocate() {
55 | if (freeHead_) // returns node from free list.
56 | {
57 | AllocatedType *object = freeHead_;
58 | freeHead_ = *(AllocatedType **)object;
59 | return object;
60 | }
61 | if (currentBatch_->used_ == currentBatch_->end_) {
62 | currentBatch_ = currentBatch_->next_;
63 | while (currentBatch_ && currentBatch_->used_ == currentBatch_->end_)
64 | currentBatch_ = currentBatch_->next_;
65 |
66 | if (!currentBatch_) // no free batch found, allocate a new one
67 | {
68 | currentBatch_ = allocateBatch(objectsPerPage_);
69 | currentBatch_->next_ = batches_; // insert at the head of the list
70 | batches_ = currentBatch_;
71 | }
72 | }
73 | AllocatedType *allocated = currentBatch_->used_;
74 | currentBatch_->used_ += objectPerAllocation;
75 | return allocated;
76 | }
77 |
78 | /// Release the object.
79 | /// @warning it is the responsability of the caller to actually destruct the
80 | /// object.
81 | void release(AllocatedType *object) {
82 | assert(object != 0);
83 | *(AllocatedType **)object = freeHead_;
84 | freeHead_ = object;
85 | }
86 |
87 | private:
88 | struct BatchInfo {
89 | BatchInfo *next_;
90 | AllocatedType *used_;
91 | AllocatedType *end_;
92 | AllocatedType buffer_[objectPerAllocation];
93 | };
94 |
95 | // disabled copy constructor and assignement operator.
96 | BatchAllocator(const BatchAllocator &);
97 | void operator=(const BatchAllocator &);
98 |
99 | static BatchInfo *allocateBatch(unsigned int objectsPerPage) {
100 | const unsigned int mallocSize =
101 | sizeof(BatchInfo) - sizeof(AllocatedType) * objectPerAllocation +
102 | sizeof(AllocatedType) * objectPerAllocation * objectsPerPage;
103 | BatchInfo *batch = static_cast(malloc(mallocSize));
104 | batch->next_ = 0;
105 | batch->used_ = batch->buffer_;
106 | batch->end_ = batch->buffer_ + objectsPerPage;
107 | return batch;
108 | }
109 |
110 | BatchInfo *batches_;
111 | BatchInfo *currentBatch_;
112 | /// Head of a single linked list within the allocated space of freeed object
113 | AllocatedType *freeHead_;
114 | unsigned int objectsPerPage_;
115 | };
116 |
117 | } // namespace Json
118 |
119 | #endif // ifndef JSONCPP_DOC_INCLUDE_IMPLEMENTATION
120 |
121 | #endif // JSONCPP_BATCHALLOCATOR_H_INCLUDED
122 | // vim: et ts=3 sts=3 sw=3 tw=0
123 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/jsoncpp/src/json_tool.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007-2010 Baptiste Lepilleur
2 | // Distributed under MIT license, or public domain if desired and
3 | // recognized in your jurisdiction.
4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5 |
6 | #ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
7 | #define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
8 |
9 | /* This header provides common string manipulation support, such as UTF-8,
10 | * portable conversion from/to string...
11 | *
12 | * It is an internal header that must not be exposed.
13 | */
14 |
15 | namespace Json {
16 |
17 | /// Converts a unicode code-point to UTF-8.
18 | static inline std::string codePointToUTF8(unsigned int cp) {
19 | std::string result;
20 |
21 | // based on description from http://en.wikipedia.org/wiki/UTF-8
22 |
23 | if (cp <= 0x7f) {
24 | result.resize(1);
25 | result[0] = static_cast(cp);
26 | } else if (cp <= 0x7FF) {
27 | result.resize(2);
28 | result[1] = static_cast(0x80 | (0x3f & cp));
29 | result[0] = static_cast(0xC0 | (0x1f & (cp >> 6)));
30 | } else if (cp <= 0xFFFF) {
31 | result.resize(3);
32 | result[2] = static_cast(0x80 | (0x3f & cp));
33 | result[1] = 0x80 | static_cast((0x3f & (cp >> 6)));
34 | result[0] = 0xE0 | static_cast((0xf & (cp >> 12)));
35 | } else if (cp <= 0x10FFFF) {
36 | result.resize(4);
37 | result[3] = static_cast(0x80 | (0x3f & cp));
38 | result[2] = static_cast(0x80 | (0x3f & (cp >> 6)));
39 | result[1] = static_cast(0x80 | (0x3f & (cp >> 12)));
40 | result[0] = static_cast(0xF0 | (0x7 & (cp >> 18)));
41 | }
42 |
43 | return result;
44 | }
45 |
46 | /// Returns true if ch is a control character (in range [0,32[).
47 | static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; }
48 |
49 | enum {
50 | /// Constant that specify the size of the buffer that must be passed to
51 | /// uintToString.
52 | uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1
53 | };
54 |
55 | // Defines a char buffer for use with uintToString().
56 | typedef char UIntToStringBuffer[uintToStringBufferSize];
57 |
58 | /** Converts an unsigned integer to string.
59 | * @param value Unsigned interger to convert to string
60 | * @param current Input/Output string buffer.
61 | * Must have at least uintToStringBufferSize chars free.
62 | */
63 | static inline void uintToString(LargestUInt value, char *¤t) {
64 | *--current = 0;
65 | do {
66 | *--current = char(value % 10) + '0';
67 | value /= 10;
68 | } while (value != 0);
69 | }
70 |
71 | } // namespace Json {
72 |
73 | #endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
74 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/metadata.cpp:
--------------------------------------------------------------------------------
1 | #include "metadata.h"
2 | #include "./dudu.h"
3 |
4 | using namespace QTDUDU;
5 |
6 | void registerQmlProperty(std::map >& properties, QQmlContext* contex, const char* name, QObject* object) {
7 | properties[name] = std::shared_ptr(object);
8 | contex->setContextProperty(name, object);
9 | }
10 |
11 | void registerQmlClasses(QQmlContext* context) {
12 | //qmlRegisterType("DuDuMediaPlayer", 1, 0, "DuDuMediaPlayer");
13 | }
14 |
15 | void registerCpp2Property(std::map >& properties, QQmlContext* ctx) {
16 | // 如果包含了vld头文件进行内存泄漏检测,或者是编译QNX版本则用上面的代码
17 | // 否则用下面的代码,这样可以在qt creator里面使用提示功能
18 |
19 | //registerQmlProperty(properties, ctx, "lstModelMusic", CListModelMusic::getInstance());
20 |
21 | registerQmlProperty(properties, ctx, "lstModelMusic", new TreeModel());
22 | registerQmlProperty(properties, ctx, "localMusicModel", new LocalMusicModel());
23 | registerQmlProperty(properties, ctx, "CppLocalMusic", LocalMusic::getInstance());
24 |
25 | registerQmlProperty(properties, ctx, "JCNet_AppOnlineMusic", CAppOnlineMusic::getInstance());
26 | registerQmlProperty(properties, ctx, "modelOnlineMusicTypeHot", new CModelOnlineMusicType());
27 | registerQmlProperty(properties, ctx, "modelOnlineMusicTypeSence", new CModelOnlineMusicSence());
28 | registerQmlProperty(properties, ctx, "modelOnlineMusicTypeEmotion", new CModelOnlineMusicEmotion());
29 | registerQmlProperty(properties, ctx, "modelOnlineMusicTypeStyle", new CModelOnlineMusicStyle());
30 | registerQmlProperty(properties, ctx, "modelOnlineMusicTypeYears", new CModelOnlineMusicYears());
31 | registerQmlProperty(properties, ctx, "modelOnlineMusicTypeLanguage", new CModelOnlineMusicLanguage());
32 | registerQmlProperty(properties, ctx, "modelOnlineMusicTypeTopName", new CModelOnlineMusicTopName());
33 | registerQmlProperty(properties, ctx, "modelOnlineMusicTypeSearched", new CModelOnlineMusicSearched());
34 | registerQmlProperty(properties, ctx, "modelOnlineMusicHistory", new CModelOnlineMusicHistory());
35 | registerQmlProperty(properties, ctx, "modelOnlineMusicCollect", new CModelOnlineMusicCollect());
36 | registerQmlProperty(properties, ctx, "duduMediaPlayer", DuDuMediaPlayer::getInstance());
37 |
38 | if (0) {
39 | //ctx->setContextProperty("modelOnlineMusicTypeLanguage", new CModelOnlineMusicLanguage());
40 |
41 | }
42 |
43 | //ChinaCityList::getInstance()->init();
44 | }
45 |
46 | void regiserMetaData(std::map >& properties, QQmlContext* context) {
47 | registerQmlClasses(context);
48 | registerCpp2Property(properties, context);
49 | }
50 |
--------------------------------------------------------------------------------
/DuDuPlayer/code/framework/metadata.h:
--------------------------------------------------------------------------------
1 | #ifndef METADATA_H
2 | #define METADATA_H
3 |
4 | #include
5 | #include