diff options
-rw-r--r-- | bitcoin-qt.pro | 1 | ||||
-rw-r--r-- | src/addrman.cpp | 1 | ||||
-rw-r--r-- | src/bitcoinrpc.cpp | 1 | ||||
-rw-r--r-- | src/hash.h | 116 | ||||
-rw-r--r-- | src/init.cpp | 6 | ||||
-rw-r--r-- | src/key.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 12 | ||||
-rw-r--r-- | src/net.h | 1 | ||||
-rw-r--r-- | src/netbase.cpp | 1 | ||||
-rw-r--r-- | src/noui.cpp | 4 | ||||
-rw-r--r-- | src/qt/addressbookpage.cpp | 2 | ||||
-rw-r--r-- | src/qt/addressbookpage.h | 2 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 11 | ||||
-rw-r--r-- | src/qt/bitcoinstrings.cpp | 9 | ||||
-rw-r--r-- | src/qt/clientmodel.cpp | 7 | ||||
-rw-r--r-- | src/qt/forms/optionsdialog.ui | 34 | ||||
-rw-r--r-- | src/qt/forms/overviewpage.ui | 3 | ||||
-rw-r--r-- | src/qt/forms/signverifymessagedialog.ui | 14 | ||||
-rw-r--r-- | src/qt/locale/bitcoin_en.ts | 225 | ||||
-rw-r--r-- | src/qt/optionsdialog.cpp | 27 | ||||
-rw-r--r-- | src/qt/optionsdialog.h | 1 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 18 | ||||
-rw-r--r-- | src/qt/optionsmodel.h | 1 | ||||
-rw-r--r-- | src/qt/qtipcserver.cpp | 15 | ||||
-rw-r--r-- | src/qt/qtipcserver.h | 10 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 9 | ||||
-rw-r--r-- | src/test/util_tests.cpp | 8 | ||||
-rw-r--r-- | src/util.cpp | 2 | ||||
-rw-r--r-- | src/util.h | 106 | ||||
-rw-r--r-- | src/walletdb.cpp | 2 |
30 files changed, 396 insertions, 255 deletions
diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index b10cda2af6..2ca142add6 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -144,6 +144,7 @@ HEADERS += src/qt/bitcoingui.h \ src/compat.h \ src/sync.h \ src/util.h \ + src/hash.h \ src/uint256.h \ src/serialize.h \ src/main.h \ diff --git a/src/addrman.cpp b/src/addrman.cpp index 4428cd169a..780edde90f 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "addrman.h" +#include "hash.h" using namespace std; diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index bfb696da3d..41850d8bb8 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -1219,6 +1219,7 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri if (strMethod == "gettxout" && n > 2) ConvertTo<bool>(params[2]); if (strMethod == "lockunspent" && n > 0) ConvertTo<bool>(params[0]); if (strMethod == "lockunspent" && n > 1) ConvertTo<Array>(params[1]); + if (strMethod == "importprivkey" && n > 2) ConvertTo<bool>(params[2]); return params; } diff --git a/src/hash.h b/src/hash.h new file mode 100644 index 0000000000..bc013139bb --- /dev/null +++ b/src/hash.h @@ -0,0 +1,116 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2012 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. +#ifndef BITCOIN_HASH_H +#define BITCOIN_HASH_H + +#include "uint256.h" +#include "serialize.h" + +#include <openssl/sha.h> +#include <openssl/ripemd.h> + +template<typename T1> +inline uint256 Hash(const T1 pbegin, const T1 pend) +{ + static unsigned char pblank[1]; + uint256 hash1; + SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1); + uint256 hash2; + SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); + return hash2; +} + +class CHashWriter +{ +private: + SHA256_CTX ctx; + +public: + int nType; + int nVersion; + + void Init() { + SHA256_Init(&ctx); + } + + CHashWriter(int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn) { + Init(); + } + + CHashWriter& write(const char *pch, size_t size) { + SHA256_Update(&ctx, pch, size); + return (*this); + } + + // invalidates the object + uint256 GetHash() { + uint256 hash1; + SHA256_Final((unsigned char*)&hash1, &ctx); + uint256 hash2; + SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); + return hash2; + } + + template<typename T> + CHashWriter& operator<<(const T& obj) { + // Serialize to this stream + ::Serialize(*this, obj, nType, nVersion); + return (*this); + } +}; + + +template<typename T1, typename T2> +inline uint256 Hash(const T1 p1begin, const T1 p1end, + const T2 p2begin, const T2 p2end) +{ + static unsigned char pblank[1]; + uint256 hash1; + SHA256_CTX ctx; + SHA256_Init(&ctx); + SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0])); + SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0])); + SHA256_Final((unsigned char*)&hash1, &ctx); + uint256 hash2; + SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); + return hash2; +} + +template<typename T1, typename T2, typename T3> +inline uint256 Hash(const T1 p1begin, const T1 p1end, + const T2 p2begin, const T2 p2end, + const T3 p3begin, const T3 p3end) +{ + static unsigned char pblank[1]; + uint256 hash1; + SHA256_CTX ctx; + SHA256_Init(&ctx); + SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0])); + SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0])); + SHA256_Update(&ctx, (p3begin == p3end ? pblank : (unsigned char*)&p3begin[0]), (p3end - p3begin) * sizeof(p3begin[0])); + SHA256_Final((unsigned char*)&hash1, &ctx); + uint256 hash2; + SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); + return hash2; +} + +template<typename T> +uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION) +{ + CHashWriter ss(nType, nVersion); + ss << obj; + return ss.GetHash(); +} + +inline uint160 Hash160(const std::vector<unsigned char>& vch) +{ + uint256 hash1; + SHA256(&vch[0], vch.size(), (unsigned char*)&hash1); + uint160 hash2; + RIPEMD160((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); + return hash2; +} + +#endif diff --git a/src/init.cpp b/src/init.cpp index 74533e49e1..557c23fc92 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -258,7 +258,7 @@ std::string HelpMessage() " -onlynet=<net> " + _("Only connect to nodes in network <net> (IPv4, IPv6 or Tor)") + "\n" + " -discover " + _("Discover own IP address (default: 1 when listening and no -externalip)") + "\n" + " -irc " + _("Find peers using internet relay chat (default: 0)") + "\n" + - " -checkpoints " + _("Lock in block chain with compiled-in checkpoints (default: 1)") + "\n" + + " -checkpoints " + _("Only accept block chain matching built-in checkpoints (default: 1)") + "\n" + " -listen " + _("Accept connections from outside (default: 1 if no -proxy or -connect)") + "\n" + " -bind=<addr> " + _("Bind to given address and always listen on it. Use [host]:port notation for IPv6") + "\n" + " -dnsseed " + _("Find peers using DNS lookup (default: 1 unless -connect)") + "\n" + @@ -301,7 +301,7 @@ std::string HelpMessage() " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + "\n" + " -checkblocks=<n> " + _("How many blocks to check at startup (default: 2500, 0 = all)") + "\n" + " -checklevel=<n> " + _("How thorough the block verification is (0-6, default: 1)") + "\n" + - " -loadblock=<file> " + _("Imports blocks from external blk000?.dat file") + "\n" + + " -loadblock=<file> " + _("Imports blocks from external blk000??.dat file") + "\n" + " -reindex " + _("Rebuild blockchain index from current blk000??.dat files") + "\n" + "\n" + _("Block creation options:") + "\n" + @@ -571,7 +571,7 @@ bool AppInit2() printf("Bitcoin version %s (%s)\n", FormatFullVersion().c_str(), CLIENT_DATE.c_str()); printf("Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION)); if (!fLogTimestamps) - printf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", GetTime()).c_str()); + printf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str()); printf("Default data directory %s\n", GetDefaultDataDir().string().c_str()); printf("Used data directory %s\n", strDataDir.c_str()); std::ostringstream strErrors; @@ -11,7 +11,7 @@ #include "allocators.h" #include "serialize.h" #include "uint256.h" -#include "util.h" +#include "hash.h" #include <openssl/ec.h> // for EC_KEY definition diff --git a/src/main.cpp b/src/main.cpp index 20480f029c..164006133d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,7 +45,7 @@ bool fReindex = false; bool fBenchmark = false; unsigned int nCoinCacheSize = 5000; -CMedianFilter<int> cPeerBlockCounts(5, 0); // Amount of blocks that other nodes claim to have +CMedianFilter<int> cPeerBlockCounts(8, 0); // Amount of blocks that other nodes claim to have map<uint256, CBlock*> mapOrphanBlocks; multimap<uint256, CBlock*> mapOrphanBlocksByPrev; @@ -1187,11 +1187,11 @@ void static InvalidChainFound(CBlockIndex* pindexNew) } printf("InvalidChainFound: invalid block=%s height=%d work=%s date=%s\n", BlockHashStr(pindexNew->GetBlockHash()).c_str(), pindexNew->nHeight, - pindexNew->bnChainWork.ToString().c_str(), DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", + pindexNew->bnChainWork.ToString().c_str(), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexNew->GetBlockTime()).c_str()); printf("InvalidChainFound: current best=%s height=%d work=%s date=%s\n", BlockHashStr(hashBestChain).c_str(), nBestHeight, bnBestChainWork.ToString().c_str(), - DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", pindexBest->GetBlockTime()).c_str()); + DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str()); if (pindexBest && bnBestInvalidWork > bnBestChainWork + pindexBest->GetBlockWork() * 6) printf("InvalidChainFound: Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n"); } @@ -1828,7 +1828,7 @@ bool SetBestChain(CBlockIndex* pindexNew) nTransactionsUpdated++; printf("SetBestChain: new best=%s height=%d work=%s tx=%lu date=%s\n", BlockHashStr(hashBestChain).c_str(), nBestHeight, bnBestChainWork.ToString().c_str(), (unsigned long)pindexNew->nChainTx, - DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", pindexBest->GetBlockTime()).c_str()); + DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str()); // Check the version of the last 100 blocks to see if we need to upgrade: if (!fIsInitialDownload) @@ -2375,7 +2375,7 @@ bool static LoadBlockIndexDB() } printf("LoadBlockIndex(): hashBestChain=%s height=%d date=%s\n", BlockHashStr(hashBestChain).c_str(), nBestHeight, - DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", pindexBest->GetBlockTime()).c_str()); + DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str()); // Verify blocks in the best chain int nCheckLevel = GetArg("-checklevel", 1); @@ -2538,7 +2538,7 @@ void PrintBlockTree() printf("%d (blk%05u.dat:0x%x) %s tx %"PRIszu"", pindex->nHeight, pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos, - DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", block.GetBlockTime()).c_str(), + DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()).c_str(), block.vtx.size()); PrintWallets(block); @@ -18,6 +18,7 @@ #include "netbase.h" #include "protocol.h" #include "addrman.h" +#include "hash.h" class CNode; class CBlockIndex; diff --git a/src/netbase.cpp b/src/netbase.cpp index 9e7307204a..4f31ce9cf3 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -6,6 +6,7 @@ #include "netbase.h" #include "util.h" #include "sync.h" +#include "hash.h" #ifndef WIN32 #include <sys/fcntl.h> diff --git a/src/noui.cpp b/src/noui.cpp index 204e76aba7..96a8de4ee9 100644 --- a/src/noui.cpp +++ b/src/noui.cpp @@ -24,10 +24,10 @@ static int noui_ThreadSafeMessageBox(const std::string& message, const std::stri strCaption += _("Information"); break; default: - strCaption += caption; // Use supplied caption + strCaption += caption; // Use supplied caption (can be empty) } - printf("%s: %s\n", caption.c_str(), message.c_str()); + printf("%s: %s\n", strCaption.c_str(), message.c_str()); fprintf(stderr, "%s: %s\n", strCaption.c_str(), message.c_str()); return 4; } diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index e20358c70e..263fd52790 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -361,7 +361,7 @@ void AddressBookPage::contextualMenu(const QPoint &point) } } -void AddressBookPage::selectNewAddress(const QModelIndex &parent, int begin, int end) +void AddressBookPage::selectNewAddress(const QModelIndex &parent, int begin, int /*end*/) { QModelIndex idx = proxyModel->mapFromSource(model->index(begin, AddressTableModel::Address, parent)); if(idx.isValid() && (idx.data(Qt::EditRole).toString() == newAddressToSelect)) diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h index f7d177c513..6d3a734a16 100644 --- a/src/qt/addressbookpage.h +++ b/src/qt/addressbookpage.h @@ -75,7 +75,7 @@ private slots: void onEditAction(); /** New entry/entries were added to address table */ - void selectNewAddress(const QModelIndex &parent, int begin, int end); + void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/); signals: void signMessage(QString addr); diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index dbdfade0b1..c3701ced7f 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -113,6 +113,14 @@ static void handleRunawayException(std::exception *e) #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { + // Command-line options take precedence: + ParseParameters(argc, argv); + + if(GetBoolArg("-testnet")) // Separate message queue name for testnet + strBitcoinURIQueueName = BITCOINURI_QUEUE_NAME_TESTNET; + else + strBitcoinURIQueueName = BITCOINURI_QUEUE_NAME_MAINNET; + // Do this early as we don't want to bother initializing if we are just calling IPC ipcScanRelay(argc, argv); @@ -126,9 +134,6 @@ int main(int argc, char *argv[]) // Install global event filter that makes sure that long tooltips can be word-wrapped app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app)); - // Command-line options take precedence: - ParseParameters(argc, argv); - // ... then bitcoin.conf: if (!boost::filesystem::is_directory(GetDataDir(false))) { diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp index 497c05976b..7fcb7acf0e 100644 --- a/src/qt/bitcoinstrings.cpp +++ b/src/qt/bitcoinstrings.cpp @@ -84,7 +84,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"), QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Bitcoin version"), -QT_TRANSLATE_NOOP("bitcoin-core", "Bitcoin"), QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot initialize keypool"), @@ -102,6 +101,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of Bitcoin"), QT_TRANSLATE_NOOP("bitcoin-core", "Error"), +QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Transaction creation failed!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: could not start node"), @@ -114,7 +114,8 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Get help for a command"), QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: 2500, 0 = all)"), QT_TRANSLATE_NOOP("bitcoin-core", "How thorough the block verification is (0-6, default: 1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Importing blocks from block database..."), -QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000?.dat file"), +QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000??.dat file"), +QT_TRANSLATE_NOOP("bitcoin-core", "Information"), QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -tor address: '%s'"), @@ -128,6 +129,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Loading wallet..."), QT_TRANSLATE_NOOP("bitcoin-core", "Maintain at most <n> connections to peers (default: 125)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Only accept block chain matching built-in checkpoints (default: 1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Only connect to nodes in network <net> (IPv4, IPv6 or Tor)"), QT_TRANSLATE_NOOP("bitcoin-core", "Options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Output extra debugging information. Implies all other -debug* options"), @@ -144,7 +146,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or bitcoind"), QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"), -QT_TRANSLATE_NOOP("bitcoin-core", "Sending..."), QT_TRANSLATE_NOOP("bitcoin-core", "Server certificate file (default: server.cert)"), QT_TRANSLATE_NOOP("bitcoin-core", "Server private key (default: server.pem)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set database cache size in megabytes (default: 25)"), @@ -173,7 +174,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"), QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying database integrity..."), QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Bitcoin to complete"), -QT_TRANSLATE_NOOP("bitcoin-core", "Warning: Disk space is low!"), +QT_TRANSLATE_NOOP("bitcoin-core", "Warning"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"), QT_TRANSLATE_NOOP("bitcoin-core", "wallet.dat corrupt, salvage failed"), };
\ No newline at end of file diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index ce112803f8..12bd989338 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -15,10 +15,8 @@ static const int64 nClientStartupTime = GetTime(); ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) : QObject(parent), optionsModel(optionsModel), - cachedNumBlocks(0), cachedNumBlocksOfPeers(0), pollTimer(0) + cachedNumBlocks(0), cachedNumBlocksOfPeers(0), numBlocksAtStartup(-1), pollTimer(0) { - numBlocksAtStartup = -1; - pollTimer = new QTimer(this); pollTimer->setInterval(MODEL_UPDATE_DELAY); pollTimer->start(); @@ -65,7 +63,8 @@ void ClientModel::updateTimer() cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; - emit numBlocksChanged(newNumBlocks, newNumBlocksOfPeers); + // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI + emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks)); } } diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 6a13361974..3771f9de63 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -44,7 +44,7 @@ </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_Main"> + <layout class="QHBoxLayout" name="horizontalLayout_1_Main"> <item> <widget class="QLabel" name="transactionFeeLabel"> <property name="text"> @@ -62,7 +62,7 @@ <widget class="BitcoinAmountField" name="transactionFee"/> </item> <item> - <spacer name="horizontalSpacer_Main"> + <spacer name="horizontalSpacer_1_Main"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -99,6 +99,36 @@ </property> </spacer> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2_Main"> + <item> + <spacer name="horizontalSpacer_2_Main"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="resetButton"> + <property name="toolTip"> + <string>Reset all client options to default.</string> + </property> + <property name="text"> + <string>&Reset Options</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> <widget class="QWidget" name="tabNetwork"> diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 4c4dec6c9c..970e6c671d 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -20,8 +20,7 @@ <bool>false</bool> </property> <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488); color:#000000 -</string> + <string notr="true">background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488); color:#000000;</string> </property> <property name="wordWrap"> <bool>true</bool> diff --git a/src/qt/forms/signverifymessagedialog.ui b/src/qt/forms/signverifymessagedialog.ui index 8128bdf457..279b2a5052 100644 --- a/src/qt/forms/signverifymessagedialog.ui +++ b/src/qt/forms/signverifymessagedialog.ui @@ -105,6 +105,16 @@ </widget> </item> <item> + <widget class="QLabel" name="signatureLabel_SM"> + <property name="text"> + <string>Signature</string> + </property> + <property name="textFormat"> + <enum>Qt::PlainText</enum> + </property> + </widget> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout_2_SM"> <property name="spacing"> <number>0</number> @@ -148,7 +158,7 @@ <string>Sign the message to prove you own this Bitcoin address</string> </property> <property name="text"> - <string>&Sign Message</string> + <string>Sign &Message</string> </property> <property name="icon"> <iconset resource="../bitcoin.qrc"> @@ -294,7 +304,7 @@ <string>Verify the message to ensure it was signed with the specified Bitcoin address</string> </property> <property name="text"> - <string>&Verify Message</string> + <string>Verify &Message</string> </property> <property name="icon"> <iconset resource="../bitcoin.qrc"> diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index c70ea652de..cb6f982d32 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -300,17 +300,17 @@ This product includes software developed by the OpenSSL Project for use in the O <context> <name>BitcoinGUI</name> <message> - <location filename="../bitcoingui.cpp" line="+266"/> + <location filename="../bitcoingui.cpp" line="+267"/> <source>Sign &message...</source> <translation>Sign &message...</translation> </message> <message> - <location line="+241"/> + <location line="+254"/> <source>Synchronizing with network...</source> <translation>Synchronizing with network...</translation> </message> <message> - <location line="-309"/> + <location line="-322"/> <source>&Overview</source> <translation>&Overview</translation> </message> @@ -400,7 +400,7 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>&Change Passphrase...</translation> </message> <message> - <location line="+246"/> + <location line="+259"/> <source>Importing blocks from disk...</source> <translation>Importing blocks from disk...</translation> </message> @@ -418,7 +418,7 @@ This product includes software developed by the OpenSSL Project for use in the O </translation> </message> <message> - <location line="-252"/> + <location line="-265"/> <source>&Export...</source> <translation>&Export...</translation> </message> @@ -464,11 +464,12 @@ This product includes software developed by the OpenSSL Project for use in the O </message> <message> <location line="-196"/> + <location line="+538"/> <source>Bitcoin</source> <translation>Bitcoin</translation> </message> <message> - <location line="+0"/> + <location line="-538"/> <source>Wallet</source> <translation>Wallet</translation> </message> @@ -534,12 +535,12 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>[testnet]</translation> </message> <message> - <location line="+60"/> + <location line="+63"/> <source>Bitcoin client</source> <translation>Bitcoin client</translation> </message> <message numerus="yes"> - <location line="+69"/> + <location line="+79"/> <source>%n active connection(s) to Bitcoin network</source> <translation> <numerusform>%n active connection to Bitcoin network</numerusform> @@ -557,12 +558,37 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>Processed %1 blocks of transaction history.</translation> </message> <message> - <location line="+107"/> + <location line="+70"/> + <source>Error</source> + <translation>Error</translation> + </message> + <message> + <location line="+3"/> + <source>Warning</source> + <translation>Warning</translation> + </message> + <message> + <location line="+3"/> + <source>Information</source> + <translation>Information</translation> + </message> + <message> + <location line="+66"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</translation> </message> + <message> + <location line="+210"/> + <source>Backup Successful</source> + <translation>Backup Successful</translation> + </message> + <message> + <location line="+0"/> + <source>The wallet data was successfully saved to the new location.</source> + <translation>The wallet data was successfully saved to the new location.</translation> + </message> <message numerus="yes"> - <location line="-93"/> + <location line="-338"/> <source>%n second(s) ago</source> <translation> <numerusform>%n second ago</numerusform> @@ -609,17 +635,17 @@ This product includes software developed by the OpenSSL Project for use in the O <translation>Last received block was generated %1.</translation> </message> <message> - <location line="+62"/> + <location line="+97"/> <source>Confirm transaction fee</source> <translation>Confirm transaction fee</translation> </message> <message> - <location line="+27"/> + <location line="+23"/> <source>Sent transaction</source> <translation>Sent transaction</translation> </message> <message> - <location line="+1"/> + <location line="+0"/> <source>Incoming transaction</source> <translation>Incoming transaction</translation> </message> @@ -637,19 +663,19 @@ Address: %4 </translation> </message> <message> - <location line="+100"/> - <location line="+27"/> + <location line="+99"/> + <location line="+28"/> <source>URI handling</source> <translation>URI handling</translation> </message> <message> - <location line="-27"/> - <location line="+27"/> + <location line="-28"/> + <location line="+28"/> <source>URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters.</source> <translation>URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters.</translation> </message> <message> - <location line="+16"/> + <location line="+17"/> <source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source> <translation>Wallet is <b>encrypted</b> and currently <b>unlocked</b></translation> </message> @@ -1447,12 +1473,11 @@ Address: %4 </message> <message> <location line="+13"/> - <location line="+124"/> <source>&Sign Message</source> <translation>&Sign Message</translation> </message> <message> - <location line="-118"/> + <location line="+6"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</translation> </message> @@ -1499,7 +1524,12 @@ Address: %4 <translation>Sign the message to prove you own this Bitcoin address</translation> </message> <message> - <location line="+17"/> + <location line="+3"/> + <source>Sign &Message</source> + <translation>Sign &Message</translation> + </message> + <message> + <location line="+14"/> <source>Reset all sign message fields</source> <translation>Reset all sign message fields</translation> </message> @@ -1511,12 +1541,11 @@ Address: %4 </message> <message> <location line="-87"/> - <location line="+70"/> <source>&Verify Message</source> <translation>&Verify Message</translation> </message> <message> - <location line="-64"/> + <location line="+6"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</translation> </message> @@ -1531,7 +1560,12 @@ Address: %4 <translation>Verify the message to ensure it was signed with the specified Bitcoin address</translation> </message> <message> - <location line="+17"/> + <location line="+3"/> + <source>Verify &Message</source> + <translation>Verify &Message</translation> + </message> + <message> + <location line="+14"/> <source>Reset all verify message fields</source> <translation>Reset all verify message fields</translation> </message> @@ -2103,14 +2137,6 @@ Address: %4 </message> </context> <context> - <name>WalletModel</name> - <message> - <location filename="../walletmodel.cpp" line="+192"/> - <source>Sending...</source> - <translation>Sending...</translation> - </message> -</context> -<context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+86"/> @@ -2118,32 +2144,32 @@ Address: %4 <translation>Bitcoin version</translation> </message> <message> - <location line="+81"/> + <location line="+82"/> <source>Usage:</source> <translation>Usage:</translation> </message> <message> - <location line="-24"/> + <location line="-23"/> <source>Send command to -server or bitcoind</source> <translation>Send command to -server or bitcoind</translation> </message> <message> - <location line="-20"/> + <location line="-21"/> <source>List commands</source> <translation>List commands</translation> </message> <message> - <location line="-10"/> + <location line="-11"/> <source>Get help for a command</source> <translation>Get help for a command</translation> </message> <message> - <location line="+19"/> + <location line="+21"/> <source>Options:</source> <translation>Options:</translation> </message> <message> - <location line="+23"/> + <location line="+22"/> <source>Specify configuration file (default: bitcoin.conf)</source> <translation>Specify configuration file (default: bitcoin.conf)</translation> </message> @@ -2153,17 +2179,17 @@ Address: %4 <translation>Specify pid file (default: bitcoind.pid)</translation> </message> <message> - <location line="-46"/> + <location line="-47"/> <source>Generate coins</source> <translation>Generate coins</translation> </message> <message> - <location line="-14"/> + <location line="-15"/> <source>Don't generate coins</source> <translation>Don't generate coins</translation> </message> <message> - <location line="+59"/> + <location line="+61"/> <source>Specify data directory</source> <translation>Specify data directory</translation> </message> @@ -2183,12 +2209,12 @@ Address: %4 <translation>Maintain at most <n> connections to peers (default: 125)</translation> </message> <message> - <location line="-32"/> + <location line="-34"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>Connect to a node to retrieve peer addresses, and disconnect</translation> </message> <message> - <location line="+63"/> + <location line="+65"/> <source>Specify your own public address</source> <translation>Specify your own public address</translation> </message> @@ -2198,7 +2224,7 @@ Address: %4 <translation>Threshold for disconnecting misbehaving peers (default: 100)</translation> </message> <message> - <location line="-113"/> + <location line="-114"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</translation> </message> @@ -2218,17 +2244,17 @@ Address: %4 <translation>Accept command line and JSON-RPC commands</translation> </message> <message> - <location line="+60"/> + <location line="+62"/> <source>Run in the background as a daemon and accept commands</source> <translation>Run in the background as a daemon and accept commands</translation> </message> <message> - <location line="+32"/> + <location line="+31"/> <source>Use the test network</source> <translation>Use the test network</translation> </message> <message> - <location line="-91"/> + <location line="-92"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation>Accept connections from outside (default: 1 if no -proxy or -connect)</translation> </message> @@ -2323,7 +2349,7 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Attempt to recover private keys from a corrupt wallet.dat</translation> </message> <message> - <location line="+3"/> + <location line="+2"/> <source>Block creation options:</source> <translation>Block creation options:</translation> </message> @@ -2339,6 +2365,11 @@ If the file does not exist, create it with owner-readable-only file permissions. </message> <message> <location line="+8"/> + <source>Error: Disk space is low!</source> + <translation>Error: Disk space is low!</translation> + </message> + <message> + <location line="+1"/> <source>Error: Transaction creation failed!</source> <translation>Error: Transaction creation failed!</translation> </message> @@ -2363,7 +2394,17 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Importing blocks from block database...</translation> </message> <message> - <location line="+4"/> + <location line="+1"/> + <source>Imports blocks from external blk000??.dat file</source> + <translation>Imports blocks from external blk000??.dat file</translation> + </message> + <message> + <location line="+1"/> + <source>Information</source> + <translation>Information</translation> + </message> + <message> + <location line="+3"/> <source>Invalid -tor address: '%s'</source> <translation>Invalid -tor address: '%s'</translation> </message> @@ -2379,6 +2420,11 @@ If the file does not exist, create it with owner-readable-only file permissions. </message> <message> <location line="+1"/> + <source>Only accept block chain matching built-in checkpoints (default: 1)</source> + <translation>Only accept block chain matching built-in checkpoints (default: 1)</translation> + </message> + <message> + <location line="+1"/> <source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source> <translation>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</translation> </message> @@ -2423,7 +2469,7 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Send trace/debug info to debugger</translation> </message> <message> - <location line="+6"/> + <location line="+5"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation>Set maximum block size in bytes (default: 250000)</translation> </message> @@ -2469,8 +2515,8 @@ If the file does not exist, create it with owner-readable-only file permissions. </message> <message> <location line="+2"/> - <source>Warning: Disk space is low!</source> - <translation>Warning: Disk space is low!</translation> + <source>Warning</source> + <translation>Warning</translation> </message> <message> <location line="+1"/> @@ -2483,27 +2529,27 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>wallet.dat corrupt, salvage failed</translation> </message> <message> - <location line="-43"/> + <location line="-42"/> <source>Password for JSON-RPC connections</source> <translation>Password for JSON-RPC connections</translation> </message> <message> - <location line="-51"/> + <location line="-53"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>Allow JSON-RPC connections from specified IP address</translation> </message> <message> - <location line="+60"/> + <location line="+62"/> <source>Send commands to node running on <ip> (default: 127.0.0.1)</source> <translation>Send commands to node running on <ip> (default: 127.0.0.1)</translation> </message> <message> - <location line="-101"/> + <location line="-103"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>Execute command when the best block changes (%s in cmd is replaced by block hash)</translation> </message> <message> - <location line="+123"/> + <location line="+124"/> <source>Upgrade wallet to latest format</source> <translation>Upgrade wallet to latest format</translation> </message> @@ -2513,12 +2559,12 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Set key pool size to <n> (default: 100)</translation> </message> <message> - <location line="-13"/> + <location line="-12"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>Rescan the block chain for missing wallet transactions</translation> </message> <message> - <location line="-24"/> + <location line="-26"/> <source>How many blocks to check at startup (default: 2500, 0 = all)</source> <translation>How many blocks to check at startup (default: 2500, 0 = all)</translation> </message> @@ -2528,12 +2574,7 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>How thorough the block verification is (0-6, default: 1)</translation> </message> <message> - <location line="+2"/> - <source>Imports blocks from external blk000?.dat file</source> - <translation>Imports blocks from external blk000?.dat file</translation> - </message> - <message> - <location line="+51"/> + <location line="+54"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>Use OpenSSL (https) for JSON-RPC connections</translation> </message> @@ -2548,42 +2589,37 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Server private key (default: server.pem)</translation> </message> <message> - <location line="-130"/> + <location line="-131"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation> </message> <message> - <location line="+141"/> + <location line="+142"/> <source>This help message</source> <translation>This help message</translation> </message> <message> - <location line="-73"/> - <source>Bitcoin</source> - <translation>Bitcoin</translation> - </message> - <message> - <location line="+76"/> + <location line="+3"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation>Unable to bind to %s on this computer (bind returned error %d, %s)</translation> </message> <message> - <location line="-68"/> + <location line="-70"/> <source>Connect through socks proxy</source> <translation>Connect through socks proxy</translation> </message> <message> - <location line="-12"/> + <location line="-11"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation>Allow DNS lookups for -addnode, -seednode and -connect</translation> </message> <message> - <location line="+42"/> + <location line="+43"/> <source>Loading addresses...</source> <translation>Loading addresses...</translation> </message> <message> - <location line="-25"/> + <location line="-27"/> <source>Error loading blkindex.dat</source> <translation>Error loading blkindex.dat</translation> </message> @@ -2598,17 +2634,17 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Error loading wallet.dat: Wallet requires newer version of Bitcoin</translation> </message> <message> - <location line="+72"/> + <location line="+74"/> <source>Wallet needed to be rewritten: restart Bitcoin to complete</source> <translation>Wallet needed to be rewritten: restart Bitcoin to complete</translation> </message> <message> - <location line="-74"/> + <location line="-76"/> <source>Error loading wallet.dat</source> <translation>Error loading wallet.dat</translation> </message> <message> - <location line="+18"/> + <location line="+20"/> <source>Invalid -proxy address: '%s'</source> <translation>Invalid -proxy address: '%s'</translation> </message> @@ -2623,7 +2659,7 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Unknown -socks proxy version requested: %i</translation> </message> <message> - <location line="-73"/> + <location line="-75"/> <source>Cannot resolve -bind address: '%s'</source> <translation>Cannot resolve -bind address: '%s'</translation> </message> @@ -2633,22 +2669,17 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Cannot resolve -externalip address: '%s'</translation> </message> <message> - <location line="+29"/> + <location line="+31"/> <source>Invalid amount for -paytxfee=<amount>: '%s'</source> <translation>Invalid amount for -paytxfee=<amount>: '%s'</translation> </message> <message> - <location line="-14"/> + <location line="-15"/> <source>Error: could not start node</source> <translation>Error: could not start node</translation> </message> <message> - <location line="+40"/> - <source>Sending...</source> - <translation>Sending...</translation> - </message> - <message> - <location line="-25"/> + <location line="+16"/> <source>Invalid amount</source> <translation>Invalid amount</translation> </message> @@ -2663,7 +2694,7 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Loading block index...</translation> </message> <message> - <location line="-44"/> + <location line="-45"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Add a node to connect to and attempt to keep the connection open</translation> </message> @@ -2683,12 +2714,12 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Fee per KB to add to transactions you send</translation> </message> <message> - <location line="+18"/> + <location line="+19"/> <source>Loading wallet...</source> <translation>Loading wallet...</translation> </message> <message> - <location line="-38"/> + <location line="-40"/> <source>Cannot downgrade wallet</source> <translation>Cannot downgrade wallet</translation> </message> @@ -2703,27 +2734,27 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation>Cannot write default address</translation> </message> <message> - <location line="+46"/> + <location line="+49"/> <source>Rescanning...</source> <translation>Rescanning...</translation> </message> <message> - <location line="-40"/> + <location line="-43"/> <source>Done loading</source> <translation>Done loading</translation> </message> <message> - <location line="+63"/> + <location line="+65"/> <source>To use the %s option</source> <translation>To use the %s option</translation> </message> <message> - <location line="-58"/> + <location line="-60"/> <source>Error</source> <translation>Error</translation> </message> <message> - <location line="-29"/> + <location line="-28"/> <source>You must set rpcpassword=<password> in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 03dcb0b538..6b98ab1929 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -177,6 +177,33 @@ void OptionsDialog::setSaveButtonState(bool fState) ui->okButton->setEnabled(fState); } +void OptionsDialog::on_resetButton_clicked() +{ + if(model) + { + // confirmation dialog + QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"), + tr("Some settings may require a client restart to take effect.") + "<br><br>" + tr("Do you want to proceed?"), + QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel); + + if(btnRetVal == QMessageBox::Cancel) + return; + + disableApplyButton(); + + /* disable restart warning messages display */ + fRestartWarningDisplayed_Lang = fRestartWarningDisplayed_Proxy = true; + + /* reset all options and save the default values (QSettings) */ + model->Reset(); + mapper->toFirst(); + mapper->submit(); + + /* re-enable restart warning messages display */ + fRestartWarningDisplayed_Lang = fRestartWarningDisplayed_Proxy = false; + } +} + void OptionsDialog::on_okButton_clicked() { mapper->submit(); diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h index 18469f509d..d64ed0b57f 100644 --- a/src/qt/optionsdialog.h +++ b/src/qt/optionsdialog.h @@ -36,6 +36,7 @@ private slots: void disableSaveButtons(); /* set apply button and OK button state (enabled / disabled) */ void setSaveButtonState(bool fState); + void on_resetButton_clicked(); void on_okButton_clicked(); void on_cancelButton_clicked(); void on_applyButton_clicked(); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 5dac5a6c45..2457e38742 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -60,6 +60,24 @@ void OptionsModel::Init() SoftSetArg("-lang", language.toStdString()); } +void OptionsModel::Reset() +{ + QSettings settings; + + // Remove all entries in this QSettings object + settings.clear(); + + // default setting for OptionsModel::StartAtStartup - disabled + if (GUIUtil::GetStartOnSystemStartup()) + GUIUtil::SetStartOnSystemStartup(false); + + // Re-Init to get default values + Init(); + + // Ensure Upgrade() is not running again by setting the bImportFinished flag + settings.setValue("bImportFinished", true); +} + bool OptionsModel::Upgrade() { QSettings settings; diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index 4f893bb44e..d25d898d9c 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -33,6 +33,7 @@ public: }; void Init(); + void Reset(); /* Migrate settings from wallet.dat after app initialization */ bool Upgrade(); /* returns true if settings upgraded */ diff --git a/src/qt/qtipcserver.cpp b/src/qt/qtipcserver.cpp index b26c37581c..2777fab852 100644 --- a/src/qt/qtipcserver.cpp +++ b/src/qt/qtipcserver.cpp @@ -26,6 +26,9 @@ using namespace boost; using namespace boost::interprocess; using namespace boost::posix_time; +// holds Bitcoin-Qt message queue name (initialized in bitcoin.cpp) +std::string strBitcoinURIQueueName; + #if defined MAC_OSX || defined __FreeBSD__ // URI handling not implemented on OSX yet @@ -46,7 +49,7 @@ static bool ipcScanCmd(int argc, char *argv[], bool fRelay) { const char *strURI = argv[i]; try { - boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME); + boost::interprocess::message_queue mq(boost::interprocess::open_only, strBitcoinURIQueueName.c_str()); if (mq.try_send(strURI, strlen(strURI), 0)) fSent = true; else if (fRelay) @@ -76,7 +79,7 @@ static void ipcThread(void* pArg) { // Make this thread recognisable as the GUI-IPC thread RenameThread("bitcoin-gui-ipc"); - + try { ipcThread2(pArg); @@ -112,7 +115,7 @@ static void ipcThread2(void* pArg) } // Remove message queue - message_queue::remove(BITCOINURI_QUEUE_NAME); + message_queue::remove(strBitcoinURIQueueName.c_str()); // Cleanup allocated memory delete mq; } @@ -125,7 +128,7 @@ void ipcInit(int argc, char *argv[]) unsigned int nPriority = 0; try { - mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); + mq = new message_queue(open_or_create, strBitcoinURIQueueName.c_str(), 2, MAX_URI_LENGTH); // Make sure we don't lose any bitcoin: URIs for (int i = 0; i < 2; i++) @@ -140,10 +143,10 @@ void ipcInit(int argc, char *argv[]) } // Make sure only one bitcoin instance is listening - message_queue::remove(BITCOINURI_QUEUE_NAME); + message_queue::remove(strBitcoinURIQueueName.c_str()); delete mq; - mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); + mq = new message_queue(open_or_create, strBitcoinURIQueueName.c_str(), 2, MAX_URI_LENGTH); } catch (interprocess_exception &ex) { printf("ipcInit() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what()); diff --git a/src/qt/qtipcserver.h b/src/qt/qtipcserver.h index cccf200b2d..f775f272c2 100644 --- a/src/qt/qtipcserver.h +++ b/src/qt/qtipcserver.h @@ -1,8 +1,14 @@ #ifndef QTIPCSERVER_H #define QTIPCSERVER_H -// Define Bitcoin-Qt message queue name -#define BITCOINURI_QUEUE_NAME "BitcoinURI" +#include <string> + +// Define Bitcoin-Qt message queue name for mainnet +#define BITCOINURI_QUEUE_NAME_MAINNET "BitcoinURI" +// Define Bitcoin-Qt message queue name for testnet +#define BITCOINURI_QUEUE_NAME_TESTNET "BitcoinURI-testnet" + +extern std::string strBitcoinURIQueueName; void ipcScanRelay(int argc, char *argv[]); void ipcInit(int argc, char *argv[]); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 3dc32d0e47..7cf2d41962 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -269,8 +269,6 @@ void RPCConsole::setClientModel(ClientModel *model) setNumConnections(model->getNumConnections()); ui->isTestNet->setChecked(model->isTestNet()); - - setNumBlocks(model->getNumBlocks(), model->getNumBlocksOfPeers()); } } @@ -342,13 +340,10 @@ void RPCConsole::setNumConnections(int count) void RPCConsole::setNumBlocks(int count, int countOfPeers) { ui->numberOfBlocks->setText(QString::number(count)); - ui->totalBlocks->setText(QString::number(countOfPeers)); + // If there is no current countOfPeers available display N/A instead of 0, which can't ever be true + ui->totalBlocks->setText(countOfPeers == 0 ? tr("N/A") : QString::number(countOfPeers)); if(clientModel) - { - // If there is no current number available display N/A instead of 0, which can't ever be true - ui->totalBlocks->setText(clientModel->getNumBlocksOfPeers() == 0 ? tr("N/A") : QString::number(clientModel->getNumBlocksOfPeers())); ui->lastBlockTime->setText(clientModel->getLastBlockDate().toString()); - } } void RPCConsole::on_lineEdit_returnPressed() diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index c47d25bbe9..f56969cba6 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -104,11 +104,11 @@ BOOST_AUTO_TEST_CASE(util_HexStr) BOOST_AUTO_TEST_CASE(util_DateTimeStrFormat) { /*These are platform-dependant and thus removed to avoid useless test failures - BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", 0), "1970-01-01T00:00:00"); - BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", 0x7FFFFFFF), "2038-01-19T03:14:07"); + BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%d %H:%M:%S", 0), "1970-01-01 00:00:00"); + BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%d %H:%M:%S", 0x7FFFFFFF), "2038-01-19 03:14:07"); // Formats used within Bitcoin - BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", 1317425777), "2011-09-30T23:36:17"); - BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%dT%H:%M", 1317425777), "2011-09-30T23:36"); + BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%d %H:%M:%S", 1317425777), "2011-09-30 23:36:17"); + BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%d %H:%M", 1317425777), "2011-09-30 23:36"); */ } diff --git a/src/util.cpp b/src/util.cpp index 806f3ebcf6..576ba50dbb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -240,7 +240,7 @@ inline int OutputDebugStringF(const char* pszFormat, ...) // Debug print useful for profiling if (fLogTimestamps && fStartedNewLine) - fprintf(fileout, "%s ", DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", GetTime()).c_str()); + fprintf(fileout, "%s ", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str()); if (pszFormat[strlen(pszFormat) - 1] == '\n') fStartedNewLine = true; else diff --git a/src/util.h b/src/util.h index ab921e6f05..8bea0dd2b3 100644 --- a/src/util.h +++ b/src/util.h @@ -24,9 +24,6 @@ typedef int pid_t; /* define for Windows compatibility */ #include <boost/date_time/gregorian/gregorian_types.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> -#include <openssl/sha.h> -#include <openssl/ripemd.h> - #include "netbase.h" // for AddTimeData typedef long long int64; @@ -414,109 +411,6 @@ bool SoftSetBoolArg(const std::string& strArg, bool fValue); -template<typename T1> -inline uint256 Hash(const T1 pbegin, const T1 pend) -{ - static unsigned char pblank[1]; - uint256 hash1; - SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1); - uint256 hash2; - SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); - return hash2; -} - -class CHashWriter -{ -private: - SHA256_CTX ctx; - -public: - int nType; - int nVersion; - - void Init() { - SHA256_Init(&ctx); - } - - CHashWriter(int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn) { - Init(); - } - - CHashWriter& write(const char *pch, size_t size) { - SHA256_Update(&ctx, pch, size); - return (*this); - } - - // invalidates the object - uint256 GetHash() { - uint256 hash1; - SHA256_Final((unsigned char*)&hash1, &ctx); - uint256 hash2; - SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); - return hash2; - } - - template<typename T> - CHashWriter& operator<<(const T& obj) { - // Serialize to this stream - ::Serialize(*this, obj, nType, nVersion); - return (*this); - } -}; - - -template<typename T1, typename T2> -inline uint256 Hash(const T1 p1begin, const T1 p1end, - const T2 p2begin, const T2 p2end) -{ - static unsigned char pblank[1]; - uint256 hash1; - SHA256_CTX ctx; - SHA256_Init(&ctx); - SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0])); - SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0])); - SHA256_Final((unsigned char*)&hash1, &ctx); - uint256 hash2; - SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); - return hash2; -} - -template<typename T1, typename T2, typename T3> -inline uint256 Hash(const T1 p1begin, const T1 p1end, - const T2 p2begin, const T2 p2end, - const T3 p3begin, const T3 p3end) -{ - static unsigned char pblank[1]; - uint256 hash1; - SHA256_CTX ctx; - SHA256_Init(&ctx); - SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0])); - SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0])); - SHA256_Update(&ctx, (p3begin == p3end ? pblank : (unsigned char*)&p3begin[0]), (p3end - p3begin) * sizeof(p3begin[0])); - SHA256_Final((unsigned char*)&hash1, &ctx); - uint256 hash2; - SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); - return hash2; -} - -template<typename T> -uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION) -{ - CHashWriter ss(nType, nVersion); - ss << obj; - return ss.GetHash(); -} - -inline uint160 Hash160(const std::vector<unsigned char>& vch) -{ - uint256 hash1; - SHA256(&vch[0], vch.size(), (unsigned char*)&hash1); - uint160 hash2; - RIPEMD160((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); - return hash2; -} - - /** Median filter over a stream of values. * Returns the median of the last N numbers */ diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 4419cbb5f7..2282bed18a 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -238,7 +238,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, //printf("LoadWallet %s\n", wtx.GetHash().ToString().c_str()); //printf(" %12"PRI64d" %s %s %s\n", // wtx.vout[0].nValue, - // DateTimeStrFormat("%Y-%m-%dT%H:%M:%S", wtx.GetBlockTime()).c_str(), + // DateTimeStrFormat("%Y-%m-%d %H:%M:%S", wtx.GetBlockTime()).c_str(), // wtx.hashBlock.ToString().substr(0,20).c_str(), // wtx.mapValue["message"].c_str()); } |