~qqworini/ubuntu-rssreader-app/reboot-add-cmake

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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
  license GPL v3 ...........

  description of this file:
  a page for viewing a user selected RSS feed ;

*/

import QtQuick 2.3
import QtQuick.XmlListModel 2.0
import Ubuntu.Components 1.1
import Ubuntu.Components.ListItems 1.0 as ListItem
import Ubuntu.Components.Popups 1.0
import "./dateutils.js" as DateUtils
import "databasemodule_v2.js" as DB

Popover {
    id: readingOptionsPopover

    Component.onCompleted: {
        fontSizeSlider.value = optionsKeeper.fontSize()
        buttonRow.updateButtonsState()
    }

    Column {
        id: contentColumn

        anchors {
            left: parent.left
            top: parent.top
            right: parent.right
        }

        ListItem.Empty {
            Row {
                id: buttonRow

                property bool useDark: false
                spacing: units.gu(2)
                anchors.centerIn: parent
                Button {
                    text: i18n.tr("Dark")
                    width: units.gu(14)
                    gradient: buttonRow.useDark ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
                    onClicked: {
                        optionsKeeper.setUseDarkTheme(true)
                        buttonRow.updateButtonsState()
                    }
                }

                Button {
                    text: i18n.tr("Light")
                    width: units.gu(14)
                    gradient: buttonRow.useDark ? UbuntuColors.greyGradient : UbuntuColors.orangeGradient
                    onClicked: {
                        optionsKeeper.setUseDarkTheme(false)
                        buttonRow.updateButtonsState()
                    }
                }

                function updateButtonsState() {
                    useDark = optionsKeeper.useDarkTheme()
                }
            }
        }

        ListItem.Empty {
            showDivider: false
            Label {
                id: lblLess

                text: "A"
                fontSize: "small"
                color: "black" // TODO TEMP
                anchors {
                    left: parent.left
                    leftMargin: units.gu(2)
                    verticalCenter: parent.verticalCenter
                }
            }

            Slider {
                id: fontSizeSlider

                anchors {
                    right: lblMore.left
                    rightMargin: units.gu(1)
                    left: lblLess.right
                    leftMargin: units.gu(1)
                    verticalCenter: parent.verticalCenter
                }

                minimumValue: 0
                maximumValue: 2

                onValueChanged: {
                    var res
                    if (value < maximumValue / 3)
                        res = 0
                    else if (value < maximumValue / 3 * 2)
                        res = 1
                    else res = 2

                    optionsKeeper.setFontSize(res)
                }

                function formatValue(v) {
                    if (v < maximumValue / 3)
                        return i18n.tr("Small")
                    else if (v < maximumValue / 3 * 2)
                        return i18n.tr("Mid")
                    else return i18n.tr("Large")
                }
            } // SLider

            Label {
                id: lblMore

                text: "A"
                fontSize: "large"
                color: "black" // TODO TEMP
                anchors {
                    right: parent.right
                    rightMargin: units.gu(2)
                    verticalCenter: parent.verticalCenter
                }
            }
        } // ListItem.Empty
    }
}