Skip to content
Snippets Groups Projects
Commit f2f084b6 authored by aleksandr.ledyaev's avatar aleksandr.ledyaev
Browse files

[*] DapNetworkPopup.qml; DapNetworksList.qml

[+] DapNetworkPopupButton.qml
parent 00f213cf
No related branches found
No related tags found
1 merge request!11Cellframe clone
......@@ -182,5 +182,6 @@
<file>screen/desktop/NetworksPanel/DapNetworksList.qml</file>
<file>screen/desktop/NetworksPanel/DapNetworkPopup.qml</file>
<file>screen/desktop/NetworksPanel/DapNetworkName.qml</file>
<file>screen/desktop/NetworksPanel/DapNetworkPopupButton.qml</file>
</qresource>
</RCC>
......@@ -17,13 +17,8 @@ Popup {
property int linksCount
property string nodeAddress
property bool mouseWasClicked
function show(networkDelegateItem)
{
if (mouseWasClicked)
return;
networkDelegateItemCoords = Qt.binding(function() { return parent.mapFromItem(networkDelegateItem.parent, networkDelegateItem.x, networkDelegateItem.y) });
networkDelegateItemWidth = Qt.binding(function() { return networkDelegateItem.width });
networkDelegateItemHeight = Qt.binding(function() { return networkDelegateItem.height });
......@@ -35,8 +30,6 @@ Popup {
linksCount = Qt.binding(function() { return networkDelegateItem.linksCount });
nodeAddress = Qt.binding(function() { return networkDelegateItem.nodeAddress });
mouseWasClicked = false;
open();
}
......@@ -52,8 +45,6 @@ Popup {
activeLinksCount = 0;
linksCount = 0;
nodeAddress = 0;
mouseWasClicked = false;
}
x: networkDelegateItemCoords.x
......@@ -83,8 +74,8 @@ Popup {
case "NET_STATE_OFFLINE":
return qsTr("OFFLINE");
default:
if (control.state.length > 0)
console.warn("Unknown network state: " + control.state);
if (state.length > 0)
console.warn("Unknown network state: " + state);
return "";
}
}
......@@ -92,19 +83,25 @@ Popup {
implicitWidth: columnItem.width
implicitHeight: columnItem.height
MouseArea {
id: contentItemMouseArea
width: parent.width
height: parent.height
hoverEnabled: true
}
Column {
id: columnItem
topPadding: 20 * pt
spacing: Math.floor(control.networkDelegateItemHeight / 2)
Row {
DapNetworkPopupButton {
width: contentItem.width / 2
height: 24 * pt
enabled: control.state == "NET_STATE_ONLINE" && control.targetState == "NET_STATE_ONLINE"
text: qsTr("Sync network")
}
DapNetworkPopupButton {
width: contentItem.width / 2
height: 24 * pt
text: control.state == "NET_STATE_OFFLINE" ? qsTr("On network") : qsTr("Off network")
}
}
ColumnLayout {
width: contentItem.width
......@@ -204,13 +201,6 @@ Popup {
textColor: "#070023"
name: control.name
state: control.state
MouseArea {
id: networkNameMouseArea
width: parent.width
height: parent.height
onClicked: control.mouseWasClicked = true
}
}
}
}
......@@ -235,11 +225,4 @@ Popup {
}
onClosed: release()
Timer {
running: !contentItemMouseArea.containsMouse && !btnCopyAddressMouseArea.containsMouse && control.visible && !control.mouseWasClicked
interval: 100
repeat: false
onTriggered: control.close();
}
}
import QtQuick 2.7
Rectangle {
id: control
property alias text: _text.text
property bool highlight: enabled && (mouseArea.containsMouse || mouseArea.pressed)
property int spacing: 6 * pt
signal clicked
color: highlight ? "#D51F5D" : "#FFFFFF"
Rectangle {
id: icon
anchors.verticalCenter: control.verticalCenter
anchors.right: _text.left
anchors.rightMargin: control.spacing
width: 10
height: 10
color: control.enabled ? control.highlight ? "#FFFFFF" : "#453F5A" : "gray"
}
Text {
id: _text
anchors.verticalCenter: control.verticalCenter
x: Math.floor(icon.width + control.spacing + (control.width - (width + icon.width + control.spacing)) * 0.5)
width: Math.min(implicitWidth, control.width - icon.width - control.spacing)
font: quicksandFonts.medium12
color: control.enabled ? control.highlight ? "#FFFFFF" : "#453F5A" : "gray"
elide: Text.ElideRight
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
}
}
}
......@@ -46,6 +46,11 @@ Item {
{
model = networks;
// for set position of elements if there are less than 4
// [*][*][*][*] if 4+
// [ ][*][*][*] if 3
// [ ][*][*][ ] 2
// [ ][ ][ ][*] 1
var visibleItems = networks.length;
if (visibleItems >= 4) {
visibleItems = 4;
......@@ -94,9 +99,8 @@ Item {
width: parent.width
height: parent.height
hoverEnabled: true
onEntered: {
onClicked: {
if (index >= listView.leftIndex && index < listView.leftIndex + listView.visibleItems) {
networkPanelPopup.show(delegateItem);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment