aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bignum.h2
-rw-r--r--src/clientversion.h6
-rw-r--r--src/init.cpp2
-rw-r--r--src/main.cpp50
-rw-r--r--src/main.h14
-rw-r--r--src/qt/aboutdialog.cpp7
-rw-r--r--src/qt/addressbookpage.cpp4
-rw-r--r--src/qt/addressbookpage.h3
-rw-r--r--src/qt/bitcoingui.cpp23
-rw-r--r--src/qt/bitcoingui.h2
-rw-r--r--src/qt/forms/addressbookpage.ui14
-rw-r--r--src/qt/res/bitcoin-qt.rc3
-rw-r--r--src/qt/walletview.cpp30
-rw-r--r--src/uint256.h10
14 files changed, 95 insertions, 75 deletions
diff --git a/src/bignum.h b/src/bignum.h
index 1ee7a99934..0881807d70 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -222,7 +222,7 @@ public:
BN_mpi2bn(pch, p - pch, this);
}
- uint256 getuint256()
+ uint256 getuint256() const
{
unsigned int nSize = BN_bn2mpi(this, NULL);
if (nSize < 4)
diff --git a/src/clientversion.h b/src/clientversion.h
index bc2e9c882a..635641bd29 100644
--- a/src/clientversion.h
+++ b/src/clientversion.h
@@ -2,7 +2,7 @@
#define CLIENTVERSION_H
//
-// client versioning
+// client versioning and copyright year
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
@@ -14,6 +14,10 @@
// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE false
+// Copyright year (2009-this)
+// Todo: update this when changing our copyright comments in the source
+#define COPYRIGHT_YEAR 2013
+
// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
diff --git a/src/init.cpp b/src/init.cpp
index 70a9233386..f6485c3b1d 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -333,7 +333,9 @@ std::string HelpMessage()
" -rpcpassword=<pw> " + _("Password for JSON-RPC connections") + "\n" +
" -rpcport=<port> " + _("Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332)") + "\n" +
" -rpcallowip=<ip> " + _("Allow JSON-RPC connections from specified IP address") + "\n" +
+#ifndef QT_GUI
" -rpcconnect=<ip> " + _("Send commands to node running on <ip> (default: 127.0.0.1)") + "\n" +
+#endif
" -rpcthreads=<n> " + _("Set the number of threads to service RPC calls (default: 4)") + "\n" +
" -blocknotify=<cmd> " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" +
" -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n" +
diff --git a/src/main.cpp b/src/main.cpp
index 8284d54c7c..6f3b5da961 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -35,8 +35,8 @@ uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3
static CBigNum bnProofOfWorkLimit(~uint256(0) >> 32);
CBlockIndex* pindexGenesisBlock = NULL;
int nBestHeight = -1;
-CBigNum bnBestChainWork = 0;
-CBigNum bnBestInvalidWork = 0;
+uint256 nBestChainWork = 0;
+uint256 nBestInvalidWork = 0;
uint256 hashBestChain = 0;
CBlockIndex* pindexBest = NULL;
set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid; // may contain all CBlockIndex*'s that have validness >=BLOCK_VALID_TRANSACTIONS, and must contain those who aren't failed
@@ -768,7 +768,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn
// Check against previous transactions
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
- if (!tx.CheckInputs(state, view, true, SCRIPT_VERIFY_P2SH))
+ if (!tx.CheckInputs(state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC))
{
return error("CTxMemPool::accept() : ConnectInputs failed %s", hash.ToString().c_str());
}
@@ -1191,20 +1191,20 @@ bool IsInitialBlockDownload()
void static InvalidChainFound(CBlockIndex* pindexNew)
{
- if (pindexNew->bnChainWork > bnBestInvalidWork)
+ if (pindexNew->nChainWork > nBestInvalidWork)
{
- bnBestInvalidWork = pindexNew->bnChainWork;
- pblocktree->WriteBestInvalidWork(bnBestInvalidWork);
+ nBestInvalidWork = pindexNew->nChainWork;
+ pblocktree->WriteBestInvalidWork(CBigNum(nBestInvalidWork));
uiInterface.NotifyBlocksChanged();
}
- printf("InvalidChainFound: invalid block=%s height=%d work=%s date=%s\n",
+ printf("InvalidChainFound: invalid block=%s height=%d log2_work=%.8g date=%s\n",
pindexNew->GetBlockHash().ToString().c_str(), pindexNew->nHeight,
- pindexNew->bnChainWork.ToString().c_str(), DateTimeStrFormat("%Y-%m-%d %H:%M:%S",
+ log(pindexNew->nChainWork.getdouble())/log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S",
pindexNew->GetBlockTime()).c_str());
- printf("InvalidChainFound: current best=%s height=%d work=%s date=%s\n",
- hashBestChain.ToString().c_str(), nBestHeight, bnBestChainWork.ToString().c_str(),
+ printf("InvalidChainFound: current best=%s height=%d log2_work=%.8g date=%s\n",
+ hashBestChain.ToString().c_str(), nBestHeight, log(nBestChainWork.getdouble())/log(2.0),
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str());
- if (pindexBest && bnBestInvalidWork > bnBestChainWork + pindexBest->GetBlockWork() * 6)
+ if (pindexBest && nBestInvalidWork > nBestChainWork + (pindexBest->GetBlockWork() * 6).getuint256())
printf("InvalidChainFound: Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n");
}
@@ -1230,7 +1230,7 @@ bool ConnectBestBlock(CValidationState &state) {
pindexNewBest = *it;
}
- if (pindexNewBest == pindexBest || (pindexBest && pindexNewBest->bnChainWork == pindexBest->bnChainWork))
+ if (pindexNewBest == pindexBest || (pindexBest && pindexNewBest->nChainWork == pindexBest->nChainWork))
return true; // nothing to do
// check ancestry
@@ -1250,7 +1250,7 @@ bool ConnectBestBlock(CValidationState &state) {
break;
}
- if (pindexBest == NULL || pindexTest->bnChainWork > pindexBest->bnChainWork)
+ if (pindexBest == NULL || pindexTest->nChainWork > pindexBest->nChainWork)
vAttach.push_back(pindexTest);
if (pindexTest->pprev == NULL || pindexTest->pnext != NULL) {
@@ -1858,11 +1858,11 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
pindexBest = pindexNew;
pblockindexFBBHLast = NULL;
nBestHeight = pindexBest->nHeight;
- bnBestChainWork = pindexNew->bnChainWork;
+ nBestChainWork = pindexNew->nChainWork;
nTimeBestReceived = GetTime();
nTransactionsUpdated++;
- printf("SetBestChain: new best=%s height=%d work=%s tx=%lu date=%s progress=%f\n",
- hashBestChain.ToString().c_str(), nBestHeight, bnBestChainWork.ToString().c_str(), (unsigned long)pindexNew->nChainTx,
+ printf("SetBestChain: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f\n",
+ hashBestChain.ToString().c_str(), nBestHeight, log(nBestChainWork.getdouble())/log(2.0), (unsigned long)pindexNew->nChainTx,
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str(),
Checkpoints::GuessVerificationProgress(pindexBest));
@@ -1915,7 +1915,7 @@ bool CBlock::AddToBlockIndex(CValidationState &state, const CDiskBlockPos &pos)
pindexNew->nHeight = pindexNew->pprev->nHeight + 1;
}
pindexNew->nTx = vtx.size();
- pindexNew->bnChainWork = (pindexNew->pprev ? pindexNew->pprev->bnChainWork : 0) + pindexNew->GetBlockWork();
+ pindexNew->nChainWork = (pindexNew->pprev ? pindexNew->pprev->nChainWork : 0) + pindexNew->GetBlockWork().getuint256();
pindexNew->nChainTx = (pindexNew->pprev ? pindexNew->pprev->nChainTx : 0) + pindexNew->nTx;
pindexNew->nFile = pos.nFile;
pindexNew->nDataPos = pos.nPos;
@@ -2537,7 +2537,7 @@ bool static LoadBlockIndexDB()
boost::this_thread::interruption_point();
- // Calculate bnChainWork
+ // Calculate nChainWork
vector<pair<int, CBlockIndex*> > vSortedByHeight;
vSortedByHeight.reserve(mapBlockIndex.size());
BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex)
@@ -2549,7 +2549,7 @@ bool static LoadBlockIndexDB()
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
{
CBlockIndex* pindex = item.second;
- pindex->bnChainWork = (pindex->pprev ? pindex->pprev->bnChainWork : 0) + pindex->GetBlockWork();
+ pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + pindex->GetBlockWork().getuint256();
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS && !(pindex->nStatus & BLOCK_FAILED_MASK))
setBlockIndexValid.insert(pindex);
@@ -2561,8 +2561,10 @@ bool static LoadBlockIndexDB()
if (pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile))
printf("LoadBlockIndexDB(): last block file info: %s\n", infoLastBlockFile.ToString().c_str());
- // Load bnBestInvalidWork, OK if it doesn't exist
+ // Load nBestInvalidWork, OK if it doesn't exist
+ CBigNum bnBestInvalidWork;
pblocktree->ReadBestInvalidWork(bnBestInvalidWork);
+ nBestInvalidWork = bnBestInvalidWork.getuint256();
// Check whether we need to continue reindexing
bool fReindexing = false;
@@ -2579,7 +2581,7 @@ bool static LoadBlockIndexDB()
return true;
hashBestChain = pindexBest->GetBlockHash();
nBestHeight = pindexBest->nHeight;
- bnBestChainWork = pindexBest->bnChainWork;
+ nBestChainWork = pindexBest->nChainWork;
// set 'next' pointers in best chain
CBlockIndex *pindex = pindexBest;
@@ -2675,8 +2677,8 @@ void UnloadBlockIndex()
setBlockIndexValid.clear();
pindexGenesisBlock = NULL;
nBestHeight = 0;
- bnBestChainWork = 0;
- bnBestInvalidWork = 0;
+ nBestChainWork = 0;
+ nBestInvalidWork = 0;
hashBestChain = 0;
pindexBest = NULL;
}
@@ -2953,7 +2955,7 @@ string GetWarnings(string strFor)
}
// Longer invalid proof-of-work chain
- if (pindexBest && bnBestInvalidWork > bnBestChainWork + pindexBest->GetBlockWork() * 6)
+ if (pindexBest && nBestInvalidWork > nBestChainWork + (pindexBest->GetBlockWork() * 6).getuint256())
{
nPriority = 2000;
strStatusBar = strRPC = _("Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.");
diff --git a/src/main.h b/src/main.h
index 9a3664a437..24b2cb2aa6 100644
--- a/src/main.h
+++ b/src/main.h
@@ -77,8 +77,8 @@ extern std::set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid;
extern uint256 hashGenesisBlock;
extern CBlockIndex* pindexGenesisBlock;
extern int nBestHeight;
-extern CBigNum bnBestChainWork;
-extern CBigNum bnBestInvalidWork;
+extern uint256 nBestChainWork;
+extern uint256 nBestInvalidWork;
extern uint256 hashBestChain;
extern CBlockIndex* pindexBest;
extern unsigned int nTransactionsUpdated;
@@ -1619,7 +1619,7 @@ public:
unsigned int nUndoPos;
// (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block
- CBigNum bnChainWork;
+ uint256 nChainWork;
// Number of transactions in this block.
// Note: in a potential headers-first mode, this number cannot be relied upon
@@ -1648,7 +1648,7 @@ public:
nFile = 0;
nDataPos = 0;
nUndoPos = 0;
- bnChainWork = 0;
+ nChainWork = 0;
nTx = 0;
nChainTx = 0;
nStatus = 0;
@@ -1669,7 +1669,7 @@ public:
nFile = 0;
nDataPos = 0;
nUndoPos = 0;
- bnChainWork = 0;
+ nChainWork = 0;
nTx = 0;
nChainTx = 0;
nStatus = 0;
@@ -1793,8 +1793,8 @@ public:
struct CBlockIndexWorkComparator
{
bool operator()(CBlockIndex *pa, CBlockIndex *pb) {
- if (pa->bnChainWork > pb->bnChainWork) return false;
- if (pa->bnChainWork < pb->bnChainWork) return true;
+ if (pa->nChainWork > pb->nChainWork) return false;
+ if (pa->nChainWork < pb->nChainWork) return true;
if (pa->GetBlockHash() < pb->GetBlockHash()) return false;
if (pa->GetBlockHash() > pb->GetBlockHash()) return true;
diff --git a/src/qt/aboutdialog.cpp b/src/qt/aboutdialog.cpp
index 755413b2bb..57818b8a27 100644
--- a/src/qt/aboutdialog.cpp
+++ b/src/qt/aboutdialog.cpp
@@ -2,10 +2,7 @@
#include "ui_aboutdialog.h"
#include "clientmodel.h"
-
-// Copyright year (2009-this)
-// Todo: update this when changing our copyright comments in the source
-const int ABOUTDIALOG_COPYRIGHT_YEAR = 2013;
+#include "clientversion.h"
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
@@ -14,7 +11,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
ui->setupUi(this);
// Set current copyright year
- ui->copyrightLabel->setText(tr("Copyright") + QString(" &copy; ") + tr("2009-%1 The Bitcoin developers").arg(ABOUTDIALOG_COPYRIGHT_YEAR));
+ ui->copyrightLabel->setText(tr("Copyright") + QString(" &copy; ") + tr("2009-%1 The Bitcoin developers").arg(COPYRIGHT_YEAR));
}
void AboutDialog::setModel(ClientModel *model)
diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp
index 23c69fef21..8529c88b39 100644
--- a/src/qt/addressbookpage.cpp
+++ b/src/qt/addressbookpage.cpp
@@ -33,6 +33,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
ui->deleteAddress->setIcon(QIcon());
ui->verifyMessage->setIcon(QIcon());
ui->signMessage->setIcon(QIcon());
+ ui->exportButton->setIcon(QIcon());
#endif
#ifndef USE_QRCODE
@@ -45,6 +46,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setFocus();
+ ui->exportButton->hide();
break;
case ForEditing:
ui->buttonBox->setVisible(false);
@@ -323,7 +325,7 @@ void AddressBookPage::done(int retval)
QDialog::done(retval);
}
-void AddressBookPage::exportClicked()
+void AddressBookPage::on_exportButton_clicked()
{
// CSV is currently the only supported format
QString filename = GUIUtil::getSaveFileName(
diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h
index 0631781685..34465aa65f 100644
--- a/src/qt/addressbookpage.h
+++ b/src/qt/addressbookpage.h
@@ -43,7 +43,6 @@ public:
public slots:
void done(int retval);
- void exportClicked();
private:
Ui::AddressBookPage *ui;
@@ -76,6 +75,8 @@ private slots:
void onCopyLabelAction();
/** Edit currently selected address entry (no button) */
void onEditAction();
+ /** Export button clicked */
+ void on_exportButton_clicked();
/** Set button states based on selected tab and selection */
void selectionChanged();
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 27272e69e1..14d738d9da 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -236,9 +236,6 @@ void BitcoinGUI::createActions()
verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Bitcoin addresses"));
- exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
- exportAction->setStatusTip(tr("Export the data in the current tab to a file"));
- exportAction->setToolTip(exportAction->statusTip());
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console"));
@@ -267,7 +264,6 @@ void BitcoinGUI::createMenuBar()
// Configure the menus
QMenu *file = appMenuBar->addMenu(tr("&File"));
file->addAction(backupWalletAction);
- file->addAction(exportAction);
file->addAction(signMessageAction);
file->addAction(verifyMessageAction);
file->addSeparator();
@@ -295,10 +291,6 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
-
- QToolBar *toolbar2 = addToolBar(tr("Actions toolbar"));
- toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- toolbar2->addAction(exportAction);
}
void BitcoinGUI::setClientModel(ClientModel *clientModel)
@@ -611,25 +603,28 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
void BitcoinGUI::message(const QString &title, const QString &message, unsigned int style, bool *ret)
{
- QString strTitle = tr("Bitcoin") + " - ";
+ QString strTitle = tr("Bitcoin"); // default title
// Default to information icon
int nMBoxIcon = QMessageBox::Information;
int nNotifyIcon = Notificator::Information;
- // Check for usage of predefined title
+ // Override title based on style
+ QString msgType;
switch (style) {
case CClientUIInterface::MSG_ERROR:
- strTitle += tr("Error");
+ msgType = tr("Error");
break;
case CClientUIInterface::MSG_WARNING:
- strTitle += tr("Warning");
+ msgType = tr("Warning");
break;
case CClientUIInterface::MSG_INFORMATION:
- strTitle += tr("Information");
+ msgType = tr("Information");
break;
default:
- strTitle += title; // Use supplied title
+ msgType = title; // Use supplied title
}
+ if (!msgType.isEmpty())
+ strTitle += " - " + msgType;
// Check for error/warning icon
if (style & CClientUIInterface::ICON_ERROR) {
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 5f7ef746f9..f361a62a41 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -67,7 +67,6 @@ public:
QAction * getAddressBookAction() { return addressBookAction; }
QAction * getReceiveCoinsAction() { return receiveCoinsAction; }
QAction * getSendCoinsAction() { return sendCoinsAction; }
- QAction * getExportAction() { return exportAction; }
protected:
void changeEvent(QEvent *e);
@@ -98,7 +97,6 @@ private:
QAction *receiveCoinsAction;
QAction *optionsAction;
QAction *toggleHideAction;
- QAction *exportAction;
QAction *encryptWalletAction;
QAction *backupWalletAction;
QAction *changePassphraseAction;
diff --git a/src/qt/forms/addressbookpage.ui b/src/qt/forms/addressbookpage.ui
index 3cf307384a..a2a7da34dd 100644
--- a/src/qt/forms/addressbookpage.ui
+++ b/src/qt/forms/addressbookpage.ui
@@ -149,6 +149,20 @@
</spacer>
</item>
<item>
+ <widget class="QPushButton" name="exportButton">
+ <property name="toolTip">
+ <string>Export the data in the current tab to a file</string>
+ </property>
+ <property name="text">
+ <string>&amp;Export</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../bitcoin.qrc">
+ <normaloff>:/icons/export</normaloff>:/icons/export</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
diff --git a/src/qt/res/bitcoin-qt.rc b/src/qt/res/bitcoin-qt.rc
index 5af328b6f9..3e3672a835 100644
--- a/src/qt/res/bitcoin-qt.rc
+++ b/src/qt/res/bitcoin-qt.rc
@@ -8,6 +8,7 @@ IDI_ICON2 ICON DISCARDABLE "icons/bitcoin_testnet.ico"
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD)
#define VER_FILEVERSION VER_PRODUCTVERSION
#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR
+#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin developers"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
@@ -23,7 +24,7 @@ BEGIN
VALUE "FileDescription", "Bitcoin-Qt (OSS GUI client for Bitcoin)"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "bitcoin-qt"
- VALUE "LegalCopyright", "2009-2013 The Bitcoin developers"
+ VALUE "LegalCopyright", COPYRIGHT_STR
VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
VALUE "OriginalFilename", "bitcoin-qt.exe"
VALUE "ProductName", "Bitcoin-Qt"
diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp
index 1d02b81fb6..727b48ded7 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -23,6 +23,7 @@
#include <QAction>
#include <QDesktopServices>
#include <QFileDialog>
+#include <QPushButton>
WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
QStackedWidget(parent),
@@ -35,8 +36,17 @@ WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
transactionsPage = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout();
+ QHBoxLayout *hbox_buttons = new QHBoxLayout();
transactionView = new TransactionView(this);
vbox->addWidget(transactionView);
+ QPushButton *exportButton = new QPushButton("&Export", this);
+ exportButton->setToolTip(tr("Export the data in the current tab to a file"));
+#ifndef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
+ exportButton->setIcon(QIcon(":/icons/export"));
+#endif
+ hbox_buttons->addStretch();
+ hbox_buttons->addWidget(exportButton);
+ vbox->addLayout(hbox_buttons);
transactionsPage->setLayout(vbox);
addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);
@@ -66,6 +76,8 @@ WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
// Clicking on "Sign Message" in the receive coins page opens the sign message tab in the Sign/Verify Message dialog
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
+ // Clicking on "Export" allows to export the transaction list
+ connect(exportButton, SIGNAL(clicked()), transactionView, SLOT(exportClicked()));
gotoOverviewPage();
}
@@ -142,39 +154,24 @@ void WalletView::gotoOverviewPage()
{
gui->getOverviewAction()->setChecked(true);
setCurrentWidget(overviewPage);
-
- gui->getExportAction()->setEnabled(false);
- disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
}
void WalletView::gotoHistoryPage()
{
gui->getHistoryAction()->setChecked(true);
setCurrentWidget(transactionsPage);
-
- gui->getExportAction()->setEnabled(true);
- disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
- connect(gui->getExportAction(), SIGNAL(triggered()), transactionView, SLOT(exportClicked()));
}
void WalletView::gotoAddressBookPage()
{
gui->getAddressBookAction()->setChecked(true);
setCurrentWidget(addressBookPage);
-
- gui->getExportAction()->setEnabled(true);
- disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
- connect(gui->getExportAction(), SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
}
void WalletView::gotoReceiveCoinsPage()
{
gui->getReceiveCoinsAction()->setChecked(true);
setCurrentWidget(receiveCoinsPage);
-
- gui->getExportAction()->setEnabled(true);
- disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
- connect(gui->getExportAction(), SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
}
void WalletView::gotoSendCoinsPage(QString addr)
@@ -182,9 +179,6 @@ void WalletView::gotoSendCoinsPage(QString addr)
gui->getSendCoinsAction()->setChecked(true);
setCurrentWidget(sendCoinsPage);
- gui->getExportAction()->setEnabled(false);
- disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
-
if (!addr.isEmpty())
sendCoinsPage->setAddress(addr);
}
diff --git a/src/uint256.h b/src/uint256.h
index eb0066fa27..8a9af8ba04 100644
--- a/src/uint256.h
+++ b/src/uint256.h
@@ -55,6 +55,16 @@ public:
return ret;
}
+ double getdouble() const
+ {
+ double ret = 0.0;
+ double fact = 1.0;
+ for (int i = 0; i < WIDTH; i++) {
+ ret += fact * pn[i];
+ fact *= 4294967296.0;
+ }
+ return ret;
+ }
base_uint& operator=(uint64 b)
{