[Dev] Documenting Feathercoin Specific Software settings - Part 8
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/bitcoingui.h
+ QAction *inertBlockChainAction;
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/feathercoin.qrc
+ <file alias="comment">res/icons/comment.png</file>
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/forms/commentdialog.ui
New file added, 129 lines of code
+ <?xml version="1.0" encoding="UTF-8"?> + <ui version="4.0"> + <class>CommentDialog</class> + <widget class="QDialog" name="CommentDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>556</width> + <height>208</height> + </rect> + </property> + <property name="windowTitle"> + <string>Insert your comments into blockchain</string> + </property> + <widget class="QPushButton" name="insertButton"> + <property name="geometry">
Start of added file comment dialog, note : updated since.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/forms/shiftdialog.ui
- <number>1</number> + <number>0</number>
Code replaced
+ <property name="cursor"> + <cursorShape>PointingHandCursor</cursorShape> + </property>
Code added
+ <property name="cursor"> + <cursorShape>PointingHandCursor</cursorShape> + </property> + <property name="cursor"> + <cursorShape>PointingHandCursor</cursorShape> + </property> + <property name="cursor"> + <cursorShape>PointingHandCursor</cursorShape> + </property>
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/locale/bitcoin_zh_CN.ts
+ <source>&Comments</source> + <translation>留言</translation> + </message> + <message> + <source>Insert your comments into blockchain</source> + <translation>向区块链内写入留言</translation> + </message> + <message>
Additional code for Comment text chinese
+ <name>CommentDialog</name> + <message> + <source>Insert your comments into blockchain</source> + <translation>向区块链插入你的留言</translation> + </message> + <message> + <source>Pay to:</source> + <translation>付款给:</translation> + </message> + <message> + <source>Comments</source> + <translation>请留言</translation> + </message> + <message> + <source>Insert into BlockChain</source> + <translation>插入区块链</translation> + </message> + <message> + <source>Exit</source> + <translation>退出</translation> + </message> + <message> + <source>The comment length can not be above 35 charset !</source> + <translation>留言文字长度不能超过35个字符!</translation> + </message> + <message> + <source>Are you sure you want to send?</source> + <translation>你同意发出吗?</translation> + </message> + <message> + <source>Insert into blockchain ,Yes!!!</source> + <translation>写入块链完成!</translation> + </message> + <message> + <source>Wallet Message</source> + <translation>钱包信息</translation> + </message> + <message> + <source>Wallet WARNING</source> + <translation>钱包警告</translation> + </message> + <message> + <source>Send Coins Failed:</source> + <translation>发送羽毛币失败:</translation> + </message> + <message> + <source>Send Coins</source> + <translation>发送羽毛币</translation> + </message> + </context> + <context>
Large section of extra translations
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/res/icons/*
src/qt/res/icons/comment.png
File added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/utilitydialog.cpp
+ #include "ui_commentdialog.h" + #include "ui_interface.h" + #include "walletmodel.h" + #include "addresstablemodel.h" + #include "main.h" + /** "comment" dialog box */ + CommentDialog::CommentDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::CommentDialog) + { + ui->setupUi(this); + //ui->buttonBox->addButton(tr("Close"), QDialogButtonBox::RejectRole); + + } + + void CommentDialog::setModel(WalletModel *model) + { + + this->model = model; + //this->on_insertButton_clicked(); + + } + + CommentDialog::~CommentDialog() + { + delete ui; + } + + void CommentDialog::on_insertButton_clicked() + { + if(!model || !model->getOptionsModel()) + return; + + QString addrOP=ui->addrEdit->text(); + QString textOP=ui->txtComment->text(); + if (textOP.length()>35) + { + QMessageBox::information(NULL, tr("Wallet Message"), tr("The comment length can not be above 35 charset !"), QMessageBox::Yes , QMessageBox::Yes); + return; + } + + QList<SendCoinsRecipient> recipients; + SendCoinsRecipient rcptmp; + // Payment request + if (rcptmp.paymentRequest.IsInitialized()) + return ; + rcptmp.typeInd = AddressTableModel::AT_Normal; + rcptmp.address=addrOP; + rcptmp.label="blockchain"; + rcptmp.amount=DUST_HARD_LIMIT*10; + rcptmp.message =textOP; + recipients.append(rcptmp); + + // Format confirmation message + QStringList formatted; + foreach(const SendCoinsRecipient &rcp, recipients) + { + // generate bold amount string + QString amount = "<b>" + BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount); + amount.append("</b>"); + // generate monospace address string + QString address = "<span style='font-family: monospace;'>" + rcp.address; + address.append("</span>"); + + QString recipientElement; + if (!rcp.paymentRequest.IsInitialized()) // normal payment + { + if(rcp.label.length() > 0) // label with address + { + recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.label)); + recipientElement.append(QString(" (%1)").arg(address)); + } + else // just address + { + recipientElement = tr("%1 to %2").arg(amount, address); + } + } + else if(!rcp.authenticatedMerchant.isEmpty()) // secure payment request + { + recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.authenticatedMerchant)); + } + else // insecure payment request + { + recipientElement = tr("%1 to %2").arg(amount, address); + } + + formatted.append(recipientElement); + } + + // prepare transaction for getting txFee earlier + WalletModelTransaction currentTransaction(recipients); + WalletModel::SendCoinsReturn prepareStatus; + if (model->getOptionsModel()->getCoinControlFeatures()) // coin control enabled + prepareStatus = model->prepareTransaction(currentTransaction, CoinControlDialog::coinControl); + else + prepareStatus = model->prepareTransaction(currentTransaction); + + // process prepareStatus and on error generate message shown to user + processSendCoinsReturn(prepareStatus, + BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), currentTransaction.getTransactionFee())); + + if(prepareStatus.status != WalletModel::OK) { + return; + } + + QString questionString = tr("Are you sure you want to send?"); + questionString.append("<br /><br />%1"); + qint64 txFee = currentTransaction.getTransactionFee(); + if(txFee > 0) + { + // append fee string if a fee is required + questionString.append("<hr /><span style='color:#aa0000;'>"); + questionString.append(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), txFee)); + questionString.append("</span> "); + questionString.append(tr("added as transaction fee")); + } + + // add total amount in all subdivision units + questionString.append("<hr />"); + qint64 totalAmount = currentTransaction.getTotalTransactionAmount() + txFee; + QStringList alternativeUnits; + foreach(BitcoinUnits::Unit u, BitcoinUnits::availableUnits()) + { + if(u != model->getOptionsModel()->getDisplayUnit()) + alternativeUnits.append(BitcoinUnits::formatWithUnit(u, totalAmount)); + } + questionString.append(tr("Total Amount %1 (= %2)") + .arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount)) + .arg(alternativeUnits.join(" " + tr("or") + " "))); + QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm send coins"), + questionString.arg(formatted.join("<br />")), + QMessageBox::Yes | QMessageBox::Cancel, + QMessageBox::Cancel); + if(retval != QMessageBox::Yes) + { + return; + } + + // now send the prepared transaction + WalletModel::SendCoinsReturn sendStatus = model->sendCoins(currentTransaction); + if (sendStatus.status == WalletModel::OK) + { + QMessageBox::information(NULL, tr("Wallet Message"), tr("Insert into blockchain ,Yes!!!"), QMessageBox::Yes , QMessageBox::Yes); + ui->txtComment->setText(""); + } + } + + void CommentDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg) + { + QPair<QString, CClientUIInterface::MessageBoxFlags> msgParams; + // Default to a warning message, override if error message is needed + msgParams.second = CClientUIInterface::MSG_WARNING; + + // This comment is specific to SendCoinsDialog usage of WalletModel::SendCoinsReturn. + // WalletModel::TransactionCommitFailed is used only in WalletModel::sendCoins() + // all others are used only in WalletModel::prepareTransaction() + switch(sendCoinsReturn.status) + { + case WalletModel::InvalidAddress: + msgParams.first = tr("The recipient address is not valid, please recheck."); + break; + case WalletModel::InvalidAmount: + msgParams.first = tr("The amount to pay must be larger than 0."); + break; + case WalletModel::AmountExceedsBalance: + msgParams.first = tr("The amount exceeds your balance."); + break; + case WalletModel::AmountWithFeeExceedsBalance: + msgParams.first = tr("The total exceeds your balance when the %1 transaction fee is included.").arg(msgArg); + break; + case WalletModel::DuplicateAddress: + msgParams.first = tr("Duplicate address found, can only send to each address once per send operation."); + break; + case WalletModel::TransactionCreationFailed: + msgParams.first = tr("Transaction creation failed!"); + msgParams.second = CClientUIInterface::MSG_ERROR; + break; + case WalletModel::TransactionCommitFailed: + msgParams.first = tr("The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); + msgParams.second = CClientUIInterface::MSG_ERROR; + break; + // included to prevent a compiler warning. + case WalletModel::OK: + default: + return; + } + + QMessageBox::information(NULL, tr("Wallet WARNING"), tr("Send Coins Failed:") + msgParams.first, QMessageBox::Yes , QMessageBox::Yes); + emit message(tr("Send Coins"), msgParams.first, msgParams.second); + } + + void CommentDialog::on_pushButton_clicked() + { + close(); + } + +
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/utilitydialog.h
+ class SendCoinsRecipient; + class CommentDialog;
Code added
+ /** "Comment" dialog box */ + class CommentDialog : public QDialog + { + Q_OBJECT + + public: + explicit CommentDialog(QWidget *parent); + ~CommentDialog(); + + void setModel(WalletModel *model); + + private: + Ui::CommentDialog *ui; + WalletModel *model; + void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg = QString()); + + private slots: + void on_insertButton_clicked(); + void on_pushButton_clicked(); + + signals: + void message(const QString &title, const QString &message, unsigned int style); + }; +
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/walletframe.h
+ /** Open comment dialog **/ + void inertBlockChain();
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/walletmodel.cpp
+ LogPrintf("scriptPubKey= %s \n", scriptPubKey.ToString());
Code replaced
+ //insert message into blockchain + if (rcp.message.length()>=1) + { + std::string strMess = rcp.message.toStdString(); + const char* pszMess =strMess.c_str(); + CScript scriptP = CScript() << OP_RETURN << vector<unsigned char>((const unsigned char*)pszMess, (const unsigned char*)pszMess + strlen(pszMess)); + vecSend.push_back(std::pair<CScript, int64_t>(scriptP, 0)); + } + //normal +
Code added, //insert message into blockchain
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/walletview.cpp
+ } + + void WalletView::inertBlockChain() + { + if(!walletModel) + return; + + CommentDialog dlg(this); + dlg.setModel(walletModel); + dlg.exec();
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Blockchain comment : - commit
https://github.com/FeatherCoin/Feathercoin/commit/07b97230a33008f23992330eb1689382df53a1e8
Adds support for making comments in Blockchain
src/qt/walletview.h
+ /** Open comment dialog **/ + void inertBlockChain(); +
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
fix code : - commit
https://github.com/FeatherCoin/Feathercoin/commit/eae29b86c9ae0ecd550e1088393526cfa55a97b6
fix code
src/main.cpp
- //if (!CheckProofOfWork(block.GetHash(), block.nBits)) - //if (!CheckProofOfWork(block.GetPoWHash(), block.nBits))
Commented out code removed
// Feathercoin: eHRC at 3rd hard fork -//int64_t nTargetTimespan = 60; // Feathercoin: 1 minute -//int64_t nTargetSpacing = 60; // Feathercoin: 1 minute
Commented out code removed
-static const int64_t nTargetTimespanNEW = 60 ; // Feathercoin: unused
Code removed
-static const int64_t nDiffChangeTarget = 145000; // Feathercoin: unused ,Patch effective @ block 145000 -static const int64_t nTestnetResetTargetFix = 157500; // Feathercoin: unused ,Testnet enables target reset at block 157500
Code removed
-//0.8.7 ACP code have some problem in 0.9.3,so I delete them.
Comment removed
- //if (!pblocktree->WriteDiskBlockIndex(CDiskBlockIndex(pindexNew)) || !pblocktree->WriteBlockIndex(*pindexNew)) - //if (!pblocktree->WriteBlockIndex(CDiskBlockIndex(pindexNew)))
Commented code removed
- LogPrintf("CBlockHeader::CheckProofOfWork(), nHeight=%i \n",nHeight); + //LogPrintf("CBlockHeader::CheckProofOfWork(), nHeight=%i \n",nHeight);
Code commented out
- //if (fCheckPOW && !CheckProofOfWork(block.GetPoWHash(), block.nBits)) - //if (fCheckPOW && !CheckProofOfWork(GetPoWHash(), nBits))
Commented out code removed
- // auxpow is not in memory, load CDiskBlockHeader - // from database to get it - - //Feathercoin unused - //pblocktree->ReadDiskBlockIndex(*phashBlock, diskblockindex); - //block.auxpow = diskblockindex.auxpow;
Commented out code removed
- //from dogecoin - /*if (!CheckBlock(*pblock, state, INT_MAX)) { - if (state.CorruptionPossible()) - mapAlreadyAskedFor.erase(CInv(MSG_BLOCK, hash)); - return error("ProcessBlock() : CheckBlock FAILED"); - }*/ - //if (!CheckBlock(*pblock, state,nForkFour-1)) - //if (!CheckBlock(*pblock, state,1))
Commented out code removed
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
fix code : - commit
https://github.com/FeatherCoin/Feathercoin/commit/eae29b86c9ae0ecd550e1088393526cfa55a97b6
fix code
src/qt/Makefile.am
+ forms/commentdialog.ui \
Add code.
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/crypter.h
No change, white space removed
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/key.h
+ // Simply read-only vector-like interface to the pubkey data.
Unnecessary change to a comment?
- ::WriteCompactSize(s, len); + //::WriteCompactSize(s, len); + ::Serialize(s, VARINT(len), nType, nVersion);
Code replaced
- unsigned int len = ::ReadCompactSize(s); + //unsigned int len = ::ReadCompactSize(s); + unsigned int len; + ::Unserialize(s, VARINT(len), nType, nVersion);
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/main.cpp
- //from bitcoin - //if (!AddToBlockIndex(block, state, blockPos)) - // return error("InitBlockIndex AddToBlockIndex() : genesis block not accepted"); - //from dogecoin
Code removed
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/qt/Makefile.am
+ forms/debugdialog.ui \
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/qt/bitcoingui.cpp
+ debugAction = new QAction(QIcon(":/icons/comment"), tr("&Debug"), this); + debugAction->setStatusTip(tr("Debug Feathercoin")); + connect(debugAction, SIGNAL(triggered()), walletFrame, SLOT(debugClicked())); + help->addAction(debugAction); + debugAction->setEnabled(enabled);
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/qt/bitcoingui.h
+ QAction *debugAction;
Code added