use colorscopes

This commit is contained in:
Marco Martin 2014-11-25 17:57:38 +01:00
parent 678585e5c5
commit 33984e3da9
3 changed files with 205 additions and 186 deletions

View file

@ -1,6 +1,7 @@
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kio 1.0 as Kio
import org.kde.plasma.components 2.0 as PlasmaComponents
MouseArea {
id: root
@ -19,7 +20,7 @@ MouseArea {
source: model.ApplicationIconRole
}
Text {
PlasmaComponents.Label {
visible: text.length > 0
anchors {
@ -34,6 +35,6 @@ MouseArea {
text: model.ApplicationNameRole
font.pixelSize: theme.smallestFont.pixelSize
color: "white"
color: PlasmaCore.ColorScope.textColor
}
}

View file

@ -19,6 +19,7 @@
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
MouseArea {
id: root
@ -124,13 +125,13 @@ MouseArea {
color: textGradientOverlay
}
Text {
PlasmaComponents.Label {
id: summaryText
anchors.fill: parent
clip: true
horizontalAlignment: root.expanded ? Qt.AlignHCenter : Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
color: "white"
color: PlasmaCore.ColorScope.textColor
text: summary + (root.expanded ? (body ? "\n" + body : '') :
(body ? '...' : ''))
}

View file

@ -295,91 +295,96 @@ MouseEventListener {
source: simManager.pinRequired != OfonoSimManager.NoPin ? Qt.resolvedUrl("Pin.qml") : ""
}
Rectangle {
PlasmaCore.ColorScope {
id: statusPanel
anchors {
top: parent.top
left: parent.left
right: parent.right
}
z: 1
height: units.iconSizes.small
color: Qt.rgba(0, 0, 0, 0.7)
z: 1
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
PlasmaCore.DataSource {
id: timeSource
engine: "time"
connectedSources: ["Local"]
interval: 500
}
PlasmaCore.IconItem {
id: strengthIcon
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
width: units.iconSizes.small
height: width
}
Text {
anchors {
left: strengthIcon.right
verticalCenter: parent.verticalCenter
}
text: netreg.strength + "% " + netreg.name
color: "white"
font.pixelSize: parent.height / 2
}
Text {
id: clock
Rectangle {
anchors.fill: parent
text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm")
color: "white"
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
font.pixelSize: height / 2
}
MouseArea {
property int oldMouseY: 0
anchors.fill: parent
enabled: !dialerOverlay.item.visible
onPressed: {
oldMouseY = mouse.y;
slidingPanel.visible = true;
}
onPositionChanged: {
slidingPanel.offset = slidingPanel.offset + (mouse.y - oldMouseY);
oldMouseY = mouse.y;
}
onReleased: slidingPanel.updateState();
}
PlasmaWorkspace.BatteryIcon {
id: batteryIcon
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
width: units.iconSizes.small
height: width
hasBattery: pmSource.data["Battery"]["Has Battery"]
batteryType: "Phone"
percent: pmSource.data["Battery0"] ? pmSource.data["Battery0"]["Percent"] : 0
color: Qt.rgba(0, 0, 0, 0.7)
PlasmaCore.DataSource {
id: pmSource
engine: "powermanagement"
connectedSources: sources
onSourceAdded: {
disconnectSource(source);
connectSource(source);
id: timeSource
engine: "time"
connectedSources: ["Local"]
interval: 500
}
PlasmaCore.IconItem {
id: strengthIcon
colorGroup: PlasmaCore.ColorScope.colorGroup
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
onSourceRemoved: {
disconnectSource(source);
width: units.iconSizes.small
height: width
}
PlasmaComponents.Label {
anchors {
left: strengthIcon.right
verticalCenter: parent.verticalCenter
}
text: netreg.strength + "% " + netreg.name
color: PlasmaCore.ColorScope.textColor
font.pixelSize: parent.height / 2
}
PlasmaComponents.Label {
id: clock
anchors.fill: parent
text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm")
color: PlasmaCore.ColorScope.textColor
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
font.pixelSize: height / 2
}
MouseArea {
property int oldMouseY: 0
anchors.fill: parent
enabled: !dialerOverlay.item.visible
onPressed: {
oldMouseY = mouse.y;
slidingPanel.visible = true;
}
onPositionChanged: {
slidingPanel.offset = slidingPanel.offset + (mouse.y - oldMouseY);
oldMouseY = mouse.y;
}
onReleased: slidingPanel.updateState();
}
PlasmaWorkspace.BatteryIcon {
id: batteryIcon
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
width: units.iconSizes.small
height: width
hasBattery: pmSource.data["Battery"]["Has Battery"]
batteryType: "Phone"
percent: pmSource.data["Battery0"] ? pmSource.data["Battery0"]["Percent"] : 0
PlasmaCore.DataSource {
id: pmSource
engine: "powermanagement"
connectedSources: sources
onSourceAdded: {
disconnectSource(source);
connectSource(source);
}
onSourceRemoved: {
disconnectSource(source);
}
}
}
}
@ -391,121 +396,133 @@ MouseEventListener {
height: homescreen.height
}
ListView {
id: notificationView
spacing: units.smallSpacing
PlasmaCore.ColorScope {
z: 1
anchors {
top: statusPanel.bottom
bottom: stripe.top
left: parent.left
right: parent.right
bottomMargin: units.smallSpacing
}
z: 1
clip: true
verticalLayoutDirection: ListView.BottomToTop
model: notificationsModel
add: Transition {
NumberAnimation {
properties: "x"
from: notificationView.width
duration: 100
}
}
remove: Transition {
NumberAnimation {
properties: "x"
to: notificationView.width
duration: 500
}
NumberAnimation {
properties: "opacity"
to: 0
duration: 500
}
}
removeDisplaced: Transition {
SequentialAnimation {
PauseAnimation { duration: 600 }
NumberAnimation { properties: "x,y"; duration: 100 }
}
}
delegate: NotificationStripe {}
}
SatelliteStripe {
id: stripe
z: 1
PlasmaCore.Svg {
id: stripeIcons
imagePath: Qt.resolvedUrl("../images/homescreenicons.svg")
}
Row {
anchors.fill: parent
property int columns: 4
property alias buttonHeight: stripe.height
HomeLauncherSvg {
id: phoneIcon
svg: stripeIcons
elementId: "phone"
callback: function() {
dialerOverlay.open()
}
}
HomeLauncherSvg {
id: messagingIcon
svg: stripeIcons
elementId: "messaging"
callback: function() { console.log("Start messaging") }
}
HomeLauncherSvg {
id: emailIcon
svg: stripeIcons
elementId: "email"
callback: function() { console.log("Start email") }
}
HomeLauncherSvg {
id: webIcon
svg: stripeIcons
elementId: "web"
callback: function() { console.log("Start web") }
}
}
}
SatelliteComponents.ApplicationListModel {
id: appListModel
}
GridView {
id: applications
anchors {
top: stripe.bottom
bottom: parent.bottom
left: parent.left
right: parent.right
topMargin: units.smallSpacing
}
z: 1
cellWidth: stripe.height * 2
cellHeight: cellWidth
model: appListModel
snapMode: GridView.SnapToRow
clip: true
delegate: HomeLauncher {}
Component.onCompleted : { console.log("WTF " + width) }
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
ListView {
id: notificationView
spacing: units.smallSpacing
anchors {
top: parent.top
bottom: stripe.top
left: parent.left
right: parent.right
bottomMargin: units.smallSpacing
}
z: 1
clip: true
verticalLayoutDirection: ListView.BottomToTop
model: notificationsModel
add: Transition {
NumberAnimation {
properties: "x"
from: notificationView.width
duration: 100
}
}
remove: Transition {
NumberAnimation {
properties: "x"
to: notificationView.width
duration: 500
}
NumberAnimation {
properties: "opacity"
to: 0
duration: 500
}
}
removeDisplaced: Transition {
SequentialAnimation {
PauseAnimation { duration: 600 }
NumberAnimation { properties: "x,y"; duration: 100 }
}
}
delegate: NotificationStripe {}
}
SatelliteStripe {
id: stripe
z: 1
PlasmaCore.Svg {
id: stripeIcons
imagePath: Qt.resolvedUrl("../images/homescreenicons.svg")
}
Row {
anchors.fill: parent
property int columns: 4
property alias buttonHeight: stripe.height
HomeLauncherSvg {
id: phoneIcon
svg: stripeIcons
elementId: "phone"
callback: function() {
dialerOverlay.open()
}
}
HomeLauncherSvg {
id: messagingIcon
svg: stripeIcons
elementId: "messaging"
callback: function() { console.log("Start messaging") }
}
HomeLauncherSvg {
id: emailIcon
svg: stripeIcons
elementId: "email"
callback: function() { console.log("Start email") }
}
HomeLauncherSvg {
id: webIcon
svg: stripeIcons
elementId: "web"
callback: function() { console.log("Start web") }
}
}
}
SatelliteComponents.ApplicationListModel {
id: appListModel
}
GridView {
id: applications
anchors {
top: stripe.bottom
bottom: parent.bottom
left: parent.left
right: parent.right
topMargin: units.smallSpacing
}
z: 1
cellWidth: stripe.height * 2
cellHeight: cellWidth
model: appListModel
snapMode: GridView.SnapToRow
clip: true
delegate: HomeLauncher {}
Component.onCompleted : { console.log("WTF " + width) }
}
}
Component.onCompleted: {