Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Commit

Permalink
Implemented profile changes on watch (dis)connection
Browse files Browse the repository at this point in the history
  • Loading branch information
smokku committed Apr 30, 2015
1 parent f212fcc commit 3f64297
Show file tree
Hide file tree
Showing 9 changed files with 295 additions and 205 deletions.
82 changes: 72 additions & 10 deletions app/qml/pages/ManagerPage.qml
Expand Up @@ -2,14 +2,16 @@ import QtQuick 2.0
import QtQml 2.1
import Sailfish.Silica 1.0
import org.nemomobile.configuration 1.0
import org.nemomobile.dbus 2.0

Page {
id: page

ConfigurationGroup {
id: settings
path: "/org/pebbled/settings"
property bool silentWhenConnected: false
property string profileWhenConnected: ""
property string profileWhenDisconnected: ""
property bool transliterateMessage: false
property bool useSystemVolume: true
property bool incomingCallNotification: true
Expand All @@ -23,6 +25,25 @@ Page {
property bool notificationsAll: false
}

DBusInterface {
id: profiled

service: 'com.nokia.profiled'
iface: 'com.nokia.profiled'
path: '/com/nokia/profiled'

property var profiles
}

Component.onCompleted: {
profiled.typedCall('get_profiles', [], function (result) {
console.log('Got profiles: ' + result);
profiled.profiles = result;
});
}



SilicaFlickable {
id: flickable
anchors.fill: parent
Expand Down Expand Up @@ -124,15 +145,6 @@ Page {
settings.incomingCallNotification = !settings.incomingCallNotification;
}
}
TextSwitch {
text: qsTr("Silent when connected")
description: qsTr("Sets phone profile to \"silent\" when Pebble is connected")
checked: settings.silentWhenConnected
automaticCheck: false
onClicked: {
settings.silentWhenConnected = !settings.silentWhenConnected;
}
}
TextSwitch {
text: qsTr("Control main volume")
description: qsTr("Pebble music volume buttons change the main phone volume directly instead of through the music player.")
Expand Down Expand Up @@ -234,6 +246,56 @@ Page {
settings.notificationsAll = !settings.notificationsAll;
}
}

Label {
text: qsTr("Profiles")
font.family: Theme.fontFamilyHeading
color: Theme.highlightColor
anchors.right: parent.right
anchors.rightMargin: Theme.paddingMedium
}

ComboBox {
label: qsTr("Connected")
menu: ContextMenu {
MenuItem {
text: qsTr("no change")
font.capitalization: Font.SmallCaps
}
Repeater {
model: profiled.profiles
delegate: MenuItem {
text: modelData
down: modelData === settings.profileWhenConnected
}
}
}
value: settings.profileWhenConnected || qsTr("no change")
onCurrentIndexChanged: {
settings.profileWhenConnected = currentIndex ? currentItem.text : ""
}
}

ComboBox {
label: qsTr("Disconnected")
menu: ContextMenu {
MenuItem {
text: qsTr("no change")
font.capitalization: Font.SmallCaps
}
Repeater {
model: profiled.profiles
delegate: MenuItem {
text: modelData
down: modelData === settings.profileWhenDisconnected
}
}
}
value: settings.profileWhenDisconnected || qsTr("no change")
onCurrentIndexChanged: {
settings.profileWhenDisconnected = currentIndex ? currentItem.text : ""
}
}
}
}
}

0 comments on commit 3f64297

Please sign in to comment.