[Dev] Documenting Feathercoin Specific Software settings - Part 10
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/base40.h
Copyright not included.
+/* Encode strings as base40. + Lizhi +*/ + +#ifndef FEATHERCOIN_BASE40_H +#define FEATHERCOIN_BASE40_H + +#include <stdint.h> +#include <stdio.h> +#include <string> +#include <string.h> +#include <cctype> +#include <iostream> + +#include <sstream> +#include <algorithm> + +static const char* pszBase40 = "0123456789abcdefghijklmnopqrstuvwxyz-_.+"; +static const char* pszBase16 = "0123456789abcdef"; + + +//Turn a string into a non-negative integer. +uint64_t charset_to_int(const unsigned char* pbegin, const unsigned char* pend) +{ + uint64_t output = 0; + while (pbegin != pend) + { + const char *ch = strchr(pszBase40, *pbegin); + if (ch == NULL) + return 404; + int carry = ch - pszBase40; //indexof + output = output * strlen(pszBase40) + carry; + pbegin++; + } + return output; +} + +void i64tohex(uint64_t n,char *s) +{ + char base[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; + uint64_t a = n; + int i = 0; + while(a != 0) + { + s[i++] = base[a%16]; + a/=16; + } +} + +//Turn a non-negative integer into a string. +std::string int_to_charset(uint64_t val) +{ + if (val < 0) return "ERROR"; + if (val == 0) return "0"; + + std::string output; + char a[80] = {0}; + i64tohex(val,a); + std::string tmp; + tmp.assign(a); + + const char *s1 = tmp.c_str(); + char b[80] = {0}; + int p=0; + for (int i=(strlen(s1)-1);i>=0;i--) + { + b[p]=a[i]; + p++; + } + + output.assign(b); + return output; +} + +std::string hexpad(std::string val) +{ + std::string output="0"; + if ((val.length()%2)==1) + { + output=output+val; + return output; + } + else + { + return val; + } +} + +std::string charset_to_hex(const std::vector<unsigned char>& vch) +{ + uint64_t intermediate_integer=charset_to_int(&vch[0],&vch[0] + vch.size()); + + std::string output; + output=int_to_charset(intermediate_integer); + output=hexpad(output); + return output; +} + + + + + +void unhexlify(const std::string &hex, std::vector<unsigned char> &bytes) +{ + for (std::size_t i = 0; i < hex.size(); i += 2) + { + int byte; + std::stringstream ss; + ss << std::hex << hex[i] << hex[i + 1]; + ss >> byte; + bytes.push_back(byte); + } +} + +std::string unhexlify(std::string inData) +{ + std::vector<unsigned char> vch; + unhexlify(inData,vch); + + std::string output(vch.begin(),vch.end()); + return output; +} + + + +#endif // FEATHERCOIN_BASE40_H
Code added 126 lines new code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/bitcoin-config.h
-/* Define to 1 libzxing must be available for support */ -#define USE_ZXING 1 +/* Define to 0 libzxing must be available for support */ +#define USE_ZXING 0
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/chainparams.cpp
- 0xc49c0ed8, 0x1df9d243, 0xd9b75a40, 0xdc525e46, 0x72c321b1, 0x4eedeeb2, 0x18271787, 0xce725232, + 0xc49c0ed8, 0x1df9d243, 0xd9b75a40, 0xdc525e46, 0x72c321b1, 0x4eedeeb2, 0x18271787, 0xce725232,
Code replaced
+ vSeeds.push_back(CDNSSeedData("feathercoin.com", "dnsseed.feathercoin.com"));
Code added
+ vSeeds.push_back(CDNSSeedData("feathercoin.com", "testnet-dnsseed.feathercoin.com"));
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/clientversion.h
// Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source -#define COPYRIGHT_YEAR 2014 +#define COPYRIGHT_YEAR 2015
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/key.cpp
ACP code updated
+std::vector<unsigned char> CKey::GetPubKeyU(bool fCompressed) const +{ + if (fCompressed) + EC_KEY_set_conv_form(pkey, POINT_CONVERSION_COMPRESSED); + else + EC_KEY_set_conv_form(pkey, POINT_CONVERSION_UNCOMPRESSED); + + int nSize = i2o_ECPublicKey(pkey, NULL); + std::vector<unsigned char> pubKey(nSize, 0); + unsigned char* pBegin = &pubKey[0]; + i2o_ECPublicKey(pkey, &pBegin); + return pubKey; +} + +}
Code added
+ std::vector<unsigned char> GetPubKeyU(bool fCompressed = false) const;
- }
Code added
-//for 0.8.7 ACP -bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) -{ - // All modifications to the coin state will be done in this cache. - // Only when all have succeeded, we push it to pcoinsTip. - CCoinsViewCache view(*pcoinsTip, true); - - // Find the fork (typically, there is none) - uint256 hashfork = view.GetBestBlock(); - CBlockIndex* pfork = mapBlockIndex.find(hashfork)->second; - CBlockIndex* plonger = pindexNew; - while (pfork && pfork != plonger) - { - while (plonger->nHeight > pfork->nHeight) { - plonger = plonger->pprev; - assert(plonger != NULL); - } - if (pfork == plonger) - break; - pfork = pfork->pprev; - assert(pfork != NULL); - } - - // List of what to disconnect (typically nothing) - vector<CBlockIndex*> vDisconnect; - for (CBlockIndex* pindex = mapBlockIndex.find(hashfork)->second; pindex != pfork; pindex = pindex->pprev) - vDisconnect.push_back(pindex); - - // List of what to connect (typically only pindexNew) - vector<CBlockIndex*> vConnect; - for (CBlockIndex* pindex = pindexNew; pindex != pfork; pindex = pindex->pprev) - vConnect.push_back(pindex); - reverse(vConnect.begin(), vConnect.end()); - - if (vDisconnect.size() > 0) { - LogPrintf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str()); - LogPrintf("REORGANIZE: Connect %"PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str()); - } - - // Disconnect shorter branch - vector<CTransaction> vResurrect; - BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) { - CBlock block; - //if (!block.ReadFromDisk(pindex)) - if (!ReadBlockFromDisk(block, pindex)) - return state.Abort(_("Failed to read block")); - int64 nStart = GetTimeMicros(); - //if (!block.DisconnectBlock(state, pindex, view)) - bool fClean = true; - if (!DisconnectBlock(block, state, pindex, view, &fClean)) - return error("SetBestBlock() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().c_str()); - if (fBenchmark) - LogPrintf("- Disconnect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); - - // Queue memory transactions to resurrect. - // We only do this for blocks after the last checkpoint (reorganisation before that - // point should only happen with -reindex/-loadblock, or a misbehaving peer. - BOOST_FOREACH(const CTransaction& tx, block.vtx) - if (!tx.IsCoinBase() && pindex->nHeight > Checkpoints::GetTotalBlocksEstimate()) - vResurrect.push_back(tx); - } - - // Connect longer branch - vector<CTransaction> vDelete; - BOOST_FOREACH(CBlockIndex *pindex, vConnect) { - CBlock block; - //if (!block.ReadFromDisk(pindex)) - if (!ReadBlockFromDisk(block, pindex)) - return state.Abort(_("Failed to read block")); - int64 nStart = GetTimeMicros(); - //if (!block.ConnectBlock(state, pindex, view)) { - if (!ConnectBlock(block, state, pindex, view)) { - if (state.IsInvalid()) { - InvalidChainFound(pindexNew); - InvalidBlockFound(pindex,state); - } - return error("SetBestBlock() : ConnectBlock %s failed", pindex->GetBlockHash().ToString().c_str()); - } - if (fBenchmark) - LogPrintf("- Connect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); - - // Queue memory transactions to delete - BOOST_FOREACH(const CTransaction& tx, block.vtx) - vDelete.push_back(tx); - } - - // Flush changes to global coin state - int64 nStart = GetTimeMicros(); - int nModified = view.GetCacheSize(); - assert(view.Flush()); - int64 nTime = GetTimeMicros() - nStart; - if (fBenchmark) - LogPrintf("- Flush %i transactions: %.2fms (%.4fms/tx)\n", nModified, 0.001 * nTime, 0.001 * nTime / nModified); - - // Make sure it's successfully written to disk before changing memory structure - bool fIsInitialDownload = IsInitialBlockDownload(); - if (!fIsInitialDownload || pcoinsTip->GetCacheSize() > nCoinCacheSize) { - // Typical CCoins structures on disk are around 100 bytes in size. - // Pushing a new one to the database can cause it to be written - // twice (once in the log, and once in the tables). This is already - // an overestimation, as most will delete an existing entry or - // overwrite one. Still, use a conservative safety factor of 2. - if (!CheckDiskSpace(100 * 2 * 2 * pcoinsTip->GetCacheSize())) - return state.Error(); - FlushBlockFile(); - pblocktree->Sync(); - if (!pcoinsTip->Flush()) - return state.Abort(_("Failed to write to coin database")); - } - - // At this point, all changes have been done to the database. - // Proceed by updating the memory structures. - - // Disconnect shorter branch - BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) - if (pindex->pprev) - pindex->pprev->pnext = NULL; - - // Connect longer branch - BOOST_FOREACH(CBlockIndex* pindex, vConnect) - if (pindex->pprev) - pindex->pprev->pnext = pindex; - - // Resurrect memory transactions that were in the disconnected branch - BOOST_FOREACH(CTransaction& tx, vResurrect) { - // ignore validation errors in resurrected transactions - CValidationState stateDummy; - /*if (!tx.AcceptToMemoryPool(stateDummy, true, false)) - mempool.remove(tx, true);*/ - list<CTransaction> removed; - if (!AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL)) - mempool.remove(tx, removed, true); - } - - // Delete redundant memory transactions that are in the connected branch - list<CTransaction> txConflicted; - BOOST_FOREACH(CTransaction& tx, vDelete) { - //mempool.remove(tx); - //mempool.removeConflicts(tx); - list<CTransaction> removed; - mempool.remove(tx, removed); - mempool.removeConflicts(tx, txConflicted); - } - - LogPrintf("SetTip and UpdateTip.pindexNew=%i\n",pindexNew->nHeight); - UpdateTip(pindexNew); - - std::string strCmd = GetArg("-blocknotify", ""); - - if (!fIsInitialDownload && !strCmd.empty()) - { - boost::replace_all(strCmd, "%s", hashBestChain.GetHex()); - boost::thread t(runCommand, strCmd); // thread runs free - } - - return true; -} -
Code deleted then reinserted - needs checking
+//for 0.8.7 ACP +bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) +{ + LOCK(cs_main); + CBlockIndex *pindexOldTip = chainActive.Tip(); + bool fComplete = false; + while (!fComplete) { + FindMostWorkChain(); + fComplete = true; + + // Check whether we have something to do. + if (chainMostWork.Tip() == NULL) break; + + // Disconnect active blocks which are no longer in the best chain. + while (chainActive.Tip() && !chainMostWork.Contains(chainActive.Tip())) { + if (!DisconnectTip(state)) + return false; + } + + // Connect new blocks. + while (!chainActive.Contains(chainMostWork.Tip())) { + CBlockIndex *pindexConnect = chainMostWork[chainActive.Height() + 1]; + //if (!ConnectTip(state, pindexConnect)) { + if (!ConnectTip(state, pindexNew)) { + if (state.IsInvalid()) { + // The block violates a consensus rule. + if (!state.CorruptionPossible()) + InvalidChainFound(chainMostWork.Tip()); + fComplete = false; + state = CValidationState(); + break; + } else { + // A system error occurred (disk space, database error, ...). + return false; + } + } + } + } + + if (chainActive.Tip() != pindexOldTip) { + std::string strCmd = GetArg("-blocknotify", ""); + if (!IsInitialBlockDownload() && !strCmd.empty()) + { + boost::replace_all(strCmd, "%s", chainActive.Tip()->GetBlockHash().GetHex()); + boost::thread t(runCommand, strCmd); // thread runs free + } + } + + return true; +} +
ACP code added,
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/main.h
+static const char* OPENNAME_MAGIC_BYTES_MAINSET="08"; +static const char* OPENNAME_NAME_PREORDER="a"; +static const char* OPENNAME_NAME_REGISTRATION="b"; +static const char* OPENNAME_NAME_UPDATE="c"; +static const char* OPENNAME_NAME_TRANSFER="d"; +static const char* OPENNAME_NAME_RENEWAL="e"; + +
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/Makefile.am
+ forms/coinnectordialog.ui \ + forms/opennamedialog.ui \ + moc_coinnectordialog.cpp \ + coinnectordialog.h \ + coinnectordialog.cpp \
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/addressbookpage.cpp
- QAction *copyPriKeyAction = new QAction(tr("Copy Private Key"), this); + QAction *copyPriKeyAction = new QAction(tr("Copy P&rivate Key"), this); + QAction *copySecretAction = new QAction(tr("Copy Public &Hash160"), this);
Code replaced
+ contextMenu->addAction(copySecretAction); + connect(copySecretAction, SIGNAL(triggered()), this, SLOT(on_copySecKey_clicked()));
Code added
+void AddressBookPage::on_copySecKey_clicked() +{ + //hash160 = FeathercoinPrivateKey(private_key).public_key().hash160() + LogPrintf("addressbookpage...........................\n"); + //CWallet* pwalletMain; init.cpp + QModelIndexList selection = ui->tableView->selectionModel()->selectedRows(AddressTableModel::Address); + if(!selection.isEmpty()) + { + QString addrStr = selection.at(0).data(Qt::EditRole).toString(); + LogPrintf("addressbookpage public_address=%s\n",addrStr.toStdString());//6zdaoWaNBND4KPTR49rqoGFTyHgwGzAf81 + + CBitcoinAddress address(addrStr.toStdString()); + CKeyID keyID; //the Hash160 of its serialized public key + if ( !address.GetKeyID(keyID) ) + { + QMessageBox::warning(this, windowTitle(), + tr("Address \"%1\" doesn't have public key ").arg(addrStr), + QMessageBox::Ok, QMessageBox::Ok); + return; + } + LogPrintf("addressbookpage CKeyID=%s\n", keyID.ToString());//82c35d4284907f248746f6b21f7aafed86d63ee5 + + //FeathercoinPrivateKey(private_key) + CSecret vchSecret; + bool fCompressed=false; + if (!pwalletMain->GetSecret(keyID, vchSecret, fCompressed)) + { + QMessageBox::warning(this, windowTitle(), + tr("Address \"%1\" doesn't have private key ").arg(addrStr), + QMessageBox::Ok, QMessageBox::Ok); + return; + } + LogPrintf("addressbookpage vchSecret=%s\n", HexStr(vchSecret).c_str());//e2ee135cc175081810bbaa603df551f657c8e8a37aca1321883fc588022f95d6 + + //FeathercoinPrivateKey(private_key).public_key() + CPubKey vchPubKey; + if ( !pwalletMain->GetPubKey(keyID, vchPubKey)) + { + QMessageBox::warning(this, windowTitle(), + tr("Address \"%1\" doesn't have public key ").arg(addrStr), + QMessageBox::Ok, QMessageBox::Ok); + return; + } + //GUIUtil::setClipboard(QString::fromStdString(HexStr(vchPubKey))); + LogPrintf("addressbookpage vchPubKey=%s\n", HexStr(vchPubKey).c_str());//02edb297ba63c35998ec23cfca60666bb4d0d1c3e810b93d2d20c94e3a12977440 + + //FeathercoinPrivateKey(private_key).public_key().hash160() + LogPrintf("addressbookpage hash160,vchPubKey.GetID()=%s\n", HexStr(vchPubKey.GetID()).c_str());//e53ed686edaf7a1fb2f64687247f9084425dc382 + + //FeathercoinPrivateKey(private_key).public_key() + CKey key; + fCompressed=false; + key.SetSecret(vchSecret, fCompressed); + std::vector<unsigned char> uret=key.GetPubKeyU(fCompressed); + LogPrintf("addressbookpage unCompressedPubKey =%s\n", HexStr(uret).c_str());//04edb297ba63c35998ec23cfca60666bb4d0d1c3e810b93d2d20c94e3a129774407b719ecf902de8a20c6d99ed0ad0d8c5af178640fdcb0c5dee26c41d39306998 + + //FeathercoinPrivateKey(private_key).public_key().hash160() + CKeyID unkeyID=CKeyID(Hash160(uret)); + LogPrintf("addressbookpage hash160,unCompressedPubKey=%s\n", HexStr(unkeyID).c_str());//6f01b45dd6685d5ac1717baa46e4cda8287c160b + GUIUtil::setClipboard(HexStr(unkeyID).c_str()); + + //unCompressed address + LogPrintf("addressbookpage address, unPubKey=%s\n",CBitcoinAddress(unkeyID).ToString()); + } +} +
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/addressbookpage.h
+ /** Copy a serialization of just the secret parameter (32 bytes) to clipboard */ + void on_copySecKey_clicked();
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/bitcoingui.cpp
+#include "coinnectordialog.h" + opennameAction = new QAction(QIcon(":/icons/openname"), tr("&Openname"), this); + opennameAction->setStatusTip(tr("Your identity and reputation in blockchain"));
Code added
+ coinnectorAction = new QAction(QIcon(":/icons/coinnector"), tr("Coinnector..."), this); + coinnectorAction->setStatusTip(tr("Exchange other coins whit your feathercoin on Coinnector")); + coinnectorAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_9));
Code added
- connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + //connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + connect(quitAction, SIGNAL(triggered()), walletFrame, SLOT(backupquitWallet())); +
Code replaced / commented out
+ connect(coinnectorAction, SIGNAL(triggered()), this, SLOT(openCoinnectorClicked())); + connect(opennameAction, SIGNAL(triggered()), walletFrame, SLOT(opennameClicked()));
Code added
+ advanced->addAction(opennameAction); + plugins->addAction(coinnectorAction); + coinnectorAction->setEnabled(enabled); + opennameAction->setEnabled(enabled);
Code added
+void BitcoinGUI::openCoinnectorClicked() +{ + if(!clientModel || !clientModel->getOptionsModel()) + return; + + CoinnectorDialog dlg(this); + dlg.setModel(clientModel->getOptionsModel()); + dlg.exec(); +} +
Code added
-{ +{ if(clientModel) { + //if (walletFrame) walletFrame->backupWallet();
Bracket change to Q_OS_MAC exception
void BitcoinGUI::detectShutdown() -{ +{ if (ShutdownRequested()) { + //if (walletFrame) walletFrame->backupWallet(); +
Comment out code - alter code bracketing
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/bitcoingui.h
+ QAction *opennameAction; + QAction *coinnectorAction; + /** Visit Coinnector' API */
Coinnector code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/bitcoinstrings.cpp
-QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the Bitcoin Wiki for SSL setup instructions)"), +QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the Feathercoin Wiki for SSL setup instructions)"),
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/coinnectordialog.cpp
Large new file, 283 lines code
+// Copyright (c) 2011-2013 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#if defined(HAVE_CONFIG_H) +#include "bitcoin-config.h" +#endif + +#include "coinnectordialog.h" +#include "ui_coinnectordialog.h" + +#include "bitcoinunits.h" +#include "guiutil.h" +#include "monitoreddatamapper.h" +#include "optionsmodel.h" + +#include "main.h" // for CTransaction::nMinTxFee and MAX_SCRIPTCHECK_THREADS +#include "netbase.h" +#include "txdb.h" // for -dbcache defaults + +#include <QDir> +#include <QIntValidator> +#include <QLocale> +#include <QMessageBox> +#include <QTimer> +#include <QNetworkReply> +#include <QNetworkRequest> +#include <QJsonObject> +#include <QJsonArray> +#include <QJsonDocument> +#include <QByteArray> +#include <QDateTime> +#include <QStandardItemModel> +#include <QDesktopServices> +#include <QUrl> + +CoinnectorDialog::CoinnectorDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::CoinnectorDialog), + model(0), + mapper(0), + fProxyIpValid(true) +{ + ui->setupUi(this); + GUIUtil::restoreWindowGeometry("nCoinnectorDialogWindow", this->size(), this); + + ui->label_6->installEventFilter(this); + ui->tableView->installEventFilter(this); + + manager = new QNetworkAccessManager(this); + connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(replyFinished(QNetworkReply*))); + manager->get(QNetworkRequest(QUrl("https://coinnector.com/API/ticker/"))); + + /* Widget-to-option mapper */ + mapper = new MonitoredDataMapper(this); + mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); + mapper->setOrientation(Qt::Vertical); +} + +CoinnectorDialog::~CoinnectorDialog() +{ + GUIUtil::saveWindowGeometry("nCoinnectorDialogWindow", this); + delete ui; +} + +void CoinnectorDialog::replyFinished(QNetworkReply *reply) +{ + int sw=0; + QByteArray data = reply->readAll(); + QString result(data); + ui->textReplyEdit->setText(result); + //{"result":"success","timestamp":1432562645,"BTC_DASH":["81.2366199952",1],"DASH_BTC":["0.0116620098",-1],"BTC_DOGE":["1633333.333333333",0],"DOGE_BTC":["0.0000005782",0],"BTC_FTC":["50943.9640074796",0],"FTC_BTC":["0.0000164383",0],"BTC_LTC":["128.6659808144",-1],"LTC_BTC":["0.0073686355",1],"BTC_NMC":["623.9861305917",1],"NMC_BTC":["0.0013302033",-1],"BTC_PPC":["696.1033450117",-1],"PPC_BTC":["0.0013102915",1],"DASH_DOGE":["19047.9493465333",0],"DOGE_DASH":["0.000046971",0],"DASH_FTC":["594.1090077099",0],"FTC_DASH":["0.0013353946",0],"DASH_LTC":["1.5005039297",-1],"LTC_DASH":["0.5986030454",1],"DASH_NMC":["7.2769323725",1],"NMC_DASH":["0.1080612229",-1],"DASH_PPC":["8.1179640341",-1],"PPC_DASH":["0.1064436502",1],"DOGE_FTC":["0.0294558",0],"FTC_DOGE":["26.8492772333",0],"DOGE_LTC":["0.0000743947",-1],"LTC_DOGE":["12035.4380519333",1],"DOGE_NMC":["0.0003607888",1],"NMC_DOGE":["2172.6654488",-1],"DOGE_PPC":["0.000402487",-1],"PPC_DOGE":["2140.1427343333",1],"FTC_LTC":["0.0021150542",-1],"LTC_FTC":["375.3875038359",1],"FTC_NMC":["0.0102572918",-1],"NMC_FTC":["67.7658308718",1],"FTC_PPC":["0.0114427786",-1],"PPC_FTC":["66.751441487",1],"LTC_NMC":["4.5979263796",1],"NMC_LTC":["0.1711519169",-1],"LTC_PPC":["5.129331849",1],"PPC_LTC":["0.1685899371",-1],"NMC_PPC":["0.9259589917",-1],"PPC_NMC":["0.8176037043",1]} + + //listModel->setRowCount(6); + + QJsonParseError err;
Start of new file code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/coinnectordialog.h
New file 69 lines of code
+// Copyright (c) 2011-2013 The Feathercoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef COINNECTORDIALOG_H +#define COINNECTORDIALOG_H + +#include <QWidget> +#include <QDialog> +#include <QtNetwork> + +class MonitoredDataMapper; +class OptionsModel; +class QValidatedLineEdit; +class QStandardItemModel; + +namespace Ui { +class CoinnectorDialog; +} + +/** Preferences dialog. */ +class CoinnectorDialog : public QDialog +{ + Q_OBJECT + +public: + explicit CoinnectorDialog(QWidget *parent); + ~CoinnectorDialog(); + + void setModel(OptionsModel *model); + void setMapper(); + +protected: + bool eventFilter(QObject *object, QEvent *event); + +private slots: + /* enable OK button */ + void enableOkButton(); + /* disable OK button */ + void disableOkButton(); + /* set OK button state (enabled / disabled) */ + void setOkButtonState(bool fState); + void on_resetButton_clicked(); + void on_okButton_clicked(); + void on_cancelButton_clicked(); + void on_txStatButton_clicked(); + void on_postTransButton_clicked(); + void on_postFixButton_clicked(); + void on_pushButton_clicked(); + + void showRestartWarning(bool fPersistent = false); + void clearStatusLabel(); + void updateDisplayUnit(); + void doProxyIpChecks(QValidatedLineEdit *pUiProxyIp, int nProxyPort); + void replyFinished(QNetworkReply *); + +signals: + void proxyIpChecks(QValidatedLineEdit *pUiProxyIp, int nProxyPort); + +private: + Ui::CoinnectorDialog *ui; + OptionsModel *model; + MonitoredDataMapper *mapper; + bool fProxyIpValid; + QNetworkAccessManager *manager; + QStandardItemModel *listModel; +}; + +#endif // COINNECTORDIALOG_H
Code added new file
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/feathercoin.qrc
+ <file alias="coinnector">res/icons/coinnector.png</file> + <file alias="coinnector">res/icons/coinnector.png</file>
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/forms/coinnectordialog.ui
New file to define coinnector ,ui 108 lines of code
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CoinnectorDialog</class> + <widget class="QDialog" name="CoinnectorDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>560</width> + <height>428</height> + </rect> + </property> + <property name="windowTitle"> + <string>Coinnector</string> + </property> + <property name="modal"> + <bool>true</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QFrame" name="frame"> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QVBoxLayout" name="verticalLayout_Bottom"> + <item> + <widget class="QTableView" name="tableView"/> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_Buttons"> + <item> + <spacer name="horizontalSpacer_1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>48</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLineEdit" name="textReplyEdit"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_6"> + <property name="font"> + <font> + <underline>true</underline> + </font> + </property> + <property name="cursor"> + <cursorShape>PointingHandCursor</cursorShape> + </property> + <property name="text"> + <string>Connect Coinnector API (experts only!)</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"/> + </item> + <item> + <widget class="QPushButton" name="pushButton"> + <property name="text"> + <string>Refresh</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width>
Start of new file code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/forms/opennamedialog.ui
New file to define opennamedialog 246 lines of code
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>OpennameDialog</class> + <widget class="QDialog" name="OpennameDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>556</width> + <height>375</height> + </rect> + </property> + <property name="windowTitle"> + <string>Insert your Opennames into blockchain</string> + </property> + <widget class="QPushButton" name="insertButton"> + <property name="geometry"> + <rect> + <x>230</x>
Start of new file code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/locale/*
Large number of updates to Translation files to cover, Feathercoin name changes.
src/qt/locale/bitcoin_en.ts
File updated
+ <source>About Feathercoin Core</source> + <translation>About Feathercoin Core</translation>
Example changes to transalation files
src/qt/locale/bitcoin_es.ts src/qt/locale/bitcoin_es.ts src/qt/locale/bitcoin_it.ts src/qt/locale/bitcoin_zh_CN.ts + <source>Copy Public &Hash160</source> + <translation>复制公匙Hash160</translation> + </message> + <message>
Example of Added Code / translations
+ <name>OpennameDialog</name> + <message> + <source>Wallet Message</source> + <translation>钱包信息</translation> + </message> + <message> + <source>Your openname length can not be above 40 charset !</source> + <translation>Openname信息长度不能超过40个字符!</translation> + </message>
Example added code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/optionsdialog.cpp
- ui->thirdPartyTxUrls->setPlaceholderText("http://explorer.feathercoin.com/tx/%s"); + ui->thirdPartyTxUrls->setPlaceholderText("http://block.ftc-c.com/tx/%s");
Code replaced : review…
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
plugin and base40 encode : - commit
https://github.com/FeatherCoin/Feathercoin/commit/386f5cc1dc3d25bab04c44fc5d84abd269ad8f7b
src/qt/paymentserver.cpp
+ tr("URI can not be parsed! This can be caused by an invalid Feathercoin address or malformed URI parameters."),
Code replaced Feathercoin name