Skip to content

Commit

Permalink
Progress FollowMyVote#19: Add options for contest expiration
Browse files Browse the repository at this point in the history
Need to replace this with a proper date/time picker, but neither Quick
nor V-Play has one of these, so we'll need to make our own or snag
someone else's
  • Loading branch information
nathanielhourt committed Feb 9, 2016
1 parent e72c90b commit feb2dae
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion VotingApp/qml/CreateContestPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4 as Controls
import QtQuick.Controls.Styles 1.4 as ControlStyles
import QtQuick.Extras 1.4 as Extras
import Qt.labs.controls 1.0

import VPlayApps 1.0
Expand Down Expand Up @@ -94,11 +95,43 @@ Page {

onClicked: purchaseRequest.contestants.append({"name": "Joe", "description": "Joe is a candidate."})
}
Row {
spacing: window.dp(8)

Binding {
target: purchaseRequest
property: "expiration"
value: {
if (contestEndsTime.currentIndex === 0)
return new Date(0)

var date = new Date()
if (contestEndsTime.currentIndex === 1)
date.setDate(date.getDate() + 1)
else if (contestEndsTime.currentIndex === 2)
date.setDate(date.getDate() + 7)
else if (contestEndsTime.currentIndex === 3)
date.setMonth(date.getMonth() + 1)
return date
}
}

AppText {
text: qsTr("Contest Ends")
}
Controls.ComboBox {
id: contestEndsTime
width: window.dp(100)
model: [qsTr("never"), qsTr("in a day"), qsTr("in a week"), qsTr("in a month")]
style: ControlStyles.ComboBoxStyle {
font: weightCoinLabel.font
}
}
}
}
}
}
}

PageControl {
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
Expand Down

0 comments on commit feb2dae

Please sign in to comment.