diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 258a1c7..3d5a7c0 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -517,7 +517,7 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel * } // actually update labels - int nDisplayUnit = CrownUnits::BTC; + int nDisplayUnit = CrownUnits::CRW; if (model && model->getOptionsModel()) nDisplayUnit = model->getOptionsModel()->getDisplayUnit(); diff --git a/src/qt/crownamountfield.cpp b/src/qt/crownamountfield.cpp index 1efe158..6a333e3 100644 --- a/src/qt/crownamountfield.cpp +++ b/src/qt/crownamountfield.cpp @@ -122,7 +122,7 @@ class AmountSpinBox: public QAbstractSpinBox const QFontMetrics fm(fontMetrics()); int h = lineEdit()->minimumSizeHint().height(); - int w = GUIUtil::TextWidth(fm, CrownUnits::format(CrownUnits::BTC, CrownUnits::maxMoney(), false, CrownUnits::SeparatorStyle::ALWAYS)); + int w = GUIUtil::TextWidth(fm, CrownUnits::format(CrownUnits::CRW, CrownUnits::maxMoney(), false, CrownUnits::SeparatorStyle::ALWAYS)); w += 2; // cursor blinking space QStyleOptionSpinBox opt; @@ -148,7 +148,7 @@ class AmountSpinBox: public QAbstractSpinBox } private: - int currentUnit{CrownUnits::BTC}; + int currentUnit{CrownUnits::CRW}; CAmount singleStep{CAmount(100000)}; // satoshis mutable QSize cachedMinimumSizeHint; bool m_allow_empty{true}; diff --git a/src/qt/crownunits.cpp b/src/qt/crownunits.cpp index 258b505..840a186 100755 --- a/src/qt/crownunits.cpp +++ b/src/qt/crownunits.cpp @@ -8,7 +8,7 @@ #include -static constexpr auto MAX_DIGITS_BTC = 16; +static constexpr auto MAX_DIGITS_CRW = 16; CrownUnits::CrownUnits(QObject *parent): QAbstractListModel(parent), @@ -19,9 +19,9 @@ CrownUnits::CrownUnits(QObject *parent): QList CrownUnits::availableUnits() { QList unitlist; - unitlist.append(BTC); - unitlist.append(mBTC); - unitlist.append(uBTC); + unitlist.append(CRW); + unitlist.append(mCRW); + unitlist.append(uCRW); unitlist.append(SAT); return unitlist; } @@ -30,9 +30,9 @@ bool CrownUnits::valid(int unit) { switch(unit) { - case BTC: - case mBTC: - case uBTC: + case CRW: + case mCRW: + case uCRW: case SAT: return true; default: @@ -44,9 +44,9 @@ QString CrownUnits::longName(int unit) { switch(unit) { - case BTC: return QString("BTC"); - case mBTC: return QString("mBTC"); - case uBTC: return QString::fromUtf8("µBTC (bits)"); + case CRW: return QString("CRW"); + case mCRW: return QString("mCRW"); + case uCRW: return QString::fromUtf8("µCRW (bits)"); case SAT: return QString("Satoshi (sat)"); default: return QString("???"); } @@ -56,7 +56,7 @@ QString CrownUnits::shortName(int unit) { switch(unit) { - case uBTC: return QString::fromUtf8("bits"); + case uCRW: return QString::fromUtf8("bits"); case SAT: return QString("sat"); default: return longName(unit); } @@ -66,9 +66,9 @@ QString CrownUnits::description(int unit) { switch(unit) { - case BTC: return QString("Crowns"); - case mBTC: return QString("Milli-Crowns (1 / 1" THIN_SP_UTF8 "000)"); - case uBTC: return QString("Micro-Crowns (bits) (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)"); + case CRW: return QString("Crowns"); + case mCRW: return QString("Milli-Crowns (1 / 1" THIN_SP_UTF8 "000)"); + case uCRW: return QString("Micro-Crowns (bits) (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)"); case SAT: return QString("Satoshi (sat) (1 / 100" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)"); default: return QString("???"); } @@ -78,9 +78,9 @@ qint64 CrownUnits::factor(int unit) { switch(unit) { - case BTC: return 100000000; - case mBTC: return 100000; - case uBTC: return 100; + case CRW: return 100000000; + case mCRW: return 100000; + case uCRW: return 100; case SAT: return 1; default: return 100000000; } @@ -90,9 +90,9 @@ int CrownUnits::decimals(int unit) { switch(unit) { - case BTC: return 8; - case mBTC: return 5; - case uBTC: return 2; + case CRW: return 8; + case mCRW: return 5; + case uCRW: return 2; case SAT: return 0; default: return 0; } @@ -111,7 +111,7 @@ QString CrownUnits::format(int unit, const CAmount& nIn, bool fPlus, SeparatorSt qint64 quotient = n_abs / coin; QString quotient_str = QString::number(quotient); if (justify) { - quotient_str = quotient_str.rightJustified(MAX_DIGITS_BTC - num_decimals, ' '); + quotient_str = quotient_str.rightJustified(MAX_DIGITS_CRW - num_decimals, ' '); } // Use SI-style thin space separators as these are locale independent and can't be diff --git a/src/qt/crownunits.h b/src/qt/crownunits.h index 7e558cb..b441f7b 100755 --- a/src/qt/crownunits.h +++ b/src/qt/crownunits.h @@ -41,9 +41,9 @@ class CrownUnits: public QAbstractListModel */ enum Unit { - BTC, - mBTC, - uBTC, + CRW, + mCRW, + uCRW, SAT }; diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 1f99013..d0f69a1 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -150,7 +150,7 @@ bool parseCrownURI(const QUrl &uri, SendAssetsRecipient *out) { if(!i->second.isEmpty()) { - if(!CrownUnits::parse(CrownUnits::BTC, i->second, &rv.amount)) + if(!CrownUnits::parse(CrownUnits::CRW, i->second, &rv.amount)) { return false; } @@ -183,7 +183,7 @@ QString formatCrownURI(const SendAssetsRecipient &info) if (info.amount) { - ret += QString("?amount=%1").arg(CrownUnits::format(CrownUnits::BTC, info.amount, false, CrownUnits::SeparatorStyle::NEVER)); + ret += QString("?amount=%1").arg(CrownUnits::format(CrownUnits::CRW, info.amount, false, CrownUnits::SeparatorStyle::NEVER)); paramCount++; } diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 9a48490..ddb76eb 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -69,7 +69,7 @@ void OptionsModel::Init(bool resetSettings) // Display if (!settings.contains("nDisplayUnit")) - settings.setValue("nDisplayUnit", CrownUnits::BTC); + settings.setValue("nDisplayUnit", CrownUnits::CRW); nDisplayUnit = settings.value("nDisplayUnit").toInt(); if (!settings.contains("strThirdPartyTxUrls")) diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index bc644c0..a3f4687 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -34,7 +34,7 @@ class TxViewDelegate : public QAbstractItemDelegate Q_OBJECT public: explicit TxViewDelegate(const PlatformStyle *_platformStyle, QObject *parent=nullptr): - QAbstractItemDelegate(parent), unit(CrownUnits::BTC), + QAbstractItemDelegate(parent), unit(CrownUnits::CRW), platformStyle(_platformStyle) { connect(this, &TxViewDelegate::width_changed, this, &TxViewDelegate::sizeHintChanged); @@ -292,7 +292,7 @@ void OverviewPage::setWalletModel(WalletModel *model) }); } - // update the display unit, to not use the default ("BTC") + // update the display unit, to not use the default ("CRW") updateDisplayUnit(); } diff --git a/src/qt/psbtoperationsdialog.cpp b/src/qt/psbtoperationsdialog.cpp index 38837e3..935d294 100644 --- a/src/qt/psbtoperationsdialog.cpp +++ b/src/qt/psbtoperationsdialog.cpp @@ -165,7 +165,7 @@ std::string PSBTOperationsDialog::renderTransaction(const PartiallySignedTransac ExtractDestination(out.scriptPubKey, address); totalAmount += out.nValue; tx_description.append(tr(" * Sends %1 to %2") - .arg(CrownUnits::formatWithUnit(CrownUnits::BTC, out.nValue)) + .arg(CrownUnits::formatWithUnit(CrownUnits::CRW, out.nValue)) .arg(QString::fromStdString(EncodeDestination(address)))); tx_description.append("
"); } @@ -177,7 +177,7 @@ std::string PSBTOperationsDialog::renderTransaction(const PartiallySignedTransac tx_description.append(tr("Unable to calculate transaction fee or total transaction amount.")); } else { tx_description.append(tr("Pays transaction fee: ")); - tx_description.append(CrownUnits::formatWithUnit(CrownUnits::BTC, *analysis.fee)); + tx_description.append(CrownUnits::formatWithUnit(CrownUnits::CRW, *analysis.fee)); // add total amount in all subdivision units tx_description.append("
"); diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index b98d695..0e9e486 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -115,10 +115,12 @@ QList TransactionRecord::decomposeTransaction(const interface // Debit // CAmountMap nTxFee = nDebit - wtx.tx->GetValueOutMap(); - - for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++) - { - const CTxOut& txout = wtx.tx->vout[nOut]; + for (unsigned int nOut = 0; nOut < (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout.size() : wtx.tx->vout.size()) ; nOut++){ + CTxOutAsset txout = (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout[nOut] : wtx.tx->vout[nOut]); + + //for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++) + //{ + //const CTxOut& txout = wtx.tx->vout[nOut]; TransactionRecord sub(hash, nTime); sub.idx = nOut; sub.involvesWatchAddress = involvesWatchAddress;