Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/groovy_gluon_7.2RC' into…
Browse files Browse the repository at this point in the history
… mainnet
  • Loading branch information
anatolse committed Nov 8, 2022
2 parents 0a328ff + e134316 commit d09aca0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion beam
5 changes: 3 additions & 2 deletions ui/model/assets_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,10 @@ QMap<QString, QVariant> AssetsManager::getAssetProps(beam::Asset::ID assetId)

beam::wallet::Currency assetCurr(assetId);
const bool isBEAM = assetId == beam::Asset::s_BeamID;

auto unitName = getUnitName(assetId, AssetsManager::NoShorten);
asset.insert("isBEAM", isBEAM);
asset.insert("unitName", getUnitName(assetId, AssetsManager::NoShorten));
asset.insert("unitName", unitName);
asset.insert("unitNameWithId", isBEAM ? unitName : QString("%1 <font color='#8da1ad'>(%2)</font>").arg(unitName).arg(assetId));
asset.insert("rate", beamui::AmountToUIString(_rates->getRate(assetCurr)));
asset.insert("rateUnit", getRateUnit());
asset.insert("assetId", static_cast<int>(assetId));
Expand Down
8 changes: 5 additions & 3 deletions ui/view/controls/AmountInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ ColumnLayout {
readonly property bool isValid: error.length == 0

property int currencyIdx: currCombo.currentIndex
readonly property string currencyUnit: currencies[currencyIdx].unitName
readonly property string currencyUnitNoId: currencies[currencyIdx].unitName
readonly property string currencyUnit: currencies[currencyIdx].unitName +
((currencies[currencyIdx].assetId > 0) ? " (%1)".arg(currencies[currencyIdx].assetId) : "")
readonly property bool isBeam: !!currencies[currencyIdx].isBEAM

property string rate: currencies[currencyIdx].rate
Expand All @@ -37,7 +39,7 @@ ColumnLayout {
property bool readOnlyA: false
property bool resetAmount: true
property var amountInput: ainput
property bool showRate: control.rateUnit != "" && control.rateUnit != control.currencyUnit
property bool showRate: control.rateUnit != "" && control.rateUnit != control.currencyUnitNoId
readonly property bool isExchangeRateAvailable: control.rate != "0"

SFText {
Expand Down Expand Up @@ -129,7 +131,7 @@ ColumnLayout {
enabled: multi
colorConst: true
model: control.currencies
textRole: "unitName"
textRole: "unitNameWithId"
textMaxLenDrop: 10
enableScroll: true
showBackground: false
Expand Down
14 changes: 12 additions & 2 deletions ui/viewmodel/dex/dex_orders_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
#include "viewmodel/ui_helpers.h"
#include <QDateTime>

namespace
{
QString FormatAmount(beam::Amount amount, const std::string& unitName, beam::Asset::ID assetId)
{
return beamui::AmountToUIString(amount) +
" " + QString::fromStdString(unitName) +
(assetId > 0 ? QString("<font color='#8da1ad'> (%1)</font>").arg(assetId) : "");
}
}

DexOrdersList::DexOrdersList()
: m_amgr(AppModel::getInstance().getAssets())
, m_wallet(AppModel::getInstance().getWalletModel())
Expand Down Expand Up @@ -74,15 +84,15 @@ QVariant DexOrdersList::data(const QModelIndex &index, int role) const
}
case Roles::RSend:
{
return beamui::AmountToUIString(order.getSendAmount()) + " " + QString::fromStdString(order.getSendAssetSName());
return FormatAmount(order.getSendAmount(), order.getSendAssetSName(), order.getSendAssetId());
}
case Roles::RSendSort:
{
return QVariant::fromValue(order.getSendAmount());
}
case Roles::RReceive:
{
return beamui::AmountToUIString(order.getReceiveAmount()) + " " + QString::fromStdString(order.getReceiveAssetSName());
return FormatAmount(order.getReceiveAmount(), order.getReceiveAssetSName(), order.getReceiveAssetId());
}
case Roles::RReceiveSort:
{
Expand Down

0 comments on commit d09aca0

Please sign in to comment.