Style location list view

This commit is contained in:
Angela Mazzurco 2017-07-22 17:41:40 +02:00
parent 1ee655978c
commit 18d29310d3

View File

@ -20,6 +20,8 @@ import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import org.retroshare.qml_components.LibresapiLocalClient 1.0 import org.retroshare.qml_components.LibresapiLocalClient 1.0
import "components/."
Item Item
{ {
id: locationView id: locationView
@ -34,14 +36,14 @@ Item
{ {
name: "selectLocation" name: "selectLocation"
PropertyChanges { target: locationsListView; visible: true } PropertyChanges { target: locationsListView; visible: true }
PropertyChanges { target: createNewButton; visible: true } PropertyChanges { target: bottomButton; visible: true }
PropertyChanges { target: loginView; visible: false } PropertyChanges { target: loginView; visible: false }
}, },
State State
{ {
name: "createLocation" name: "createLocation"
PropertyChanges { target: locationsListView; visible: false } PropertyChanges { target: locationsListView; visible: false }
PropertyChanges { target: createNewButton; visible: false } PropertyChanges { target: bottomButton; visible: false }
PropertyChanges PropertyChanges
{ {
target: loginView target: loginView
@ -59,12 +61,8 @@ Item
JSON.stringify(jsonData)) JSON.stringify(jsonData))
mainWindow.user_name = login mainWindow.user_name = login
locationView.state = "selectLocation" locationView.state = "selectLocation"
createNewButton.enabled = false bottomButton.enabled = false
createNewButton.text = "Creating profile..." bottomButton.text = "Creating profile..."
}
onCancel:
{
locationView.state = "selectLocation"
} }
} }
}, },
@ -72,7 +70,7 @@ Item
{ {
name: "login" name: "login"
PropertyChanges { target: locationsListView; visible: false } PropertyChanges { target: locationsListView; visible: false }
PropertyChanges { target: createNewButton; visible: false } PropertyChanges { target: bottomButton; visible: false }
PropertyChanges PropertyChanges
{ {
target: loginView target: loginView
@ -87,10 +85,6 @@ Item
locationView.attemptLogin = true locationView.attemptLogin = true
attemptTimer.start() attemptTimer.start()
} }
onCancel:
{
locationView.state = "selectLocation"
}
} }
} }
] ]
@ -124,15 +118,6 @@ Item
onFocusChanged: focus && requestLocationsList() onFocusChanged: focus && requestLocationsList()
Component.onCompleted: requestLocationsList() Component.onCompleted: requestLocationsList()
Button
{
id: createNewButton
text: "Create new location"
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
onClicked: locationView.state = "createLocation"
}
JSONListModel JSONListModel
{ {
id: locationsModel id: locationsModel
@ -142,28 +127,69 @@ Item
{ {
id: locationsListView id: locationsListView
width: parent.width width: parent.width
height: parent.height - createNewButton.height anchors.top: parent.top
anchors.top: createNewButton.bottom anchors.bottom: bottomButton.top
anchors.topMargin: 10
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
model: locationsModel.model model: locationsModel.model
clip: true spacing: 3
delegate: Button delegate: Item
{ {
text: model.name id: delegate
anchors.horizontalCenter: parent.horizontalCenter width: parent.width
onClicked: height: locationButton.height + 5
Rectangle
{ {
loginView.login = text id: backgroundRectangle
locationView.sslid = model.id anchors.fill: parent.fill
locationView.state = "login" anchors.horizontalCenter: parent.horizontalCenter
mainWindow.user_name = model.name width: parent.width /2
height: parent.height
color:"transparent"
Rectangle
{
id: borderBottom
width: parent.width
height: 1
anchors.bottom: parent.bottom
anchors.right: parent.right
color: "lightgrey"
}
}
ButtonText
{
id: locationButton
anchors.horizontalCenter: parent.horizontalCenter
text: model.name
borderRadius:0
iconUrl: "/icons/edit-image-face-detect.svg"
color: "white"
pressColor: "lightsteelblue"
buttonTextPixelSize: 20
onClicked:
{
loginView.login = text
locationView.sslid = model.id
locationView.state = "login"
mainWindow.user_name = model.name
}
} }
} }
visible: false visible: false
} }
Button
{
id: bottomButton
text: "Create new location"
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
onClicked: locationView.state = "createLocation"
}
RsLoginPassView RsLoginPassView
{ {
id: loginView id: loginView
@ -205,8 +231,8 @@ Item
else else
{ {
// if Already logged in // if Already logged in
createNewButton.enabled = false bottomButton.enabled = false
createNewButton.text = "Unlocking location..." bottomButton.text = "Unlocking location..."
locationView.attemptLogin = false locationView.attemptLogin = false
locationView.state = "selectLocation" locationView.state = "selectLocation"
locationsListView.enabled = false locationsListView.enabled = false