~etherpulse/podbird/bottom_edge

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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright 2015-2016 Podbird Team
 *
 * This file is part of Podbird.
 *
 * Podbird is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * Podbird is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import QtQuick 2.4
import Ubuntu.Components 1.3
import "../components"

Page {
    id: cleanSettingPage

    visible: false

    header: PageHeader {
        title: i18n.tr("Delete older than")
        flickable: cleanup
        StyleHints {
            backgroundColor: podbird.appTheme.background
        }
    }

    ListModel {
        id: cleanupModel
        Component.onCompleted: initialize()
        function initialize() {
            cleanupModel.append({ name: i18n.tr("Never"), value: -1 })
            cleanupModel.append({ name: i18n.tr("%1 day", "%1 days", 7).arg(7), value: 7 })
            cleanupModel.append({ name: i18n.tr("%1 month", "%1 months", 1).arg(1), value: 31 })
            cleanupModel.append({ name: i18n.tr("%1 month", "%1 months", 3).arg(3), value: 90 })
            cleanupModel.append({ name: i18n.tr("%1 month", "%1 months", 6).arg(6), value: 180 })
            cleanupModel.append({ name: i18n.tr("%1 year", "%1 years", 1).arg(1), value: 360 })
        }
    }

    ListView {
        id: cleanup

        currentIndex: -1
        model: cleanupModel
        anchors.fill: parent

        // Required to accomodate the now playing bar being shown in landscape mode which
        // can hide a setting if not for this footer.
        footer: Item {
            width: parent.width
            height: units.gu(8)
        }

        delegate: ListItem {

            ListItemLayout {
                title.text: model.name
                title.color: podbird.appTheme.baseText

                Icon {
                    width: units.gu(2)
                    height: width
                    name: "ok"
                    color: podbird.appTheme.baseText
                    visible: podbird.settings.retentionDays === model.value
                    SlotsLayout.position: SlotsLayout.Trailing
                }
            }

            onClicked: {
                podbird.settings.retentionDays = model.value
            }
        }
    }
}