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

View file

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

View file

@ -295,91 +295,96 @@ MouseEventListener {
source: simManager.pinRequired != OfonoSimManager.NoPin ? Qt.resolvedUrl("Pin.qml") : "" source: simManager.pinRequired != OfonoSimManager.NoPin ? Qt.resolvedUrl("Pin.qml") : ""
} }
Rectangle { PlasmaCore.ColorScope {
id: statusPanel id: statusPanel
anchors { anchors {
top: parent.top top: parent.top
left: parent.left left: parent.left
right: parent.right right: parent.right
} }
z: 1
height: units.iconSizes.small height: units.iconSizes.small
color: Qt.rgba(0, 0, 0, 0.7) z: 1
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
PlasmaCore.DataSource { Rectangle {
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
anchors.fill: parent anchors.fill: parent
text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm") color: Qt.rgba(0, 0, 0, 0.7)
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
PlasmaCore.DataSource { PlasmaCore.DataSource {
id: pmSource id: timeSource
engine: "powermanagement" engine: "time"
connectedSources: sources connectedSources: ["Local"]
onSourceAdded: { interval: 500
disconnectSource(source); }
connectSource(source);
PlasmaCore.IconItem {
id: strengthIcon
colorGroup: PlasmaCore.ColorScope.colorGroup
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
} }
onSourceRemoved: { width: units.iconSizes.small
disconnectSource(source); 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 height: homescreen.height
} }
ListView { PlasmaCore.ColorScope {
id: notificationView z: 1
spacing: units.smallSpacing
anchors { anchors {
top: statusPanel.bottom 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 bottom: parent.bottom
left: parent.left left: parent.left
right: parent.right right: parent.right
topMargin: units.smallSpacing
} }
z: 1
cellWidth: stripe.height * 2 colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
cellHeight: cellWidth
model: appListModel ListView {
snapMode: GridView.SnapToRow id: notificationView
clip: true spacing: units.smallSpacing
delegate: HomeLauncher {} anchors {
Component.onCompleted : { console.log("WTF " + width) } 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: { Component.onCompleted: {