status-desktop/ui/app/AppLayouts/Node/NodeLayout.qml

257 lines
8.5 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
feat: layouts for the Profile screens Work on this PR started before the build system was updated and at one point I upgraded `nim_status_client.nimble` to use NimScript so the nimble command would stop warning that the old format was being used. In team chat it was discussed that since we're no longer using nimble for package management we could simply delete `nim_status_client.nimble` to avoid confusion, which can be done in another PR. Introduce a BrowserLayout stub so the index will be calcualted correctly re: the active tab. Reorganize ChatLayout and NodeLayout into subdirs `Chat` and `Node`, respectively. Introduce ProfileLayout which uses a "LeftTab" approach similar to that of WalletLayout. There remains quite a bit of styling work to be done in ProfileLayout and its LeftTab. Also, it may be better to start over using a SplitView like the ChatLayout, I'm not really sure. It wasn't clear what should be the default view for the right-pane when Profile is selected in the left-most TabBar. In this PR, it defaults to showing the view corresponding to the ENS usernames button. In the archived Figma for the desktop design, it seemed a picture could be set, e.g. there is a headshot of a woman used in the Profile screen. To that end I explored how to take a square image and clip/mask it so it appears round and I included a larger placeholder image for that purpose. In the new design, and with respect to mobile, it may not be possible to set a profile picture so the code that rounds the image can maybe be dropped.
2020-05-19 19:44:45 +00:00
import "../../../imports"
import "../../../shared"
2021-07-23 15:08:52 +00:00
import "../../../shared/status"
Item {
id: nodeView
Layout.fillHeight: true
Layout.fillWidth: true
ColumnLayout {
id: rpcColumn
spacing: 0
anchors.fill: parent
2021-07-23 15:08:52 +00:00
Rate {
}
2021-08-23 18:45:00 +00:00
RowLayout {
id: peerContainer2
Layout.fillWidth: true
StyledText {
id: peerDescription
color: Style.current.lightBlueText
text: "Peers"
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
font.weight: Font.Medium
font.pixelSize: 20
}
StyledText {
id: peerNumber
color: Style.current.lightBlueText
text: nodeModel.peerSize
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
font.weight: Font.Medium
font.pixelSize: 20
}
}
2021-08-25 01:31:20 +00:00
RowLayout {
id: bloomF
Layout.fillWidth: true
StyledText {
color: Style.current.lightBlueText
2021-08-25 12:24:31 +00:00
text: qsTr("Bloom Filter Usage")
2021-08-25 01:31:20 +00:00
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
font.weight: Font.Medium
font.pixelSize: 20
}
StyledText {
id: bloomPerc
color: Style.current.lightBlueText
text: ((nodeModel.bloomBits / 512) * 100).toFixed(2) + "%"
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
font.weight: Font.Medium
font.pixelSize: 20
}
}
RowLayout {
Layout.fillWidth: true
StyledText {
color: Style.current.lightBlueText
text: qsTr("Active Mailserver")
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
font.weight: Font.Medium
font.pixelSize: 20
}
StyledText {
id: activeMailserverTxt
color: Style.current.textColor
text: "..."
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
wrapMode: Text.Wrap
font.weight: Font.Medium
font.pixelSize: 14
}
}
Connections {
target: profileModel.mailservers
onActiveMailserverChanged: (activeMailserver) => {
activeMailserverTxt.text = profileModel.mailservers.list.getMailserverName(activeMailserver) + "\n" + activeMailserver
}
}
ColumnLayout {
id: logContainer
height: 300
StyledText {
id: logHeaderDesc
color: Style.current.lightBlueText
text: "Logs:"
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
font.weight: Font.Medium
font.pixelSize: 20
}
StyledTextArea {
id: logsTxt
text: ""
customHeight: 200
textField.readOnly: true
}
Connections {
target: nodeModel
function onLog(logContent) {
let lines = logsTxt.text.split("\n");
if (lines.length > 5){
lines.shift();
}
lines.push(logContent.trim())
logsTxt.text = lines.join("\n")
}
}
}
2020-05-19 21:00:04 +00:00
ColumnLayout {
id: messageContainer
Layout.fillHeight: true
StyledText {
2020-05-19 21:00:04 +00:00
id: testDescription
color: Style.current.lightBlueText
2020-05-19 21:00:04 +00:00
text: "latest block (auto updates):"
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
2020-05-19 21:00:04 +00:00
Layout.fillWidth: true
font.weight: Font.Medium
font.pixelSize: 20
}
StyledText {
id: test
color: Style.current.lightBlueText
text: nodeModel.lastMessage
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
font.weight: Font.Medium
2020-05-19 21:00:04 +00:00
font.pixelSize: 20
}
}
RowLayout {
id: resultContainer
Layout.fillHeight: true
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
TextArea { id: callResult; Layout.fillWidth: true; text: nodeModel.callResult; readOnly: true }
}
RowLayout {
id: rpcInputContainer
height: 70
Layout.fillWidth: true
Layout.bottomMargin: 0
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
transformOrigin: Item.Bottom
Item {
id: element2
width: 200
height: 70
Layout.fillWidth: true
Rectangle {
id: rectangle
color: "#00000000"
border.color: Style.current.border
anchors.fill: parent
Button {
id: rpcSendBtn
x: 100
width: 30
height: 30
text: "\u2191"
font.bold: true
font.pointSize: 12
anchors.top: parent.top
anchors.topMargin: 20
anchors.right: parent.right
anchors.rightMargin: 16
onClicked: {
nodeModel.onSend(txtData.text)
txtData.text = ""
}
enabled: txtData.text !== ""
background: Rectangle {
color: parent.enabled ? Style.current.blue : Style.current.grey
radius: 50
}
}
StyledTextField {
id: txtData
text: ""
leftPadding: 0
padding: 0
font.pixelSize: 14
//% "Type json-rpc message... e.g {\"method\": \"eth_accounts\"}"
placeholderText: qsTrId("type-json-rpc-message")
anchors.right: rpcSendBtn.left
anchors.rightMargin: 16
anchors.top: parent.top
anchors.topMargin: 24
anchors.left: parent.left
anchors.leftMargin: 24
Keys.onEnterPressed: {
nodeModel.onSend(txtData.text)
txtData.text = ""
}
Keys.onReturnPressed: {
nodeModel.onSend(txtData.text)
txtData.text = ""
}
background: Rectangle {
color: "#00000000"
}
}
MouseArea {
id: mouseArea1
anchors.rightMargin: 50
anchors.fill: parent
onClicked : {
txtData.forceActiveFocus(Qt.MouseFocusReason)
}
}
}
}
}
}
}
/*##^##
Designer {
D{i:0;formeditorZoom:0.5;height:770;width:1152}
}
##^##*/