Skip to content

Commit

Permalink
Merge pull request AsteroidOS#3 from Huntereb/master
Browse files Browse the repository at this point in the history
New directory structure, License information added, retro-lcd watchface added
  • Loading branch information
FlorentRevest authored Jun 4, 2017
2 parents b7de3e0 + dc2d65d commit 66dc81b
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 1 deletion.
File renamed without changes
Binary file added .thumbnails/retro-lcd.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,16 @@ AsteroidOS it can eventually be merged in the default set of asteroid-launcher.

| Watchface | Title | Creator |
|---|---|---|
| ![thumbnail](https://github.com/AsteroidOS/unofficial-watchfaces/raw/master/001-analog-precision.jpg) | [001-analog-precision](https://github.com/AsteroidOS/unofficial-watchfaces/blob/master/001-analog-precision.qml) | [Mario Kicherer](mailto:dev@kicherer.org) |
| ![thumbnail](.thumbnails/analog-precision.jpg) | [analog-precision](analog-precision/usr/share/asteroid-launcher/watchfaces/analog-precision.qml) | [Mario Kicherer](mailto:dev@kicherer.org) |
| ![thumbnail](.thumbnails/retro-lcd.jpg) | [retro-lcd](retro-lcd/usr/share/asteroid-launcher/watchfaces/retro-lcd-24hr.qml) | [Huntereb](mailto:Huntereb@lewd.pics) |

### Installation ###
Enable ADB USB mode in settings and push the usr folder to your root directory.

`adb push usr /`

### Licenses ###

| File | License |
| --- | --- |
| retro-lcd - [Digital-7 (Mono)](retro-lcd/usr/share/fonts/digital-7%20(mono).ttf) | The font "Digital-7" is freeware for home use and was created by [Sizenko Alexander](http://www.styleseven.com). |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import QtQuick 2.1

Canvas {
id: rootitem
anchors.fill: parent
contextType: "2d"
antialiasing: true
smooth: true

onPaint: {
var ctx = getContext("2d");
ctx.reset();
ctx.fillStyle = "#252525";
ctx.textAlign = "right";
ctx.textBaseline = 'middle';
var centerX = rootitem.width * 0.5;
var centerY = rootitem.height * 0.5;

var ourTime = wallClock.time.getHours();
var ourMins = wallClock.time.getMinutes();
var ourSecs = wallClock.time.getSeconds();
var ourDOW = Qt.formatDate(wallClock.time, "ddd").substr(0, 2);
var ourDay = Qt.formatDate(wallClock.time, "dd").substr(0, 2).replace("0", " ");
var amPm = "AM";

function fontSizeCalc(ourSize) {
var ratio = ourSize / 280;
var size = rootitem.width * ratio;
return size|0;
}

if (ourTime >= 12) {
amPm = "PM";
ourTime -= 12;
}

if (ourTime == 0) ourTime = 12;

if (ourMins < 10) ourMins = "0" + ourMins;
if (ourSecs < 10) ourSecs = "0" + ourSecs;

var fontFamily = "'Digital-7 Mono'";
ctx.font = "50 " + fontSizeCalc(62) + "px " + fontFamily;
ctx.fillText(ourTime, centerX - (centerX * 0.153), centerY + (centerY * 0.05));

ctx.font = "50 " + fontSizeCalc(62) + "px " + fontFamily;
ctx.fillText(ourMins, centerX + (centerX * 0.33), centerY + (centerY * 0.05));

ctx.font = "50 " + fontSizeCalc(42) + "px " + fontFamily;
ctx.fillText(ourSecs, centerX + (centerX * 0.643), centerY + (centerY * 0.123));

ctx.font = "50 " + fontSizeCalc(30) + "px " + fontFamily;
ctx.fillText(ourDOW, centerX + (centerX * 0.06), centerY - (centerY * 0.22));

ctx.font = "50 " + fontSizeCalc(35) + "px " + fontFamily;
ctx.fillText(ourDay, centerX + (centerX * 0.62), centerY - (centerY * 0.21));

ctx.textAlign = "center";
ctx.font = "50 " + fontSizeCalc(46) + "px " + "Roboto";
ctx.fillText(":", centerX - (centerX * 0.113), centerY + (centerY * 0.15));

if (amPm == "PM") {
ctx.textAlign = "center";
ctx.font = "bold " + fontSizeCalc(12) + "px " + "Roboto";
ctx.fillText(amPm, centerX - (centerX * 0.55), centerY - (centerY * 0.09));
}
}

Connections {
target: wallClock
onTimeChanged: rootitem.requestPaint()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import QtQuick 2.1

Canvas {
id: rootitem
anchors.fill: parent
contextType: "2d"
antialiasing: true
smooth: true

onPaint: {
var ctx = getContext("2d");
ctx.reset();
ctx.fillStyle = "#252525";
ctx.textAlign = "right";
ctx.textBaseline = 'middle';
var centerX = rootitem.width * 0.5;
var centerY = rootitem.height * 0.5;

var ourTime = wallClock.time.getHours();
var ourMins = wallClock.time.getMinutes();
var ourSecs = wallClock.time.getSeconds();
var ourDOW = Qt.formatDate(wallClock.time, "ddd").substr(0, 2);
var ourDay = Qt.formatDate(wallClock.time, "dd").substr(0, 2).replace("0", " ");

function fontSizeCalc(ourSize) {
var ratio = ourSize / 280;
var size = rootitem.width * ratio;
return size|0;
}

if (ourMins < 10) ourMins = "0" + ourMins;
if (ourSecs < 10) ourSecs = "0" + ourSecs;

var fontFamily = "'Digital-7 Mono'";
ctx.font = "50 " + fontSizeCalc(62) + "px " + fontFamily;
ctx.fillText(ourTime, centerX - (centerX * 0.153), centerY + (centerY * 0.05));

ctx.font = "50 " + fontSizeCalc(62) + "px " + fontFamily;
ctx.fillText(ourMins, centerX + (centerX * 0.33), centerY + (centerY * 0.05));

ctx.font = "50 " + fontSizeCalc(42) + "px " + fontFamily;
ctx.fillText(ourSecs, centerX + (centerX * 0.643), centerY + (centerY * 0.123));

ctx.font = "50 " + fontSizeCalc(30) + "px " + fontFamily;
ctx.fillText(ourDOW, centerX + (centerX * 0.06), centerY - (centerY * 0.22));

ctx.font = "50 " + fontSizeCalc(35) + "px " + fontFamily;
ctx.fillText(ourDay, centerX + (centerX * 0.62), centerY - (centerY * 0.21));

ctx.textAlign = "center";
ctx.font = "50 " + fontSizeCalc(46) + "px " + "Roboto";
ctx.fillText(":", centerX - (centerX * 0.113), centerY + (centerY * 0.15));

}

Connections {
target: wallClock
onTimeChanged: rootitem.requestPaint()
}
}
Binary file added retro-lcd/usr/share/fonts/digital-7 (mono).ttf
Binary file not shown.

0 comments on commit 66dc81b

Please sign in to comment.