List of days of week starts with monday

This commit is contained in:
Stefan Persson 2011-02-07 08:17:18 +00:00
parent d539461b84
commit 4a7af70009
3 changed files with 17 additions and 2 deletions

View file

@ -443,7 +443,8 @@ Rectangle{
}
function getTickedImageSource(index){
print("GETTING TICKED");
//print("GETTING TICKED");
index = Scripts.getOffsetWeekday(index);
if(pointRect.deviceRow.parent == undefined || pointRect.deviceRow.parent.parent == undefined){ //to get rid of warnings on initialization
print("UNDEFINED, should only be in beginning");
return "unticked.png";
@ -466,6 +467,7 @@ Rectangle{
}
function toggleTickedWeekDay(index){
index = Scripts.getOffsetWeekday(index);
var originalPoint = pointRect;
if(pointRect.parentPoint != undefined){
originalPoint = pointRect.parentPoint;

View file

@ -609,7 +609,7 @@
//anchors.fill: parent
anchors.left: tickBox.right
anchors.leftMargin: 10
text: Scripts.weekday_name_array[index] //TODO start on monday
text: Scripts.getOffsetWeekdayName(index)
}
}
}

View file

@ -427,6 +427,19 @@ function getDayIndexForDayOfWeek(dayOfWeek){
return dayOfWeek;
}
function getOffsetWeekdayName(index){
index = getOffsetWeekday(index);
return weekday_name_array[index];
}
function getOffsetWeekday(index){
index = index + 1;
if(index == weekday_name_array.length){
index = 0;
}
return index;
}
//TODO move, pragma safe:
function getFirstPointWidth(deviceRow){
var pointList = deviceRow.children; //TODO should really try to avoid using "children"... make own list instead?