aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac120
-rw-r--r--contrib/bitcoin-qt.pro3
-rw-r--r--doc/README.md40
-rw-r--r--doc/build-msw.md4
-rw-r--r--src/Makefile.am7
-rw-r--r--src/Makefile.include8
-rw-r--r--src/leveldbwrapper.cpp2
-rw-r--r--src/qt/Makefile.am21
-rw-r--r--src/qt/bitcoin.cpp2
-rw-r--r--src/qt/bitcoingui.cpp31
-rw-r--r--src/qt/bitcoingui.h7
-rw-r--r--src/qt/forms/openuridialog.ui116
-rw-r--r--src/qt/guiutil.cpp35
-rw-r--r--src/qt/guiutil.h14
-rw-r--r--src/qt/openuridialog.cpp52
-rw-r--r--src/qt/openuridialog.h34
-rw-r--r--src/qt/paymentserver.h4
-rw-r--r--src/qt/test/Makefile.am11
-rw-r--r--src/test/Makefile.am6
19 files changed, 405 insertions, 112 deletions
diff --git a/configure.ac b/configure.ac
index 68dbfdc146..4e105629e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,32 @@ AC_ARG_WITH([qt],
[AS_HELP_STRING([--with-qt],
[enable qt (default is yes)])],
[use_qt=$withval],
- [use_qt=yes])
+ [use_qt=auto])
+AC_DEFUN([BITCOIN_QT_FAIL],[
+ if test "x$use_qt" = "xauto"; then
+ AC_MSG_WARN([$1; bitcoin-qt frontend will not be built])
+ use_qt=no
+ else
+ AC_MSG_ERROR([$1])
+ fi
+])
+AC_DEFUN([BITCOIN_QT_CHECK],[
+ if test "x$use_qt" != "xno"; then
+ true
+ $1
+ else
+ true
+ $2
+ fi
+])
+AC_DEFUN([BITCOIN_QT_PATH_PROGS],[
+ BITCOIN_QT_CHECK([
+ AC_PATH_PROGS($1,$2,$3,$4)
+ if test "x$$1" = "x"; then
+ BITCOIN_QT_FAIL([$1 not found])
+ fi
+ ])
+])
AC_ARG_ENABLE(tests,
AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]),
@@ -136,12 +161,12 @@ AC_PATH_PROG(LCOV, lcov)
AC_PATH_PROG(JAVA, java)
AC_PATH_PROG(GENHTML, genhtml)
AC_PATH_PROG([GIT], [git])
-AC_PATH_PROGS([MOC], [moc-qt4 moc4 moc],, $qt_bin_path:$PATH)
-AC_PATH_PROGS([UIC], [uic-qt4 uic4 uic],, $qt_bin_path:$PATH)
-AC_PATH_PROGS([RCC], [rcc-qt4 rcc4 rcc],, $qt_bin_path:$PATH)
-AC_PATH_PROGS([LRELEASE], [lrelease-qt4 lrelease4 lrelease],, $qt_bin_path:$PATH)
-AC_PATH_PROGS([LUPDATE], [lupdate-qt4 lupdate4 lupdate],, $qt_bin_path:$PATH)
-AC_PATH_PROG([PROTOC], [protoc],, $protoc_bin_path:$PATH)
+BITCOIN_QT_PATH_PROGS([MOC], [moc-qt4 moc4 moc],, $qt_bin_path:$PATH)
+BITCOIN_QT_PATH_PROGS([UIC], [uic-qt4 uic4 uic],, $qt_bin_path:$PATH)
+BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt4 rcc4 rcc],, $qt_bin_path:$PATH)
+BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt4 lrelease4 lrelease],, $qt_bin_path:$PATH)
+BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt4 lupdate4 lupdate],, $qt_bin_path:$PATH)
+BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],, $protoc_bin_path:$PATH)
AC_PATH_PROG(CCACHE,ccache)
AC_PATH_PROG(XGETTEXT,xgettext)
AC_PATH_PROG(HEXDUMP,hexdump)
@@ -222,11 +247,11 @@ case $host in
fi
fi
- if test x$use_qt = xyes; then
+ BITCOIN_QT_CHECK([
MOC_DEFS="-DQ_OS_MAC"
base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit"
AX_CHECK_LINK_FLAG([[$base_frameworks]],[LIBS="$LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)])
- fi
+ ])
CPPFLAGS="$CPPFLAGS -DMAC_OSX"
TESTDEFS="-DBOOST_TEST_DYN_LINK"
@@ -427,8 +452,11 @@ if test x$use_pkgconfig = xyes; then
PKG_CHECK_MODULES([SSL], [libssl], [INCLUDES="$INCLUDES $SSL_CFLAGS"; LIBS="$LIBS $SSL_LIBS"], [AC_MSG_ERROR(openssl not found.)])
PKG_CHECK_MODULES([CRYPTO], [libcrypto], [INCLUDES="$INCLUDES $CRYPTO_CFLAGS"; LIBS="$LIBS $CRYPTO_LIBS"], [AC_MSG_ERROR(libcrypto not found.)])
- if test x$use_qt = xyes; then
- PKG_CHECK_MODULES([QT], [QtCore QtGui QtNetwork], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes], [have_qt=no])
+ BITCOIN_QT_CHECK([
+ PKG_CHECK_MODULES([QT], [QtCore QtGui QtNetwork], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes],[
+ have_qt=no
+ BITCOIN_QT_FAIL([Qt dependencies not found])
+ ])
if test x$use_tests = xyes; then
PKG_CHECK_MODULES([QT_TEST], [QtTest], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no])
fi
@@ -439,7 +467,7 @@ if test x$use_pkgconfig = xyes; then
PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])
fi
PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [AC_MSG_ERROR(libprotobuf not found.)])
- fi
+ ])
]
)
else
@@ -449,7 +477,7 @@ else
AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),)
AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR(libssl missing))
- if test x$use_qt = xyes; then
+ BITCOIN_QT_CHECK([
TEMP_LIBS="$LIBS"
LIBS=
if test x$qt_lib_path != x; then
@@ -462,22 +490,25 @@ else
fi
if test x$TARGET_OS == xwindows; then
- AC_CHECK_LIB([imm32], [main],, AC_MSG_ERROR(libimm32 not found. Install it or use --without-qt.))
+ AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found))
fi
+ ])
#TODO: These are only needed when they're linked directly to parent libs. It really has nothing to do with windows.
#Instead, check for missing functions in parent libs and assume static if they're absent.
if test x$TARGET_OS == xwindows; then
- AC_CHECK_LIB([qcncodecs], [main],, AC_MSG_ERROR(libqcncodecs not found. Install it or use --without-qt.))
- AC_CHECK_LIB([qjpcodecs], [main],, AC_MSG_ERROR(libqjpcodecs not found. Install it or use --without-qt.))
- AC_CHECK_LIB([qkrcodecs], [main],, AC_MSG_ERROR(libqkrcodecs not found. Install it or use --without-qt.))
- AC_CHECK_LIB([qtwcodecs], [main],, AC_MSG_ERROR(libqtwcodecs not found. Install it or use --without-qt.))
+ BITCOIN_QT_CHECK(AC_CHECK_LIB([qcncodecs],[main],,BITCOIN_QT_FAIL(libqcncodecs not found)))
+ BITCOIN_QT_CHECK(AC_CHECK_LIB([qjpcodecs],[main],,BITCOIN_QT_FAIL(libqjpcodecs not found)))
+ BITCOIN_QT_CHECK(AC_CHECK_LIB([qkrcodecs],[main],,BITCOIN_QT_FAIL(libqkrcodecs not found)))
+ BITCOIN_QT_CHECK(AC_CHECK_LIB([qtwcodecs],[main],,BITCOIN_QT_FAIL(libqtwcodecs not found)))
fi
- AC_CHECK_LIB([QtCore], [main],, AC_MSG_ERROR(libQtCore not found. Install it or use --without-qt.))
- AC_CHECK_LIB([QtGui], [main],, AC_MSG_ERROR(libQtGui not found. Install it or use --without-qt.))
- AC_CHECK_LIB([QtNetwork], [main],, AC_MSG_ERROR(libQtNetwork not found. Install it or use --without-qt.))
- AC_CHECK_LIB([protobuf], [main],, AC_MSG_ERROR(libprotobuf not found. Install it or use --without-qt.))
+ BITCOIN_QT_CHECK(AC_CHECK_LIB([QtCore] ,[main],,BITCOIN_QT_FAIL(libQtCore not found)))
+ BITCOIN_QT_CHECK(AC_CHECK_LIB([QtGui] ,[main],,BITCOIN_QT_FAIL(libQtGui not found)))
+ BITCOIN_QT_CHECK(AC_CHECK_LIB([QtNetwork],[main],,BITCOIN_QT_FAIL(libQtNetwork not found)))
+ BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],,BITCOIN_QT_FAIL(libprotobuf not found)))
+
+ BITCOIN_QT_CHECK([
QT_LIBS="$LIBS"
LIBS="$TEMP_LIBS"
@@ -486,10 +517,13 @@ else
QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus"
CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
fi
- AC_CHECK_HEADER([QtPlugin],, AC_MSG_ERROR(QtCore headers missing. Install them or use --without-qt.),)
- AC_CHECK_HEADER([QApplication],, AC_MSG_ERROR(QtGUI headers missing. Install them or use --without-qt.),)
- AC_CHECK_HEADER([QLocalSocket],, AC_MSG_ERROR(QtNetwork headers missing. Install them or use --without-qt.),)
+ ])
+
+ BITCOIN_QT_CHECK(AC_CHECK_HEADER([QtPlugin],,BITCOIN_QT_FAIL(QtCore headers missing),))
+ BITCOIN_QT_CHECK(AC_CHECK_HEADER([QApplication],, BITCOIN_QT_FAIL(QtGui headers missing),))
+ BITCOIN_QT_CHECK(AC_CHECK_HEADER([QLocalSocket],, BITCOIN_QT_FAIL(QtNetwork headers missing),))
+ BITCOIN_QT_CHECK([
if test x$use_tests = xyes; then
TEMP_LIBS="$LIBS"
LIBS=
@@ -517,7 +551,7 @@ else
AC_CHECK_LIB([qrencode], [main],, [have_qrencode=no])
AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)
fi
- fi
+ ])
fi
if test x$use_ipv6 = xyes; then
@@ -604,35 +638,19 @@ fi
dnl enable qt support
AC_MSG_CHECKING([if qt should be enabled])
-if test x$use_qt = xyes; then
- if test x$have_qt = xno; then
- AC_MSG_ERROR("qt support requested but qt could not be located. use --without-qt")
- fi
- if test x$MOC = x; then
- AC_MSG_ERROR("qt support requested but moc was not found. use --without-qt")
- fi
- if test x$PROTOC = x; then
- AC_MSG_ERROR("qt support requested but protoc was not found. use --without-qt")
- fi
- if test x$UIC = x; then
- AC_MSG_ERROR("qt support requested but uic was not found. use --without-qt")
- fi
- if test x$RCC = x; then
- AC_MSG_ERROR("qt support requested but rcc was not found. use --without-qt")
- fi
- if test x$LRELEASE = x; then
- AC_MSG_ERROR("qt support requested but lrelease was not found. use --without-qt")
- fi
+BITCOIN_QT_CHECK([
+ use_qt=yes
+ BUILD_QT=qt
if test x$use_tests = xyes; then
if test x$have_qt_test = xno; then
AC_MSG_ERROR("libQtTest not found. Use --disable-tests or --without-qt.")
fi
fi
if test x$have_qt_dbus = xno; then
- use_dbus=no
if test x$use_dbus = xyes; then
- AC_MSG_ERROR("libQtDBus not found. Use --without-qtdbus.")
+ AC_MSG_ERROR("libQtDBus not found. Install libQtDBus or remove --with-qtdbus.")
fi
+ use_dbus=no
fi
if test x$XGETTEXT == x; then
AC_MSG_WARN("xgettext is required to update qt translations")
@@ -640,11 +658,9 @@ if test x$use_qt = xyes; then
if test x$LUPDATE == x; then
AC_MSG_WARN("lupdate is required to update qt translations")
fi
-
- BUILD_QT=qt
-else
+],[
use_qt=no
-fi
+])
AC_MSG_RESULT($use_qt)
@@ -678,7 +694,7 @@ if test x$use_qt = xyes; then
fi
fi
- if test x$use_tests = xyes; then
+ if test x$use_tests$have_qt_test = xyesyes; then
BUILD_TEST_QT="test"
fi
fi
diff --git a/contrib/bitcoin-qt.pro b/contrib/bitcoin-qt.pro
index 6adf7650d2..6e31c2ed81 100644
--- a/contrib/bitcoin-qt.pro
+++ b/contrib/bitcoin-qt.pro
@@ -12,7 +12,8 @@ FORMS += \
../src/qt/forms/addressbookpage.ui \
../src/qt/forms/aboutdialog.ui \
../src/qt/forms/receivecoinsdialog.ui \
- ../src/qt/forms/receiverequestdialog.ui
+ ../src/qt/forms/receiverequestdialog.ui \
+ ../src/qt/forms/openuridialog.ui
RESOURCES += \
../src/qt/bitcoin.qrc
diff --git a/doc/README.md b/doc/README.md
index 068ed988d1..4ac2e87c3f 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -3,15 +3,14 @@ Bitcoin 0.8.2 BETA
Copyright (c) 2009-2013 Bitcoin Developers
-License
----------------------
-Distributed under the [MIT/X11 software license](http://www.opensource.org/licenses/mit-license.php).
-This product includes software developed by the OpenSSL Project for use in the [OpenSSL Toolkit](http://www.openssl.org/). This product includes
-cryptographic software written by Eric Young ([eay@cryptsoft.com](mailto:eay@cryptsoft.com)), and UPnP software written by Thomas Bernard.
Setup
---------------------
-[Bitcoin-Qt](http://bitcoin.org/en/download) is the original Bitcoin client and it builds the backbone of the network. However, it downloads and stores the entire history of Bitcoin transactions (which is currently several GBs); depending on the speed of your computer and network connection, the synchronization process can take anywhere from a few hours to a day or more.
+[Bitcoin-Qt](http://bitcoin.org/en/download) is the original Bitcoin client and it builds the backbone of the network. However, it downloads and stores the entire history of Bitcoin transactions (which is currently several GBs); depending on the speed of your computer and network connection, the synchronization process can take anywhere from a few hours to a day or more. Thankfully you only have to do this once. If you would like the process to go faster you can [download the blockchain directly](https://bitcointalk.org/index.php?topic=145386.0).
+
+Running
+---------------------
+The following are some helpful notes on how to run Bitcoin on your native platform.
### Unix
@@ -21,27 +20,29 @@ You need the Qt4 run-time libraries to run Bitcoin-Qt. On Debian or Ubuntu:
Unpack the files into a directory and run:
-- bin/32/bitcoin-qt (GUI, 32-bit)
-- bin/32/bitcoind (headless, 32-bit)
-- bin/64/bitcoin-qt (GUI, 64-bit)
-- bin/64/bitcoind (headless, 64-bit)
+- bin/32/bitcoin-qt (GUI, 32-bit) or bin/32/bitcoind (headless, 32-bit)
+- bin/64/bitcoin-qt (GUI, 64-bit) or bin/64/bitcoind (headless, 64-bit)
### Windows
-Unpack the files into a directory and run bitcoin-qt.exe.
+Unpack the files into a directory, and then run bitcoin-qt.exe.
+
+### OSX
+
+Drag Bitcoin-Qt to your applications folder, and then run Bitcoin-Qt.
### Need Help?
* See the documentation at the [Bitcoin Wiki](https://en.bitcoin.it/wiki/Main_Page)
for help and more information.
* Ask for help on [#bitcoin](http://webchat.freenode.net?channels=bitcoin) on Freenode. If you don't have an IRC client use [webchat here](http://webchat.freenode.net?channels=bitcoin).
-* Ask for help on the [BitcoinTalk](https://bitcointalk.org/) forums, in the [technical support board](https://bitcointalk.org/index.php?board=4.0).
+* Ask for help on the [BitcoinTalk](https://bitcointalk.org/) forums, in the [Technical Support board](https://bitcointalk.org/index.php?board=4.0).
Building
---------------------
-The following are developer notes on how to build Bitcoin on your native platform. They are not complete guide, but include notes on the necessary libraries, compile flags, etc.
+The following are developer notes on how to build Bitcoin on your native platform. They are not complete guides, but include notes on the necessary libraries, compile flags, etc.
- [OSX Build Notes](build-osx.md)
- [Unix Build Notes](build-unix.md)
@@ -59,8 +60,17 @@ The Bitcoin repo's [root README](https://github.com/bitcoin/bitcoin/blob/master/
- [Translation Process](translation_process.md)
- [Unit Tests](unit-tests.md)
-Other Pages
----------------------
+### Resources
+* Discuss on the [BitcoinTalk](https://bitcointalk.org/) forums, in the [Development & Technical Discussion board](https://bitcointalk.org/index.php?board=6.0).
+* Discuss on [#bitcoin-dev](http://webchat.freenode.net/?channels=bitcoin) on Freenode. If you don't have an IRC client use [webchat here](http://webchat.freenode.net/?channels=bitcoin-dev).
+
+### Miscellaneous
- [Assets Attribution](assets-attribution.md)
- [Files](files.md)
- [Tor Support](tor.md)
+
+License
+---------------------
+Distributed under the [MIT/X11 software license](http://www.opensource.org/licenses/mit-license.php).
+This product includes software developed by the OpenSSL Project for use in the [OpenSSL Toolkit](http://www.openssl.org/). This product includes
+cryptographic software written by Eric Young ([eay@cryptsoft.com](mailto:eay@cryptsoft.com)), and UPnP software written by Thomas Bernard.
diff --git a/doc/build-msw.md b/doc/build-msw.md
index c9f01045ee..9e4eaee3f5 100644
--- a/doc/build-msw.md
+++ b/doc/build-msw.md
@@ -55,7 +55,7 @@ MSYS shell:
Boost
-----
-DOS prompt:
+MSYS shell:
downloaded boost jam 3.1.18
cd \boost-1.50.0-mgw
@@ -74,7 +74,7 @@ MSYS shell:
Bitcoin
-------
-DOS prompt:
+MSYS shell:
cd \bitcoin
sh autogen.sh
diff --git a/src/Makefile.am b/src/Makefile.am
index d4d17b2a9b..24a95eed84 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,8 +1,7 @@
include Makefile.include
-AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \
- -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \
- -I$(builddir) $(BOOST_INCLUDES) $(BDB_CPPFLAGS)
-AM_LDFLAGS = $(PTHREAD_CFLAGS)
+
+AM_CPPFLAGS += -I$(top_srcdir)/src/leveldb/helpers/memenv \
+ -I$(builddir)
noinst_LIBRARIES = libbitcoin.a
diff --git a/src/Makefile.include b/src/Makefile.include
index 352471061d..8c2274a287 100644
--- a/src/Makefile.include
+++ b/src/Makefile.include
@@ -1,5 +1,9 @@
-# Helper for rules and subdir Makefiles to find parent targets.
-# Flags and other non-target variables should not be set here.
+AM_CPPFLAGS = $(INCLUDES) \
+ -I$(top_builddir)/src/obj \
+ -I$(top_srcdir)/src/leveldb/include \
+ $(BDB_CPPFLAGS) \
+ $(BOOST_INCLUDES)
+AM_LDFLAGS = $(PTHREAD_CFLAGS)
LIBBITCOIN=$(top_builddir)/src/libbitcoin.a
LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a
diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp
index 39ed63b463..aff1ec0283 100644
--- a/src/leveldbwrapper.cpp
+++ b/src/leveldbwrapper.cpp
@@ -10,7 +10,7 @@
#include <leveldb/cache.h>
#include <leveldb/env.h>
#include <leveldb/filter_policy.h>
-#include <memenv/memenv.h>
+#include <memenv.h>
void HandleError(const leveldb::Status &status) throw(leveldb_error) {
if (status.ok())
diff --git a/src/qt/Makefile.am b/src/qt/Makefile.am
index 4ecd5629ea..a19cdc25a5 100644
--- a/src/qt/Makefile.am
+++ b/src/qt/Makefile.am
@@ -1,11 +1,10 @@
include $(top_srcdir)/src/Makefile.include
-AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \
- -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \
- -I$(top_srcdir)/src/leveldb/helpers -I$(top_builddir)/src/qt \
- -I$(top_builddir)/src/qt/forms $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \
- $(QR_CFLAGS) $(BDB_CPPFLAGS)
-AM_LDFLAGS = $(PTHREAD_CFLAGS)
+AM_CPPFLAGS += -I$(top_srcdir)/src \
+ -I$(top_builddir)/src/qt \
+ -I$(top_builddir)/src/qt/forms \
+ $(PROTOBUF_CFLAGS) \
+ $(QR_CFLAGS)
bin_PROGRAMS = bitcoin-qt
noinst_LIBRARIES = libbitcoinqt.a
SUBDIRS = $(BUILD_TEST_QT)
@@ -34,6 +33,7 @@ QT_TS = locale/bitcoin_ach.ts locale/bitcoin_af_ZA.ts locale/bitcoin_ar.ts \
QT_FORMS_UI = forms/aboutdialog.ui forms/addressbookpage.ui \
forms/askpassphrasedialog.ui forms/editaddressdialog.ui forms/intro.ui \
+ forms/openuridialog.ui \
forms/optionsdialog.ui forms/overviewpage.ui forms/receiverequestdialog.ui \
forms/receivecoinsdialog.ui \
forms/rpcconsole.ui forms/sendcoinsdialog.ui forms/sendcoinsentry.ui \
@@ -45,7 +45,9 @@ QT_MOC_CPP = moc_aboutdialog.cpp moc_addressbookpage.cpp \
moc_bitcoingui.cpp moc_bitcoinunits.cpp moc_clientmodel.cpp \
moc_csvmodelwriter.cpp moc_editaddressdialog.cpp moc_guiutil.cpp \
moc_intro.cpp moc_macdockiconhandler.cpp moc_macnotificationhandler.cpp \
- moc_monitoreddatamapper.cpp moc_notificator.cpp moc_optionsdialog.cpp \
+ moc_monitoreddatamapper.cpp moc_notificator.cpp \
+ moc_openuridialog.cpp \
+ moc_optionsdialog.cpp \
moc_optionsmodel.cpp moc_overviewpage.cpp moc_paymentserver.cpp \
moc_receiverequestdialog.cpp moc_qvalidatedlineedit.cpp moc_qvaluecombobox.cpp \
moc_receivecoinsdialog.cpp \
@@ -70,7 +72,9 @@ BITCOIN_QT_H = aboutdialog.h addressbookpage.h addresstablemodel.h \
askpassphrasedialog.h bitcoinaddressvalidator.h bitcoinamountfield.h \
bitcoingui.h bitcoinunits.h clientmodel.h csvmodelwriter.h \
editaddressdialog.h guiconstants.h guiutil.h intro.h macdockiconhandler.h \
- macnotificationhandler.h monitoreddatamapper.h notificator.h optionsdialog.h \
+ macnotificationhandler.h monitoreddatamapper.h notificator.h \
+ openuridialog.h \
+ optionsdialog.h \
optionsmodel.h overviewpage.h paymentrequestplus.h paymentserver.h \
receivecoinsdialog.h \
receiverequestdialog.h qvalidatedlineedit.h qvaluecombobox.h rpcconsole.h \
@@ -101,6 +105,7 @@ BITCOIN_QT_CPP = aboutdialog.cpp addressbookpage.cpp \
bitcoinamountfield.cpp bitcoin.cpp bitcoingui.cpp \
bitcoinunits.cpp clientmodel.cpp csvmodelwriter.cpp editaddressdialog.cpp \
guiutil.cpp intro.cpp monitoreddatamapper.cpp notificator.cpp \
+ openuridialog.cpp \
optionsdialog.cpp optionsmodel.cpp overviewpage.cpp paymentrequestplus.cpp \
paymentserver.cpp qvalidatedlineedit.cpp qvaluecombobox.cpp \
receivecoinsdialog.cpp receiverequestdialog.cpp \
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index e435972686..54f96f4426 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -333,6 +333,8 @@ int main(int argc, char *argv[])
// bitcoin: URIs or payment requests:
QObject::connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
&window, SLOT(handlePaymentRequest(SendCoinsRecipient)));
+ QObject::connect(&window, SIGNAL(receivedURI(QString)),
+ paymentServer, SLOT(handleURIOrFile(QString)));
QObject::connect(&walletModel, SIGNAL(coinsSent(CWallet*,SendCoinsRecipient,QByteArray)),
paymentServer, SLOT(fetchPaymentACK(CWallet*,const SendCoinsRecipient&,QByteArray)));
QObject::connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)),
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index a1bb0ee2f4..8b0aba1b5b 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -15,6 +15,7 @@
#include "rpcconsole.h"
#include "walletframe.h"
#include "walletmodel.h"
+#include "openuridialog.h"
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
@@ -262,6 +263,9 @@ void BitcoinGUI::createActions(bool fIsTestnet)
usedReceivingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("Used &receiving addresses..."), this);
usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels"));
+ openAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_FileIcon), tr("Open URI..."), this);
+ openAction->setStatusTip(tr("Open a bitcoin: URI or payment request"));
+
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
@@ -274,6 +278,7 @@ void BitcoinGUI::createActions(bool fIsTestnet)
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses()));
connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses()));
+ connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked()));
}
void BitcoinGUI::createMenuBar()
@@ -288,6 +293,7 @@ void BitcoinGUI::createMenuBar()
// Configure the menus
QMenu *file = appMenuBar->addMenu(tr("&File"));
+ file->addAction(openAction);
file->addAction(backupWalletAction);
file->addAction(signMessageAction);
file->addAction(verifyMessageAction);
@@ -445,6 +451,15 @@ void BitcoinGUI::aboutClicked()
dlg.exec();
}
+void BitcoinGUI::openClicked()
+{
+ OpenURIDialog dlg;
+ if(dlg.exec())
+ {
+ emit receivedURI(dlg.getURI());
+ }
+}
+
void BitcoinGUI::gotoOverviewPage()
{
overviewAction->setChecked(true);
@@ -720,23 +735,11 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
{
- int nValidUrisFound = 0;
- QList<QUrl> uris = event->mimeData()->urls();
- foreach(const QUrl &uri, uris)
+ foreach(const QUrl &uri, event->mimeData()->urls())
{
- SendCoinsRecipient r;
- if (GUIUtil::parseBitcoinURI(uri, &r) && walletFrame->handlePaymentRequest(r))
- nValidUrisFound++;
+ emit receivedURI(uri.toString());
}
-
- // if valid URIs were found
- if (nValidUrisFound)
- walletFrame->gotoSendCoinsPage();
- else
- message(tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters."),
- CClientUIInterface::ICON_WARNING);
}
-
event->acceptProposedAction();
}
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 2e3b3e74b9..acbc38c894 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -87,6 +87,7 @@ private:
QAction *changePassphraseAction;
QAction *aboutQtAction;
QAction *openRPCConsoleAction;
+ QAction *openAction;
QSystemTrayIcon *trayIcon;
Notificator *notificator;
@@ -107,6 +108,10 @@ private:
/** Create system tray menu (or setup the dock menu) */
void createTrayIconMenu();
+signals:
+ /** Signal raised when a URI was entered or dragged to the GUI */
+ void receivedURI(const QString &uri);
+
public slots:
/** Set number of connections shown in the UI */
void setNumConnections(int count);
@@ -165,6 +170,8 @@ private slots:
/** Handle tray icon clicked */
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
#endif
+ /** Show open dialog */
+ void openClicked();
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
void showNormalIfMinimized(bool fToggleHidden = false);
diff --git a/src/qt/forms/openuridialog.ui b/src/qt/forms/openuridialog.ui
new file mode 100644
index 0000000000..cd09ed0246
--- /dev/null
+++ b/src/qt/forms/openuridialog.ui
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OpenURIDialog</class>
+ <widget class="QDialog" name="OpenURIDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>564</width>
+ <height>109</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Open URI</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Open payment request from URI or file</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>URI:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QValidatedLineEdit" name="uriEdit">
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="selectFileButton">
+ <property name="toolTip">
+ <string>Select payment request file</string>
+ </property>
+ <property name="text">
+ <string notr="true">…</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QValidatedLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>qvalidatedlineedit.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>OpenURIDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>OpenURIDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index e6a1138f11..85eeab2cbc 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -278,6 +278,41 @@ QString getSaveFileName(QWidget *parent, const QString &caption, const QString &
return result;
}
+QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir,
+ const QString &filter,
+ QString *selectedSuffixOut)
+{
+ QString selectedFilter;
+ QString myDir;
+ if(dir.isEmpty()) // Default to user documents location
+ {
+#if QT_VERSION < 0x050000
+ myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
+#else
+ myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
+#endif
+ }
+ else
+ {
+ myDir = dir;
+ }
+ /* Directly convert path to native OS path separators */
+ QString result = QDir::toNativeSeparators(QFileDialog::getOpenFileName(parent, caption, myDir, filter, &selectedFilter));
+
+ if(selectedSuffixOut)
+ {
+ /* Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...) */
+ QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]");
+ QString selectedSuffix;
+ if(filter_re.exactMatch(selectedFilter))
+ {
+ selectedSuffix = filter_re.cap(1);
+ }
+ *selectedSuffixOut = selectedSuffix;
+ }
+ return result;
+}
+
Qt::ConnectionType blockingGUIThreadConnection()
{
if(QThread::currentThread() != qApp->thread())
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 8bd0eab9de..ddff2de4c4 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -36,7 +36,6 @@ namespace GUIUtil
void setupAmountWidget(QLineEdit *widget, QWidget *parent);
// Parse "bitcoin:" URI into recipient object, return true on successful parsing
- // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out);
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
QString formatBitcoinURI(const SendCoinsRecipient &info);
@@ -70,6 +69,19 @@ namespace GUIUtil
const QString &dir=QString(), const QString &filter=QString(),
QString *selectedSuffixOut=0);
+ /** Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
+
+ @param[in] parent Parent window (or 0)
+ @param[in] caption Window caption (or empty, for default)
+ @param[in] dir Starting directory (or empty, to default to documents directory)
+ @param[in] filter Filter specification such as "Comma Separated Files (*.csv)"
+ @param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0).
+ Can be useful when choosing the save file format based on suffix.
+ */
+ QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir,
+ const QString &filter,
+ QString *selectedSuffixOut);
+
/** Get connection type to call object slot in GUI thread with invokeMethod. The call will be blocking.
@returns If called from the GUI thread, return a Qt::DirectConnection.
diff --git a/src/qt/openuridialog.cpp b/src/qt/openuridialog.cpp
new file mode 100644
index 0000000000..803a3c9ddb
--- /dev/null
+++ b/src/qt/openuridialog.cpp
@@ -0,0 +1,52 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include "openuridialog.h"
+#include "ui_openuridialog.h"
+
+#include "guiutil.h"
+#include "walletmodel.h"
+
+#include <QUrl>
+
+OpenURIDialog::OpenURIDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::OpenURIDialog)
+{
+ ui->setupUi(this);
+#if QT_VERSION >= 0x040700
+ ui->uriEdit->setPlaceholderText("bitcoin:");
+#endif
+}
+
+OpenURIDialog::~OpenURIDialog()
+{
+ delete ui;
+}
+
+QString OpenURIDialog::getURI()
+{
+ return ui->uriEdit->text();
+}
+
+void OpenURIDialog::accept()
+{
+ SendCoinsRecipient rcp;
+ if(GUIUtil::parseBitcoinURI(getURI(), &rcp))
+ {
+ /* Only accept value URIs */
+ QDialog::accept();
+ } else {
+ ui->uriEdit->setValid(false);
+ }
+}
+
+void OpenURIDialog::on_selectFileButton_clicked()
+{
+ QString filename = GUIUtil::getOpenFileName(this, tr("Select payment request file to open"), "", "", NULL);
+ if(filename.isEmpty())
+ return;
+ QUrl fileUri = QUrl::fromLocalFile(filename);
+ ui->uriEdit->setText("bitcoin:?request=" + QUrl::toPercentEncoding(fileUri.toString()));
+}
diff --git a/src/qt/openuridialog.h b/src/qt/openuridialog.h
new file mode 100644
index 0000000000..3b9ff0a8e1
--- /dev/null
+++ b/src/qt/openuridialog.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef OPENURIDIALOG_H
+#define OPENURIDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+class OpenURIDialog;
+}
+
+class OpenURIDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit OpenURIDialog(QWidget *parent = 0);
+ ~OpenURIDialog();
+
+ QString getURI();
+
+protected slots:
+ void accept();
+
+private slots:
+ void on_selectFileButton_clicked();
+
+private:
+ Ui::OpenURIDialog *ui;
+};
+
+#endif // OPENURIDIALOG_H
diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h
index 19cba70cb6..50f077f3bc 100644
--- a/src/qt/paymentserver.h
+++ b/src/qt/paymentserver.h
@@ -102,6 +102,9 @@ public slots:
// Submit Payment message to a merchant, get back PaymentACK:
void fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QByteArray transaction);
+ // Handle an incoming URI or file
+ void handleURIOrFile(const QString& s);
+
private slots:
void handleURIConnection();
void netRequestFinished(QNetworkReply*);
@@ -111,7 +114,6 @@ private slots:
private:
static bool readPaymentRequest(const QString& filename, PaymentRequestPlus& request);
bool processPaymentRequest(PaymentRequestPlus& request, SendCoinsRecipient& recipient);
- void handleURIOrFile(const QString& s);
void fetchRequest(const QUrl& url);
// Setup networking
diff --git a/src/qt/test/Makefile.am b/src/qt/test/Makefile.am
index f8fe97462b..7891c3e975 100644
--- a/src/qt/test/Makefile.am
+++ b/src/qt/test/Makefile.am
@@ -1,11 +1,10 @@
include $(top_srcdir)/src/Makefile.include
-AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \
- -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \
- -I$(top_srcdir)/src/leveldb/helpers -I$(top_srcdir)/src/qt \
- -I$(top_builddir)/src/qt $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \
- $(QR_CFLAGS) $(BDB_CPPFLAGS)
-AM_LDFLAGS = $(PTHREAD_CFLAGS)
+AM_CPPFLAGS += -I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/qt \
+ -I$(top_builddir)/src/qt \
+ $(PROTOBUF_CFLAGS) \
+ $(QR_CFLAGS)
bin_PROGRAMS = test_bitcoin-qt
TESTS = test_bitcoin-qt
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index c3495095d9..180fd7effa 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -1,10 +1,6 @@
include $(top_srcdir)/src/Makefile.include
-AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \
- -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \
- -I$(top_srcdir)/src $(BOOST_INCLUDES) $(BDB_CPPFLAGS)
-
-AM_LDFLAGS = $(PTHREAD_CFLAGS)
+AM_CPPFLAGS += -I$(top_srcdir)/src
bin_PROGRAMS = test_bitcoin