Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statusbar #14

Merged
merged 2 commits into from
Jun 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/qml/LauncherItemDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,6 @@ Item {
width: 100
height: width
asynchronous: true
onStatusChanged: {
if (status === Image.Error) {
console.log("Error loading an app icon, falling back to default.");
iconImage.source = ":/images/icons/apps.png";
}
}

Spinner {
id: spinner
Expand Down
14 changes: 0 additions & 14 deletions src/qml/Lockscreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,8 @@ import QtQuick 2.0
Image {
id: lockScreen
source: "images/graphics-wallpaper-home.jpg"

/**
* openingState should be a value between 0 and 1, where 0 means
* the lockscreen is "down" (obscures the view) and 1 means the
* lockscreen is "up" (not visible).
**/
visible: LipstickSettings.lockscreenVisible

function snapPosition() {
}

Connections {
target: LipstickSettings
onLockscreenVisibleChanged: snapPosition()
}

LockscreenClock {
anchors {
top: parent.top
Expand Down
58 changes: 11 additions & 47 deletions src/qml/MainScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Window 2.1
import org.nemomobile.time 1.0
import org.nemomobile.configuration 1.0
import org.freedesktop.contextkit 1.0
import "scripts/desktop.js" as Desktop

Page {
Expand Down Expand Up @@ -64,61 +63,19 @@ Page {
} else { Qt.quit(); }
}
}
Connections {
target: batterystatus
onValueChanged: {
if(batterystatus.value > 85) {
batteryimg.source = "images/battery6.png"
} else if (batterystatus.value <= 5) {
batteryimg.source = "images/battery0.png"
} else if (batterystatus.value <= 10) {
batteryimg.source = "images/battery1.png"
} else if (batterystatus.value <= 25) {
batteryimg.source = "images/battery2.png"
} else if (batterystatus.value <= 40) {
batteryimg.source = "images/battery3.png"
} else if (batterystatus.value <= 65) {
batteryimg.source = "images/battery4.png"
} else if (batterystatus.value <= 80) {
batteryimg.source = "images/battery5.png"
}
batterylbl.text = batterystatus.value + "%"
}
}

ContextProperty {
id: batterystatus
key: "Battery.ChargePercentage"
value: "100"
Statusbar {
id: statusbar
}

Rectangle {
id: toolbar
color: "black"
height: 40
width: parent.width
border.color: "white"
border.width: 1
z: 201
anchors.bottom: parent.bottom
Image {
id: batteryimg
width: 32
height: 32
}
Label {
anchors.left: batteryimg.right
id: batterylbl
color: "white"
font.pointSize: 8
}
}
Component.onCompleted: {
Desktop.instance = desktop
}

function lockscreenVisible() {
return LipstickSettings.lockscreenVisible === true
}

function setLockScreen(enabled) {
if (enabled) {
LipstickSettings.lockScreen(true)
Expand Down Expand Up @@ -154,11 +111,18 @@ Page {
// Initial view should be the AppLauncher
currentIndex: 0
}
Image {
id:wallpaper
source: "images/wallpaper-portrait-bubbles.png"
anchors.fill: parent
z: -100
}
Lockscreen {
id: lockScreen

width: parent.width
height: parent.height
z: 200
}

}
208 changes: 208 additions & 0 deletions src/qml/Statusbar.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
/****************************************************************************************
**
** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
import QtQuick 2.1
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import org.freedesktop.contextkit 1.0

Item {
id: root
z: 201
height: 48
width: parent.width
anchors.bottom: parent.bottom

Rectangle {
id: statusbar
color: "black"
anchors.fill: parent
opacity: 0.5
z: 200
}

Connections {
target: batteryChargePercentage
onValueChanged: {
if(batteryChargePercentage.value > 85) {
batteryimg.source = "images/battery6.png"
} else if (batteryChargePercentage.value <= 5) {
batteryimg.source = "images/battery0.png"
} else if (batteryChargePercentage.value <= 10) {
batteryimg.source = "images/battery1.png"
} else if (batteryChargePercentage.value <= 25) {
batteryimg.source = "images/battery2.png"
} else if (batteryChargePercentage.value <= 40) {
batteryimg.source = "images/battery3.png"
} else if (batteryChargePercentage.value <= 65) {
batteryimg.source = "images/battery4.png"
} else if (batteryChargePercentage.value <= 80) {
batteryimg.source = "images/battery5.png"
}
}
}

Connections {
target: cellularSignalBars
onValueChanged: {
cellularbars.text = cellularSignalBars.value
}
}


ContextProperty {
id: batteryChargePercentage
key: "Battery.ChargePercentage"
value: "100"
}

ContextProperty {
id: cellularSignalBars
key: "Cellular.SignalBars"
}

ContextProperty {
id: cellularRegistrationStatus
key: "Cellular.RegistrationStatus"
}

Rectangle {
id: cellular
anchors.left: parent.left
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Label {
id: cellularbars
width: 32
height: 32
font.pointSize: 8
}
}
Rectangle {
id: wifi
anchors.left: cellular.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
}
Rectangle {
id: bluetooth
anchors.left: wifi.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Image {
source: bluetoothConnected.value !== undefined && bluetoothConnected.value ? "image://theme/icon-status-bluetooth-connected" : "image://theme/icon-status-bluetooth"

ContextProperty {
id: bluetoothEnabled
key: "Bluetooth.Enabled"
}
ContextProperty {
id: bluetoothConnected
key: "Bluetooth.Connected"
}
}
}
Rectangle {
id: nfc
anchors.left: bluetooth.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Image {
source: "image://theme/icon-nfc-enabled"
}
}
Rectangle {
id: gps
anchors.left: nfc.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Image {
source: "image://theme/icon-gps-enabled"
}
}
Rectangle {
id: playlist
anchors.left: gps.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Image {
source: "image://theme/icon-playlist-playpause"
}
}
Rectangle {
id: clock
anchors.left: playlist.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Label {
id: hours
width: 16
height: 16
font.pointSize: 6
text: Qt.formatDateTime(wallClock.time, "hh")
}
Label {
id: minutes
anchors.top: hours.bottom
anchors.topMargin: 4
width: 16
height: 16
font.pointSize: 6
text: Qt.formatDateTime(wallClock.time, "mm")
}
}

Rectangle {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe these components (Rectangle + image) could be exported in another component, to reduce copy-pasting ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, could be useful. Also we need dynamic statusbar, such as you do with listview.

anchors.right: parent.right
height: 48
width: 48
color: "transparent"
anchors.margins: 8
Image {
id: batteryimg
width: 32
height: 32
}
}
}
3 changes: 1 addition & 2 deletions src/qml/compositor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ Compositor {
}
}

Rectangle {
Item {
id: layersParent
anchors.fill: parent
color: "black"

Item {
id: homeLayer
Expand Down
2 changes: 2 additions & 0 deletions src/resources-qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@
<file>qml/images/notification-circle.png</file>
<file>qml/scripts/desktop.js</file>
<file>qml/FeedsPage.qml</file>
<file>qml/Statusbar.qml</file>
<file>qml/images/wallpaper-portrait-bubbles.png</file>
</qresource>
</RCC>
3 changes: 2 additions & 1 deletion src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ OTHER_FILES += qml/*.qml \
qml/compositor/ScreenGestureArea.qml \
qml/NotificationPreview.qml \
qml/scripts/desktop.js \
qml/FeedsPage.qml
qml/FeedsPage.qml \
qml/Statusbar.qml