Skip to content

Commit

Permalink
Add delete dialog on mobile[531003]
Browse files Browse the repository at this point in the history
  • Loading branch information
Greedysky committed Mar 6, 2017
1 parent 007d946 commit f31bcbd
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 2 deletions.
130 changes: 130 additions & 0 deletions TTKMobile/MobileWidgets/TTKMusicDeletePage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/* =================================================
* This file is part of the TTK Music Player project
* Copyright (c) 2015 - 2017 Greedysky Studio
* All rights reserved!
* Redistribution and use of the source code or any derivative
* works are strictly forbiden.
=================================================*/

import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.4
import "Core"

Rectangle{
id: ttkMusicDeletePage

visible: false
anchors.fill: parent
color: ttkTheme.color_alpha_lv12

MouseArea {
anchors.fill: parent
onClicked: {
ttkMusicDeletePage.visible = false;
}
}

Rectangle {
id: mainRectangle
color: ttkTheme.color_white
radius: 10
width: 0.7*parent.width
height: 0.3*parent.height
anchors.centerIn: parent

ColumnLayout {
spacing: 0
anchors.fill: parent

Text {
anchors {
top: parent.top
topMargin: ttkGlobal.dpHeight(20)
}
Layout.preferredHeight: ttkGlobal.dpHeight(60)
Layout.alignment: Qt.AlignCenter
font.pixelSize: parent.height/9
text: qsTr("删除歌曲")
}

Text {
anchors {
left: parent.left
leftMargin: ttkGlobal.dpWidth(20)
}
Layout.preferredHeight: ttkGlobal.dpHeight(30)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("确定删除选中的歌曲?")
color: ttkTheme.color_gray
}

CheckBox {
anchors {
left: parent.left
leftMargin: ttkGlobal.dpWidth(20)
}
Layout.preferredHeight: ttkGlobal.dpHeight(30)
text: qsTr("同时删除本地文件")
style: CheckBoxStyle {
indicator: Image {
width: ttkGlobal.dpWidth(20)
height: ttkGlobal.dpHeight(20)
source: control.checked ? "qrc:/image/ic_lyric_poster_lyric_select" :
"qrc:/image/ic_lyric_poster_lyric_unselect"
}
}
}

Rectangle {
id: bottomBody
anchors.bottom: parent.bottom
Layout.preferredWidth: mainRectangle.width
height: ttkGlobal.dpHeight(60)

TTKTextButton {
border {
color: ttkTheme.color_alpha_lv9
width: 2
}
width: bottomBody.width/2
height: bottomBody.height
anchors.left: parent.left
color: ttkTheme.color_white
text: qsTr("取消")
onClicked: {
ttkMusicDeletePage.visible = false;
}
}

TTKTextButton {
border {
color: ttkTheme.color_alpha_lv9
width: 2
}
width: bottomBody.width/2
height: bottomBody.height
anchors.right: parent.right
color: ttkTheme.color_white
text: qsTr("确定")
onClicked: {
removeItemFromList();
ttkMusicDeletePage.visible = false;
}
}
}
}
}

Component.onCompleted:
{
var docRoot = ttkMusicDeletePage.parent;
while(docRoot.parent)
{
docRoot = docRoot.parent;
}
ttkMusicDeletePage.parent = docRoot;
}
}
10 changes: 9 additions & 1 deletion TTKMobile/MobileWidgets/TTKMusicPlayerCenterSettingPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Rectangle{
property alias text: musicSongTitle.text
property int muteVolume: TTK_PLAYER.volume()

function removeItemFromList() {
TTK_APP.removeMusicSongs();
}

MouseArea {
anchors.fill: parent
onClicked: {
Expand Down Expand Up @@ -120,8 +124,8 @@ Rectangle{
ttkMusicSongSharedPage.visible = true;
break;
case 3:
ttkMusicDeletePage.visible = true;
ttkMusicPlayerCenterSettingPage.visible = false;
TTK_APP.removeMusicSongs();
break;
case 4: break;
case 5: break;
Expand Down Expand Up @@ -411,4 +415,8 @@ Rectangle{
}
ttkMusicPlayerCenterSettingPage.parent = docRoot;
}

TTKMusicDeletePage {
id: ttkMusicDeletePage
}
}
6 changes: 5 additions & 1 deletion TTKMobile/MobileWidgets/TTKMusicSongSettingPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Rectangle{
ttkMusicSongSharedPage.visible = true;
break;
case 3:
removeItemFromList();
ttkMusicDeletePage.visible = true;
ttkMusicSongSettingPage.visible = false;
break;
case 4: break;
Expand Down Expand Up @@ -330,4 +330,8 @@ Rectangle{
}
ttkMusicSongSettingPage.parent = docRoot;
}

TTKMusicDeletePage {
id: ttkMusicDeletePage
}
}
1 change: 1 addition & 0 deletions TTKMobile/TTKMobile.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,6 @@
<file>MobileWidgets/TTKMusicVideoPage.qml</file>
<file>MobileWidgets/TTKMusicAboutPage.qml</file>
<file>MobileWidgets/TTKMusicCleanCachedPage.qml</file>
<file>MobileWidgets/TTKMusicDeletePage.qml</file>
</qresource>
</RCC>

0 comments on commit f31bcbd

Please sign in to comment.