From 4719f4f35ba8a885f5d7176ecaf10abad061fe71 Mon Sep 17 00:00:00 2001 From: zathras-crypto Date: Wed, 6 May 2015 21:47:21 -0700 Subject: [PATCH] UI: remove hardcoded property limit in send dialog --- src/qt/sendmpdialog.cpp | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/qt/sendmpdialog.cpp b/src/qt/sendmpdialog.cpp index ee9db69f27b3f..a0753e9a4d4da 100644 --- a/src/qt/sendmpdialog.cpp +++ b/src/qt/sendmpdialog.cpp @@ -76,14 +76,12 @@ SendMPDialog::SendMPDialog(QWidget *parent) : walletModel(0) { ui->setupUi(this); -// this->model = model; #ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac ui->clearButton->setIcon(QIcon()); ui->sendButton->setIcon(QIcon()); #endif -#if QT_VERSION >= 0x040700 - // populate placeholder text +#if QT_VERSION >= 0x040700 // populate placeholder text ui->sendToLineEdit->setPlaceholderText("Enter a Omni Layer address (e.g. 1oMn1LaYeRADDreSShef77z6A5S4P)"); ui->amountLineEdit->setPlaceholderText("Enter Amount"); #endif @@ -116,31 +114,27 @@ void SendMPDialog::setWalletModel(WalletModel *model) void SendMPDialog::updatePropSelector() { + uint32_t nextPropIdMainEco = GetNextPropertyId(true); // these allow us to end the for loop at the highest existing + uint32_t nextPropIdTestEco = GetNextPropertyId(false); // property ID rather than a fixed value like 100000 (optimization) QString spId = ui->propertyComboBox->itemData(ui->propertyComboBox->currentIndex()).toString(); ui->propertyComboBox->clear(); - for (unsigned int propertyId = 1; propertyId<100000; propertyId++) - { - if ((global_balance_money_maineco[propertyId] > 0) || (global_balance_reserved_maineco[propertyId] > 0)) - { - string spName; - spName = getPropertyName(propertyId).c_str(); - if(spName.size()>20) spName=spName.substr(0,23)+"..."; - string spId = static_cast( &(ostringstream() << propertyId) )->str(); + for (unsigned int propertyId = 1; propertyId < nextPropIdMainEco; propertyId++) { + if ((global_balance_money_maineco[propertyId] > 0) || (global_balance_reserved_maineco[propertyId] > 0)) { + std::string spName = getPropertyName(propertyId); + std::string spId = static_cast( &(ostringstream() << propertyId) )->str(); + if(spName.size()>23) spName=spName.substr(0,23) + "..."; spName += " (#" + spId + ")"; if (isPropertyDivisible(propertyId)) { spName += " [D]"; } else { spName += " [I]"; } ui->propertyComboBox->addItem(spName.c_str(),spId.c_str()); } } - for (unsigned int propertyId = 1; propertyId<100000; propertyId++) - { - if ((global_balance_money_testeco[propertyId] > 0) || (global_balance_reserved_testeco[propertyId] > 0)) - { - string spName; - spName = getPropertyName(propertyId+2147483647).c_str(); - if(spName.size()>20) spName=spName.substr(0,23)+"..."; - string spId = static_cast( &(ostringstream() << propertyId+2147483647) )->str(); + for (unsigned int propertyId = 2147483647; propertyId < nextPropIdTestEco; propertyId++) { + if ((global_balance_money_testeco[propertyId-2147483647] > 0) || (global_balance_reserved_testeco[propertyId-2147483647] > 0)) { + std::string spName = getPropertyName(propertyId); + std::string spId = static_cast( &(ostringstream() << propertyId) )->str(); + if(spName.size()>23) spName=spName.substr(0,23)+"..."; spName += " (#" + spId + ")"; - if (isPropertyDivisible(propertyId+2147483647)) { spName += " [D]"; } else { spName += " [I]"; } + if (isPropertyDivisible(propertyId)) { spName += " [D]"; } else { spName += " [I]"; } ui->propertyComboBox->addItem(spName.c_str(),spId.c_str()); } }