Changeset View
Changeset View
Standalone View
Standalone View
applets/binary-clock/package/contents/ui/BinaryClock.qml
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 46 | // Layout.maximumHeight: vertical ? Layout.minimumHeight : Infinity | |||
---|---|---|---|---|---|
56 | 56 | | |||
57 | property int hours:root.hours | 57 | property int hours:root.hours | ||
58 | property int minutes:root.minutes | 58 | property int minutes:root.minutes | ||
59 | property int seconds:root.seconds | 59 | property int seconds:root.seconds | ||
60 | 60 | | |||
61 | property bool showOffLeds: plasmoid.configuration.showOffLeds | 61 | property bool showOffLeds: plasmoid.configuration.showOffLeds | ||
62 | property bool showGrid: plasmoid.configuration.showGrid | 62 | property bool showGrid: plasmoid.configuration.showGrid | ||
63 | 63 | | |||
64 | property int base: plasmoid.configuration.showBcdFormat? 10:16 | ||||
65 | | ||||
64 | property int dots: showSeconds? 6:4 | 66 | property int dots: showSeconds? 6:4 | ||
65 | 67 | | |||
66 | property color onColor: plasmoid.configuration.useCustomColorForActive?plasmoid.configuration.customColorForActive: theme.textColor | 68 | property color onColor: plasmoid.configuration.useCustomColorForActive?plasmoid.configuration.customColorForActive: theme.textColor | ||
67 | property color offColor: plasmoid.configuration.useCustomColorForInactive?plasmoid.configuration.customColorForInactive:Qt.rgba(onColor.r,onColor.g,onColor.b,0.4) | 69 | property color offColor: plasmoid.configuration.useCustomColorForInactive?plasmoid.configuration.customColorForInactive:Qt.rgba(onColor.r,onColor.g,onColor.b,0.4) | ||
68 | property color gridColor: plasmoid.configuration.useCustomColorForGrid?plasmoid.configuration.customColorForGrid:Qt.rgba(onColor.r,onColor.g,onColor.b,0.6) | 70 | property color gridColor: plasmoid.configuration.useCustomColorForGrid?plasmoid.configuration.customColorForGrid:Qt.rgba(onColor.r,onColor.g,onColor.b,0.6) | ||
69 | 71 | | |||
70 | property real dotSize: Math.min((height-5*units.smallSpacing)/4,(width-(dots+1)*units.smallSpacing)/dots) | 72 | property real dotSize: Math.min((height-5*units.smallSpacing)/4,(width-(dots+1)*units.smallSpacing)/dots) | ||
71 | property real displayTop: (height - 4*dotSize-3*units.smallSpacing) /2 | 73 | property real displayTop: (height - 4*dotSize-3*units.smallSpacing) /2 | ||
72 | property real displayLeft: (width - dots*dotSize-(dots-1)*units.smallSpacing) /2 | 74 | property real displayLeft: (width - dots*dotSize-(dots-1)*units.smallSpacing) /2 | ||
73 | 75 | | |||
74 | MouseArea { | 76 | MouseArea { | ||
75 | id: mouseArea | 77 | id: mouseArea | ||
76 | anchors.fill: parent | 78 | anchors.fill: parent | ||
77 | hoverEnabled: true | 79 | hoverEnabled: true | ||
78 | onClicked: plasmoid.expanded = !plasmoid.expanded | 80 | onClicked: plasmoid.expanded = !plasmoid.expanded | ||
79 | } | 81 | } | ||
80 | 82 | | |||
81 | 83 | | |||
82 | /*hours*/ | 84 | /*hours*/ | ||
83 | DotColumn { | 85 | DotColumn { | ||
84 | x:displayLeft | 86 | x:displayLeft | ||
85 | y:displayTop | 87 | y:displayTop | ||
86 | val:hours | 88 | val:hours/base | ||
87 | startbit:4 | | |||
88 | } | 89 | } | ||
89 | DotColumn { | 90 | DotColumn { | ||
90 | x:displayLeft+(dotSize+units.smallSpacing) | 91 | x:displayLeft+(dotSize+units.smallSpacing) | ||
91 | y:displayTop | 92 | y:displayTop | ||
92 | val:hours | 93 | val:hours%base | ||
93 | startbit:0 | | |||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | 96 | | |||
97 | /*minutes*/ | 97 | /*minutes*/ | ||
98 | DotColumn { | 98 | DotColumn { | ||
99 | x:displayLeft+(dotSize+units.smallSpacing)*2 | 99 | x:displayLeft+(dotSize+units.smallSpacing)*2 | ||
100 | y:displayTop | 100 | y:displayTop | ||
101 | val:minutes | 101 | val:minutes/base | ||
102 | startbit:4 | | |||
103 | } | 102 | } | ||
104 | DotColumn { | 103 | DotColumn { | ||
105 | x:displayLeft+(dotSize+units.smallSpacing)*3 | 104 | x:displayLeft+(dotSize+units.smallSpacing)*3 | ||
106 | y:displayTop | 105 | y:displayTop | ||
107 | val:minutes | 106 | val:minutes%base | ||
108 | startbit:0 | | |||
109 | } | 107 | } | ||
110 | 108 | | |||
111 | /* seconds */ | 109 | /* seconds */ | ||
112 | DotColumn { | 110 | DotColumn { | ||
113 | x:displayLeft+(dotSize+units.smallSpacing)*4 | 111 | x:displayLeft+(dotSize+units.smallSpacing)*4 | ||
114 | y:displayTop | 112 | y:displayTop | ||
115 | val:seconds | 113 | val:seconds/base | ||
116 | startbit:4 | | |||
117 | visible:showSeconds | 114 | visible:showSeconds | ||
118 | } | 115 | } | ||
119 | 116 | | |||
120 | DotColumn { | 117 | DotColumn { | ||
121 | x:displayLeft+(dotSize+units.smallSpacing)*5 | 118 | x:displayLeft+(dotSize+units.smallSpacing)*5 | ||
122 | y:displayTop | 119 | y:displayTop | ||
123 | val:seconds | 120 | val:seconds%base | ||
124 | startbit:0 | | |||
125 | visible:showSeconds | 121 | visible:showSeconds | ||
126 | } | 122 | } | ||
127 | 123 | | |||
128 | Rectangle { | 124 | Rectangle { | ||
129 | x:displayLeft-units.smallSpacing | 125 | x:displayLeft-units.smallSpacing | ||
130 | y:displayTop-units.smallSpacing | 126 | y:displayTop-units.smallSpacing | ||
131 | width:dots*(dotSize+units.smallSpacing)+units.smallSpacing | 127 | width:dots*(dotSize+units.smallSpacing)+units.smallSpacing | ||
132 | height:units.smallSpacing | 128 | height:units.smallSpacing | ||
Show All 14 Lines |