Fixed results population.

Fixed alignment.
This commit is contained in:
armored-dragon 2024-09-13 16:50:07 -05:00
parent f6985faf59
commit 5b4b9f2bdc
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B
2 changed files with 16 additions and 14 deletions

View file

@ -19,6 +19,7 @@
// FIXME: Recasting vote from closed window does not populate the options.
// FIXME: Sound is inconsistent
// FIXME: Simplify
// FIXME: The results screen is not being cleared properly?
// STYLE ---------------
// FIXME: Camel case
@ -260,6 +261,7 @@
pollStats.winnerName = winnerName;
pollStats.votesCounted = totalVotes;
pollStats.winnerSelected = true;
_emitEvent({type: "poll_sync", poll: poll, pollStats: pollStats});
@ -454,7 +456,7 @@
}
if (message.type == "vote_count") {
_emitEvent({type: "received_vote", pollStats: pollStats});
_emitEvent({type: "received_vote", pollStats: message.pollStats});
}
// Received a ballot
@ -475,8 +477,7 @@
// Winner was broadcasted
if (message.type == "poll_winner") {
pollStats.winnerSelected = true;
_emitEvent({type: "poll_winner", winner: message.winner, rounds: message.rounds, votesCounted: message.votesCounted});
_emitEvent({type: "poll_winner", pollStats: message.pollStats});
}
}

View file

@ -269,13 +269,13 @@ Rectangle {
// Host actions
ColumnLayout {
anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignHCenter
width: parent.width
height: 40
RowLayout {
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignHCenter
// Close poll
Rectangle {
@ -401,6 +401,7 @@ Rectangle {
width: parent.width
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter
ListView {
property int index_selected: -1
@ -597,7 +598,7 @@ Rectangle {
// Client actions
RowLayout {
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignHCenter
visible: !votes_tallied
// Recast vote
@ -627,7 +628,7 @@ Rectangle {
RowLayout {
visible: is_host
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignHCenter
// Preform Election
Rectangle {
@ -726,7 +727,7 @@ Rectangle {
Item {
width: parent.width - 10
anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignHCenter
height: parent.height
clip: true
@ -815,7 +816,6 @@ Rectangle {
Row {
width: parent.width - 10
anchors.horizontalCenter: parent.horizontalCenter
height: parent.height
clip: true
@ -840,7 +840,7 @@ Rectangle {
Text {
Layout.fillWidth: true
text: option
anchors.centerIn: parent
anchors.centerIn: parent // FIXME: QML Does not like this for some reason...
color: "white"
font.pointSize: 14
}
@ -867,7 +867,7 @@ Rectangle {
RowLayout {
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignHCenter
height: parent.height
TextField {
@ -933,9 +933,9 @@ Rectangle {
}
function _populateResults(){
tally_votes_received.text = pollStats.votesReceived;
poll_winner.text = pollStats.winnerName ? pollStats.winnerName : "---";
tally_votes_itterations.text = pollStats.iterations;
tally_votes_counted.text = pollStats.votesCounted;
poll_winner.text = pollStats.winnerSelected ? pollStats.winnerName : "---";
tally_votes_itterations.text = pollStats.winnerSelected ? pollStats.iterations : "-";
tally_votes_counted.text = pollStats.winnerSelected ? pollStats.votesCounted : "-";
}
// Messages from script
@ -998,6 +998,7 @@ Rectangle {
break;
case "poll_winner":
pollStats = message.pollStats;
_populateResults();
votes_tallied = true;
break;