diff options
-rwxr-xr-x | contrib/debian/bin/bitcoin-qt | 16 | ||||
-rwxr-xr-x | contrib/debian/bin/bitcoind | 4 | ||||
-rw-r--r-- | contrib/debian/bitcoin-qt.install | 3 | ||||
-rw-r--r-- | contrib/debian/changelog | 12 | ||||
-rw-r--r-- | contrib/debian/control | 4 | ||||
-rw-r--r-- | doc/build-unix.txt | 2 | ||||
-rw-r--r-- | src/bitcoinrpc.cpp | 25 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 50 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 2 | ||||
-rw-r--r-- | src/qt/forms/overviewpage.ui | 32 | ||||
-rw-r--r-- | src/qt/forms/rpcconsole.ui | 27 | ||||
-rw-r--r-- | src/qt/forms/verifymessagedialog.ui | 77 | ||||
-rw-r--r-- | src/qt/guiutil.cpp | 35 | ||||
-rw-r--r-- | src/qt/guiutil.h | 18 | ||||
-rw-r--r-- | src/qt/overviewpage.cpp | 20 | ||||
-rw-r--r-- | src/qt/overviewpage.h | 3 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 15 | ||||
-rw-r--r-- | src/qt/rpcconsole.h | 2 | ||||
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 7 | ||||
-rw-r--r-- | src/qt/sendcoinsdialog.h | 2 | ||||
-rw-r--r-- | src/qt/verifymessagedialog.cpp | 100 | ||||
-rw-r--r-- | src/qt/verifymessagedialog.h | 6 | ||||
-rw-r--r-- | src/qt/walletmodel.cpp | 15 | ||||
-rw-r--r-- | src/qt/walletmodel.h | 4 | ||||
-rw-r--r-- | src/wallet.cpp | 27 | ||||
-rw-r--r-- | src/wallet.h | 1 |
26 files changed, 307 insertions, 202 deletions
diff --git a/contrib/debian/bin/bitcoin-qt b/contrib/debian/bin/bitcoin-qt deleted file mode 100755 index f2eac1b1ab..0000000000 --- a/contrib/debian/bin/bitcoin-qt +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -e - -umask 077 - -basedir=~/.bitcoin -dbfile="$basedir/DB_CONFIG" -cfgfile="$basedir/bitcoin.conf" - -[ -e "$basedir" ] || mkdir "$basedir" - -# Bitcoin does not clean up DB log files by default -[ -e "$dbfile" ] || echo 'set_flags DB_LOG_AUTOREMOVE' > "$dbfile" - -exec /usr/lib/bitcoin/bitcoin-qt "$@" diff --git a/contrib/debian/bin/bitcoind b/contrib/debian/bin/bitcoind index 0904f76f7b..a2f55a9138 100755 --- a/contrib/debian/bin/bitcoind +++ b/contrib/debian/bin/bitcoind @@ -5,14 +5,10 @@ set -e umask 077 basedir=~/.bitcoin -dbfile="$basedir/DB_CONFIG" cfgfile="$basedir/bitcoin.conf" [ -e "$basedir" ] || mkdir "$basedir" [ -e "$cfgfile" ] || perl -le 'print"rpcpassword=",map{(a..z,A..Z,0..9)[rand 62]}0..9' > "$cfgfile" -# Bitcoin does not clean up DB log files by default -[ -e "$dbfile" ] || echo 'set_flags DB_LOG_AUTOREMOVE' > "$dbfile" - exec /usr/lib/bitcoin/bitcoind "$@" diff --git a/contrib/debian/bitcoin-qt.install b/contrib/debian/bitcoin-qt.install index 6a566f515a..ba407134e7 100644 --- a/contrib/debian/bitcoin-qt.install +++ b/contrib/debian/bitcoin-qt.install @@ -1,5 +1,4 @@ -debian/bin/bitcoin-qt usr/bin -bitcoin-qt usr/lib/bitcoin +bitcoin-qt usr/bin share/pixmaps/bitcoin32.xpm usr/share/pixmaps share/pixmaps/bitcoin80.xpm usr/share/pixmaps debian/bitcoin-qt.desktop usr/share/applications diff --git a/contrib/debian/changelog b/contrib/debian/changelog index cdd4a47e91..773da6b54f 100644 --- a/contrib/debian/changelog +++ b/contrib/debian/changelog @@ -1,3 +1,15 @@ +bitcoin (0.6.2-natty1) natty; urgency=low + + * Update package description and launch scripts. + + -- Matt Corallo <matt@bluematt.me> Sat, 2 Jun 2012 16:41:00 +0200 + +bitcoin (0.6.2-natty0) natty; urgency=low + + * New upstream release. + + -- Matt Corallo <matt@bluematt.me> Tue, 8 May 2012 16:27:00 -0500 + bitcoin (0.6.1-natty0) natty; urgency=low * New upstream release. diff --git a/contrib/debian/control b/contrib/debian/control index de067d8fc4..4425e716d8 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -36,7 +36,7 @@ Description: peer-to-peer network based digital currency - daemon By default connects to an IRC network to discover other peers. . Full transaction history is stored locally at each client. This - requires 150+ MB of space, slowly growing. + requires 2+ GB of space, slowly growing. . This package provides bitcoind, a combined daemon and CLI tool to interact with the daemon. @@ -54,6 +54,6 @@ Description: peer-to-peer network based digital currency - QT GUI By default connects to an IRC network to discover other peers. . Full transaction history is stored locally at each client. This - requires 150+ MB of space, slowly growing. + requires 2+ GB of space, slowly growing. . This package provides bitcoin-qt, a GUI for Bitcoin based on QT. diff --git a/doc/build-unix.txt b/doc/build-unix.txt index c32563814d..9033301ab0 100644 --- a/doc/build-unix.txt +++ b/doc/build-unix.txt @@ -33,7 +33,7 @@ Dependencies miniupnpc may be used for UPnP port mapping. It can be downloaded from http://miniupnp.tuxfamily.org/files/. UPnP support is compiled in and turned off by default. Set USE_UPNP to a different value to control this: - USE_UPNP= No UPnP support - miniupnp not required + USE_UPNP=- No UPnP support - miniupnp not required USE_UPNP=0 (the default) UPnP support turned off by default at runtime USE_UPNP=1 UPnP support turned on by default at runtime diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index e31022d822..999c6dda09 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -2264,7 +2264,7 @@ Value sendrawtx(const Array& params, bool fHelp) CInv inv(MSG_TX, tx.GetHash()); RelayInventory(inv); - return true; + return tx.GetHash().GetHex(); } @@ -2992,24 +2992,11 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri if (strMethod == "listaccounts" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "walletpassphrase" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "listsinceblock" && n > 1) ConvertTo<boost::int64_t>(params[1]); - if (strMethod == "sendmany" && n > 1) - { - string s = params[1].get_str(); - Value v; - if (!read_string(s, v) || v.type() != obj_type) - throw runtime_error("type mismatch"); - params[1] = v.get_obj(); - } - if (strMethod == "sendmany" && n > 2) ConvertTo<boost::int64_t>(params[2]); - if (strMethod == "addmultisigaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]); - if (strMethod == "addmultisigaddress" && n > 1) - { - string s = params[1].get_str(); - Value v; - if (!read_string(s, v) || v.type() != array_type) - throw runtime_error("type mismatch "+s); - params[1] = v.get_array(); - } + if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]); + if (strMethod == "sendmany" && n > 2) ConvertTo<boost::int64_t>(params[2]); + if (strMethod == "addmultisigaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]); + if (strMethod == "addmultisigaddress" && n > 1) ConvertTo<Array>(params[1]); + return params; } diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index bdc6ea6ffd..2a2d200394 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -113,54 +113,6 @@ static void handleRunawayException(std::exception *e) exit(1); } -/** Help message for Bitcoin-Qt, shown with --help. */ -class HelpMessageBox: public QMessageBox -{ - Q_OBJECT -public: - HelpMessageBox(QWidget *parent = 0); - - void exec(); -private: - QString header; - QString coreOptions; - QString uiOptions; -}; - -HelpMessageBox::HelpMessageBox(QWidget *parent): - QMessageBox(parent) -{ - header = tr("Bitcoin-Qt") + " " + tr("version") + " " + - QString::fromStdString(FormatFullVersion()) + "\n\n" + - tr("Usage:") + "\n" + - " bitcoin-qt [" + tr("options") + "] " + "\n"; - coreOptions = QString::fromStdString(HelpMessage()); - uiOptions = tr("UI options") + ":\n" + - " -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" + - " -min " + tr("Start minimized") + "\n" + - " -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; - - setWindowTitle(tr("Bitcoin-Qt")); - setTextFormat(Qt::PlainText); - // setMinimumWidth is ignored for QMessageBox so put in nonbreaking spaces to make it wider. - QChar em_space(0x2003); - setText(header + QString(em_space).repeated(40)); - setDetailedText(coreOptions + "\n" + uiOptions); -} -#include "bitcoin.moc" - -void HelpMessageBox::exec() -{ -#if defined(WIN32) - // On windows, show a message box, as there is no stderr in windowed applications - QMessageBox::exec(); -#else - // On other operating systems, the expected action is to print the message to the console. - QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions; - fprintf(stderr, "%s", strUsage.toStdString().c_str()); -#endif -} - #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { @@ -259,7 +211,7 @@ int main(int argc, char *argv[]) // but before showing splash screen. if (mapArgs.count("-?") || mapArgs.count("--help")) { - HelpMessageBox help; + GUIUtil::HelpMessageBox help; help.exec(); return 1; } diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index a4bb63886b..546a39f43d 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -849,7 +849,7 @@ void BitcoinGUI::changePassphrase() void BitcoinGUI::verifyMessage() { - VerifyMessageDialog *dlg = new VerifyMessageDialog(walletModel->getAddressTableModel(), this); + VerifyMessageDialog *dlg = new VerifyMessageDialog(this); dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->show(); } diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 6573517b24..9d45e2e91a 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>552</width> + <width>573</width> <height>342</height> </rect> </property> @@ -141,14 +141,14 @@ </property> </widget> </item> - <item row="2" column="0"> + <item row="3" column="0"> <widget class="QLabel" name="label_2"> <property name="text"> <string>Number of transactions:</string> </property> </widget> </item> - <item row="2" column="1"> + <item row="3" column="1"> <widget class="QLabel" name="labelNumTransactions"> <property name="toolTip"> <string>Total number of transactions in wallet</string> @@ -158,6 +158,32 @@ </property> </widget> </item> + <item row="2" column="0"> + <widget class="QLabel" name="labelImmatureText"> + <property name="text"> + <string>Immature:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="labelImmature"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="toolTip"> + <string>Mined balance that has not yet matured</string> + </property> + <property name="text"> + <string notr="true">0 BTC</string> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> + </property> + </widget> + </item> </layout> </item> </layout> diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index cded274792..678afad0d4 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>706</width> - <height>446</height> + <width>740</width> + <height>450</height> </rect> </property> <property name="windowTitle"> @@ -304,6 +304,29 @@ </widget> </item> <item row="15" column="0"> + <widget class="QLabel" name="labelCLOptions"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Command-line options</string> + </property> + </widget> + </item> + <item row="16" column="0"> + <widget class="QPushButton" name="showCLOptionsButton"> + <property name="toolTip"> + <string>Show the Bitcoin-Qt help message to get a list with possible Bitcoin command-line options.</string> + </property> + <property name="text"> + <string>&Show</string> + </property> + </widget> + </item> + <item row="17" column="0"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/src/qt/forms/verifymessagedialog.ui b/src/qt/forms/verifymessagedialog.ui index a7c99716e4..afe98b05ab 100644 --- a/src/qt/forms/verifymessagedialog.ui +++ b/src/qt/forms/verifymessagedialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>494</width> - <height>342</height> + <width>650</width> + <height>380</height> </rect> </property> <property name="windowTitle"> @@ -17,7 +17,7 @@ <item> <widget class="QLabel" name="label"> <property name="text"> - <string>Enter the message and signature below (be careful to correctly copy newlines, spaces, tabs and other invisible characters) to obtain the Bitcoin address used to sign the message.</string> + <string>Enter the signing address, signature and message below (be careful to correctly copy newlines, spaces, tabs and other invisible characters) to verify the message.</string> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> @@ -28,38 +28,28 @@ </widget> </item> <item> - <widget class="QPlainTextEdit" name="edMessage"/> - </item> - <item> - <widget class="QLineEdit" name="lnSig"> + <widget class="QValidatedLineEdit" name="lnAddress"> <property name="text"> <string/> </property> </widget> </item> <item> - <widget class="QLineEdit" name="lnAddress"> + <widget class="QValidatedLineEdit" name="lnSig"> <property name="text"> <string/> </property> - <property name="readOnly"> - <bool>true</bool> - </property> </widget> </item> <item> - <widget class="QLabel" name="lblStatus"> - <property name="text"> - <string/> - </property> - </widget> + <widget class="QPlainTextEdit" name="edMessage"/> </item> <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QPushButton" name="verifyMessage"> <property name="toolTip"> - <string>Verify a message and obtain the Bitcoin address used to sign the message</string> + <string>Verify a message to ensure it was signed with the specified Bitcoin address</string> </property> <property name="text"> <string>&Verify Message</string> @@ -71,33 +61,51 @@ </widget> </item> <item> - <widget class="QPushButton" name="copyToClipboard"> - <property name="enabled"> - <bool>false</bool> - </property> + <widget class="QPushButton" name="clearButton"> <property name="toolTip"> - <string>Copy the currently selected address to the system clipboard</string> + <string>Reset all verify message fields</string> </property> <property name="text"> - <string>&Copy Address</string> + <string>Clear &All</string> </property> <property name="icon"> <iconset resource="../bitcoin.qrc"> - <normaloff>:/icons/editcopy</normaloff>:/icons/editcopy</iconset> + <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> </property> </widget> </item> <item> - <widget class="QPushButton" name="clearButton"> - <property name="toolTip"> - <string>Reset all verify message fields</string> + <spacer name="horizontalSpacer_2"> + <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="QLabel" name="lblStatus"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>48</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> </property> <property name="text"> - <string>Clear &All</string> + <string/> </property> - <property name="icon"> - <iconset resource="../bitcoin.qrc"> - <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> + <property name="wordWrap"> + <bool>true</bool> </property> </widget> </item> @@ -118,6 +126,13 @@ </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>QValidatedLineEdit</class> + <extends>QLineEdit</extends> + <header>qvalidatedlineedit.h</header> + </customwidget> + </customwidgets> <resources> <include location="../bitcoin.qrc"/> </resources> diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 22c0bfeebe..3f2fc2ffa1 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -3,6 +3,7 @@ #include "walletmodel.h" #include "bitcoinunits.h" #include "util.h" +#include "init.h" #include <QString> #include <QDateTime> @@ -413,5 +414,39 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; } #endif +HelpMessageBox::HelpMessageBox(QWidget *parent) : + QMessageBox(parent) +{ + header = tr("Bitcoin-Qt") + " " + tr("version") + " " + + QString::fromStdString(FormatFullVersion()) + "\n\n" + + tr("Usage:") + "\n" + + " bitcoin-qt [" + tr("command-line options") + "] " + "\n"; + + coreOptions = QString::fromStdString(HelpMessage()); + + uiOptions = tr("UI options") + ":\n" + + " -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" + + " -min " + tr("Start minimized") + "\n" + + " -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; + + setWindowTitle(tr("Bitcoin-Qt")); + setTextFormat(Qt::PlainText); + // setMinimumWidth is ignored for QMessageBox so put in nonbreaking spaces to make it wider. + setText(header + QString(QChar(0x2003)).repeated(50)); + setDetailedText(coreOptions + "\n" + uiOptions); +} + +void HelpMessageBox::exec() +{ +#if defined(WIN32) + // On windows, show a message box, as there is no stderr in windowed applications + QMessageBox::exec(); +#else + // On other operating systems, the expected action is to print the message to the console. + QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions; + fprintf(stderr, "%s", strUsage.toStdString().c_str()); +#endif +} + } // namespace GUIUtil diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index c5f9aae511..ca06348519 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -3,6 +3,7 @@ #include <QString> #include <QObject> +#include <QMessageBox> QT_BEGIN_NAMESPACE class QFont; @@ -80,6 +81,7 @@ namespace GUIUtil class ToolTipToRichTextFilter : public QObject { Q_OBJECT + public: explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0); @@ -93,6 +95,22 @@ namespace GUIUtil bool GetStartOnSystemStartup(); bool SetStartOnSystemStartup(bool fAutoStart); + /** Help message for Bitcoin-Qt, shown with --help. */ + class HelpMessageBox : public QMessageBox + { + Q_OBJECT + + public: + HelpMessageBox(QWidget *parent = 0); + + void exec(); + + private: + QString header; + QString coreOptions; + QString uiOptions; + }; + } // namespace GUIUtil #endif // GUIUTIL_H diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index d7bcc6f45e..35d48581e3 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -94,7 +94,9 @@ OverviewPage::OverviewPage(QWidget *parent) : ui(new Ui::OverviewPage), currentBalance(-1), currentUnconfirmedBalance(-1), - txdelegate(new TxViewDelegate()), filter(0) + currentImmatureBalance(-1), + txdelegate(new TxViewDelegate()), + filter(0) { ui->setupUi(this); @@ -125,13 +127,21 @@ OverviewPage::~OverviewPage() delete ui; } -void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance) +void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance) { int unit = model->getOptionsModel()->getDisplayUnit(); currentBalance = balance; currentUnconfirmedBalance = unconfirmedBalance; + currentImmatureBalance = immatureBalance; ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance)); ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(unit, unconfirmedBalance)); + ui->labelImmature->setText(BitcoinUnits::formatWithUnit(unit, immatureBalance)); + + // only show immature (newly mined) balance if it's non-zero, so as not to complicate things + // for the non-mining users + bool showImmature = immatureBalance != 0; + ui->labelImmature->setVisible(showImmature); + ui->labelImmatureText->setVisible(showImmature); } void OverviewPage::setNumTransactions(int count) @@ -156,8 +166,8 @@ void OverviewPage::setModel(WalletModel *model) ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress); // Keep up to date with wallet - setBalance(model->getBalance(), model->getUnconfirmedBalance()); - connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64))); + setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance()); + connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64))); setNumTransactions(model->getNumTransactions()); connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int))); @@ -171,7 +181,7 @@ void OverviewPage::displayUnitChanged() if(!model || !model->getOptionsModel()) return; if(currentBalance != -1) - setBalance(currentBalance, currentUnconfirmedBalance); + setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance); txdelegate->unit = model->getOptionsModel()->getDisplayUnit(); ui->listTransactions->update(); diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index 208b324feb..c7d3a4242c 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -27,7 +27,7 @@ public: void showOutOfSyncWarning(bool fShow); public slots: - void setBalance(qint64 balance, qint64 unconfirmedBalance); + void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance); void setNumTransactions(int count); signals: @@ -38,6 +38,7 @@ private: WalletModel *model; qint64 currentBalance; qint64 currentUnconfirmedBalance; + qint64 currentImmatureBalance; TxViewDelegate *txdelegate; TransactionFilterProxy *filter; diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 830ce4face..f7b06b5b93 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -109,10 +109,13 @@ RPCConsole::RPCConsole(QWidget *parent) : { ui->setupUi(this); -#ifdef WIN32 +#ifndef Q_WS_MAC ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export")); -#else - // Show Debug logfile label and Open button only for Windows + ui->showCLOptionsButton->setIcon(QIcon(":/icons/options")); +#endif + +#ifndef WIN32 + // Hide Debug logfile label and Open button for non Windows-OSes ui->labelDebugLogfile->setVisible(false); ui->openDebugLogfileButton->setVisible(false); #endif @@ -326,3 +329,9 @@ void RPCConsole::scrollToEnd() QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar(); scrollbar->setValue(scrollbar->maximum()); } + +void RPCConsole::on_showCLOptionsButton_clicked() +{ + GUIUtil::HelpMessageBox help; + help.exec(); +} diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 4b71cdb988..3c38b4b8de 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -35,6 +35,8 @@ private slots: void on_tabWidget_currentChanged(int index); /** open the debug.log from the current datadir */ void on_openDebugLogfileButton_clicked(); + /** display messagebox with program parameters (same as bitcoin-qt --help) */ + void on_showCLOptionsButton_clicked(); public slots: void clear(); diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index f6a3047a2b..2eb228d1d4 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -48,8 +48,8 @@ void SendCoinsDialog::setModel(WalletModel *model) } if(model) { - setBalance(model->getBalance(), model->getUnconfirmedBalance()); - connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64))); + setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance()); + connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64))); } } @@ -277,9 +277,10 @@ void SendCoinsDialog::handleURI(const QString &uri) pasteEntry(rv); } -void SendCoinsDialog::setBalance(qint64 balance, qint64 unconfirmedBalance) +void SendCoinsDialog::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance) { Q_UNUSED(unconfirmedBalance); + Q_UNUSED(immatureBalance); if(!model || !model->getOptionsModel()) return; diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index 5dcbfbeb61..358c8cf85f 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -38,7 +38,7 @@ public slots: void accept(); SendCoinsEntry *addEntry(); void updateRemoveEnabled(); - void setBalance(qint64 balance, qint64 unconfirmedBalance); + void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance); private: Ui::SendCoinsDialog *ui; diff --git a/src/qt/verifymessagedialog.cpp b/src/qt/verifymessagedialog.cpp index d71568d2e9..92f58328a4 100644 --- a/src/qt/verifymessagedialog.cpp +++ b/src/qt/verifymessagedialog.cpp @@ -4,35 +4,36 @@ #include <string> #include <vector> -#include <QDialogButtonBox> -#include <QAbstractButton> -#include <QClipboard> -#include <QMessageBox> +#include <QDialog> +#include <QLabel> +#include <QLineEdit> +#include <QPlainTextEdit> +#include <QPushButton> #include "main.h" #include "wallet.h" #include "walletmodel.h" -#include "addresstablemodel.h" #include "guiutil.h" #include "base58.h" -VerifyMessageDialog::VerifyMessageDialog(AddressTableModel *addressModel, QWidget *parent) : +VerifyMessageDialog::VerifyMessageDialog(QWidget *parent) : QDialog(parent), - ui(new Ui::VerifyMessageDialog), - model(addressModel) + ui(new Ui::VerifyMessageDialog) { ui->setupUi(this); #if (QT_VERSION >= 0x040700) /* Do not move this to the XML file, Qt before 4.7 will choke on it */ + ui->lnAddress->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)")); ui->lnSig->setPlaceholderText(tr("Enter Bitcoin signature")); - ui->lnAddress->setPlaceholderText(tr("Click \"Verify Message\" to obtain address")); #endif GUIUtil::setupAddressWidget(ui->lnAddress, this); ui->lnAddress->installEventFilter(this); - ui->edMessage->setFocus(); + ui->lnSig->setFont(GUIUtil::bitcoinAddressFont()); + + ui->lnAddress->setFocus(); } VerifyMessageDialog::~VerifyMessageDialog() @@ -40,54 +41,65 @@ VerifyMessageDialog::~VerifyMessageDialog() delete ui; } -bool VerifyMessageDialog::checkAddress() +void VerifyMessageDialog::on_verifyMessage_clicked() { - CDataStream ss(SER_GETHASH, 0); - ss << strMessageMagic; - ss << ui->edMessage->document()->toPlainText().toStdString(); - uint256 hash = Hash(ss.begin(), ss.end()); + CBitcoinAddress addr(ui->lnAddress->text().toStdString()); + if (!addr.IsValid()) + { + ui->lnAddress->setValid(false); + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(tr("\"%1\" is not a valid address.").arg(ui->lnAddress->text()) + QString(" ") + tr("Please check the address and try again.")); + return; + } + CKeyID keyID; + if (!addr.GetKeyID(keyID)) + { + ui->lnAddress->setValid(false); + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(tr("\"%1\" does not refer to a key.").arg(ui->lnAddress->text()) + QString(" ") + tr("Please check the address and try again.")); + return; + } - bool invalid = true; - std::vector<unsigned char> vchSig = DecodeBase64(ui->lnSig->text().toStdString().c_str(), &invalid); + bool fInvalid = false; + std::vector<unsigned char> vchSig = DecodeBase64(ui->lnSig->text().toStdString().c_str(), &fInvalid); - if(invalid) + if (fInvalid) { - QMessageBox::warning(this, tr("Invalid Signature"), tr("The signature could not be decoded. Please check the signature and try again.")); - return false; + ui->lnSig->setValid(false); + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(tr("The signature could not be decoded.") + QString(" ") + tr("Please check the signature and try again.")); + return; } + CDataStream ss(SER_GETHASH, 0); + ss << strMessageMagic; + ss << ui->edMessage->document()->toPlainText().toStdString(); + CKey key; - if(!key.SetCompactSignature(hash, vchSig)) + if (!key.SetCompactSignature(Hash(ss.begin(), ss.end()), vchSig)) { - QMessageBox::warning(this, tr("Invalid Signature"), tr("The signature did not match the message digest. Please check the signature and try again.")); - return false; + ui->lnSig->setValid(false); + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(tr("The signature did not match the message digest.")+ QString(" ") + tr("Please check the signature and try again.")); + return; } - CBitcoinAddress address(key.GetPubKey().GetID()); - QString qStringAddress = QString::fromStdString(address.ToString()); - ui->lnAddress->setText(qStringAddress); - ui->copyToClipboard->setEnabled(true); - - QString label = model->labelForAddress(qStringAddress); - ui->lblStatus->setText(label.isEmpty() ? tr("Address not found in address book.") : tr("Address found in address book: %1").arg(label)); - return true; -} - -void VerifyMessageDialog::on_verifyMessage_clicked() -{ - checkAddress(); -} + if (!(CBitcoinAddress(key.GetPubKey().GetID()) == addr)) + { + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(QString("<nobr>") + tr("Message verification failed.") + QString("</nobr>")); + return; + } -void VerifyMessageDialog::on_copyToClipboard_clicked() -{ - QApplication::clipboard()->setText(ui->lnAddress->text()); + ui->lblStatus->setStyleSheet("QLabel { color: green; }"); + ui->lblStatus->setText(QString("<nobr>") + tr("Message verified.") + QString("</nobr>")); } void VerifyMessageDialog::on_clearButton_clicked() { - ui->edMessage->clear(); - ui->lnSig->clear(); ui->lnAddress->clear(); + ui->lnSig->clear(); + ui->edMessage->clear(); ui->lblStatus->clear(); ui->edMessage->setFocus(); @@ -95,9 +107,11 @@ void VerifyMessageDialog::on_clearButton_clicked() bool VerifyMessageDialog::eventFilter(QObject *object, QEvent *event) { - if(object == ui->lnAddress && (event->type() == QEvent::MouseButtonPress || + if (object == ui->lnAddress && (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::FocusIn)) { + // set lnAddress to valid, as QEvent::FocusIn would not reach QValidatedLineEdit::focusInEvent + ui->lnAddress->setValid(true); ui->lnAddress->selectAll(); return true; } diff --git a/src/qt/verifymessagedialog.h b/src/qt/verifymessagedialog.h index 9a3fb43415..0bed442d4c 100644 --- a/src/qt/verifymessagedialog.h +++ b/src/qt/verifymessagedialog.h @@ -16,21 +16,17 @@ class VerifyMessageDialog : public QDialog Q_OBJECT public: - explicit VerifyMessageDialog(AddressTableModel *addressModel, QWidget *parent = 0); + explicit VerifyMessageDialog(QWidget *parent); ~VerifyMessageDialog(); protected: bool eventFilter(QObject *object, QEvent *event); private: - bool checkAddress(); - Ui::VerifyMessageDialog *ui; - AddressTableModel *model; private slots: void on_verifyMessage_clicked(); - void on_copyToClipboard_clicked(); void on_clearButton_clicked(); }; diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 033df98082..9245f774a4 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -14,7 +14,8 @@ WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent) : QObject(parent), wallet(wallet), optionsModel(optionsModel), addressTableModel(0), transactionTableModel(0), - cachedBalance(0), cachedUnconfirmedBalance(0), cachedNumTransactions(0), + cachedBalance(0), cachedUnconfirmedBalance(0), cachedImmatureBalance(0), + cachedNumTransactions(0), cachedEncryptionStatus(Unencrypted) { addressTableModel = new AddressTableModel(wallet, this); @@ -38,6 +39,11 @@ qint64 WalletModel::getUnconfirmedBalance() const return wallet->GetUnconfirmedBalance(); } +qint64 WalletModel::getImmatureBalance() const +{ + return wallet->GetImmatureBalance(); +} + int WalletModel::getNumTransactions() const { int numTransactions = 0; @@ -64,15 +70,18 @@ void WalletModel::updateTransaction(const QString &hash, int status) // Balance and number of transactions might have changed qint64 newBalance = getBalance(); qint64 newUnconfirmedBalance = getUnconfirmedBalance(); + qint64 newImmatureBalance = getImmatureBalance(); int newNumTransactions = getNumTransactions(); - if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance) - emit balanceChanged(newBalance, newUnconfirmedBalance); + if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance) + emit balanceChanged(newBalance, newUnconfirmedBalance, newImmatureBalance); + if(cachedNumTransactions != newNumTransactions) emit numTransactionsChanged(newNumTransactions); cachedBalance = newBalance; cachedUnconfirmedBalance = newUnconfirmedBalance; + cachedImmatureBalance = newImmatureBalance; cachedNumTransactions = newNumTransactions; } diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 8b615ffe8e..c973c5cf53 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -52,6 +52,7 @@ public: qint64 getBalance() const; qint64 getUnconfirmedBalance() const; + qint64 getImmatureBalance() const; int getNumTransactions() const; EncryptionStatus getEncryptionStatus() const; @@ -116,6 +117,7 @@ private: // Cache some values to be able to detect changes qint64 cachedBalance; qint64 cachedUnconfirmedBalance; + qint64 cachedImmatureBalance; qint64 cachedNumTransactions; EncryptionStatus cachedEncryptionStatus; @@ -123,7 +125,7 @@ private: void unsubscribeFromCoreSignals(); signals: // Signal that balance in wallet changed - void balanceChanged(qint64 balance, qint64 unconfirmedBalance); + void balanceChanged(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance); // Number of transactions in wallet changed void numTransactionsChanged(int count); diff --git a/src/wallet.cpp b/src/wallet.cpp index 3c4aeb4eaf..4e3b559f6a 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -567,7 +567,7 @@ void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, l } -void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived, +void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived, int64& nSent, int64& nFee) const { nGenerated = nReceived = nSent = nFee = 0; @@ -851,9 +851,8 @@ int64 CWallet::GetBalance() const for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; - if (!pcoin->IsFinal() || !pcoin->IsConfirmed()) - continue; - nTotal += pcoin->GetAvailableCredit(); + if (pcoin->IsFinal() && pcoin->IsConfirmed()) + nTotal += pcoin->GetAvailableCredit(); } } @@ -868,9 +867,23 @@ int64 CWallet::GetUnconfirmedBalance() const for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; - if (pcoin->IsFinal() && pcoin->IsConfirmed()) - continue; - nTotal += pcoin->GetAvailableCredit(); + if (!pcoin->IsFinal() || !pcoin->IsConfirmed()) + nTotal += pcoin->GetAvailableCredit(); + } + } + return nTotal; +} + +int64 CWallet::GetImmatureBalance() const +{ + int64 nTotal = 0; + { + LOCK(cs_wallet); + for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) + { + const CWalletTx& pcoin = (*it).second; + if (pcoin.IsCoinBase() && pcoin.GetBlocksToMaturity() > 0 && pcoin.GetDepthInMainChain() >= 2) + nTotal += GetCredit(pcoin); } } return nTotal; diff --git a/src/wallet.h b/src/wallet.h index 618a00623a..dfdb7b8257 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -144,6 +144,7 @@ public: void ResendWalletTransactions(); int64 GetBalance() const; int64 GetUnconfirmedBalance() const; + int64 GetImmatureBalance() const; bool CreateTransaction(const std::vector<std::pair<CScript, int64> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet); bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet); bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey); |