diff --git a/apps/lcars/ChangeLog b/apps/lcars/ChangeLog index 08b3b3d4d..fcd817015 100644 --- a/apps/lcars/ChangeLog +++ b/apps/lcars/ChangeLog @@ -16,4 +16,4 @@ 0.16: Improved stability. Wind can now be shown. 0.17: Settings for mph/kph and other minor improvements. 0.18: Fullscreen mode can now be enabled or disabled in the settings. -0.19: Use widtmr for alarm functionality instead of own implementation. \ No newline at end of file +0.19: Use qalarm for alarm functionality instead of own implementation. \ No newline at end of file diff --git a/apps/lcars/lcars.app.js b/apps/lcars/lcars.app.js index 6ffc78ca7..94159a74e 100644 --- a/apps/lcars/lcars.app.js +++ b/apps/lcars/lcars.app.js @@ -1,6 +1,7 @@ const SETTINGS_FILE = "lcars.setting.json"; const locale = require('locale'); -const storage = require('Storage') +const storage = require('Storage'); +const qalarm = require('qalarm'); let settings = { alarm: -1, dataRow1: "Steps", @@ -563,52 +564,26 @@ function getWeather(){ /* * Handle alarm */ -function isWidtmrAvailable(){ - try { - WIDGETS["widtmr"].isStarted(); - return true; - } catch(e) { - // In case the widtmr widget is not installed, the timer can - // not be used... - return false; - } -} - function isAlarmEnabled(){ - if(!isWidtmrAvailable()){ - return false; - } - - return WIDGETS["widtmr"].isStarted(); + return qalarm.isTimerStarted("lcars"); } function getAlarmMinutes(){ - if(!isWidtmrAvailable()){ - return "-"; - } - return WIDGETS["widtmr"].getRemainingMinutes(); + return qalarm.getTimerMin("lcars"); } function increaseAlarm(){ - if(!isWidtmrAvailable()){ - return; - } - - // Set to zero if alarm was disabled before - if(!isAlarmEnabled()){ - WIDGETS["widtmr"].setTimer(0); - } - - WIDGETS["widtmr"].increaseTimer(5); - WIDGETS["widtmr"].setStarted(true); + var mins = qalarm.getTimerMin("lcars")+5; + qalarm.deleteTimer("lcars"); + qalarm.editTimer("lcars", 0, mins, 0); } function decreaseAlarm(){ - if(!isWidtmrAvailable()){ - return; + var mins = qalarm.getTimerMin("lcars")-5; + qalarm.deleteTimer("lcars"); + if(mins > 0){ + qalarm.editTimer("lcars", 0, mins, 0); } - - WIDGETS["widtmr"].decreaseTimer(5); } diff --git a/apps/lcars/metadata.json b/apps/lcars/metadata.json index 5efd29e7c..b5d8e0a52 100644 --- a/apps/lcars/metadata.json +++ b/apps/lcars/metadata.json @@ -5,7 +5,7 @@ "icon": "lcars.png", "version":"0.19", "readme": "README.md", - "dependencies": {"widtmr":"app"}, + "dependencies": {"qalarm":"app"}, "supports": ["BANGLEJS2"], "description": "Library Computer Access Retrieval System (LCARS) clock.", "type": "clock", diff --git a/apps/notanalog/ChangeLog b/apps/notanalog/ChangeLog index bb5297476..3d6f1fce8 100644 --- a/apps/notanalog/ChangeLog +++ b/apps/notanalog/ChangeLog @@ -1,4 +1,4 @@ 0.01: Launch app. 0.02: 12k steps are 360 degrees - improves readability of steps. 0.03: Battery improvements through sleep (no minute updates) and partial updates of drawing. -0.04: Use widtmr widget for timer instead of own alarm implementation. \ No newline at end of file +0.04: Use qalarm for timer instead of own alarm implementation. \ No newline at end of file diff --git a/apps/notanalog/metadata.json b/apps/notanalog/metadata.json index 5a0ddbaf0..25cfa706d 100644 --- a/apps/notanalog/metadata.json +++ b/apps/notanalog/metadata.json @@ -7,7 +7,7 @@ "readme": "README.md", "supports": ["BANGLEJS2"], "description": "An analog watch face for people that can not read analog watch faces.", - "dependencies": {"widtmr":"app"}, + "dependencies": {"qalarm":"app"}, "type": "clock", "tags": "clock", "screenshots": [ diff --git a/apps/notanalog/notanalog.app.js b/apps/notanalog/notanalog.app.js index 5e56d6f6a..f51fc23fd 100644 --- a/apps/notanalog/notanalog.app.js +++ b/apps/notanalog/notanalog.app.js @@ -5,6 +5,7 @@ const locale = require('locale'); const storage = require('Storage') const SETTINGS_FILE = "notanalog.setting.json"; +const qalarm = require('qalarm'); let settings = { alarm: -1, }; @@ -392,52 +393,26 @@ function queueDraw() { /* * Handle alarm */ -function isWidtmrAvailable(){ - try { - WIDGETS["widtmr"].isStarted(); - return true; - } catch(e) { - // In case the widtmr widget is not installed, the timer can - // not be used... - return false; - } -} - function isAlarmEnabled(){ - if(!isWidtmrAvailable()){ - return false; - } - - return WIDGETS["widtmr"].isStarted(); + return qalarm.isTimerStarted("lcars"); } function getAlarmMinutes(){ - if(!isWidtmrAvailable()){ - return "-"; - } - return WIDGETS["widtmr"].getRemainingMinutes(); + return qalarm.getTimerMin("lcars"); } function increaseAlarm(){ - if(!isWidtmrAvailable()){ - return; - } - - // Set to zero if alarm was disabled before - if(!isAlarmEnabled()){ - WIDGETS["widtmr"].setTimer(0); - } - - WIDGETS["widtmr"].increaseTimer(5); - WIDGETS["widtmr"].setStarted(true); + var mins = qalarm.getTimerMin("lcars")+5; + qalarm.deleteTimer("lcars"); + qalarm.editTimer("lcars", 0, mins, 0); } function decreaseAlarm(){ - if(!isWidtmrAvailable()){ - return; + var mins = qalarm.getTimerMin("lcars")-5; + qalarm.deleteTimer("lcars"); + if(mins > 0){ + qalarm.editTimer("lcars", 0, mins, 0); } - - WIDGETS["widtmr"].decreaseTimer(5); } function feedback(){ diff --git a/apps/qalarm/lib.js b/apps/qalarm/lib.js index d75ce4204..6d186d190 100644 --- a/apps/qalarm/lib.js +++ b/apps/qalarm/lib.js @@ -1,5 +1,3 @@ -Bangle.loadWidgets(); - let alarms = require("Storage").readJSON("qalarm.json", 1) || []; /**