Warning, /maui/era/src/controls/DigitalClock.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.0
0002 import QtQuick.Controls 2.15
0003 import org.mauikit.controls 1.3 as Maui
0004
0005 Control
0006 {
0007 id : clock
0008
0009
0010 spacing: Maui.Style.space.medium
0011 implicitWidth: _layout.implicitWidth + leftPadding + rightPadding
0012 implicitHeight: _layout.implicitHeight + topPadding + bottomPadding
0013
0014 font.bold: true
0015 font.weight: Font.Black
0016 font.pointSize: Maui.Style.fontSizes.big
0017 font.family: "Open 24 Display St"
0018 font.letterSpacing: Maui.Style.space.big
0019 padding: Maui.Style.space.big
0020 property string city: i18n("Local")
0021 property int hours
0022 property int minutes
0023 property int seconds
0024 property real shift
0025 property bool night: false
0026 property bool internationalTime: true //Unset for local time
0027
0028 function timeChanged() {
0029 var date = new Date;
0030 hours = internationalTime ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours()
0031 night = ( hours < 7 || hours > 19 )
0032 minutes = internationalTime ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes()
0033 seconds = date.getUTCSeconds();
0034 }
0035
0036 function formatTime(i)
0037 {
0038 if (i < 10) {
0039 i = "0" + i;
0040 }
0041 return i;
0042 }
0043
0044 background: Rectangle
0045 {
0046 color: Maui.Theme.alternateBackgroundColor
0047 radius: Maui.Style.radiusV
0048 }
0049
0050 Timer {
0051 interval: 100; running: true; repeat: true;
0052 onTriggered: clock.timeChanged()
0053 }
0054
0055
0056 contentItem: Column
0057 {
0058 spacing: clock.spacing
0059 id: _layout
0060 Label
0061 {
0062 font: clock.font
0063 text: formatTime(hours) + ":" + formatTime(minutes)
0064 }
0065
0066 Maui.ListItemTemplate
0067 {
0068
0069 id: cityLabel
0070 width: parent.width
0071 label1.font.family: "Monospace"
0072 label1.text: clock.city
0073 label3.text: "+"+clock.shift+ "HRS"
0074 label2.text: "1/11/11"
0075 // font: clock.font
0076 }
0077 }
0078 }