~rick-rickspencer3/+junk/flash2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import QtQuick 2.0
import Ubuntu.Components 1.1
import Ubuntu.Components.ListItems 1.0 as ListItem
import Ubuntu.Content 1.1
import Ubuntu.Components.Popups 1.0
import "components"

MainView {
    id: mainView
    objectName: "mainView"
    applicationName: "flash.rickspencer3"
    useDeprecatedToolbar: false

    width: units.gu(50)
    height: units.gu(75)
    Component.onCompleted: mainStack.push(Qt.resolvedUrl("components/CardsListPage.qml"))
    PageStack {
        id: mainStack

     }

    CardsDatabase{
        id: cardsDatabase
    }
    function hoursToString(hours) {
        if(hours < 0) {
            return i18n.tr("Never")
        }

        if(hours <= 24){
            return i18n.tr("%1 hour ago","%1 hours ago",  hours).arg(hours)
        }
        if(hours <= 48) {
            return i18n.tr("Yesterday")
        }
        else{
            var days = Math.floor(hours/24)
            return i18n.tr("%1 days ago", days).arg(days)
        }
    }
}