Skip to content

Commit b1c9a32

Browse files
committed
Change music widget a bit, add flickable for widgets
1 parent 206a5a0 commit b1c9a32

File tree

2 files changed

+129
-58
lines changed

2 files changed

+129
-58
lines changed

qml/panel/NotificationCenter.qml

+93-49
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1+
/*
2+
* Papyros Shell - The desktop shell for Papyros following Material Design
3+
* Copyright (C) 2015 Michael Spencer
4+
* 2015 Bogdan Cuza
5+
* 2015 Ricardo Vieira
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
121
import QtQuick 2.0
222
import Material 0.1
323
import Material.Extras 0.1
4-
import Material.ListItems 0.1 as ListItem
5-
import Material.Desktop 0.1
624

725
View {
826
fullHeight: true
@@ -28,71 +46,97 @@ View {
2846

2947
property var widgets: ["Music"]
3048

31-
Column {
49+
View {
50+
id: view
51+
height: label.height + units.dp(16)
3252
width: parent.width
53+
backgroundColor: "#fafafa"
54+
z: 10
3355

34-
spacing: units.dp(16)
35-
36-
View {
37-
id: view
38-
height: label.height + units.dp(16)
39-
width: parent.width
40-
41-
Label {
42-
id: label
43-
anchors {
44-
left: parent.left
45-
right: parent.right
46-
bottom: parent.bottom
47-
leftMargin: units.dp(16)
48-
rightMargin: units.dp(16)
49-
}
50-
51-
text: Qt.formatDateTime(now, "dddd',<br>'MMMM d'<sup>%1</sup>'"
52-
.arg(Utils.nth(now.getDate())))
53-
54-
style: "title"
55-
font.pixelSize: units.dp(30)
56-
textFormat: Text.RichText
56+
Label {
57+
id: label
58+
anchors {
59+
left: parent.left
60+
right: parent.right
61+
bottom: parent.bottom
62+
leftMargin: units.dp(16)
63+
rightMargin: units.dp(16)
5764
}
58-
}
5965

60-
Repeater {
61-
model: widgets
62-
delegate: Loader {
63-
source: Qt.resolvedUrl("../widgets/%1.qml".arg(modelData))
66+
text: Qt.formatDateTime(now, "dddd',<br>'MMMM d'<sup>%1</sup>'"
67+
.arg(Utils.nth(now.getDate())))
6468

65-
anchors {
66-
left: parent.left
67-
right: parent.right
68-
margins: units.dp(16)
69-
}
70-
}
69+
style: "title"
70+
font.pixelSize: units.dp(30)
71+
textFormat: Text.RichText
7172
}
7273
}
7374

74-
Item {
75+
Flickable {
7576
anchors {
77+
top: view.bottom
7678
left: parent.left
7779
right: parent.right
78-
bottom: parent.bottom
79-
margins: units.dp(16)
80+
bottom: silentMode.bottom
81+
topMargin: units.dp(16)
8082
}
83+
z: 5
84+
contentHeight: widgetCol.height
85+
interactive: contentHeight > height
86+
boundsBehavior: Flickable.StopAtBounds
8187

82-
height: units.dp(30)
88+
Column {
89+
id: widgetCol
8390

84-
Label {
85-
anchors.verticalCenter: parent.verticalCenter
91+
width: parent.width
8692

87-
text: "Silent mode"
93+
Repeater {
94+
model: widgets
95+
delegate: Loader {
96+
source: Qt.resolvedUrl("../widgets/%1.qml".arg(modelData))
97+
98+
anchors {
99+
left: parent.left
100+
right: parent.right
101+
margins: units.dp(16)
102+
}
103+
}
104+
}
88105
}
106+
}
107+
108+
Rectangle {
109+
id: silentMode
110+
111+
anchors.bottom: parent.bottom
112+
height: units.dp(46)
113+
width: parent.width
114+
color: "#fafafa"
115+
z: 10
116+
117+
Rectangle {
118+
anchors {
119+
left: parent.left
120+
right: parent.right
121+
bottom: parent.bottom
122+
margins: units.dp(16)
123+
}
124+
125+
height: units.dp(30)
89126

90-
Switch {
91-
anchors.verticalCenter: parent.verticalCenter
92-
anchors.right: parent.right
127+
Label {
128+
anchors.verticalCenter: parent.verticalCenter
93129

94-
checked: config.silentMode
95-
onCheckedChanged: config.silentMode = checked
130+
text: "Silent mode"
131+
}
132+
133+
Switch {
134+
anchors.verticalCenter: parent.verticalCenter
135+
anchors.right: parent.right
136+
137+
checked: config.silentMode
138+
onCheckedChanged: config.silentMode = checked
139+
}
96140
}
97141
}
98142
}

qml/widgets/Music.qml

+36-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1+
/*
2+
* Papyros Shell - The desktop shell for Papyros following Material Design
3+
* Copyright (C) 2015 Michael Spencer
4+
* 2015 Bogdan Cuza
5+
* 2015 Ricardo Vieira
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
121
import QtQuick 2.0
222
import Material 0.1
3-
import Material.ListItems 0.1 as ListItem
423
import Material.Desktop 0.1
5-
import Material.Extras 0.1
624

725
Column {
826
spacing: units.dp(16)
927

1028
Repeater {
1129
model: musicPlayer.playerList
1230

13-
/*
14-
if the playback state is Stopped
15-
a player can't play, pause, next or previous
16-
so you should replace it with an open button
17-
and use the raise function,
18-
*/
1931
delegate: Card {
2032
width: parent.width
2133

@@ -96,26 +108,41 @@ Column {
96108
}
97109
}
98110

111+
//TODO: Add a slider
112+
99113
Row {
100114
anchors.horizontalCenter: parent.horizontalCenter
101115

102116
spacing: units.dp(10)
117+
opacity: playbackStatus == "Stopped" ? 0 : 1
118+
height: playbackStatus == "Stopped" ? 0 : playPauseBtn.height
103119

104120
IconButton {
105121
name: "av/skip_previous"
106122
onClicked: previous()
123+
enabled: canGoPrevious
107124
}
108125

109126
IconButton {
110-
name: "av/pause"
127+
id: playPauseBtn
128+
129+
name: playbackStatus == "Paused" ? "av/play_arrow" : "av/pause"
111130
onClicked: playPause()
112131
}
113132

114133
IconButton {
115134
name: "av/skip_next"
116135
onClicked: next()
136+
enabled: canGoNext
117137
}
118138
}
139+
140+
Button {
141+
anchors.horizontalCenter: parent.horizontalCenter
142+
opacity: playbackStatus == "Stopped" ? 1 : 0
143+
text: "Open"
144+
onClicked: raise()
145+
}
119146
}
120147
}
121148
}

0 commit comments

Comments
 (0)