- finished up athlete stuff
This commit is contained in:
parent
33ae172038
commit
a0a3d8cfe6
8 changed files with 237 additions and 139 deletions
|
@ -51,6 +51,8 @@ private:
|
|||
QTcpSocket *socket;
|
||||
//socket for communication with the extention
|
||||
|
||||
QString readBuffer;
|
||||
|
||||
QSemaphore remoteSessions;
|
||||
|
||||
int nextConnectionId;
|
||||
|
|
|
@ -87,6 +87,10 @@ Popup {
|
|||
Connections {
|
||||
target: root
|
||||
onOpened: {
|
||||
if(profiles_stack.depth > 0){
|
||||
profiles_stack.clear()
|
||||
}
|
||||
|
||||
profiles_stack.openAthletes()
|
||||
}
|
||||
}
|
||||
|
@ -112,26 +116,38 @@ Popup {
|
|||
RemoteDataListView {
|
||||
id: profileList
|
||||
|
||||
property int currentAthlete: -1
|
||||
property string title: "profiles"
|
||||
property string secondButt: "add"
|
||||
|
||||
signal opened()
|
||||
|
||||
onOpened: {
|
||||
loadData()
|
||||
profileList.loadData()
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: topContainerItm.height * 0.1
|
||||
|
||||
loadData: function () {
|
||||
status = 905
|
||||
listData = {}
|
||||
listData = speedBackend.getAthletes()
|
||||
var retData = speedBackend.getAthletes()
|
||||
|
||||
if(retData === undefined){
|
||||
status = 500
|
||||
return
|
||||
}
|
||||
|
||||
listData = retData["allAthletes"]
|
||||
currentAthlete = retData["activeAthlete"]
|
||||
status = listData.lenght !== false ? 200:0
|
||||
}
|
||||
|
||||
delegate: SwipeDelegate {
|
||||
id: swipeDelegate
|
||||
|
||||
property bool active: profileList.listData[index]["active"]
|
||||
property bool active: profileList.currentAthlete === profileList.listData[index]["id"]
|
||||
|
||||
text: profileList.listData[index]["fullName"]
|
||||
width: profileList.width - (swipeDelegate.x)
|
||||
|
@ -150,6 +166,13 @@ Popup {
|
|||
|
||||
background: Rectangle {
|
||||
color: Qt.darker( pressed ? Qt.darker("white", 1.1):"white", swipeDelegate.active ? 1.1:0 )
|
||||
|
||||
Behavior on color {
|
||||
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
|
@ -187,9 +210,34 @@ Popup {
|
|||
width: parent.width * 0.65
|
||||
height: width
|
||||
anchors.centerIn: parent
|
||||
radius: width * 0.2
|
||||
radius: control.checked ? width * 0.2:0
|
||||
color: control.down ? "#17a81a" : "#21be2b"
|
||||
visible: control.checked
|
||||
opacity: control.checked ? 1:0
|
||||
scale: control.checked ? 0.9:0
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on radius {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,6 +294,7 @@ Popup {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*-----Option to add a profile-----*/
|
||||
|
@ -263,7 +312,7 @@ Popup {
|
|||
|
||||
onClicked: {
|
||||
if(speedBackend.createAthlete(userNameTf.text, fullNameTf.text)){
|
||||
profiles_stack.get(profiles_stack.depth - 2 ).loadData()
|
||||
profiles_stack.get(profiles_stack.depth - 2 ).opened()
|
||||
profiles_stack.pop()
|
||||
}
|
||||
}
|
||||
|
@ -545,9 +594,9 @@ Popup {
|
|||
height: parent.height * 0.1
|
||||
width:height
|
||||
|
||||
opacity: profiles_stack.currentItem.secondButt !== "none" ? 1:0
|
||||
opacity: root.opacity < 1 ? root.opacity : profiles_stack.currentItem.secondButt !== "none" ? 1:0
|
||||
|
||||
glowOpacity: Math.pow( root.opacity, 100 )
|
||||
//glowOpacity: Math.pow( root.opacity, 100 )
|
||||
|
||||
backgroundColor: appTheme.style.buttonColor
|
||||
|
||||
|
|
|
@ -29,15 +29,26 @@ SequentialAnimation {
|
|||
property alias outEasingType: outAnimation.easing.type
|
||||
property alias inEasingType: inAnimation.easing.type
|
||||
property string easingType: "Quad"
|
||||
ParallelAnimation {
|
||||
NumberAnimation { // in the default case, fade scale to 0
|
||||
id: outAnimation
|
||||
target: root.target
|
||||
property: root.fadeProperty
|
||||
property: "scale"
|
||||
duration: root.fadeDuration_in
|
||||
to: 0.9
|
||||
easing.type: Easing["In"+root.easingType]
|
||||
}
|
||||
NumberAnimation { // in the default case, fade scale to 0
|
||||
id: outAnimation2
|
||||
target: root.target
|
||||
property: "opacity"
|
||||
duration: root.fadeDuration_in
|
||||
to: 0
|
||||
easing.type: Easing["In"+root.easingType]
|
||||
}
|
||||
}
|
||||
PropertyAction { } // actually change the property targeted by the Behavior between the 2 other animations
|
||||
ParallelAnimation {
|
||||
NumberAnimation { // in the default case, fade scale back to 1
|
||||
id: inAnimation
|
||||
target: root.target
|
||||
|
@ -46,4 +57,14 @@ SequentialAnimation {
|
|||
to: 1
|
||||
easing.type: Easing["Out"+root.easingType]
|
||||
}
|
||||
NumberAnimation { // in the default case, fade scale to 0
|
||||
id: inAnimation2
|
||||
target: root.target
|
||||
property: "opacity"
|
||||
duration: root.fadeDuration_in
|
||||
to: 1
|
||||
easing.type: Easing["In"+root.easingType]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ Button {
|
|||
property double glowSpread: 0.2
|
||||
property bool glowVisible: true
|
||||
property double glowScale: 0.75
|
||||
property double glowOpacity: 1
|
||||
property double glowOpacity: Math.pow( control.opacity, 100 )
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ Item {
|
|||
|
||||
anchors.fill: parent
|
||||
|
||||
//enabled: status === 200 || status === 902
|
||||
//opacity: enabled ? 1:0
|
||||
|
||||
enabled: status === 200 || status === 902
|
||||
opacity: enabled ? 1:0
|
||||
|
||||
boundsBehavior: ListView.StopAtBounds
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: listView.parent
|
||||
|
@ -62,16 +62,16 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Behavior on contentY {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FancyBusyIndicator {
|
||||
anchors.centerIn: parent
|
||||
opacity: listView.opacity === 1 ? 0:1
|
||||
opacity: !(status === 200 || status === 902) ? 1:0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -689,7 +689,10 @@ Window {
|
|||
anchors.rightMargin: root.landscape() ? parent.width * 0.05:parent.width * 0.5 - startButt.width * 0.5 //put the button more to the right to hide the menu (only in landscape mode)
|
||||
anchors.bottomMargin: root.landscape() ? parent.height * 0.5 - startButt.height * 0.5:parent.height * 0.1 //put the button lower to hide the menu (only in portrait mode)
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: topLa
|
||||
text: ""
|
||||
}
|
||||
},
|
||||
|
||||
State {
|
||||
|
@ -707,6 +710,10 @@ Window {
|
|||
anchors.rightMargin: root.landscape() ? 0-startButt.width/2:undefined
|
||||
anchors.bottomMargin: root.landscape() ? undefined:0-startButt.height/2
|
||||
}
|
||||
PropertyChanges {
|
||||
target: topLa
|
||||
text: ""
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -186,12 +186,30 @@ QVariantMap BaseConn::sendCommand(int header, QJsonValue data){
|
|||
|
||||
void BaseConn::readyRead() {
|
||||
|
||||
//qDebug() << "ready to ready " << socket->bytesAvailable() << " bytes" ;
|
||||
QString reply = socket->readAll();
|
||||
|
||||
if(!reply.endsWith("</message>")){
|
||||
this->readBuffer += reply;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if(!this->readBuffer.isEmpty()){
|
||||
reply = readBuffer + reply;
|
||||
readBuffer.clear();
|
||||
}
|
||||
}
|
||||
|
||||
reply.replace("<message>", "");
|
||||
reply.replace("</message>", "");
|
||||
|
||||
int id = 0;
|
||||
|
||||
QJsonDocument jsonReply = QJsonDocument::fromJson(reply.toUtf8());
|
||||
QJsonObject replyObj = jsonReply.object();
|
||||
|
||||
//qDebug() << "got: " << reply;
|
||||
|
||||
if(!replyObj.isEmpty()){
|
||||
id = replyObj.value("id").toInt();
|
||||
|
||||
|
@ -206,6 +224,7 @@ void BaseConn::readyRead() {
|
|||
|
||||
latestReadReply = reply;
|
||||
emit gotUnexpectedReply(reply);
|
||||
|
||||
}
|
||||
|
||||
int BaseConn::writeRemoteSetting(QString key, QString value) {
|
||||
|
|
|
@ -457,9 +457,9 @@ QVariant ClimbingRace::getAthletes() {
|
|||
return false;
|
||||
}
|
||||
|
||||
QVariantList tmpAthletes = reply["data"].toList();
|
||||
QVariantMap tmpAthletes = reply["data"].toMap();
|
||||
|
||||
//qDebug() << tmpAthletes;
|
||||
qDebug() << tmpAthletes;
|
||||
|
||||
return tmpAthletes;
|
||||
}
|
||||
|
|
Reference in a new issue