Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[DateTime] Add datatime plugin
  • Loading branch information
neochapay committed Jul 9, 2019
1 parent ef2dded commit 6ba472b
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 1 deletion.
11 changes: 10 additions & 1 deletion glacier-settings.pro
Expand Up @@ -64,6 +64,10 @@ displayplugin.files = qml/plugins/display/display.qml\
qml/plugins/display/display.svg
displayplugin.path = /usr/share/glacier-settings/qml/plugins/display

datetimeplugin.files = qml/plugins/datetime/*.qml \
qml/plugins/datetime/*.svg
datetimeplugin.path = /usr/share/glacier-settings/qml/plugins/datetime

wifiplugin.files = qml/plugins/wifi/wifi.qml\
qml/plugins/wifi/WifiSettings.qml\
qml/plugins/wifi/WifiStatus.qml\
Expand Down Expand Up @@ -101,6 +105,7 @@ pluginconfigs.files = qml/plugins/example/example.json \
qml/plugins/bluez4/bluez4.json \
qml/plugins/developermode/developermode.json \
qml/plugins/display/display.json \
qml/plugins/datetime/datetime.json \
qml/plugins/wifi/wifi.json \
qml/plugins/gps/gps.json\
qml/plugins/language/language.json\
Expand All @@ -121,6 +126,7 @@ INSTALLS += target \
bluez4plugin \
developermodeplugin \
displayplugin \
datetimeplugin \
wifiplugin \
gpsplugin\
languageplugin \
Expand Down Expand Up @@ -162,4 +168,7 @@ DISTFILES += \
qml/plugins/wifi/SavedStatus.qml \
qml/plugins/wifi/NetworkDelegate.qml \
qml/components/SettingsService.qml \
data/org.nemomobile.qmlsettings.service
data/org.nemomobile.qmlsettings.service \
qml/plugins/datetime/datetime.qml \
qml/plugins/datetime/datetime.json \
qml/plugins/datetime/datetime.svg
5 changes: 5 additions & 0 deletions qml/plugins/datetime/datetime.json
@@ -0,0 +1,5 @@
{
"path": "datetime",
"category": "Personalization",
"title": "Date and time"
}
162 changes: 162 additions & 0 deletions qml/plugins/datetime/datetime.qml
@@ -0,0 +1,162 @@
/*
* Copyright (C) 2018-2019 Chupligin Sergey <neochapay@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
import QtQuick 2.6

import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0

import org.nemomobile.systemsettings 1.0
import org.nemomobile.configuration 1.0

import "../../components"

Page {
id: listViewPage

property date currentDate: new Date()

headerTools: HeaderToolsLayout {
showBackButton: true;
title: qsTr("Date and time")
}

property var monthNames: ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
]

DateTimeSettings{
id: dateTimeSettings
}

ListModel{
id: timeFormatModel
ListElement{name: qsTr("12h")}
ListElement{name: qsTr("24h")}
}

ConfigurationValue {
id: timeFormat
key: "/home/glacier/timeFormat"
defaultValue: 1 //24H
}

Component.onCompleted: {
timeFormatRoller.currentIndex = timeFormat.value
}


SettingsColumn{
Row{
id: dateView
width: parent.width

TimePicker{
id: timePicker
height: width
width: listViewPage.width/2

hours: currentDate.getHours()
minutes: currentDate.getMinutes()
}

Column{
id: dateLabel
width: parent.width/2

Text{
id: dayLabel
text: currentDate.getDate()
width: parent.width
height: timePicker.height/3
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraLarge
color: Theme.accentColor
}

Text {
id: monthLabel
text: monthNames[currentDate.getMonth()]
width: parent.width
height: timePicker.height/3
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: Theme.fontSizeExtraLarge
color: Theme.accentColor
}

Text {
id: yearLabel
text: currentDate.getFullYear()
width: parent.width
height: timePicker.height/3
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraLarge
color: Theme.accentColor
}
}
}

GlacierRoller {
id: timeFormatRoller
width: parent.width

clip: true
model: timeFormatModel
label: qsTr("Time format")
delegate:GlacierRollerItem{
Text{
height: timeFormatRoller.itemHeight
verticalAlignment: Text.AlignVCenter
text: name
color: Theme.textColor
font.pixelSize: Theme.fontSizeMedium
font.bold: (timeFormatRoller.activated && timeFormatRoller.currentIndex === index)
}
}

onCurrentIndexChanged: {
if(timeFormat.value != currentIndex) {
timeFormat.value = currentIndex
}
}

}

CheckBox{
id: automaticTimeUpdateCheckbox
text: qsTr("Automatic time update")
checked: dateTimeSettings.automaticTimeUpdate
onClicked:{
dateTimeSettings.automaticTimeUpdate = automaticTimeUpdateCheckbox.checked
}
}

CheckBox{
id: automaticTimezoneUpdateCheckbox
text: qsTr("Automatic time zone update")
checked: dateTimeSettings.automaticTimezoneUpdate
onClicked:{
dateTimeSettings.automaticTimezoneUpdate = automaticTimezoneUpdateCheckbox.checked
}
}

}
}
2 changes: 2 additions & 0 deletions qml/plugins/datetime/datetime.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6ba472b

Please sign in to comment.