2
* I Quit! is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; version 3.
6
* I Quit! is distributed in the hope that it will be useful,
7
* but WITHOUT ANY WARRANTY; without even the implied warranty of
8
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
* GNU General Public License for more details.
11
* You should have received a copy of the GNU General Public License
12
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
import QtQuick.Layouts 1.1
17
import Ubuntu.Components 1.3
18
import Ubuntu.Components.Popups 1.0
19
import Ubuntu.Components.ListItems 1.3
20
import Ubuntu.Components.Pickers 1.0
22
//******************************************************ADDITIONS PAGE**************************************
27
title: i18n.tr("ADDITIONS")
31
contentHeight: parent.height
32
//contentHeight: colG1.height
37
top: addPage.header.bottom
41
fillMode: Image.Stretch
43
source: "..//assets/oops.png"
55
font.pixelSize: FontUtils.sizeToPixels("medium")
56
text: i18n.tr("You can record any cravings you have succumbed to here. \n THIS WILL RESET THE FIRST FOUR COUNTERS ON THE PROGRESS PAGE")
57
wrapMode: Text.WordWrap
61
font.pixelSize: FontUtils.sizeToPixels("medium")
62
text: if (additions.text == 0) {
63
i18n.tr("Since quitting on ") + Qt.formatDateTime(d1,"ddd dd MMMM yyyy") + i18n.tr(", you have succeeded in your goal to completely quit. Congratulations and keep up the good work!")
65
i18n.tr("Since quitting on ") + Qt.formatDateTime(d1,"ddd dd MMMM yyyy") + i18n.tr(", you have smoked ") + i18n.tr("%1 cigarette", "%1 cigarettes", additions.text).arg(additions.text) + i18n.tr(". The last one was on ")+ Qt.formatDateTime(d8,"ddd dd MMMM yyyy")
67
wrapMode: Text.WordWrap
79
placeholderText: i18n.tr("Enter Cigarettes You Shouldn't Have Smoked")
80
inputMethodHints: Qt.ImhFormattedNumbersOnly
81
validator: DoubleValidator {notation: DoubleValidator.StandardNotation}
84
addText.text = (Number(additions.text) + Number(succumbed.text))
101
text: i18n.tr("Enter the date, followed by the time")
103
width: colG1.width / 2 - units.gu(1)
105
id: popoverComponent3
110
minimum: "2010-01-01T00:00:00"
112
pickerDate3.text = (Qt.formatDateTime(datePicker3.date, 'yyyy-MM-dd'));
120
color: UbuntuColors.orange
121
anchors.centerIn: parent
122
text: i18n.tr("Date Picker")
123
onClicked: PopupUtils.open(popoverComponent3, popoverButton3)
127
width: colG1.width / 2 - units.gu(1)
129
id: popoverComponent4
135
mode: "Hours|Minutes"
137
pickerTime3.text = (Qt.formatDateTime(datePicker4.date, 'hh:mm:ss'));
145
color: UbuntuColors.orange
146
anchors.centerIn: parent
147
text: i18n.tr("Time Picker")
148
onClicked: PopupUtils.open(popoverComponent4, popoverButton4)
153
color:UbuntuColors.green
154
onClicked: PopupUtils.close(dialogue)
161
color:UbuntuColors.red
162
text: i18n.tr("Click to enter date / time manually")
163
onClicked: PopupUtils.open(dialog)
182
text: if (pickerDate3.text == "") {
185
pickerDate3.text + "T" + pickerTime3.text
189
// End of New Section
197
color: UbuntuColors.green
199
text: i18n.tr("Save")
200
onClicked: if (addText.text == "") {
202
function saveUnits7() {
203
appdata7.contents = {
206
appdata8.contents = {
212
function saveUnits8() {
213
appdata7.contents = {
214
"additions":addText.text
216
appdata8.contents = {
217
"lastdate":pickerDateTime3.text
226
title: "Confirm Reset"
229
text: i18n.tr("Are you certain that you wish to reset ALL counters? This will set your start date to now, and clear any 'additional' cigarettes you may have smoked")
232
color: UbuntuColors.green
235
function saveUnits2() {
236
appdata1.contents = {
237
"stopdate":pickerDateTime3.text
239
appdata7.contents = {
242
appdata8.contents = {
245
PopupUtils.close(dialogue2)
247
onClicked: page0.pageStack.removePages(Qt.resolvedUrl("Additions.qml"), page0)
252
color: UbuntuColors.red
253
onClicked: PopupUtils.close(dialogue2)
260
color: UbuntuColors.red
261
text: i18n.tr("Click to reset all counters")
262
onClicked: PopupUtils.open(dialog2)
266
font.pixelSize: FontUtils.sizeToPixels("medium")
267
text: i18n.tr("If you are finding it difficult, why not try some of the online resources listed in the ") + i18n.tr("<a href='Advice.qml'>Advice Page?</a>") + i18n.tr(" Alternatively, sign up to one of the no-smoking groups that are being run.")
268
wrapMode: Text.WordWrap
269
onLinkActivated: page0.pageStack.addPageToNextColumn (page0, Qt.resolvedUrl("Advice.qml"))
274
//******************************************************END OF ADDITIONS PAGE*******************************