From fb1f352332605d2598275d87a460f4c0fa69b5e0 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 12 Aug 2024 17:02:45 +0800 Subject: [PATCH 1/3] limit decimals on large numbers --- atomic_defi_design/Dex/Constants/General.qml | 9 +++++++++ .../Dex/Exchange/Trade/OrderBook/ListDelegate.qml | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/atomic_defi_design/Dex/Constants/General.qml b/atomic_defi_design/Dex/Constants/General.qml index 8f626296f7..7cfea9c828 100644 --- a/atomic_defi_design/Dex/Constants/General.qml +++ b/atomic_defi_design/Dex/Constants/General.qml @@ -434,6 +434,15 @@ QtObject { return feetype + " " + amount + " " + ticker + " (" + fiat_text + ")" } + function reducedBignum(text, decimals=8, max_length=12) { + let val = new BigNumber(text).toFixed(decimals) + if (val.length > max_length) + { + return val.substring(0, max_length) + "..." + } + return val + } + function getSimpleFromPlaceholder(selectedTicker, selectedOrder, sell_ticker_balance) { if (sell_ticker_balance == 0) { diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml index 03819d17fe..25eca66c04 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml @@ -185,7 +185,7 @@ Item Layout.fillHeight: true Layout.minimumWidth: 90 Layout.alignment: Qt.AlignVCenter - text: { new BigNumber(price).toFixed(8) } + text: General.reducedBignum(price) font.family: DexTypo.fontFamily font.pixelSize: 12 color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor @@ -200,7 +200,7 @@ Item Layout.fillHeight: true Layout.minimumWidth: 90 Layout.alignment: Qt.AlignVCenter - text: { new BigNumber(base_max_volume).toFixed(6) } + text: General.reducedBignum(base_max_volume) font.family: DexTypo.fontFamily font.pixelSize: 12 horizontalAlignment: Text.AlignRight @@ -219,7 +219,7 @@ Item Layout.alignment: Qt.AlignVCenter font.family: DexTypo.fontFamily font.pixelSize: 12 - text: { new BigNumber(total).toFixed(6) } + text: General.reducedBignum(total) horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter wrapMode: Text.NoWrap From 5583759d42375f2c73dee3a7bcb3c1d15f25861e Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 23 Aug 2024 00:17:59 +0800 Subject: [PATCH 2/3] handle binary name change --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fe4e988fd..49fa003f6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,12 +89,12 @@ FetchContent_MakeAvailable(kdf jl777-coins qmaterial) if (UNIX) configure_file(${jl777-coins_SOURCE_DIR}/utils/coins_config_tcp.json ${CMAKE_CURRENT_SOURCE_DIR}/assets/config/${PROJECT_VERSION}-coins.json COPYONLY) configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/coins COPYONLY) - configure_file(${kdf_SOURCE_DIR}/kdf ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/${DEX_API} COPYONLY) + configure_file(${kdf_SOURCE_DIR}/mm2 ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/${DEX_API} COPYONLY) file(COPY ${jl777-coins_SOURCE_DIR}/icons/ DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/atomic_defi_design/assets/images/coins/) else () configure_file(${jl777-coins_SOURCE_DIR}/utils/coins_config_tcp.json ${CMAKE_BINARY_DIR}/bin/assets/config/${PROJECT_VERSION}-coins.json COPYONLY) configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/coins COPYONLY) - configure_file(${kdf_SOURCE_DIR}/kdf.exe ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/${DEX_API}.exe COPYONLY) + configure_file(${kdf_SOURCE_DIR}/mm2.exe ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/${DEX_API}.exe COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/msvcp140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/msvcp140.dll COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/vcruntime140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/vcruntime140.dll COPYONLY) endif () From f9e8dada71e78ce0431b40f43d27d781a0dc13ce Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 23 Aug 2024 12:23:35 +0800 Subject: [PATCH 3/3] rm dots, 6dp for middle and right cols --- atomic_defi_design/Dex/Constants/General.qml | 2 +- .../Exchange/Trade/OrderBook/ListDelegate.qml | 28 +++++++++---------- .../Dex/Exchange/Trade/OrderBook/Vertical.qml | 4 +-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/atomic_defi_design/Dex/Constants/General.qml b/atomic_defi_design/Dex/Constants/General.qml index d54a8dbd7d..34c89b8fcf 100644 --- a/atomic_defi_design/Dex/Constants/General.qml +++ b/atomic_defi_design/Dex/Constants/General.qml @@ -446,7 +446,7 @@ QtObject { let val = new BigNumber(text).toFixed(decimals) if (val.length > max_length) { - return val.substring(0, max_length) + "..." + return val.substring(0, max_length) } return val } diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml index b812cb792f..43b16d0c7b 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml @@ -21,11 +21,11 @@ Item DefaultTooltip { visible: mouse_area.containsMouse && (tooltip_text.text_value != "") - width: 300 + width: 340 contentItem: RowLayout { - width: 290 + width: 330 Qaterial.ColorIcon { @@ -175,12 +175,12 @@ Item // Dot on the left side of the row to indicate own order Rectangle { - Layout.leftMargin: 6 + Layout.leftMargin: 4 Layout.alignment: Qt.AlignVCenter opacity: is_mine ? 1 : 0 - width: 6 - height: 6 - radius: 3 + width: 4 + height: 4 + radius: 2 color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor } @@ -188,9 +188,9 @@ Item Dex.ElidableText { Layout.fillHeight: true - Layout.minimumWidth: 90 + Layout.minimumWidth: 100 Layout.alignment: Qt.AlignVCenter - text: General.reducedBignum(price) + text: General.reducedBignum(price, 8) font.family: DexTypo.fontFamily font.pixelSize: 12 color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor @@ -203,9 +203,9 @@ Item Dex.ElidableText { Layout.fillHeight: true - Layout.minimumWidth: 90 + Layout.minimumWidth: 100 Layout.alignment: Qt.AlignVCenter - text: General.reducedBignum(base_max_volume) + text: General.reducedBignum(base_max_volume, 6) font.family: DexTypo.fontFamily font.pixelSize: 12 horizontalAlignment: Text.AlignRight @@ -219,12 +219,12 @@ Item { id: total_text Layout.fillHeight: true - Layout.minimumWidth: 90 + Layout.minimumWidth: 100 Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter font.family: DexTypo.fontFamily font.pixelSize: 12 - text: General.reducedBignum(total) + text: General.reducedBignum(total, 6) horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter wrapMode: Text.NoWrap @@ -236,7 +236,7 @@ Item { id: cancel_flat_btn Layout.fillHeight: true - width: 30 + width: 20 Layout.alignment: Qt.AlignVCenter MouseArea @@ -261,7 +261,7 @@ Item Qaterial.ColorIcon { anchors.centerIn: parent - iconSize: 16 + iconSize: 14 color: Dex.CurrentTheme.warningColor source: Qaterial.Icons.close visible: is_mine diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml index a32347e739..0c8918e6fc 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml @@ -16,8 +16,8 @@ Widget readonly property string pair_volume_24hr: API.app.trading_pg.pair_volume_24hr readonly property string pair: atomic_qt_utilities.retrieve_main_ticker(left_ticker) + "/" + atomic_qt_utilities.retrieve_main_ticker(right_ticker) - margins: 10 - spacing: 10 + margins: 8 + spacing: 8 collapsable: false Header