From 4c6e6bb5d8a6474d96958e630b54423da4157227 Mon Sep 17 00:00:00 2001 From: npq7721 Date: Sat, 18 May 2024 09:09:19 -0700 Subject: [PATCH] Ft/uppercase (#375) * add --enable-stacktraces --enable-crash-hooks to debug build * enable stacktrace by default * bump up version and turn user input for asset name to be case insensitive * only convert to upercase for root asset --- build.properties | 6 +++--- configure.ac | 2 +- src/qt/createassetsdialog.cpp | 21 +++++++++++++++------ src/qt/createassetsdialog.h | 2 ++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/build.properties b/build.properties index f988cf6a1..540c62ac6 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +1,3 @@ -snapshot-version=2.0.0.99-SNAPSHOT -release-version=2.0.0.00 -candidate-version=2.0.0.00-candidate \ No newline at end of file +snapshot-version=2.0.1.99-SNAPSHOT +release-version=2.0.1.00 +candidate-version=2.0.1.00-candidate \ No newline at end of file diff --git a/configure.ac b/configure.ac index 5195e8dde..49dea8604 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.69]) define(_CLIENT_VERSION_MAJOR, 2) define(_CLIENT_VERSION_MINOR, 0) -define(_CLIENT_VERSION_REVISION, 00) +define(_CLIENT_VERSION_REVISION, 01) define(_CLIENT_VERSION_BUILD, 99) define(_CLIENT_VERSION_IS_RELEASE, false) define(_COPYRIGHT_YEAR, 2024) diff --git a/src/qt/createassetsdialog.cpp b/src/qt/createassetsdialog.cpp index fa787a144..7db80d44a 100644 --- a/src/qt/createassetsdialog.cpp +++ b/src/qt/createassetsdialog.cpp @@ -38,6 +38,7 @@ #include #include + #define SEND_CONFIRM_DELAY 3 CreateAssetsDialog::CreateAssetsDialog(QWidget *parent) : @@ -173,6 +174,7 @@ CreateAssetsDialog::CreateAssetsDialog(QWidget *parent) : ui->RootAssetBox->setModel(proxy); ui->RootAssetBox->setEditable(true); ui->RootAssetBox->lineEdit()->setPlaceholderText("Select Root asset"); + ui->assetnameText->setToolTip("a-z A-Z 0-9 and space"); } void CreateAssetsDialog::setClientModel(ClientModel *_clientModel) { @@ -293,6 +295,14 @@ void CreateAssetsDialog::on_createAssetButton_clicked() { createAsset(); } +std::string CreateAssetsDialog::getAssetName(bool isRoot) { + std::string assetName = ui->assetnameText->text().toStdString(); + if(isRoot) { + std::transform(assetName.begin(), assetName.end(), assetName.begin(), ::toupper); + } + return assetName; +} + void CreateAssetsDialog::createAsset() { if (getAssetsFees() == 0) { QMessageBox msgBox; @@ -303,7 +313,8 @@ void CreateAssetsDialog::createAsset() { } CNewAssetTx assetTx; - assetTx.name = ui->assetnameText->text().toStdString(); + bool isRoot = ui->AssetTypeBox->currentText() == "Root"; + assetTx.name = this->getAssetName(isRoot); assetTx.referenceHash = ui->ipfsText->text().toStdString(); @@ -413,9 +424,8 @@ void CreateAssetsDialog::onUniqueChanged() { bool CreateAssetsDialog::validateInputs() { bool retval{true}; - std::string assetname = ui->assetnameText->text().toStdString(); bool isRoot = ui->AssetTypeBox->currentText() == "Root"; - + std::string assetname = this->getAssetName(isRoot); //check if asset name is valid if (!IsAssetNameValid(assetname, isRoot)) { retval = false; @@ -784,8 +794,9 @@ void CreateAssetsDialog::CoinControlUpdateLabels() { void CreateAssetsDialog::checkAvailabilityClicked() { - std::string assetname = ui->assetnameText->text().toStdString(); + bool isRoot = ui->AssetTypeBox->currentText() == "Root"; + std::string assetname = this->getAssetName(isRoot); //check if asset name is valid if (!IsAssetNameValid(assetname, isRoot)) { @@ -820,11 +831,9 @@ void CreateAssetsDialog::onAssetTypeSelected(QString name) { if (name == "Root") { ui->RootAssetLabel->setVisible(false); ui->RootAssetBox->setVisible(false); - ui->assetnameText->setToolTip("A-Z 0-9 and space"); } else if (name == "Sub") { ui->RootAssetLabel->setVisible(true); ui->RootAssetBox->setVisible(true); - ui->assetnameText->setToolTip("a-z A-Z 0-9 and space"); // Get available assets list std::map > assets = model->wallet().getMyAssets(); diff --git a/src/qt/createassetsdialog.h b/src/qt/createassetsdialog.h index fa58028d1..3c4341159 100644 --- a/src/qt/createassetsdialog.h +++ b/src/qt/createassetsdialog.h @@ -79,6 +79,8 @@ public void updateFeeMinimizedLabel(); void createAsset(); + //return all uppercase assetName if it is root, otherwise return as it is + std::string getAssetName(bool isRoot); // Update the passed in CCoinControl with state from the GUI void updateCoinControlState(CCoinControl &ctrl);