This repository has been archived by the owner on May 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Was quite some work but I finally implemented a frontend for my backend leaderboard - works flawless! Furthermore this is now named v1.0 because I'm probably finished with the main work and won't add many more features.
- Loading branch information
1 parent
bfb99fe
commit bf800f3
Showing
7 changed files
with
212 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,114 @@ | ||
import QtQuick 2.2 | ||
import Sailfish.Silica 1.0 | ||
import org.nemomobile.configuration 1.0 | ||
|
||
Page { | ||
id: page | ||
allowedOrientations: Orientation.Portrait | ||
|
||
SilicaFlickable { | ||
Column { | ||
anchors.fill: parent | ||
contentHeight: column.height | ||
anchors.margins: Theme.paddingMedium | ||
|
||
Column { | ||
id: column | ||
PageHeader { | ||
title: qsTr("Leaderboard") | ||
} | ||
|
||
TextField { | ||
placeholderText: "Enter username (default: anon)" | ||
text: username.value | ||
label: "Username" | ||
width: page.width | ||
spacing: Theme.paddingLarge | ||
EnterKey.enabled: text.length > 0 && text.length <= 16 | ||
EnterKey.iconSource: "image://theme/icon-m-enter-close" | ||
EnterKey.onClicked: { | ||
focus = false | ||
username.value = text | ||
} | ||
} | ||
|
||
ComboBox { | ||
id: selector | ||
label: "Difficulty" | ||
|
||
PageHeader { | ||
title: qsTr("Under Construction!") | ||
function select(diff) { | ||
var xhr = new XMLHttpRequest() | ||
xhr.open("GET", | ||
"https://marvinborner.de/lead/binaryfun1/list?sort=time&order=asc&count=1000&filter=difficulty,"+diff, | ||
false) | ||
xhr.send() | ||
if (xhr.status !== 0) { | ||
list.model = JSON.parse(xhr.responseText); | ||
internet.visible = false; | ||
} else { | ||
internet.visible = true; | ||
} | ||
} | ||
|
||
menu: ContextMenu { | ||
MenuItem { | ||
text: qsTr("Please select") | ||
} | ||
MenuItem { | ||
property int diff: 2 | ||
text: qsTr("Very easy (2 Bit)") | ||
onClicked: selector.select(diff) | ||
} | ||
MenuItem { | ||
property int diff: 4 | ||
text: qsTr("Easy (4 Bit)") | ||
onClicked: selector.select(diff) | ||
} | ||
MenuItem { | ||
property int diff: 6 | ||
text: qsTr("Medium (6 Bit)") | ||
onClicked: selector.select(diff) | ||
} | ||
MenuItem { | ||
property int diff: 8 | ||
text: qsTr("Hard (8 Bit)") | ||
onClicked: selector.select(diff) | ||
} | ||
MenuItem { | ||
property int diff: 10 | ||
text: qsTr("God-like (10 Bit)") | ||
onClicked: selector.select(diff) | ||
} | ||
} | ||
} | ||
|
||
Label { | ||
id: internet | ||
text: qsTr("No internet connection!") | ||
visible: false | ||
} | ||
|
||
ListView { | ||
id: list | ||
clip: true | ||
width: page.width | ||
height: page.height - y | ||
model: [] | ||
delegate: ListItem { | ||
contentHeight: Theme.itemSizeMedium | ||
|
||
Label { | ||
id: name | ||
text: index + 1 + ". " + modelData.name | ||
} | ||
|
||
Label { | ||
anchors.top: name.bottom | ||
text: ((modelData.end_time[1] - modelData.start_time[1]) / 1000) + "s - Help: " + modelData.cheats | ||
font.pixelSize: Theme.fontSizeSmall | ||
} | ||
} | ||
} | ||
} | ||
|
||
ConfigurationValue { | ||
id: username | ||
key: "/com/binaryfun/username" | ||
defaultValue: "anon" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters