Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-desktop into dev
  • Loading branch information
smk762 committed Dec 23, 2024
2 parents 6a632d8 + b38edb2 commit 9ab07d1
Show file tree
Hide file tree
Showing 20 changed files with 141 additions and 51 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@ build.log
cmake-3.19.0-rc3-Linux-x86_64
ci_tools_atomic_dex/cmake-3.19.0-rc3-Linux-x86_64
ci_tools_atomic_dex/cmake-3.19.0-rc3-Linux-x86_64/*
.venv/*
cmake-3.19.0-rc3-Linux-x86_64/*
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ RUN apt-get update -y && \
libtool \
autoconf \
unzip \
fuse \
libfuse2 \
libssl-dev \
libxkbcommon-x11-0 \
Expand Down Expand Up @@ -73,6 +74,8 @@ RUN apt-get update -y && \
libnss3-dev \
libnspr4-dev \
libgstreamer-plugins-base1.0-dev \
libqt5charts5-dev \
libqt5webchannel5-dev \
libasound2-dev

RUN git config --global --add safe.directory /build/komodo-wallet-desktop
Expand All @@ -86,9 +89,10 @@ ENV CC=clang-12

# Install Qt
RUN python3 -m venv /build/.venv && \
/build/.venv/bin/pip install aqtinstall==3.1.1 && \
/build/.venv/bin/pip install aqtinstall && \
/build/.venv/bin/python -m aqt install-qt linux desktop 5.15.2 -O $HOME/Qt -b https://qt-mirror.dannhauer.de/ -m qtcharts debug_info qtwebengine


ENV DEBIAN_FRONTEND=noninteractive
ENV SHELL=/bin/bash
ENV QT_INSTALL_CMAKE_PATH=/root/Qt/5.15.2/gcc_64/lib/cmake
Expand Down
4 changes: 4 additions & 0 deletions assets/themes/Binance - Dark/colors.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@

"arrowUpColor": "#F85757",
"arrowDownColor": "#845FEF",
"colorPlaceholderText": "#444444FF",
"colorSelectedText": "#0E1021FF",
"colorSelection": "#14bca6FF",


"lineSeparatorColor": "#161515"

Expand Down
3 changes: 3 additions & 0 deletions assets/themes/Default - Dark/colors.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@

"arrowUpColor": "#F85757FF",
"arrowDownColor": "#845FEFFF",
"colorPlaceholderText": "#444444FF",
"colorSelectedText": "#0E1021FF",
"colorSelection": "#14bca6FF",

"lineSeparatorColor": "#262941FF"
}
4 changes: 4 additions & 0 deletions assets/themes/Default - Light/colors.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@

"arrowUpColor": "#F85757FF",
"arrowDownColor": "#845FEFFF",
"colorPlaceholderText": "#8E9293FF",
"colorSelectedText": "#F9F9FBFF",
"colorSelection": "#14bca6FF",


"lineSeparatorColor": "#CDD3DC88"
}
1 change: 1 addition & 0 deletions atomic_defi_design/Dex/Components/DexTextArea.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import "../Constants"
import App 1.0
import Dex.Components 1.0 as Dex
import Dex.Themes 1.0 as Dex

TextArea {
Expand Down
8 changes: 5 additions & 3 deletions atomic_defi_design/Dex/Components/Toast.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// https://gist.github.com/jonmcclung/bae669101d17b103e94790341301c129

import QtQuick 2.15
import "../Constants"
import App 1.0
import Dex.Components 1.0 as Dex
import "../Components" as Dex
import "../Constants" as Dex
import Dex.Themes 1.0 as Dex

AnimatedRectangle {
Expand Down Expand Up @@ -37,7 +39,7 @@ AnimatedRectangle {
radius: margin / 3

opacity: 0
color: isError ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.colorTheme1
color: isError ? Dex.CurrentTheme.warningColor : "#3CC9BF"
z: 1000

DexLabel {
Expand All @@ -51,7 +53,7 @@ AnimatedRectangle {
margins: margin / 2
}
font.pixelSize: Style.textSizeSmall2
text_value: title + (General.isFilled(details) ? (" - " + qsTr("Click here to see the details")) : "")
text_value: title + (Dex.General.isFilled(details) ? (" - " + qsTr("Click here to see the details")) : "")
}

SequentialAnimation on opacity {
Expand Down
6 changes: 3 additions & 3 deletions atomic_defi_design/Dex/Constants/DexTheme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ QtObject {
readonly property string colorText2: dark_theme ? "#79808C" : "#3C5368"
readonly property string colorTextDisabled: dark_theme ? Style.colorWhite8 : "#B5B9C1"

readonly property string colorPlaceholderText: Style.colorWhite9
readonly property string colorSelectedText: Style.colorTheme9
readonly property string colorSelection: Style.colorGreen2
readonly property string colorPlaceholderText: dark_theme ? Style.colorWhite9 : Style.colorWhite9
readonly property string colorSelectedText: dark_theme ? Style.colorTheme9 : Style.colorTheme9
readonly property string colorSelection: dark_theme ? Style.colorGreen2 : Style.colorGreen2

readonly property string colorTrendingLine: dark_theme ? Style.colorGreen : "#37a6ef"

Expand Down
80 changes: 67 additions & 13 deletions atomic_defi_design/Dex/Constants/General.qml
Original file line number Diff line number Diff line change
Expand Up @@ -599,14 +599,14 @@ QtObject {
return formatFiat("", value, API.app.settings_pg.current_currency)
}

function formatFiat(received, amount, fiat, precision=2) {
function formatFiat(received, amount, fiat, sf=2) {
if (privacy_mode) return ''
if (precision == 2 && fiat == "BTC") {
precision = 8
if (sf == 2 && fiat == "BTC") {
sf = 8
}
return diffPrefix(received) +
(fiat === API.app.settings_pg.current_fiat ? API.app.settings_pg.current_fiat_sign : API.app.settings_pg.current_currency_sign)
+ " " + (amount < 1E5 ? formatDouble(parseFloat(amount), precision, true) : nFormatter(parseFloat(amount), precision))
+ " " + (amount < 1E5 ? formatDouble(parseFloat(amount), sf, true) : nFormatter(parseFloat(amount), sf))
}

function formatPercent(value, show_prefix=true) {
Expand All @@ -621,7 +621,17 @@ QtObject {
return (show_prefix ? prefix : '') + parseFloat(value).toFixed(3) + ' %'
}

readonly property int amountPrecision: 8

function formatCexRates(value) {
if (value === "0") return "N/A"
if (parseFloat(value) > 0) {
return "+"+formatNumber(value, 2)+"%"
}
return formatNumber(value, 2)+"%"
}


readonly property int defaultPrecision: 8
readonly property int sliderDigitLimit: 9
readonly property int recommendedPrecision: -1337

Expand All @@ -631,17 +641,58 @@ QtObject {

function getRecommendedPrecision(v, limit) {
const lim = limit || sliderDigitLimit
return Math.min(Math.max(lim - getDigitCount(v), 0), amountPrecision)
return Math.min(Math.max(lim - getDigitCount(v), 0), defaultPrecision)
}

/**
* Converts a float into a readable string with K, M, B, etc.
* @param {number} num - The number to format.
* @param {number} decimals - The number of decimal places to include (default is 2).
* @param {number} extra_decimals - The number of decimal places to include if no suffix (default is 8).
* @returns {string} - The formatted string.
*/
function formatNumber(num, decimals = 8) {
let r = "0";
let suffix = "";

if (isNaN(num) || num === null) {
return r;
}

if (typeof(num) == 'string') {
num = parseFloat(num)
}

const suffixes = ['', 'K', 'M', 'B', 'T']; // Add more as needed for larger numbers
const tier = Math.floor(Math.log10(Math.abs(num)) / 3); // Determine the tier (e.g., thousands, millions)

if ([-1, 0].includes(tier)) {
r = num.toFixed(decimals);
return r
}
if (tier <= suffixes.length - 1) {
suffix = suffixes[tier]
if (suffix != '')
{
num = (num / Math.pow(10, tier * 3));
}
}
else {
suffix = "e" + tier * 3
num = (num / Math.pow(10, tier * 3));
}
r = num.toFixed(decimals) + "" + suffix;
return r;
}

