From f67e3be32f2cc93e9f2efa63ed138cfef1a4fa13 Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 29 Mar 2024 19:24:05 +0800 Subject: [PATCH 1/3] fix missing cancel button for own orders on orderbook --- .../Exchange/Trade/OrderBook/ListDelegate.qml | 83 +++++++++---------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml index 5ce557fc6b..e26bdbb54c 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml @@ -35,6 +35,7 @@ Item color: Qaterial.Colors.amber } + // Insufficient funds tooltip DexLabel { id: tooltip_text @@ -101,6 +102,7 @@ Item anchors.fill: parent hoverEnabled: true + // Populate foirm with selected order onClicked: { if (is_mine) return @@ -119,6 +121,7 @@ Item } } + // Highlight row on mouseover AnimatedRectangle { visible: mouse_area.containsMouse @@ -128,6 +131,7 @@ Item opacity: 0.1 } + // Dot on the left side of the row to indicate own order Rectangle { anchors.verticalCenter: parent.verticalCenter @@ -161,14 +165,16 @@ Item } } + // Price, Qty & Total text values Row { id: row anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter onWidthChanged: progress.width = ((depth * 100) * (width + 40)) / 100 - spacing: 0 + spacing: 3 + // Price Dex.ElidableText { anchors.verticalCenter: parent.verticalCenter @@ -181,78 +187,71 @@ Item wrapMode: Text.NoWrap } - Item { width: parent.width * 0.01 } - // Quantity Dex.ElidableText { anchors.verticalCenter: parent.verticalCenter width: parent.width * 0.37 + rightPadding: (is_mine) && (mouse_area.containsMouse || cancel_button_orderbook.containsMouse) ? 24 : 0 text: { new BigNumber(base_max_volume).toFixed(6) } font.family: DexTypo.fontFamily font.pixelSize: 12 horizontalAlignment: Text.AlignRight onTextChanged: depth_bar.width = ((depth * 100) * (mouse_area.width + 40)) / 100 wrapMode: Text.NoWrap + Behavior on rightPadding { NumberAnimation { duration: 150 } } } - Item { width: parent.width * 0.01 } - // Total Dex.ElidableText { + id: total_text anchors.verticalCenter: parent.verticalCenter width: parent.width * 0.30 - rightPadding: (is_mine) && (mouse_area.containsMouse || cancel_button.containsMouse) ? 30 : 0 + rightPadding: (is_mine) && (mouse_area.containsMouse || cancel_button_orderbook.containsMouse) ? 24 : 0 font.family: DexTypo.fontFamily font.pixelSize: 12 text: { new BigNumber(total).toFixed(6) } horizontalAlignment: Text.AlignRight wrapMode: Text.NoWrap - Behavior on rightPadding { NumberAnimation { duration: 150 } } } - } - } - Qaterial.ColorIcon - { - id: cancel_button_text - property bool requested_cancel: false - - visible: is_mine && !requested_cancel - - anchors.verticalCenter: parent.verticalCenter - anchors.verticalCenterOffset: 1 - anchors.right: parent.right - anchors.rightMargin: mouse_area.containsMouse || cancel_button.containsMouse ? 12 : 6 - - Behavior on iconSize - { - NumberAnimation + // Cancel button + Item { - duration: 200 - } - } + width: is_mine && mouse_area.containsMouse ? 24 : 0 + visible: is_mine && total_text.rightPadding == 24 + height: parent.height + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right - iconSize: mouse_area.containsMouse || cancel_button.containsMouse? 16 : 0 + Qaterial.FlatButton + { + id: cancel_button_orderbook + anchors.centerIn: parent + anchors.fill: parent - color: cancel_button.containsMouse ? - Qaterial.Colors.red : mouse_area.containsMouse ? - DexTheme.foregroundColor: Qaterial.Colors.red + hoverEnabled: true - DefaultMouseArea - { - id: cancel_button - anchors.fill: parent - hoverEnabled: true + onClicked: if (details) cancelOrder(details.order_id) - onClicked: - { - if (!is_mine) return - - cancel_button_text.requested_cancel = true - cancelOrder(uuid) + Behavior on scale + { + NumberAnimation + { + duration: 200 + } + } + Qaterial.ColorIcon + { + anchors.centerIn: parent + iconSize: mouse_area.containsMouse? 16 : 0 + color: Dex.CurrentTheme.warningColor + source: Qaterial.Icons.close + scale: parent.visible ? 1 : 0 + } + } } } } From e2e0b3f3b74f30b7bac80d5ed03bb04a3607e915 Mon Sep 17 00:00:00 2001 From: smk762 Date: Sun, 31 Mar 2024 19:00:15 +0800 Subject: [PATCH 2/3] Use layouts for orderbook columns --- .../Exchange/Trade/OrderBook/ListDelegate.qml | 89 ++++++++++--------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml index e26bdbb54c..2e21b85061 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml @@ -102,7 +102,7 @@ Item anchors.fill: parent hoverEnabled: true - // Populate foirm with selected order + // Populate form with selected order onClicked: { if (is_mine) return @@ -131,17 +131,6 @@ Item opacity: 0.1 } - // Dot on the left side of the row to indicate own order - Rectangle - { - anchors.verticalCenter: parent.verticalCenter - width: 6 - height: 6 - radius: width / 2 - visible: is_mine - color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor - } - // Progress bar Rectangle { @@ -166,90 +155,108 @@ Item } // Price, Qty & Total text values - Row + RowLayout { id: row anchors.fill: parent - anchors.horizontalCenter: parent.horizontalCenter onWidthChanged: progress.width = ((depth * 100) * (width + 40)) / 100 spacing: 3 + // Dot on the left side of the row to indicate own order + Rectangle + { + Layout.leftMargin: 6 + Layout.alignment: Qt.AlignVCenter + opacity: is_mine ? 1 : 0 + width: 6 + height: 6 + radius: 3 + color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor + } + // Price Dex.ElidableText { - anchors.verticalCenter: parent.verticalCenter - width: parent.width * 0.31 + Layout.fillHeight: true + Layout.minimumWidth: 90 + Layout.alignment: Qt.AlignVCenter text: { new BigNumber(price).toFixed(8) } font.family: DexTypo.fontFamily font.pixelSize: 12 color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter wrapMode: Text.NoWrap } // Quantity Dex.ElidableText { - anchors.verticalCenter: parent.verticalCenter - width: parent.width * 0.37 - rightPadding: (is_mine) && (mouse_area.containsMouse || cancel_button_orderbook.containsMouse) ? 24 : 0 + Layout.fillHeight: true + Layout.minimumWidth: 90 + Layout.alignment: Qt.AlignVCenter text: { new BigNumber(base_max_volume).toFixed(6) } font.family: DexTypo.fontFamily font.pixelSize: 12 horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter onTextChanged: depth_bar.width = ((depth * 100) * (mouse_area.width + 40)) / 100 wrapMode: Text.NoWrap - Behavior on rightPadding { NumberAnimation { duration: 150 } } } // Total Dex.ElidableText { id: total_text - anchors.verticalCenter: parent.verticalCenter - width: parent.width * 0.30 - rightPadding: (is_mine) && (mouse_area.containsMouse || cancel_button_orderbook.containsMouse) ? 24 : 0 + Layout.fillHeight: true + Layout.minimumWidth: 90 + Layout.fillWidth: true + Layout.alignment: Qt.AlignVCenter font.family: DexTypo.fontFamily font.pixelSize: 12 text: { new BigNumber(total).toFixed(6) } horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter wrapMode: Text.NoWrap - Behavior on rightPadding { NumberAnimation { duration: 150 } } } + // Cancel button Item { - width: is_mine && mouse_area.containsMouse ? 24 : 0 - visible: is_mine && total_text.rightPadding == 24 - height: parent.height - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right + id: cancel_flat_btn + Layout.fillHeight: true + width: 30 + Layout.alignment: Qt.AlignVCenter + + MouseArea + { + id: cancel_mouse_area + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + hoverEnabled: true + } Qaterial.FlatButton { id: cancel_button_orderbook anchors.centerIn: parent anchors.fill: parent + opacity: is_mine ? 1 : 0 - hoverEnabled: true - - onClicked: if (details) cancelOrder(details.order_id) - - Behavior on scale - { - NumberAnimation - { - duration: 200 - } + onClicked: { + if (uuid) cancelOrder(uuid); } + Qaterial.ColorIcon { anchors.centerIn: parent - iconSize: mouse_area.containsMouse? 16 : 0 + iconSize: 16 color: Dex.CurrentTheme.warningColor source: Qaterial.Icons.close - scale: parent.visible ? 1 : 0 + visible: is_mine + scale: is_mine && mouse_area.containsMouse ? 1 : 0 + Behavior on scale { NumberAnimation { duration: 150 } } } } } From a952f3d8ed330357cdc42f83859c20dee0e47f38 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 1 Apr 2024 17:07:09 +0800 Subject: [PATCH 3/3] open lcw when chart is clicked --- atomic_defi_design/Dex/Exchange/ProView/Chart.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/atomic_defi_design/Dex/Exchange/ProView/Chart.qml b/atomic_defi_design/Dex/Exchange/ProView/Chart.qml index 30fc49a4cd..69480206f4 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/Chart.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/Chart.qml @@ -70,6 +70,7 @@ Item transform: scale(${Math.min(scale_x, scale_y)}); transform-origin: top left; } + a { pointer-events: none; }
@@ -226,6 +227,16 @@ Item } } + MouseArea { + id: chart_mousearea + anchors.fill: webEngineViewPlaceHolder + onClicked: { + if (webEngineView.visible) { + Qt.openUrlExternally("https://www.livecoinwatch.com") + } + } + } + Connections { target: app