Skip to content

Commit

Permalink
Adds a 'Unit' Panel to choose between 12H/24H format and °C/°F
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentRevest committed Oct 29, 2017
1 parent 6f3dbe5 commit 3885e15
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 1 deletion.
72 changes: 72 additions & 0 deletions UnitsPage.qml
@@ -0,0 +1,72 @@
/*
* Copyright (C) 2017 - Florent Revest <revestflo@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.9
import QtQuick.Layouts 1.3
import org.nemomobile.configuration 1.0
import org.asteroid.controls 1.0

Item {
ConfigurationValue {
id: use12H
key: "/org/asteroidos/settings/use-12h-format"
defaultValue: false
}

ConfigurationValue {
id: useFahrenheit
key: "/org/asteroidos/settings/use-fahrenheit"
defaultValue: false
}

GridLayout {
columns: 2
anchors.fill: parent
anchors.margins: Dims.l(15)

Text {
text: qsTr("Use 12H format:")
font.pixelSize: Dims.l(6)
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
}

Switch {
Component.onCompleted: checked = use12H.value
onCheckedChanged: use12H.value = checked
width: Dims.l(20)
}

Text {
text: qsTr("Use Farhenheit:")
font.pixelSize: Dims.l(6)
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
}

Switch {
Component.onCompleted: checked = useFahrenheit.value
onCheckedChanged: useFahrenheit.value = checked
width: Dims.l(20)
}
}
}

2 changes: 2 additions & 0 deletions asteroid-settings.pro
Expand Up @@ -14,6 +14,7 @@ OTHER_FILES += main.qml \
BluetoothPage.qml \
BrightnessPage.qml \
SoundPage.qml \
UnitsPage.qml \
USBPage.qml \
WatchfacePage.qml \
PoweroffPage.qml \
Expand All @@ -30,6 +31,7 @@ lupdate_only{
BluetoothPage.qml \
BrightnessPage.qml \
SoundPage.qml \
UnitsPage.qml \
USBPage.qml \
WatchfacePage.qml \
PoweroffPage.qml \
Expand Down
8 changes: 7 additions & 1 deletion main.qml
Expand Up @@ -32,6 +32,7 @@ Application {
Component { id: bluetoothLayer; BluetoothPage { } }
Component { id: brightnessLayer; BrightnessPage { } }
Component { id: soundLayer; SoundPage { } }
Component { id: unitsLayer; UnitsPage { } }
Component { id: wallpaperLayer; WallpaperPage { } }
Component { id: watchfaceLayer; WatchfacePage { } }
Component { id: usbLayer; USBPage { } }
Expand All @@ -49,7 +50,7 @@ Application {

Flickable {
function elementsNb() {
var nb = 11;
var nb = 12;
if(DeviceInfo.hasSpeaker) nb ++
return nb;
}
Expand Down Expand Up @@ -95,6 +96,11 @@ Application {
height: DeviceInfo.hasSpeaker ? Dims.h(16) : 0
clip: true
}
ListItem {
title: qsTr("Units")
iconName: "ios-speedometer-outline"
onClicked: layerStack.push(unitsLayer)
}
ListItem {
title: qsTr("Wallpaper")
iconName: "ios-images-outline"
Expand Down
1 change: 1 addition & 0 deletions resources.qrc
Expand Up @@ -8,6 +8,7 @@
<file>BluetoothPage.qml</file>
<file>BrightnessPage.qml</file>
<file>SoundPage.qml</file>
<file>UnitsPage.qml</file>
<file>WallpaperPage.qml</file>
<file>WatchfacePage.qml</file>
<file>USBPage.qml</file>
Expand Down

0 comments on commit 3885e15

Please sign in to comment.