function formatDouble(v, precision, trail_zeros) {
function formatDouble(v, sf = defaultPrecision, trail_zeros = true) {
if(v === '') return "0"
if(precision === recommendedPrecision) precision = getRecommendedPrecision(v)
if(sf === recommendedPrecision) sf = getRecommendedPrecision(v)

if(precision === 0) return parseInt(v).toString()
if(sf === 0) return parseInt(v).toString()

// Remove more than n decimals, then convert to string without trailing zeros
const full_double = parseFloat(v).toFixed(precision || amountPrecision)
const full_double = parseFloat(v).toFixed(sf || defaultPrecision)

return trail_zeros ? full_double : full_double.replace(/\.?0+$/,"")
}
Expand All @@ -654,9 +705,12 @@ QtObject {
return parseFloat(formatDouble(value, 2))
}

function formatCrypto(received, amount, ticker, fiat_amount, fiat, precision, trail_zeros) {
if (privacy_mode) return ''
return diffPrefix(received) + ticker + " " + formatDouble(amount, precision, trail_zeros) + (fiat_amount ? " (" + formatFiat("", fiat_amount, fiat) + ")" : "")
function formatCrypto(received, amount, ticker, fiat_amount, fiat, sf, trail_zeros) {
if (privacy_mode) {
return ""
}
const prefix = diffPrefix(received)
return prefix + ticker + " " + formatDouble(amount, sf, trail_zeros) + (fiat_amount ? " (" + formatFiat("", fiat_amount, fiat) + ")" : "")
}

function formatFullCrypto(received, amount, ticker, fiat_amount, fiat, use_full_ticker) {
Expand Down
6 changes: 3 additions & 3 deletions atomic_defi_design/Dex/Constants/Style.qml
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ QtObject {
readonly property string colorText2: dark_theme ? "#79808C" : "#3C5368"
readonly property string colorTextDisabled: dark_theme ? Style.colorWhite8 : "#B5B9C1"

readonly property string colorPlaceholderText: Style.colorWhite9
readonly property string colorSelectedText: Style.colorTheme9
readonly property string colorSelection: Style.colorGreen2
readonly property string colorPlaceholderText: dark_theme ? Style.colorWhite9 : Style.colorWhite9
readonly property string colorSelectedText: dark_theme ? Style.colorTheme9 : Style.colorTheme9
readonly property string colorSelection: dark_theme ? Style.colorGreen2 : Style.colorGreen2

readonly property string colorTrendingLine: dark_theme ? Style.colorGreen : "#37a6ef"

Expand Down
6 changes: 3 additions & 3 deletions atomic_defi_design/Dex/Exchange/Trade/SimpleView/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Item

Column
{
width: root.currentSubPage === subPages.Trade ? _simpleTrade.best ? 600 : 450 : 450
width: root.currentSubPage === subPages.Trade ? _simpleTrade.best ? 720 : 450 : 450
y: 60
spacing: 30
anchors.horizontalCenter: parent.horizontalCenter
Expand Down Expand Up @@ -133,7 +133,7 @@ Item
id: _swipeSimplifiedView
currentIndex: root.currentSubPage
anchors.horizontalCenter: parent.horizontalCenter
width: 600
width: 720
height: 650
clip: true
interactive: false
Expand All @@ -144,7 +144,7 @@ Item
{
id: subTradePage
height: _simpleTrade.height
width: _simpleTrade.best ? 600 : _simpleTrade.coinSelection ? 450 : 380
width: _simpleTrade.best ? 720 : _simpleTrade.coinSelection ? 450 : 380
anchors.horizontalCenter: parent.horizontalCenter
radius: 20

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ DexListView

property int _rowWidth: width
property int _rowHeight: 40
property int _tokenColumnSize: 90
property int _quantityColumnSize: 90
property int _tokenColumnSize: 120
property int _quantityColumnSize: 95
property int _quantityInBaseColumnSize: 120
property int _fiatVolumeColumnSize: 80
property int _cexRateColumnSize: 60
property int _fiatVolumeColumnSize: 95
property int _cexRateColumnSize: 75

headerPositioning: ListView.OverlayHeader
reuseItems: true
Expand Down Expand Up @@ -187,7 +187,7 @@ DexListView
{
Layout.preferredWidth: _quantityColumnSize
horizontalAlignment: Text.AlignRight
text_value: parseFloat(General.formatDouble(rel_max_volume, General.amountPrecision, true)).toFixed(8)
text_value: Constants.General.formatNumber(rel_max_volume)
font.pixelSize: 14
opacity: !_isCoinEnabled? .3 : 1
}
Expand All @@ -196,7 +196,7 @@ DexListView
{
Layout.preferredWidth: _quantityInBaseColumnSize
horizontalAlignment: Text.AlignRight
text_value: parseFloat(General.formatDouble(base_max_volume, General.amountPrecision, true)).toFixed(8)
text_value: Constants.General.formatNumber(base_max_volume)
font.pixelSize: 14
opacity: !_isCoinEnabled? .3 : 1
}
Expand All @@ -206,16 +206,16 @@ DexListView
Layout.preferredWidth: _fiatVolumeColumnSize
horizontalAlignment: Text.AlignRight
// TODO: Adjust fiat to left/right sign based on region
text_value: parseFloat(price_fiat).toFixed(2)+Constants.API.app.settings_pg.current_fiat_sign
text_value: Constants.General.formatFiat("", price_fiat, Constants.API.app.settings_pg.current_fiat_sign)
opacity: !_isCoinEnabled? .3 : 1
}

DexLabel
DexLabel // Order CEX Rate
{
Layout.preferredWidth: _cexRateColumnSize
horizontalAlignment: Text.AlignRight
color: cex_rates=== "0" ? Qt.darker(DexTheme.foregroundColor) : parseFloat(cex_rates)>0? DexTheme.warningColor : DexTheme.okColor
text_value: cex_rates=== "0" ? "N/A" : parseFloat(cex_rates)>0? "+"+parseFloat(cex_rates).toFixed(2)+"%" : parseFloat(cex_rates).toFixed(2)+"%"
text_value: Constants.General.formatCexRates(cex_rates)
opacity: !_isCoinEnabled? .3 : 1
}

Expand Down
4 changes: 2 additions & 2 deletions atomic_defi_design/Dex/Exchange/Trade/SimpleView/Trade.qml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ClipRRect // Trade Card
Component.onCompleted: _fromValue.forceActiveFocus()
onBestChanged: if (best) Constants.API.app.trading_pg.orderbook.refresh_best_orders()

width: bestOrderSimplified.visible ? 600 : coinSelection ? 450 : 380
width: bestOrderSimplified.visible ? 720 : coinSelection ? 450 : 380
height: swap_card_content.height + 15
radius: 20

Expand Down Expand Up @@ -865,7 +865,7 @@ ClipRRect // Trade Card
tradeCard: _tradeCard
anchors.fill: parent
anchors.topMargin: 10
visible: _tradeCard.width == 600
visible: _tradeCard.width == 720

onSelectedOrderChanged:
{
Expand Down
3 changes: 2 additions & 1 deletion atomic_defi_design/Dex/Themes/CurrentTheme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ ThemeData
{
addressBookTagColors[i] = Dex.Color.argbStrFromRgbaStr(addressBookTagColors[i])
}

okColor = Dex.Color.argbStrFromRgbaStr(themeData.okColor || defaultTheme.okColor);
warningColor = Dex.Color.argbStrFromRgbaStr(themeData.warningColor || defaultTheme.warningColor);
swapIconColor = Dex.Color.argbStrFromRgbaStr(themeData.swapIconColor || defaultTheme.swapIconColor);
Expand All @@ -221,6 +220,7 @@ ThemeData
receiverColorStart = Dex.Color.argbStrFromRgbaStr(themeData.receiverColorStart || defaultTheme.receiverColorStart);

lineSeparatorColor = Dex.Color.argbStrFromRgbaStr(themeData.lineSeparatorColor || defaultTheme.lineSeparatorColor);
colorPlaceholderText = Dex.Color.argbStrFromRgbaStr(themeData.colorPlaceholderText || defaultTheme.colorPlaceholderText);
}

function loadLogo(themeName)
Expand Down Expand Up @@ -341,6 +341,7 @@ ThemeData
console.info("Dex.Themes.CurrentTheme.printValues.receiverColorStart : %1".arg(receiverColorStart));

console.info("Dex.Themes.CurrentTheme.printValues.lineSeparatorColor : %1".arg(lineSeparatorColor));
console.info("Dex.Themes.CurrentTheme.printValues.colorPlaceholderText : %1".arg(colorPlaceholderText));

console.info("Dex.Themes.CurrentTheme.printValues.logoPath : %1".arg(logoPath));
console.info("Dex.Themes.CurrentTheme.printValues.bigLogoPath : %1".arg(bigLogoPath));
Expand Down
8 changes: 7 additions & 1 deletion atomic_defi_design/Dex/Themes/DefaultTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,19 @@ function getHardcoded()

okColor: "#00C058FF",
warningColor: "#E52167FF",
colorTheme1: "#3CC9BFFF",

senderColorStart: "#F85757FF",
receiverColorStart: "#845FEFFF",

arrowUpColor: "#F85757FF",
arrowDownColor: "#845FEFFF",

lineSeparatorColor: "#CDD3DCFF"
lineSeparatorColor: "#CDD3DCFF",

colorPlaceholderText: "#444444FF",
colorSelectedText: "#0E1021FF",
colorSelection: "#14bca6FF"

}
}
Loading

0 comments on commit 9ab07d1

Please sign in to comment.